|
wlmaker
|
#include "workspace.h"#include <libbase/libbase.h>#include <linux/input-event-codes.h>#include <stdlib.h>#include <wayland-server-core.h>#include <wayland-util.h>#include <wlr/types/wlr_output.h>#include <wlr/types/wlr_output_layout.h>#include <wlr/types/wlr_pointer.h>#include <wlr/types/wlr_scene.h>#include <wlr/util/edges.h>#include <wlr/version.h>#include "container.h"#include "fsm.h"#include "input.h"#include "layer.h"#include "test.h"#include "tile.h"#include "util.h"
Classes | |
| struct | _wlmtk_workspace_t |
| struct | _wlmtk_workspace_test_context |
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 bool | _wlmtk_workspace_element_pointer_button (wlmtk_element_t *element_ptr, const wlmtk_button_event_t *button_event_ptr) |
| static void | _wlmtk_workspace_handle_output_layout_change (struct wl_listener *listener_ptr, void *data_ptr) |
| static void | _wlmtk_workspace_handle_element_pointer_leave (struct wl_listener *listener_ptr, void *data_ptr) |
| static void | _wlmtk_workspace_handle_element_pointer_motion (struct wl_listener *listener_ptr, void *data_ptr) |
| static void | _wlmtk_window_reposition_window (bs_dllist_node_t *dlnode_ptr, void *ud_ptr) |
| static bool | _wlmtk_workspace_window_overlaps (bs_dllist_node_t *dlnode_ptr, void *ud_ptr) |
| static void | _wlmtk_workspace_place_window (wlmtk_workspace_t *workspace_ptr, wlmtk_window_t *window_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 (struct wlr_output_layout *wlr_output_layout_ptr, const char *name_ptr, const struct wlmtk_tile_style *tile_style_ptr) |
| void | wlmtk_workspace_destroy (wlmtk_workspace_t *workspace_ptr) |
| void | wlmtk_workspace_set_details (wlmtk_workspace_t *workspace_ptr, int index) |
| void | wlmtk_workspace_get_details (wlmtk_workspace_t *workspace_ptr, const char **name_ptr_ptr, int *index_ptr) |
| struct wlr_box | wlmtk_workspace_get_maximize_extents (wlmtk_workspace_t *workspace_ptr, struct wlr_output *wlr_output_ptr) |
| void | wlmtk_workspace_confine_within (wlmtk_workspace_t *workspace_ptr, wlmtk_window_t *window_ptr) |
| struct wlr_output_layout * | wlmtk_workspace_get_wlr_output_layout (wlmtk_workspace_t *workspace_ptr) |
| struct wlr_box | wlmtk_workspace_get_fullscreen_extents (wlmtk_workspace_t *workspace_ptr, struct wlr_output *wlr_output_ptr) |
| void | wlmtk_workspace_enable (wlmtk_workspace_t *workspace_ptr, bool enabled) |
| bool | wlmtk_workspace_enabled (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) |
| void | wlmtk_workspace_set_window_position (wlmtk_workspace_t *workspace_ptr, wlmtk_window_t *window_ptr, int x, int y) |
| wlmtk_layer_t * | wlmtk_workspace_get_layer (wlmtk_workspace_t *workspace_ptr, wlmtk_workspace_layer_t layer) |
| 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) |
| 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) |
| wlmtk_element_t * | wlmtk_workspace_element (wlmtk_workspace_t *workspace_ptr) |
| wlmtk_desktop_t * | wlmtk_workspace_get_desktop (wlmtk_workspace_t *workspace_ptr) |
| void | wlmtk_workspace_set_desktop (wlmtk_workspace_t *workspace_ptr, wlmtk_desktop_t *desktop_ptr) |
| bs_dllist_node_t * | wlmtk_dlnode_from_workspace (wlmtk_workspace_t *workspace_ptr) |
| wlmtk_workspace_t * | wlmtk_workspace_from_dlnode (bs_dllist_node_t *dlnode_ptr) |
| static bool | wlr_box_contains_box (const struct wlr_box *parent_box_ptr, const struct wlr_box *child_box_ptr) |
| static void | test_create_destroy (bs_test_t *test_ptr) |
| static void | test_map_unmap (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_enable (bs_test_t *test_ptr) |
| static void | test_activate (bs_test_t *test_ptr) |
| static void | test_activate_cycling (bs_test_t *test_ptr) |
| static void | test_multi_output_extents (bs_test_t *test_ptr) |
| static void | test_multi_output_reposition (bs_test_t *test_ptr) |
| static void | test_window_position (bs_test_t *test_ptr) |
| static void * | _wlmtk_workspace_test_setup (void) |
| static void | _wlmtk_workspace_test_teardown (void *setup_context_ptr) |
| static void | _wlmtk_workspace_test_unmap_and_destroy_window (bs_dllist_node_t *dlnode_ptr, void *ud_ptr) |
Variables | |
| const wlmtk_element_vmt_t | workspace_element_vmt |
| static const wlmtk_fsm_transition_t | pfsm_transitions [] |
| static const int | _wlmtk_workspace_placement_step = 24 |
| static const bs_test_case_t | _wlmtk_workspace_test_cases [] |
| static const struct wlmtk_tile_style | _wlmtk_workspace_test_tile_style |
| const bs_test_set_t | wlmtk_workspace_test_set |
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 |
Repositions the window. To be called when output layout changes.
|
static |
Virtual destructor, wraps to our dtor.
|
static |
Returns the workspace area.
|
static |
Extends wlmtk_container_t::pointer_button.
| element_ptr | |
| button_event_ptr |
|
static |
Handles wlmtk_element_events_t::pointer_leave. Reset state machine.
|
static |
wlmtk_element_events_t::pointer_motion. Feeds into state machine.
|
static |
Handles output changes: Updates own extents, updates layers.
|
static |
Window placement: Finds a place for the window.
Looks for a non-overlapping space at the current position of window_ptr, and then for tiles right or below it. If none is found, build a stacking order, at _wlmtk_workspace_placement_step pixels apart.
| workspace_ptr | |
| window_ptr |
|
static |
Context setup for workspace tests.
|
static |
Context teardown for workspace tests.
|
static |
Iterator for bs_dllist_for_each: Unmaps and destroys any window.
|
static |
Iterator for bs_dllist_any: Does window at dlnode_ptr overlap?
|
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 |
Exercises workspace create & destroy methods.
|
static |
Tests enabling or disabling the workspace.
|
static |
Verifies that mapping and unmapping windows works.
|
static |
Tests moving a window.
|
static |
Tests extents with multiple outputs.
|
static |
Verifies that windows are re-positioned when output is removed.
|
static |
Tests resizing a window.
|
static |
Tests moving a window that unmaps during the move.
|
static |
Tests window placement.
| bs_dllist_node_t * wlmtk_dlnode_from_workspace | ( | wlmtk_workspace_t * | workspace_ptr | ) |
| 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.
| 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 |
| void wlmtk_workspace_confine_within | ( | wlmtk_workspace_t * | workspace_ptr, |
| wlmtk_window_t * | window_ptr | ||
| ) |
Confines the window to remain entirely within workspace extents.
A no-op if window_ptr is not mapped to workspace_ptr.
| workspace_ptr | |
| window_ptr |
| wlmtk_workspace_t * wlmtk_workspace_create | ( | struct wlr_output_layout * | wlr_output_layout_ptr, |
| const char * | name_ptr, | ||
| const struct wlmtk_tile_style * | tile_style_ptr | ||
| ) |
Creates a workspace.
| wlr_output_layout_ptr | Output layout. Must outlive the workspace. |
| name_ptr | |
| tile_style_ptr |
| void wlmtk_workspace_destroy | ( | wlmtk_workspace_t * | workspace_ptr | ) |
Destroys the workspace. Will destroy any stil-contained element.
| workspace_ptr |
| wlmtk_element_t * wlmtk_workspace_element | ( | wlmtk_workspace_t * | workspace_ptr | ) |
| void wlmtk_workspace_enable | ( | wlmtk_workspace_t * | workspace_ptr, |
| bool | enabled | ||
| ) |
Enabled or disables the workspace.
An enabled workspace can have keyboard focus and activated windows. When re-enabling a workspace, the formerly activated window will get re-activated and re-gains keyboard focus.
| workspace_ptr | |
| enabled |
| bool wlmtk_workspace_enabled | ( | wlmtk_workspace_t * | workspace_ptr | ) |
| wlmtk_workspace_t * wlmtk_workspace_from_dlnode | ( | bs_dllist_node_t * | dlnode_ptr | ) |
dlnode_ptr. | wlmtk_window_t * wlmtk_workspace_get_activated_window | ( | wlmtk_workspace_t * | workspace_ptr | ) |
| wlmtk_desktop_t * wlmtk_workspace_get_desktop | ( | wlmtk_workspace_t * | workspace_ptr | ) |
workspace_ptr. | void wlmtk_workspace_get_details | ( | wlmtk_workspace_t * | workspace_ptr, |
| const char ** | name_ptr_ptr, | ||
| int * | index_ptr | ||
| ) |
Retrieves the naming details of this workspace.
| workspace_ptr | |
| name_ptr_ptr | |
| index_ptr |
| struct wlr_box wlmtk_workspace_get_fullscreen_extents | ( | wlmtk_workspace_t * | workspace_ptr, |
| struct wlr_output * | wlr_output_ptr | ||
| ) |
Returns the extents of the workspace available for fullscreen windows.
| workspace_ptr | |
| wlr_output_ptr | Output to lookup the extents for. May be NULL, in which case the primary output is used. |
struct wlr_box that lines out the available space and position. | wlmtk_layer_t * wlmtk_workspace_get_layer | ( | wlmtk_workspace_t * | workspace_ptr, |
| wlmtk_workspace_layer_t | layer | ||
| ) |
Returns pointer to the wlmtk_layer_t handle serving layer.
| workspace_ptr | |
| layer |
| struct wlr_box wlmtk_workspace_get_maximize_extents | ( | wlmtk_workspace_t * | workspace_ptr, |
| struct wlr_output * | wlr_output_ptr | ||
| ) |
Returns the workspace'soutput extents available for maximized windows.
| workspace_ptr | |
| wlr_output_ptr | Output to lookup the extents for. May be NULL, in which case the primary output is used. |
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 |
| struct wlr_output_layout * wlmtk_workspace_get_wlr_output_layout | ( | wlmtk_workspace_t * | 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 |
| 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_desktop | ( | wlmtk_workspace_t * | workspace_ptr, |
| wlmtk_desktop_t * | desktop_ptr | ||
| ) |
Sets the anchor wlmtk_desktop_t of workspace_ptr.
Must only be called from wlmtk_desktop_t.
| workspace_ptr | |
| desktop_ptr |
| void wlmtk_workspace_set_details | ( | wlmtk_workspace_t * | workspace_ptr, |
| int | index | ||
| ) |
Sets or updates workspace details.
| workspace_ptr | |
| index |
| void wlmtk_workspace_set_window_position | ( | wlmtk_workspace_t * | workspace_ptr, |
| wlmtk_window_t * | window_ptr, | ||
| int | x, | ||
| int | y | ||
| ) |
Sets the window's position.
| workspace_ptr | |
| window_ptr | |
| x | |
| y |
| 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 |
Whether smaller is fully contained in bigger.
|
static |
For window placement: Pixel distance between each stacked position.
|
static |
Test cases
|
static |
Tile style used in tests.
|
static |
Finite state machine definition for pointer events.
| const bs_test_set_t wlmtk_workspace_test_set |
Unit tests for the workspace.
| const wlmtk_element_vmt_t workspace_element_vmt |
Extensions to the workspace's super element's virtual methods.