|
wlmaker
|
#include "surface.h"#include <libbase/libbase.h>#include <stdlib.h>#include <wayland-server-protocol.h>#include <wayland-util.h>#include <wlr/types/wlr_compositor.h>#include <wlr/types/wlr_keyboard.h>#include <wlr/types/wlr_scene.h>#include <wlr/types/wlr_seat.h>#include <wlr/types/wlr_xdg_shell.h>#include <wlr/version.h>#include "element.h"#include "container.h"#include "gfxbuf.h"#include "input.h"#include "util.h"#include "test.h"
Classes | |
| struct | _wlmtk_surface_t |
Functions | |
| static bool | _wlmtk_surface_init (wlmtk_surface_t *surface_ptr, struct wlr_surface *wlr_surface_ptr) |
| static bool | _wlmtk_xdg_surface_init (wlmtk_surface_t *surface_ptr, struct wlr_xdg_surface *wlr_xdg_surface_ptr) |
| static void | _wlmtk_surface_fini (wlmtk_surface_t *surface_ptr) |
| static void | _wlmtk_surface_element_destroy (wlmtk_element_t *element_ptr) |
| static struct wlr_scene_node * | _wlmtk_surface_element_create_scene_node (wlmtk_element_t *element_ptr, struct wlr_scene_tree *wlr_scene_tree_ptr) |
| static void | _wlmtk_surface_element_get_dimensions (wlmtk_element_t *element_ptr, int *left_ptr, int *top_ptr, int *right_ptr, int *bottom_ptr) |
| static bool | _wlmtk_surface_element_pointer_accepts_motion (wlmtk_element_t *element_ptr, wlmtk_pointer_motion_event_t *motion_event_ptr) |
| static bool | _wlmtk_surface_element_pointer_button (wlmtk_element_t *element_ptr, const wlmtk_button_event_t *button_event_ptr) |
| static bool | _wlmtk_surface_element_pointer_axis (wlmtk_element_t *element_ptr, struct wlr_pointer_axis_event *wlr_pointer_axis_event_ptr) |
| static bool | _wlmtk_surface_element_keyboard_event (wlmtk_element_t *element_ptr, struct wlr_keyboard_key_event *wlr_keyboard_key_event_ptr) |
| static void | _wlmtk_surface_handle_wlr_scene_tree_node_destroy (struct wl_listener *listener_ptr, void *data_ptr) |
| static void | _wlmtk_surface_handle_surface_commit (struct wl_listener *listener_ptr, void *data_ptr) |
| static void | _wlmtk_surface_handle_surface_map (struct wl_listener *listener_ptr, void *data_ptr) |
| static void | _wlmtk_surface_handle_surface_unmap (struct wl_listener *listener_ptr, void *data_ptr) |
| static void | _wlmtk_surface_handle_element_pointer_leave (struct wl_listener *listener_ptr, void *data_ptr) |
| static void | _wlmtk_surface_handle_element_pointer_motion (struct wl_listener *listener_ptr, void *data_ptr) |
| static void | _wlmtk_surface_commit_size (wlmtk_surface_t *surface_ptr, int width, int height) |
| wlmtk_surface_t * | wlmtk_surface_create (struct wlr_surface *wlr_surface_ptr, struct wlr_seat *wlr_seat_ptr) |
| wlmtk_surface_t * | wlmtk_xdg_surface_create (struct wlr_xdg_surface *wlr_xdg_surface_ptr, struct wlr_seat *wlr_seat_ptr) |
| void | wlmtk_surface_destroy (wlmtk_surface_t *surface_ptr) |
| wlmtk_element_t * | wlmtk_surface_element (wlmtk_surface_t *surface_ptr) |
| void | wlmtk_surface_get_size (wlmtk_surface_t *surface_ptr, int *width_ptr, int *height_ptr) |
| void | wlmtk_surface_set_activated (wlmtk_surface_t *surface_ptr, bool activated) |
| bool | wlmtk_surface_is_activated (wlmtk_surface_t *surface_ptr) |
| void | wlmtk_surface_connect_map_listener_signal (wlmtk_surface_t *surface_ptr, struct wl_listener *listener_ptr, wl_notify_func_t handler) |
| void | wlmtk_surface_connect_unmap_listener_signal (wlmtk_surface_t *surface_ptr, struct wl_listener *listener_ptr, wl_notify_func_t handler) |
| static void | test_create_destroy (bs_test_t *test_ptr) |
| static void | test_dimensions (bs_test_t *test_ptr) |
Variables | |
| static const wlmtk_element_vmt_t | surface_element_vmt |
| const bs_test_case_t | wlmtk_surface_test_cases [] |
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
static |
Surface commits a new size: Store the size, and update the parent's layout.
| surface_ptr | |
| width | |
| height |
|
static |
Implements wlmtk_element_vmt_t::create_scene_node. Creates the node.
| element_ptr | |
| wlr_scene_tree_ptr |
|
static |
Implements wlmtk_element_vmt_t::destroy. Calls the dtor.
|
static |
Implementation of the element's get_dimensions method: Return dimensions.
| element_ptr | |
| left_ptr | Leftmost position. May be NULL. |
| top_ptr | Topmost position. May be NULL. |
| right_ptr | Rightmost position. Ma be NULL. |
| bottom_ptr | Bottommost position. May be NULL. |
|
static |
Implements wlmtk_element_vmt_t::keyboard_event. Handle keyboard events.
Registers the surface as active, and forwards events there.
| element_ptr | |
| wlr_keyboard_key_event_ptr |
|
static |
Implements wlmtk_element_vmt_t::pointer_accepts_motion.
| element_ptr | |
| motion_event_ptr |
|
static |
Passes pointer axis events further to the focused surface, if any.
The actual passing is handled by wlr_seat. Here we just verify that the currently-focused surface (or sub-surface) is part of this surface.
| element_ptr | |
| wlr_pointer_axis_event_ptr |
|
static |
Passes pointer button event further to the focused surface, if any.
The actual passing is handled by wlr_seat. Here we just verify that the currently-focused surface (or sub-surface) is part of this surface.
| element_ptr | |
| button_event_ptr |
|
static |
Un-initializes the surface.
| surface_ptr |
|
static |
Handles pointer leave: If there's a WLR (sub)surface currently holding focus, that will be cleared.
| listener_ptr | |
| data_ptr |
|
static |
Handles pointer motion: Passes the motion events to client's surface(s).
Identifies the surface (or sub-surface) at the given coordinates, and pass on the motion event to that surface. If needed, will update the seat's pointer focus.
| listener_ptr | |
| data_ptr | Points to a wlmtk_pointer_motion_event_t. |
|
static |
Handler for the commit signal of wlr_surface.
|
static |
Handles the surface_map signal: Makes the surface visible.
| listener_ptr | |
| data_ptr |
|
static |
Handles the surface_unmap signal: Makes the surface invisible.
| listener_ptr | |
| data_ptr |
|
static |
Handler for the destroy signal of wlr_scene_tree_ptr->node.
We have this registered to clear out the extra pointer we're holding to wlmtk_surface_t::wlr_scene_tree_ptr. wlmtk_element_t has a separate destroy handler that will take care of actual cleanup.
|
static |
Initializes the surface.
| surface_ptr | |
| wlr_surface_ptr |
|
static |
Initializes the surface, based off an XDG surface.
TODO(kaese.nosp@m.r@gu.nosp@m.bbe.c.nosp@m.h): Merge with _wlmtk_surface_init.
| surface_ptr | |
| wlr_xdg_surface_ptr |
|
static |
Tests ctor and dtor.
|
static |
Verifies that dimensions from the surface propagate thorugh.
| void wlmtk_surface_connect_map_listener_signal | ( | wlmtk_surface_t * | surface_ptr, |
| struct wl_listener * | listener_ptr, | ||
| wl_notify_func_t | handler | ||
| ) |
Connects a listener and handler to the map signal of wlr_surface.
| void wlmtk_surface_connect_unmap_listener_signal | ( | wlmtk_surface_t * | surface_ptr, |
| struct wl_listener * | listener_ptr, | ||
| wl_notify_func_t | handler | ||
| ) |
Connects a listener and handler to the unmap signal of wlr_surface.
| wlmtk_surface_t * wlmtk_surface_create | ( | struct wlr_surface * | wlr_surface_ptr, |
| struct wlr_seat * | wlr_seat_ptr | ||
| ) |
Creates a toolkit surface from the wlr_surface_ptr.
| wlr_surface_ptr | |
| wlr_seat_ptr |
| void wlmtk_surface_destroy | ( | wlmtk_surface_t * | surface_ptr | ) |
Destroys the toolkit surface.
| surface_ptr |
| wlmtk_element_t * wlmtk_surface_element | ( | wlmtk_surface_t * | surface_ptr | ) |
Returns a pointer to the surface's element superclass instance.
| surface_ptr |
| void wlmtk_surface_get_size | ( | wlmtk_surface_t * | surface_ptr, |
| int * | width_ptr, | ||
| int * | height_ptr | ||
| ) |
Returns committed size of the surface.
| surface_ptr | |
| width_ptr | |
| height_ptr |
| bool wlmtk_surface_is_activated | ( | wlmtk_surface_t * | surface_ptr | ) |
| void wlmtk_surface_set_activated | ( | wlmtk_surface_t * | surface_ptr, |
| bool | activated | ||
| ) |
Activates the surface.
| surface_ptr | |
| activated |
| wlmtk_surface_t * wlmtk_xdg_surface_create | ( | struct wlr_xdg_surface * | wlr_xdg_surface_ptr, |
| struct wlr_seat * | wlr_seat_ptr | ||
| ) |
Creates a toolkit surface from the XDG surface wlr_xdg_surface_ptr.
TODO(kaese.nosp@m.r@gu.nosp@m.bbe.c.nosp@m.h): Merge with wlmtk_surface_create.
| wlr_xdg_surface_ptr | |
| wlr_seat_ptr |
|
static |
Method table for the element's virtual methods.
| const bs_test_case_t wlmtk_surface_test_cases[] |
Unit test cases.