wlmaker
|
#include "root.h"
#include <libbase/libbase.h>
#include <stdlib.h>
#include <wayland-server-protocol.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_scene.h>
#include <wlr/version.h>
#include <xkbcommon/xkbcommon.h>
#include "container.h"
#include "input.h"
#include "rectangle.h"
#include "tile.h"
#include "util.h"
#include "workspace.h"
Classes | |
struct | _wlmtk_root_t |
Functions | |
static void | _wlmtk_root_switch_to_workspace (wlmtk_root_t *root_ptr, wlmtk_workspace_t *workspace_ptr) |
static void | _wlmtk_root_enumerate_workspaces (bs_dllist_node_t *dlnode_ptr, void *ud_ptr) |
static void | _wlmtk_root_destroy_workspace (bs_dllist_node_t *dlnode_ptr, void *ud_ptr) |
static bool | _wlmtk_root_element_pointer_motion (wlmtk_element_t *element_ptr, wlmtk_pointer_motion_event_t *motion_event_ptr) |
static bool | _wlmtk_root_element_pointer_button (wlmtk_element_t *element_ptr, const wlmtk_button_event_t *button_event_ptr) |
static bool | _wlmtk_root_element_pointer_axis (wlmtk_element_t *element_ptr, struct wlr_pointer_axis_event *wlr_pointer_axis_event_ptr) |
static bool | _wlmtk_root_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_root_handle_output_layout_change (struct wl_listener *listener_ptr, void *data_ptr) |
wlmtk_root_t * | wlmtk_root_create (struct wlr_scene *wlr_scene_ptr, struct wlr_output_layout *wlr_output_layout_ptr) |
void | wlmtk_root_destroy (wlmtk_root_t *root_ptr) |
wlmtk_root_events_t * | wlmtk_root_events (wlmtk_root_t *root_ptr) |
bool | wlmtk_root_pointer_motion (wlmtk_root_t *root_ptr, double x, double y, uint32_t time_msec, wlmtk_pointer_t *pointer_ptr) |
bool | wlmtk_root_pointer_button (wlmtk_root_t *root_ptr, const struct wlr_pointer_button_event *event_ptr) |
bool | wlmtk_root_pointer_axis (wlmtk_root_t *root_ptr, struct wlr_pointer_axis_event *wlr_pointer_axis_event_ptr) |
void | wlmtk_root_add_workspace (wlmtk_root_t *root_ptr, wlmtk_workspace_t *workspace_ptr) |
void | wlmtk_root_remove_workspace (wlmtk_root_t *root_ptr, wlmtk_workspace_t *workspace_ptr) |
wlmtk_workspace_t * | wlmtk_root_get_current_workspace (wlmtk_root_t *root_ptr) |
void | wlmtk_root_switch_to_next_workspace (wlmtk_root_t *root_ptr) |
void | wlmtk_root_switch_to_previous_workspace (wlmtk_root_t *root_ptr) |
void | wlmtk_root_for_each_workspace (wlmtk_root_t *root_ptr, void(*func)(bs_dllist_node_t *dlnode_ptr, void *ud_ptr), void *ud_ptr) |
bool | wlmtk_root_lock (wlmtk_root_t *root_ptr, wlmtk_element_t *element_ptr) |
bool | wlmtk_root_unlock (wlmtk_root_t *root_ptr, wlmtk_element_t *element_ptr) |
bool | wlmtk_root_locked (wlmtk_root_t *root_ptr) |
void | wlmtk_root_lock_unreference (wlmtk_root_t *root_ptr, wlmtk_element_t *element_ptr) |
wlmtk_element_t * | wlmtk_root_element (wlmtk_root_t *root_ptr) |
static void | test_create_destroy (bs_test_t *test_ptr) |
static void | test_workspaces (bs_test_t *test_ptr) |
static void | test_pointer_button (bs_test_t *test_ptr) |
Variables | |
static const wlmtk_element_vmt_t | _wlmtk_root_element_vmt |
const bs_test_case_t | wlmtk_root_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 |
Callback for bs_dllist_for_each: Destroys the workspace.
|
static |
Implements wlmtk_element_vmt_t::keyboard_event. Handle keyboard events.
When locked, the root container will forward the events strictly only to the lock container.
element_ptr | |
wlr_keyboard_key_event_ptr | |
key_syms | |
key_syms_count | |
modifiers |
|
static |
Implements wlmtk_element_vmt_t::pointer_axis. Handle axis events.
When locked, the root container will forward the events strictly only to the lock container.
element_ptr | |
wlr_pointer_axis_event_ptr |
|
static |
Implements wlmtk_element_vmt_t::pointer_button. Handle button events.
When locked, the root container will forward the events strictly only to the lock container.
element_ptr | |
button_event_ptr |
|
static |
Implements wlmtk_element_vmt_t::pointer_motion. Handle pointer moves.
When locked, the root container will forward the events strictly only to the lock container.
element_ptr | |
motion_event_ptr |
|
static |
Callback for bs_dllist_for_each: Enumerates the workspace.
|
static |
Handles wlr_output_layout::events::change. Triggers when the output layout changes, and we use this for updating the curtain and the layout in each workspace.
listener_ptr | |
data_ptr |
|
static |
Switches to workspace_ptr
as the current workspace.
root_ptr | |
workspace_ptr |
|
static |
Exercises ctor and dtor.
|
static |
Tests wlmtk_root_pointer_button.
|
static |
Exercises workspace adding and removal.
void wlmtk_root_add_workspace | ( | wlmtk_root_t * | root_ptr, |
wlmtk_workspace_t * | workspace_ptr | ||
) |
Adds a workspace.
root_ptr | |
workspace_ptr |
wlmtk_root_t * wlmtk_root_create | ( | struct wlr_scene * | wlr_scene_ptr, |
struct wlr_output_layout * | wlr_output_layout_ptr | ||
) |
Creates the root element.
wlr_scene_ptr | |
wlr_output_layout_ptr |
void wlmtk_root_destroy | ( | wlmtk_root_t * | root_ptr | ) |
Destroys the root element.
root_ptr |
wlmtk_element_t * wlmtk_root_element | ( | wlmtk_root_t * | root_ptr | ) |
wlmtk_root_events_t * wlmtk_root_events | ( | wlmtk_root_t * | root_ptr | ) |
Gets the set of events available in root. To bind listeners to.
root_ptr |
void wlmtk_root_for_each_workspace | ( | wlmtk_root_t * | root_ptr, |
void(*)(bs_dllist_node_t *dlnode_ptr, void *ud_ptr) | func, | ||
void * | ud_ptr | ||
) |
Runs |func()| for each workspace.
root_ptr | |
func | |
ud_ptr |
wlmtk_workspace_t * wlmtk_root_get_current_workspace | ( | wlmtk_root_t * | root_ptr | ) |
Returns a pointer to the currently-active workspace.
root_ptr |
bool wlmtk_root_lock | ( | wlmtk_root_t * | root_ptr, |
wlmtk_element_t * | element_ptr | ||
) |
Locks the root, using the provided element.
The root must not be locked already. If locked successfully, the root will keep a reference to element_ptr
. The lock must call wlmtk_root_unlock to unlock root, and for releasing the reference.
root_ptr | |
element_ptr |
void wlmtk_root_lock_unreference | ( | wlmtk_root_t * | root_ptr, |
wlmtk_element_t * | element_ptr | ||
) |
Releases the lock reference, but keeps the root locked.
This is in accordance with the session lock protocol specification [1], stating the session should remain locked if the client dies. This call is a no-op if element_ptr
is not currently the lock of root_ptr
.
[1] https://wayland.app/protocols/ext-session-lock-v1
root_ptr | |
element_ptr |
bool wlmtk_root_locked | ( | wlmtk_root_t * | root_ptr | ) |
bool wlmtk_root_pointer_axis | ( | wlmtk_root_t * | root_ptr, |
struct wlr_pointer_axis_event * | wlr_pointer_axis_event_ptr | ||
) |
Handles a pointer axis event.
root_ptr | |
wlr_pointer_axis_event_ptr |
bool wlmtk_root_pointer_button | ( | wlmtk_root_t * | root_ptr, |
const struct wlr_pointer_button_event * | event_ptr | ||
) |
Handles a button event: Translates to button down/up/click/dblclick events.
Each button activity (button pressed or released) will directly trigger a corresponding BUTTON_DOWN or BUTTON_UP event. Depending on timing and motion, a "released" event may also triccer a CLICK, DOUBLE_CLICK or DRAG event. These events will be forwarded to the event currently having pointer focus.
TODO(kaese.nosp@m.r@gu.nosp@m.bbe.c.nosp@m.h): Implement DOUBLE_CLICK and DRAG events, and make it well tested.
root_ptr | |
event_ptr |
bool wlmtk_root_pointer_motion | ( | wlmtk_root_t * | root_ptr, |
double | x, | ||
double | y, | ||
uint32_t | time_msec, | ||
wlmtk_pointer_t * | pointer_ptr | ||
) |
Handles a pointer motion event.
root_ptr | |
x | |
y | |
time_msec | |
pointer_ptr |
void wlmtk_root_remove_workspace | ( | wlmtk_root_t * | root_ptr, |
wlmtk_workspace_t * | workspace_ptr | ||
) |
Removes the workspace.
root_ptr | |
workspace_ptr |
void wlmtk_root_switch_to_next_workspace | ( | wlmtk_root_t * | root_ptr | ) |
Switches to the next workspace.
root_ptr |
void wlmtk_root_switch_to_previous_workspace | ( | wlmtk_root_t * | root_ptr | ) |
Switches to the previous workspace.
root_ptr |
bool wlmtk_root_unlock | ( | wlmtk_root_t * | root_ptr, |
wlmtk_element_t * | element_ptr | ||
) |
Unlocks the root, and releases the reference from wlmtk_root_lock.
Unlocking can only be done with element_ptr
matching the element_ptr
argument from wlmtk_root_lock.
root_ptr | |
element_ptr |
|
static |
Virtual method table for the container's super class: Element.
const bs_test_case_t wlmtk_root_test_cases[] |
Unit test cases.