wlmaker
|
#include "workspace.h"
#include "fsm.h"
#include <wlr/types/wlr_pointer.h>
#include <wlr/types/wlr_scene.h>
#include <wlr/util/edges.h>
Classes | |
struct | _wlmtk_workspace_t |
Enumerations | |
enum | pointer_state_t { PFSMS_PASSTHROUGH , PFSMS_MOVE , PFSMS_RESIZE } |
enum | pointer_state_event_t { PFSME_BEGIN_MOVE , PFSME_BEGIN_RESIZE , PFSME_RELEASED , PFSME_MOTION , PFSME_RESET } |
Functions | |
static void | _wlmtk_workspace_element_destroy (wlmtk_element_t *element_ptr) |
static void | _wlmtk_workspace_element_get_dimensions (wlmtk_element_t *element_ptr, int *left_ptr, int *top_ptr, int *right_ptr, int *bottom_ptr) |
static void | _wlmtk_workspace_element_get_pointer_area (wlmtk_element_t *element_ptr, int *x1_ptr, int *y1_ptr, int *x2_ptr, int *y2_ptr) |
static bool | _wlmtk_workspace_element_pointer_motion (wlmtk_element_t *element_ptr, double x, double y, uint32_t time_msec) |
static bool | _wlmtk_workspace_element_pointer_button (wlmtk_element_t *element_ptr, const wlmtk_button_event_t *button_event_ptr) |
static void | _wlmtk_workspace_element_pointer_leave (wlmtk_element_t *element_ptr) |
static bool | pfsm_move_begin (wlmtk_fsm_t *fsm_ptr, void *ud_ptr) |
static bool | pfsm_move_motion (wlmtk_fsm_t *fsm_ptr, void *ud_ptr) |
static bool | pfsm_resize_begin (wlmtk_fsm_t *fsm_ptr, void *ud_ptr) |
static bool | pfsm_resize_motion (wlmtk_fsm_t *fsm_ptr, void *ud_ptr) |
static bool | pfsm_reset (wlmtk_fsm_t *fsm_ptr, void *ud_ptr) |
wlmtk_workspace_t * | wlmtk_workspace_create (wlmtk_env_t *env_ptr, struct wlr_scene_tree *wlr_scene_tree_ptr) |
void | wlmtk_workspace_set_signals (wlmtk_workspace_t *workspace_ptr, struct wl_signal *mapped_event_ptr, struct wl_signal *unmapped_event_ptr) |
void | wlmtk_workspace_destroy (wlmtk_workspace_t *workspace_ptr) |
void | wlmtk_workspace_set_extents (wlmtk_workspace_t *workspace_ptr, const struct wlr_box *extents_ptr) |
struct wlr_box | wlmtk_workspace_get_maximize_extents (wlmtk_workspace_t *workspace_ptr) |
struct wlr_box | wlmtk_workspace_get_fullscreen_extents (wlmtk_workspace_t *workspace_ptr) |
void | wlmtk_workspace_map_window (wlmtk_workspace_t *workspace_ptr, wlmtk_window_t *window_ptr) |
void | wlmtk_workspace_unmap_window (wlmtk_workspace_t *workspace_ptr, wlmtk_window_t *window_ptr) |
bs_dllist_t * | wlmtk_workspace_get_windows_dllist (wlmtk_workspace_t *workspace_ptr) |
void | wlmtk_workspace_window_to_fullscreen (wlmtk_workspace_t *workspace_ptr, wlmtk_window_t *window_ptr, bool fullscreen) |
bool | wlmtk_workspace_motion (wlmtk_workspace_t *workspace_ptr, double x, double y, uint32_t time_msec) |
bool | wlmtk_workspace_button (wlmtk_workspace_t *workspace_ptr, const struct wlr_pointer_button_event *event_ptr) |
bool | wlmtk_workspace_axis (wlmtk_workspace_t *workspace_ptr, struct wlr_pointer_axis_event *wlr_pointer_axis_event_ptr) |
void | wlmtk_workspace_begin_window_move (wlmtk_workspace_t *workspace_ptr, wlmtk_window_t *window_ptr) |
void | wlmtk_workspace_begin_window_resize (wlmtk_workspace_t *workspace_ptr, wlmtk_window_t *window_ptr, uint32_t edges) |
void | wlmtk_workspace_activate_window (wlmtk_workspace_t *workspace_ptr, wlmtk_window_t *window_ptr) |
wlmtk_window_t * | wlmtk_workspace_get_activated_window (wlmtk_workspace_t *workspace_ptr) |
void | wlmtk_workspace_activate_previous_window (wlmtk_workspace_t *workspace_ptr) |
void | wlmtk_workspace_activate_next_window (wlmtk_workspace_t *workspace_ptr) |
void | wlmtk_workspace_raise_window (wlmtk_workspace_t *workspace_ptr, wlmtk_window_t *window_ptr) |
static void | wlmtk_fake_workspace_handle_window_mapped (struct wl_listener *listener_ptr, void *data_ptr) |
static void | wlmtk_fake_workspace_handle_window_unmapped (struct wl_listener *listener_ptr, void *data_ptr) |
wlmtk_fake_workspace_t * | wlmtk_fake_workspace_create (int width, int height) |
void | wlmtk_fake_workspace_destroy (wlmtk_fake_workspace_t *fw_ptr) |
static void | test_create_destroy (bs_test_t *test_ptr) |
static void | test_map_unmap (bs_test_t *test_ptr) |
static void | test_button (bs_test_t *test_ptr) |
static void | test_move (bs_test_t *test_ptr) |
static void | test_unmap_during_move (bs_test_t *test_ptr) |
static void | test_resize (bs_test_t *test_ptr) |
static void | test_activate (bs_test_t *test_ptr) |
static void | test_activate_cycling (bs_test_t *test_ptr) |
Variables | |
const wlmtk_element_vmt_t | workspace_element_vmt |
static const wlmtk_fsm_transition_t | pfsm_transitions [] |
const bs_test_case_t | wlmtk_workspace_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.
Events for the pointer FSM.
enum pointer_state_t |
States of the pointer FSM.
|
static |
Virtual destructor, wraps to our dtor.
|
static |
Returns the workspace area.
|
static |
Returns workspace area: _wlmtk_workspace_element_get_dimensions.
|
static |
Extends wlmtk_container_t::pointer_button.
element_ptr | |
button_event_ptr |
|
static |
Extends wlmtk_container_t::leave.
element_ptr |
|
static |
Extends wlmtk_container_t::pointer_button: Feeds the motion into the workspace's pointer state machine, and only passes it to the container's handler if the event isn't consumed yet.
element_ptr | |
x | |
y | |
time_msec |
|
static |
Initiates a move.
|
static |
Handles motion during a move.
|
static |
Resets the state machine.
|
static |
Initiates a resize.
|
static |
Handles motion during a resize.
|
static |
Tests window activation.
|
static |
Tests cycling through windows.
|
static |
Tests wlmtk_workspace_button.
|
static |
Exercises workspace create & destroy methods.
|
static |
Verifies that mapping and unmapping windows works.
|
static |
Tests moving a window.
|
static |
Tests resizing a window.
|
static |
Tests moving a window that unmaps during the move.
wlmtk_fake_workspace_t * wlmtk_fake_workspace_create | ( | int | width, |
int | height ) |
Creates a fake workspace with specified extents.
void wlmtk_fake_workspace_destroy | ( | wlmtk_fake_workspace_t * | fake_workspace_ptr | ) |
Destroys the fake workspace.
|
static |
Handler for the fake workspace's "window mapped" signal.
|
static |
Handler for the fake workspace's "window unmapped" signal.
void wlmtk_workspace_activate_next_window | ( | wlmtk_workspace_t * | workspace_ptr | ) |
Activates the wlmtk_window_t after the currently activated one.
Intended to permit cycling through tasks. Will activate the window, but not raise it. See wlmtk_workspace_activate_previous_window.
workspace_ptr |
void wlmtk_workspace_activate_previous_window | ( | wlmtk_workspace_t * | workspace_ptr | ) |
Activates the wlmtk_window_t before the currently activated one.
Intended to permit cycling through tasks. Will activate the window, but not raise it. See wlmtk_workspace_activate_next_window.
workspace_ptr |
void wlmtk_workspace_activate_window | ( | wlmtk_workspace_t * | workspace_ptr, |
wlmtk_window_t * | window_ptr ) |
Acticates window_ptr
. Will de-activate an earlier window.
bool wlmtk_workspace_axis | ( | wlmtk_workspace_t * | workspace_ptr, |
struct wlr_pointer_axis_event * | wlr_pointer_axis_event_ptr ) |
Handles an axis event.
workspace_ptr | |
wlr_pointer_axis_event_ptr |
void wlmtk_workspace_begin_window_move | ( | wlmtk_workspace_t * | workspace_ptr, |
wlmtk_window_t * | window_ptr ) |
Initiates a 'move' for the window.
workspace_ptr | |
window_ptr |
void wlmtk_workspace_begin_window_resize | ( | wlmtk_workspace_t * | workspace_ptr, |
wlmtk_window_t * | window_ptr, | ||
uint32_t | edges ) |
Initiates a 'resize' for the window.
workspace_ptr | |
window_ptr | |
edges |
bool wlmtk_workspace_button | ( | wlmtk_workspace_t * | workspace_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. Also, move this code into the server and make it well tested.
workspace_ptr | |
event_ptr |
wlmtk_workspace_t * wlmtk_workspace_create | ( | wlmtk_env_t * | env_ptr, |
struct wlr_scene_tree * | wlr_scene_tree_ptr ) |
Creates a workspace.
TODO(kaese.nosp@m.r@gu.nosp@m.bbe.c.nosp@m.h): Consider replacing the interface with a container, and permit a "toplevel" container that will be at the server level.
env_ptr | |
wlr_scene_tree_ptr |
void wlmtk_workspace_destroy | ( | wlmtk_workspace_t * | workspace_ptr | ) |
Destroys the workspace. Will destroy any stil-contained element.
workspace_ptr |
wlmtk_window_t * wlmtk_workspace_get_activated_window | ( | wlmtk_workspace_t * | workspace_ptr | ) |
struct wlr_box wlmtk_workspace_get_fullscreen_extents | ( | wlmtk_workspace_t * | workspace_ptr | ) |
Returns the extents of the workspace available for fullscreen windows.
workspace_ptr |
struct wlr_box
that lines out the available space and position. struct wlr_box wlmtk_workspace_get_maximize_extents | ( | wlmtk_workspace_t * | workspace_ptr | ) |
Returns the extents of the workspace available for maximized windows.
workspace_ptr |
struct wlr_box
that lines out the available space and position. bs_dllist_t * wlmtk_workspace_get_windows_dllist | ( | wlmtk_workspace_t * | workspace_ptr | ) |
Returns the bs_dllist_t
of currently mapped windows.
workspace_ptr |
void wlmtk_workspace_map_window | ( | wlmtk_workspace_t * | workspace_ptr, |
wlmtk_window_t * | window_ptr ) |
Maps the window: Adds it to the workspace container and makes it visible.
workspace_ptr | |
window_ptr |
bool wlmtk_workspace_motion | ( | wlmtk_workspace_t * | workspace_ptr, |
double | x, | ||
double | y, | ||
uint32_t | time_msec ) |
Handles a motion event.
TODO(kaese.nosp@m.r@gu.nosp@m.bbe.c.nosp@m.h): Move this to the server, and have the workspace's motion handling dealt with the element's pointer_motion method.
workspace_ptr | |
x | |
y | |
time_msec |
void wlmtk_workspace_raise_window | ( | wlmtk_workspace_t * | workspace_ptr, |
wlmtk_window_t * | window_ptr ) |
Raises window_ptr
: Will show it atop all other windows.
void wlmtk_workspace_set_extents | ( | wlmtk_workspace_t * | workspace_ptr, |
const struct wlr_box * | extents_ptr ) |
Sets (or updates) the extents of the workspace.
workspace_ptr | |
extents_ptr |
void wlmtk_workspace_set_signals | ( | wlmtk_workspace_t * | workspace_ptr, |
struct wl_signal * | mapped_event_ptr, | ||
struct wl_signal * | unmapped_event_ptr ) |
Sets signals for window events.
TODO(kaese.nosp@m.r@gu.nosp@m.bbe.c.nosp@m.h): Remove this, once migrated to an event registry.
workspace_ptr | |
mapped_event_ptr | |
unmapped_event_ptr |
void wlmtk_workspace_unmap_window | ( | wlmtk_workspace_t * | workspace_ptr, |
wlmtk_window_t * | window_ptr ) |
Unmaps the window: Sets it as invisible and removes it from the container.
workspace_ptr | |
window_ptr |
void wlmtk_workspace_window_to_fullscreen | ( | wlmtk_workspace_t * | workspace_ptr, |
wlmtk_window_t * | window_ptr, | ||
bool | fullscreen ) |
Promotes the window to the fullscreen layer (or back).
To be called by wlmtk_window_commit_fullscreen.
workspace_ptr | |
window_ptr | |
fullscreen |
|
static |
Finite state machine definition for pointer events.
const bs_test_case_t wlmtk_workspace_test_cases[] |
Unit tests for the workspace.
const wlmtk_element_vmt_t workspace_element_vmt |
Extensions to the workspace's super element's virtual methods.