wlmaker
|
#include <libbase/libbase.h>
#include <wayland-server.h>
#include <xkbcommon/xkbcommon.h>
#include "wlr/util/box.h"
#include "env.h"
#include "input.h"
#include <wlr/types/wlr_pointer.h>
Go to the source code of this file.
Classes | |
struct | _wlmtk_element_vmt_t |
struct | _wlmtk_element_t |
struct | wlmtk_fake_element_t |
Typedefs | |
typedef struct _wlmtk_element_t | wlmtk_element_t |
typedef struct _wlmtk_element_vmt_t | wlmtk_element_vmt_t |
typedef struct _wlmtk_container_t | wlmtk_container_t |
Functions | |
bool | wlmtk_element_init (wlmtk_element_t *element_ptr, wlmtk_env_t *env_ptr) |
wlmtk_element_vmt_t | wlmtk_element_extend (wlmtk_element_t *element_ptr, const wlmtk_element_vmt_t *element_vmt_ptr) |
void | wlmtk_element_fini (wlmtk_element_t *element_ptr) |
bs_dllist_node_t * | wlmtk_dlnode_from_element (wlmtk_element_t *element_ptr) |
wlmtk_element_t * | wlmtk_element_from_dlnode (bs_dllist_node_t *dlnode_ptr) |
void | wlmtk_element_set_parent_container (wlmtk_element_t *element_ptr, wlmtk_container_t *parent_container_ptr) |
void | wlmtk_element_attach_to_scene_graph (wlmtk_element_t *element_ptr) |
void | wlmtk_element_set_visible (wlmtk_element_t *element_ptr, bool visible) |
void | wlmtk_element_get_position (wlmtk_element_t *element_ptr, int *x_ptr, int *y_ptr) |
void | wlmtk_element_set_position (wlmtk_element_t *element_ptr, int x, int y) |
static void | wlmtk_element_get_pointer_area (wlmtk_element_t *element_ptr, int *x1_ptr, int *y1_ptr, int *x2_ptr, int *y2_ptr) |
static void | wlmtk_element_get_dimensions (wlmtk_element_t *element_ptr, int *left_ptr, int *top_ptr, int *right_ptr, int *bottom_ptr) |
static struct wlr_box | wlmtk_element_get_dimensions_box (wlmtk_element_t *element_ptr) |
bool | wlmtk_element_pointer_motion (wlmtk_element_t *element_ptr, double x, double y, uint32_t time_msec) |
static bool | wlmtk_element_pointer_button (wlmtk_element_t *element_ptr, const wlmtk_button_event_t *button_event_ptr) |
static bool | wlmtk_element_pointer_axis (wlmtk_element_t *element_ptr, struct wlr_pointer_axis_event *wlr_pointer_axis_event_ptr) |
static bool | wlmtk_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_element_keyboard_blur (wlmtk_element_t *element_ptr) |
static void | wlmtk_element_destroy (wlmtk_element_t *element_ptr) |
wlmtk_fake_element_t * | wlmtk_fake_element_create (void) |
void | wlmtk_fake_element_grab_keyboard (wlmtk_fake_element_t *fake_element_ptr) |
Variables | |
const bs_test_case_t | wlmtk_element_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.
typedef struct _wlmtk_container_t wlmtk_container_t |
Forward declaration: Container.
typedef struct _wlmtk_element_t wlmtk_element_t |
Forward declaration: Element.
typedef struct _wlmtk_element_vmt_t wlmtk_element_vmt_t |
Forward declaration: Element virtual method table.
bs_dllist_node_t * wlmtk_dlnode_from_element | ( | wlmtk_element_t * | element_ptr | ) |
Gets the dlnode from the element.
void wlmtk_element_attach_to_scene_graph | ( | wlmtk_element_t * | element_ptr | ) |
Attaches or detaches the element to the parent's wlroots scene tree.
If the element has a parent, and that parent is itself attached to the wlroots scene tree, this will either re-parent an already existing node, or invoke wlmtk_element_vmt_t::create_scene_node to create and attach a new node to the paren'ts tree. Otherwise, it will clear any existing node.
The function is idempotent.
Private: Should only called by wlmtk_container_t methods, when there are changes to wlmtk_container_t::wlr_scene_tree.
element_ptr |
|
inlinestatic |
Virtual method: Calls the dtor of the element's implementation.
The implementation is required to call wlmtk_element_fini().
element_ptr |
wlmtk_element_vmt_t wlmtk_element_extend | ( | wlmtk_element_t * | element_ptr, |
const wlmtk_element_vmt_t * | element_vmt_ptr ) |
Extends the element's virtual methods.
element_ptr | |
element_vmt_ptr |
void wlmtk_element_fini | ( | wlmtk_element_t * | element_ptr | ) |
Cleans up the element.
element_ptr |
wlmtk_element_t * wlmtk_element_from_dlnode | ( | bs_dllist_node_t * | dlnode_ptr | ) |
Gets the element from the dlnode.
|
inlinestatic |
Gets the dimensions of the element in pixels, relative to the position.
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. |
|
inlinestatic |
Gets the element's dimensions in pixel as wlr_box, relative to the position.
element_ptr |
|
inlinestatic |
Gets the area that the element on which the element accepts pointer events.
The area extents are relative to the element's position. By default, this overlaps with the element dimensions. Some elements (eg. a surface with further-extending sub-surfaces) may differ.
element_ptr | |
x1_ptr | Leftmost position of pointer area. May be NULL. |
y1_ptr | Topmost position of pointer area. May be NULL. |
x2_ptr | Rightmost position of pointer area. May be NULL. |
y2_ptr | Bottommost position of pointer area. May be NULL. |
void wlmtk_element_get_position | ( | wlmtk_element_t * | element_ptr, |
int * | x_ptr, | ||
int * | y_ptr ) |
Returns the position of the element.
element_ptr | |
x_ptr | Optional, may be NULL. |
y_ptr | Optional, may be NULL. |
bool wlmtk_element_init | ( | wlmtk_element_t * | element_ptr, |
wlmtk_env_t * | env_ptr ) |
Initializes the element.
element_ptr | |
env_ptr |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
bool wlmtk_element_pointer_motion | ( | wlmtk_element_t * | element_ptr, |
double | x, | ||
double | y, | ||
uint32_t | time_msec ) |
Passes a pointer motion event on to the element.
Will forward to wlmtk_element_vmt_t::pointer_motion, and (depending on that return value) trigger wlmtk_element_vmt_t::pointer_enter of wlmtk_element_vmt_t::pointer_leave calls.
element_ptr | |
x | |
y | |
time_msec |
void wlmtk_element_set_parent_container | ( | wlmtk_element_t * | element_ptr, |
wlmtk_container_t * | parent_container_ptr ) |
Sets the parent container for the element.
Will call wlmtk_element_attach_to_scene_graph to align the scene graph with the new (or deleted) parent.
Private: Should only be called by wlmtk_container_add_element, respectively wlmtk_container_remove_element ("friends").
element_ptr | |
parent_container_ptr | Pointer to the parent container, or NULL if the parent should be cleared. |
void wlmtk_element_set_position | ( | wlmtk_element_t * | element_ptr, |
int | x, | ||
int | y ) |
Sets the position of the element.
element_ptr | |
x | |
y |
void wlmtk_element_set_visible | ( | wlmtk_element_t * | element_ptr, |
bool | visible ) |
Sets the element's visibility.
element_ptr | |
visible |
wlmtk_fake_element_t * wlmtk_fake_element_create | ( | void | ) |
Ctor for the fake element, useful for tests.
void wlmtk_fake_element_grab_keyboard | ( | wlmtk_fake_element_t * | fake_element_ptr | ) |
Sets wlmtk_fake_element_t::has_keyboard_focus and calls wlmtk_container_set_keyboard_focus_element for the parent (if set).
fake_element_ptr |
|
extern |
Unit tests for the element.