wlmaker
|
#include <stdbool.h>
#include <wayland-server-core.h>
#include "libbase/libbase.h"
#include "element.h"
#include "input.h"
Go to the source code of this file.
Classes | |
struct | _wlmtk_container_vmt_t |
struct | _wlmtk_container_t |
Typedefs | |
typedef struct _wlmtk_container_t | wlmtk_container_t |
typedef struct _wlmtk_container_vmt_t | wlmtk_container_vmt_t |
Variables | |
const bs_test_case_t | wlmtk_container_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_container_vmt_t wlmtk_container_vmt_t |
Forward declaration: Container virtual method table.
void wlmtk_container_add_element | ( | wlmtk_container_t * | container_ptr, |
wlmtk_element_t * | element_ptr | ||
) |
Adds element_ptr
to the container.
Requires that element_ptr
is not added to a container yet. The element will be added at the top of the container.
container_ptr | |
element_ptr |
void wlmtk_container_add_element_atop | ( | wlmtk_container_t * | container_ptr, |
wlmtk_element_t * | reference_element_ptr, | ||
wlmtk_element_t * | element_ptr | ||
) |
Adds element_ptr
to the container atop the reference's position.
If reference_element_ptr is NULL, the element will be added at the back.
container_ptr | |
reference_element_ptr | Must be an element of this container. |
element_ptr |
wlmtk_container_t * wlmtk_container_create_fake_parent | ( | void | ) |
Constructor for a fake container with a scene tree.
void wlmtk_container_destroy_fake_parent | ( | wlmtk_container_t * | container_ptr | ) |
Destructor for that fake container.
wlmtk_container_vmt_t wlmtk_container_extend | ( | wlmtk_container_t * | container_ptr, |
const wlmtk_container_vmt_t * | container_vmt_ptr | ||
) |
Extends the container's virtual methods.
container_ptr | |
container_vmt_ptr |
void wlmtk_container_fini | ( | wlmtk_container_t * | container_ptr | ) |
Un-initializes the container.
Any element still in elements
will be destroyed.
container_ptr |
bool wlmtk_container_init | ( | wlmtk_container_t * | container_ptr | ) |
Initializes the container with the provided virtual method table.
container_ptr |
bool wlmtk_container_init_attached | ( | wlmtk_container_t * | container_ptr, |
struct wlr_scene_tree * | root_wlr_scene_tree_ptr | ||
) |
Initializes the container, and attach to WLR sene graph.
container_ptr | |
root_wlr_scene_tree_ptr |
void wlmtk_container_pointer_grab | ( | wlmtk_container_t * | container_ptr, |
wlmtk_element_t * | element_ptr | ||
) |
Requests a pointer grab from container_ptr
for element_ptr
.
Will cancel any existing grab held by elements other than element_ptr
, and propagates the grab to the parent container. When a pointer grab is held, pointer events will be routed exclusively to the element holding the pointer grab.
container_ptr | |
element_ptr | Must be a child of this container. |
void wlmtk_container_pointer_grab_release | ( | wlmtk_container_t * | container_ptr, |
wlmtk_element_t * | element_ptr | ||
) |
Releases a pointer grab in container_ptr
held by element_ptr
.
If the grab is held by an element other than element_ptr
, nothing is done. Otherwise, the pointer grab is released, and the release is propagated to the parent container.
container_ptr | |
element_ptr | Must be a child of this container. |
void wlmtk_container_raise_element_to_top | ( | wlmtk_container_t * | container_ptr, |
wlmtk_element_t * | element_ptr | ||
) |
Places element_ptr
at the top (head) of the container.
Expects that container_ptr
is element_ptr
's parent container.
container_ptr | |
element_ptr |
void wlmtk_container_remove_element | ( | wlmtk_container_t * | container_ptr, |
wlmtk_element_t * | element_ptr | ||
) |
Removes element_ptr
from the container.
Expects that container_ptr
is element_ptr
's parent container. In case element_ptr
holds a pointer grab, wlmtk_element_pointer_grab_cancel will be called.
container_ptr | |
element_ptr |
bool wlmtk_container_request_pointer_focus | ( | wlmtk_container_t * | container_ptr, |
wlmtk_element_t * | element_ptr, | ||
wlmtk_pointer_motion_event_t * | motion_event_ptr | ||
) |
Requests that element_ptr
be given pointer focus from container_ptr
.
container_ptr | |
element_ptr | Must be in wlmtk_container_t::elements. |
motion_event_ptr | The motion event (in particular: pointer) that led to request pointer focus. FIXME -> Must change to pointer! |
void wlmtk_container_set_keyboard_focus_element | ( | wlmtk_container_t * | container_ptr, |
wlmtk_element_t * | element_ptr, | ||
bool | enabled | ||
) |
Sets or disables keyboard focus for element_ptr
for the container.
If enabled
, calls wlmtk_element_keyboard_blur for the element currently having keyboard focus, and updates wlmtk_container_t::keyboard_focus_element_ptr to element_ptr
. Otherwise, evaluates whether the focus is currently held by element_ptr
, and (if yes) clears this container's focus. Propagates the event to the container's parent.
container_ptr | |
element_ptr | |
enabled |
void wlmtk_container_update_layout_and_pointer_focus | ( | wlmtk_container_t * | container_ptr | ) |
Updates the layout of the container, and recomputes pointer focus as needed.
Must be called if an element is added or removed, or if any of the child elements changes visibility or dimensions. Propagates to the parent container(s).
If needed: Trigger a poitner focus computation.
container_ptr |
struct wlr_scene_tree * wlmtk_container_wlr_scene_tree | ( | wlmtk_container_t * | container_ptr | ) |
Returns the wlroots scene graph tree for this node.
Private: Should be called only by wlmtk_element_t.
container_ptr |
|
extern |
Unit tests for the container.