wlmaker
|
#include "surface.h"
#include <libbase/libbase.h>
#include <stdint.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/version.h>
#include <xkbcommon/xkbcommon.h>
#include "element.h"
#include "container.h"
#include "gfxbuf.h"
#include "input.h"
#include "util.h"
Functions | |
static bool | _wlmtk_surface_init (wlmtk_surface_t *surface_ptr, struct wlr_surface *wlr_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 void | _wlmtk_surface_element_get_pointer_area (wlmtk_element_t *element_ptr, int *left_ptr, int *top_ptr, int *right_ptr, int *bottom_ptr) |
static bool | _wlmtk_surface_element_pointer_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, const xkb_keysym_t *key_syms, size_t key_syms_count, uint32_t modifiers) |
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_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) |
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) |
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 | _wlmtk_fake_surface_element_destroy (wlmtk_element_t *element_ptr) |
static struct wlr_scene_node * | _wlmtk_fake_surface_element_create_scene_node (wlmtk_element_t *element_ptr, struct wlr_scene_tree *wlr_scene_tree_ptr) |
static bool | _wlmtk_fake_surface_element_pointer_motion (wlmtk_element_t *element_ptr, wlmtk_pointer_motion_event_t *motion_event_ptr) |
static bool | _wlmtk_fake_surface_element_pointer_button (wlmtk_element_t *element_ptr, const wlmtk_button_event_t *button_event_ptr) |
wlmtk_fake_surface_t * | wlmtk_fake_surface_create (void) |
wlmtk_surface_t * | wlmtk_fake_surface_create_inject (struct wlr_surface *wlr_surface_ptr, struct wlr_seat *wlr_seat_ptr) |
void | wlmtk_fake_surface_commit_size (wlmtk_fake_surface_t *fake_surface_ptr, int width, int height) |
void | wlmtk_fake_surface_destroy (wlmtk_fake_surface_t *fake_surface_ptr) |
static void | test_create_destroy (bs_test_t *test_ptr) |
static void | test_fake_commit (bs_test_t *test_ptr) |
Variables | |
static const wlmtk_element_vmt_t | surface_element_vmt |
static const wlmtk_element_vmt_t | _wlmtk_fake_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 |
Fake implementation of wlmtk_element_vmt_t::create_scene_node.
|
static |
Fake implementation of the dtor, wlmtk_element_vmt_t::destroy.
|
static |
Fake for wlmtk_element_vmt_t::pointer_button. Returns true.
|
static |
Fake for wlmtk_element_vmt_t::pointer_motion. True if in committed.
|
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 |
Overwrites the element's get_pointer_area method: Returns the extents of the surface and all subsurfaces.
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 | |
key_syms | |
key_syms_count | |
modifiers |
|
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 |
Pass pointer motion events to client's surface.
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.
element_ptr | |
motion_event_ptr | Pointer motion event, with position relative to this element's node. |
|
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 |
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 |
Tests ctor and dtor.
|
static |
Exercises the request_size / commit flow.
void wlmtk_fake_surface_commit_size | ( | wlmtk_fake_surface_t * | fake_surface_ptr, |
int | width, | ||
int | height | ||
) |
Fakes a wlr_surface commit event.
wlmtk_fake_surface_t * wlmtk_fake_surface_create | ( | void | ) |
Ctor for the fake surface.
wlmtk_surface_t * wlmtk_fake_surface_create_inject | ( | struct wlr_surface * | wlr_surface_ptr, |
struct wlr_seat * | wlr_seat_ptr | ||
) |
Injectable ctor for the fake surface.
void wlmtk_fake_surface_destroy | ( | wlmtk_fake_surface_t * | fake_surface_ptr | ) |
Dtor for the fake surface.
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 |
void wlmtk_surface_set_activated | ( | wlmtk_surface_t * | surface_ptr, |
bool | activated | ||
) |
Activates the surface.
surface_ptr | |
activated |
|
static |
Extensions to the surface's super elements virtual methods.
|
static |
Method table for the element's virtual methods.
const bs_test_case_t wlmtk_surface_test_cases[] |
Unit test cases.