2021-11-26 19:27:50 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2023-05-13 16:10:33 +03:00
|
|
|
#ifndef LABWC_H
|
|
|
|
|
#define LABWC_H
|
2020-12-30 10:29:21 +00:00
|
|
|
#include "config.h"
|
2019-11-19 21:00:26 +00:00
|
|
|
#include <getopt.h>
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
#include <stdio.h>
|
2020-09-28 20:41:41 +01:00
|
|
|
#include <stdlib.h>
|
2019-11-19 21:00:26 +00:00
|
|
|
#include <time.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <wayland-server-core.h>
|
|
|
|
|
#include <wlr/backend.h>
|
2021-11-21 07:01:16 +00:00
|
|
|
#include <wlr/render/allocator.h>
|
2019-11-19 21:00:26 +00:00
|
|
|
#include <wlr/render/wlr_renderer.h>
|
|
|
|
|
#include <wlr/types/wlr_compositor.h>
|
2022-02-11 23:12:45 +00:00
|
|
|
#include <wlr/types/wlr_buffer.h>
|
2020-09-28 20:41:41 +01:00
|
|
|
#include <wlr/types/wlr_cursor.h>
|
2019-11-19 21:00:26 +00:00
|
|
|
#include <wlr/types/wlr_data_device.h>
|
2021-08-05 12:18:10 +01:00
|
|
|
#include <wlr/types/wlr_foreign_toplevel_management_v1.h>
|
2019-11-19 21:00:26 +00:00
|
|
|
#include <wlr/types/wlr_input_device.h>
|
|
|
|
|
#include <wlr/types/wlr_keyboard.h>
|
2020-10-02 21:19:56 +01:00
|
|
|
#include <wlr/types/wlr_keyboard_group.h>
|
2020-10-31 15:09:13 +00:00
|
|
|
#include <wlr/types/wlr_layer_shell_v1.h>
|
2019-11-19 21:00:26 +00:00
|
|
|
#include <wlr/types/wlr_matrix.h>
|
|
|
|
|
#include <wlr/types/wlr_output.h>
|
2021-02-27 23:15:02 -05:00
|
|
|
#include <wlr/types/wlr_output_management_v1.h>
|
2022-03-06 04:46:11 +00:00
|
|
|
#include <wlr/types/wlr_output_power_management_v1.h>
|
2019-11-19 21:00:26 +00:00
|
|
|
#include <wlr/types/wlr_output_layout.h>
|
2022-02-11 23:12:45 +00:00
|
|
|
#include <wlr/types/wlr_scene.h>
|
2021-10-17 16:54:35 -04:00
|
|
|
#include <wlr/types/wlr_relative_pointer_v1.h>
|
2019-11-19 21:00:26 +00:00
|
|
|
#include <wlr/types/wlr_pointer.h>
|
2021-10-17 16:54:35 -04:00
|
|
|
#include <wlr/types/wlr_pointer_constraints_v1.h>
|
2021-12-31 23:34:08 +00:00
|
|
|
#include <wlr/types/wlr_pointer_gestures_v1.h>
|
2019-11-19 21:00:26 +00:00
|
|
|
#include <wlr/types/wlr_seat.h>
|
2022-02-14 20:20:16 +00:00
|
|
|
#include <wlr/types/wlr_subcompositor.h>
|
2020-09-28 20:41:41 +01:00
|
|
|
#include <wlr/types/wlr_xcursor_manager.h>
|
2023-02-04 10:07:46 +01:00
|
|
|
#include <wlr/types/wlr_xdg_activation_v1.h>
|
2020-09-28 20:41:41 +01:00
|
|
|
#include <wlr/types/wlr_xdg_shell.h>
|
2022-03-26 04:51:54 +00:00
|
|
|
#include <wlr/types/wlr_drm_lease_v1.h>
|
2022-08-17 18:17:21 +00:00
|
|
|
#include <wlr/types/wlr_virtual_pointer_v1.h>
|
2022-08-17 18:23:06 +00:00
|
|
|
#include <wlr/types/wlr_virtual_keyboard_v1.h>
|
2019-11-19 21:00:26 +00:00
|
|
|
#include <wlr/util/log.h>
|
|
|
|
|
#include <xkbcommon/xkbcommon.h>
|
2022-09-16 02:03:32 +02:00
|
|
|
#include "cursor.h"
|
2020-08-03 20:56:38 +01:00
|
|
|
#include "config/keybind.h"
|
2020-09-28 20:41:41 +01:00
|
|
|
#include "config/rcxml.h"
|
2022-09-13 08:15:33 +02:00
|
|
|
#include "regions.h"
|
2023-03-30 22:19:05 +01:00
|
|
|
#include "session-lock.h"
|
2022-05-01 14:38:45 +10:00
|
|
|
#if HAVE_NLS
|
|
|
|
|
#include <libintl.h>
|
|
|
|
|
#include <locale.h>
|
|
|
|
|
#define _ gettext
|
|
|
|
|
#else
|
|
|
|
|
#define _(s) (s)
|
|
|
|
|
#endif
|
2020-06-18 20:18:01 +01:00
|
|
|
|
2019-11-19 21:00:26 +00:00
|
|
|
#define XCURSOR_DEFAULT "left_ptr"
|
|
|
|
|
#define XCURSOR_SIZE 24
|
|
|
|
|
|
2020-10-21 20:30:06 +01:00
|
|
|
enum input_mode {
|
|
|
|
|
LAB_INPUT_STATE_PASSTHROUGH = 0,
|
|
|
|
|
LAB_INPUT_STATE_MOVE,
|
|
|
|
|
LAB_INPUT_STATE_RESIZE,
|
2020-10-19 22:14:17 +01:00
|
|
|
LAB_INPUT_STATE_MENU,
|
2019-11-19 21:00:26 +00:00
|
|
|
};
|
|
|
|
|
|
2020-10-02 21:19:56 +01:00
|
|
|
struct input {
|
|
|
|
|
struct wlr_input_device *wlr_input_device;
|
|
|
|
|
struct seat *seat;
|
|
|
|
|
struct wl_listener destroy;
|
2023-10-02 19:47:59 +01:00
|
|
|
struct wl_list link; /* seat.inputs */
|
2020-10-02 21:19:56 +01:00
|
|
|
};
|
|
|
|
|
|
2022-09-26 07:17:19 +01:00
|
|
|
/*
|
|
|
|
|
* Virtual keyboards should not belong to seat->keyboard_group. As a result we
|
|
|
|
|
* need to be able to ascertain which wlr_keyboard key/modifer events come from
|
|
|
|
|
* and we achieve that by using `struct keyboard` which inherits `struct input`
|
|
|
|
|
* and adds keybord specific listeners and a wlr_keyboard pointer.
|
|
|
|
|
*/
|
|
|
|
|
struct keyboard {
|
|
|
|
|
struct input base;
|
|
|
|
|
struct wlr_keyboard *wlr_keyboard;
|
|
|
|
|
bool is_virtual;
|
|
|
|
|
struct wl_listener modifier;
|
|
|
|
|
struct wl_listener key;
|
2022-11-02 16:37:24 -04:00
|
|
|
/* key repeat for compositor keybinds */
|
|
|
|
|
uint32_t keybind_repeat_keycode;
|
|
|
|
|
int32_t keybind_repeat_rate;
|
|
|
|
|
struct wl_event_source *keybind_repeat;
|
2022-09-26 07:17:19 +01:00
|
|
|
};
|
|
|
|
|
|
2020-10-02 21:19:56 +01:00
|
|
|
struct seat {
|
|
|
|
|
struct wlr_seat *seat;
|
|
|
|
|
struct server *server;
|
|
|
|
|
struct wlr_keyboard_group *keyboard_group;
|
2021-11-28 21:47:24 +00:00
|
|
|
|
2023-08-26 17:01:42 +00:00
|
|
|
struct wl_list touch_points; /* struct touch_point.link */
|
|
|
|
|
|
2022-09-12 13:14:18 -04:00
|
|
|
/*
|
2022-09-16 02:23:44 +02:00
|
|
|
* Enum of most recent server-side cursor image. Set by
|
2022-09-12 13:14:18 -04:00
|
|
|
* cursor_set(). Cleared when a client surface is entered
|
2022-09-16 02:23:44 +02:00
|
|
|
* (in that case the client is expected to set its own cursor image).
|
2022-09-12 13:14:18 -04:00
|
|
|
*/
|
2022-09-16 02:23:44 +02:00
|
|
|
enum lab_cursors server_cursor;
|
2020-10-02 21:19:56 +01:00
|
|
|
struct wlr_cursor *cursor;
|
|
|
|
|
struct wlr_xcursor_manager *xcursor_manager;
|
2022-11-09 05:18:14 +00:00
|
|
|
struct {
|
|
|
|
|
double x, y;
|
|
|
|
|
} smooth_scroll_offset;
|
2021-11-28 21:47:24 +00:00
|
|
|
|
2021-10-17 16:54:35 -04:00
|
|
|
struct wlr_pointer_constraint_v1 *current_constraint;
|
2020-10-02 21:19:56 +01:00
|
|
|
|
2023-03-03 18:16:46 +01:00
|
|
|
/* In support for ToggleKeybinds */
|
2023-03-05 10:35:56 +01:00
|
|
|
uint32_t nr_inhibited_keybind_views;
|
2023-03-03 18:16:46 +01:00
|
|
|
|
2022-06-15 01:07:45 +02:00
|
|
|
/* Used to hide the workspace OSD after switching workspaces */
|
|
|
|
|
struct wl_event_source *workspace_osd_timer;
|
|
|
|
|
bool workspace_osd_shown_by_modifier;
|
|
|
|
|
|
2020-10-31 15:09:13 +00:00
|
|
|
/* if set, views cannot receive focus */
|
|
|
|
|
struct wlr_layer_surface_v1 *focused_layer;
|
|
|
|
|
|
2022-02-26 01:21:39 +01:00
|
|
|
/**
|
2022-08-14 14:40:56 +02:00
|
|
|
* pressed view/surface/node will usually be NULL and is only set on
|
2022-09-14 23:09:36 -04:00
|
|
|
* button press while the mouse is over a view or surface, and reset
|
|
|
|
|
* to NULL on button release.
|
2022-02-26 01:21:39 +01:00
|
|
|
* It is used to send cursor motion events to a surface even though
|
|
|
|
|
* the cursor has left the surface in the meantime.
|
|
|
|
|
*
|
|
|
|
|
* This allows to keep dragging a scrollbar or selecting text even
|
|
|
|
|
* when moving outside of the window.
|
2022-09-14 23:09:36 -04:00
|
|
|
*
|
|
|
|
|
* Both (view && !surface) and (surface && !view) are possible.
|
2022-02-26 01:21:39 +01:00
|
|
|
*/
|
2022-05-24 13:02:51 +02:00
|
|
|
struct {
|
|
|
|
|
struct view *view;
|
2022-08-14 14:40:56 +02:00
|
|
|
struct wlr_scene_node *node;
|
2022-05-24 13:02:51 +02:00
|
|
|
struct wlr_surface *surface;
|
2022-09-10 01:57:39 -04:00
|
|
|
struct wlr_surface *toplevel;
|
2022-09-14 23:09:36 -04:00
|
|
|
uint32_t resize_edges;
|
2022-05-24 13:02:51 +02:00
|
|
|
} pressed;
|
2022-02-26 01:21:39 +01:00
|
|
|
|
2022-09-18 05:40:52 +02:00
|
|
|
struct {
|
|
|
|
|
bool active;
|
|
|
|
|
struct {
|
|
|
|
|
struct wl_listener request;
|
|
|
|
|
struct wl_listener start;
|
|
|
|
|
struct wl_listener destroy;
|
|
|
|
|
} events;
|
|
|
|
|
struct wlr_scene_tree *icons;
|
|
|
|
|
} drag;
|
|
|
|
|
|
2022-09-13 08:15:33 +02:00
|
|
|
/* Private use by regions.c */
|
|
|
|
|
struct region *region_active;
|
|
|
|
|
struct region_overlay region_overlay;
|
2023-03-07 17:51:28 +01:00
|
|
|
/* Used to prevent region snapping when starting a move with A-Left */
|
|
|
|
|
bool region_prevent_snap;
|
2022-07-06 07:19:28 +02:00
|
|
|
|
2021-08-21 17:12:02 +01:00
|
|
|
struct wl_client *active_client_while_inhibited;
|
2020-10-02 21:19:56 +01:00
|
|
|
struct wl_list inputs;
|
|
|
|
|
struct wl_listener new_input;
|
2023-09-27 18:24:35 -04:00
|
|
|
struct wl_listener focus_change;
|
2020-10-02 21:19:56 +01:00
|
|
|
|
|
|
|
|
struct wl_listener cursor_motion;
|
|
|
|
|
struct wl_listener cursor_motion_absolute;
|
|
|
|
|
struct wl_listener cursor_button;
|
|
|
|
|
struct wl_listener cursor_axis;
|
|
|
|
|
struct wl_listener cursor_frame;
|
|
|
|
|
|
2021-12-31 23:34:08 +00:00
|
|
|
struct wlr_pointer_gestures_v1 *pointer_gestures;
|
|
|
|
|
struct wl_listener pinch_begin;
|
|
|
|
|
struct wl_listener pinch_update;
|
|
|
|
|
struct wl_listener pinch_end;
|
|
|
|
|
struct wl_listener swipe_begin;
|
|
|
|
|
struct wl_listener swipe_update;
|
|
|
|
|
struct wl_listener swipe_end;
|
|
|
|
|
|
2020-10-02 21:19:56 +01:00
|
|
|
struct wl_listener request_cursor;
|
|
|
|
|
struct wl_listener request_set_selection;
|
2021-08-18 23:41:07 +01:00
|
|
|
struct wl_listener request_set_primary_selection;
|
2020-10-02 21:19:56 +01:00
|
|
|
|
2021-12-31 23:50:31 +00:00
|
|
|
struct wl_listener touch_down;
|
|
|
|
|
struct wl_listener touch_up;
|
|
|
|
|
struct wl_listener touch_motion;
|
|
|
|
|
struct wl_listener touch_frame;
|
|
|
|
|
|
2021-10-17 16:54:35 -04:00
|
|
|
struct wl_listener constraint_commit;
|
2022-09-13 10:55:59 -04:00
|
|
|
struct wl_listener pressed_surface_destroy;
|
2022-08-17 18:17:21 +00:00
|
|
|
|
|
|
|
|
struct wlr_virtual_pointer_manager_v1 *virtual_pointer;
|
|
|
|
|
struct wl_listener virtual_pointer_new;
|
2022-08-17 18:23:06 +00:00
|
|
|
|
|
|
|
|
struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard;
|
|
|
|
|
struct wl_listener virtual_keyboard_new;
|
2020-10-02 21:19:56 +01:00
|
|
|
};
|
|
|
|
|
|
2022-02-11 23:12:45 +00:00
|
|
|
struct lab_data_buffer;
|
2022-06-15 01:07:45 +02:00
|
|
|
struct workspace;
|
2022-02-11 23:12:45 +00:00
|
|
|
|
2019-12-27 20:48:58 +00:00
|
|
|
struct server {
|
2019-11-19 21:00:26 +00:00
|
|
|
struct wl_display *wl_display;
|
2022-06-15 01:07:45 +02:00
|
|
|
struct wl_event_loop *wl_event_loop; /* Can be used for timer events */
|
2019-11-19 21:00:26 +00:00
|
|
|
struct wlr_renderer *renderer;
|
2021-11-21 07:01:16 +00:00
|
|
|
struct wlr_allocator *allocator;
|
2020-09-29 19:53:46 +01:00
|
|
|
struct wlr_backend *backend;
|
2019-11-19 21:00:26 +00:00
|
|
|
|
|
|
|
|
struct wlr_xdg_shell *xdg_shell;
|
2020-09-30 17:18:20 +01:00
|
|
|
struct wlr_layer_shell_v1 *layer_shell;
|
|
|
|
|
|
2019-11-19 21:00:26 +00:00
|
|
|
struct wl_listener new_xdg_surface;
|
2020-09-30 17:18:20 +01:00
|
|
|
struct wl_listener new_layer_surface;
|
|
|
|
|
|
2023-03-22 19:56:59 +00:00
|
|
|
struct wl_listener kde_server_decoration;
|
2020-05-13 20:51:13 +01:00
|
|
|
struct wl_listener xdg_toplevel_decoration;
|
2020-12-30 10:29:21 +00:00
|
|
|
#if HAVE_XWAYLAND
|
2019-11-19 21:00:26 +00:00
|
|
|
struct wlr_xwayland *xwayland;
|
2022-07-21 02:47:20 +02:00
|
|
|
struct wl_listener xwayland_ready;
|
2023-01-07 17:50:33 -05:00
|
|
|
struct wl_listener xwayland_new_surface;
|
2020-12-30 10:29:21 +00:00
|
|
|
#endif
|
2020-10-02 21:19:56 +01:00
|
|
|
|
2021-08-21 17:12:02 +01:00
|
|
|
struct wlr_input_inhibit_manager *input_inhibit;
|
2021-09-22 20:24:02 +01:00
|
|
|
struct wl_listener input_inhibit_activate;
|
2021-08-21 17:12:02 +01:00
|
|
|
struct wl_listener input_inhibit_deactivate;
|
|
|
|
|
|
2023-02-04 10:07:46 +01:00
|
|
|
struct wlr_xdg_activation_v1 *xdg_activation;
|
|
|
|
|
struct wl_listener xdg_activation_request;
|
|
|
|
|
|
2019-11-19 21:00:26 +00:00
|
|
|
struct wl_list views;
|
2020-09-04 20:25:20 +01:00
|
|
|
struct wl_list unmanaged_surfaces;
|
2019-11-19 21:00:26 +00:00
|
|
|
|
2020-10-02 21:19:56 +01:00
|
|
|
struct seat seat;
|
2022-02-11 23:12:45 +00:00
|
|
|
struct wlr_scene *scene;
|
|
|
|
|
|
2020-05-18 20:54:25 +01:00
|
|
|
/* cursor interactive */
|
2020-10-21 20:30:06 +01:00
|
|
|
enum input_mode input_mode;
|
2019-12-27 20:48:58 +00:00
|
|
|
struct view *grabbed_view;
|
2019-11-19 21:00:26 +00:00
|
|
|
double grab_x, grab_y;
|
2020-05-12 20:37:05 +01:00
|
|
|
struct wlr_box grab_box;
|
2019-11-19 21:00:26 +00:00
|
|
|
uint32_t resize_edges;
|
|
|
|
|
|
2022-02-21 03:18:38 +01:00
|
|
|
/* SSD state */
|
2023-09-26 01:35:36 -04:00
|
|
|
/*
|
2023-09-27 18:24:35 -04:00
|
|
|
* Currently focused view. Updated with each "focus change"
|
|
|
|
|
* event. This view is drawn with "active" SSD coloring.
|
2023-09-26 01:35:36 -04:00
|
|
|
*/
|
2022-08-26 02:02:19 -04:00
|
|
|
struct view *focused_view;
|
2022-11-26 16:46:28 -05:00
|
|
|
struct ssd_hover_state *ssd_hover_state;
|
2022-02-21 03:18:38 +01:00
|
|
|
|
2022-02-22 07:57:17 +01:00
|
|
|
/* Tree for all non-layer xdg/xwayland-shell surfaces */
|
|
|
|
|
struct wlr_scene_tree *view_tree;
|
2023-05-20 08:58:42 +01:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Popups need to be rendered above always-on-top views, so we reparent
|
|
|
|
|
* them to this dedicated tree
|
|
|
|
|
*/
|
|
|
|
|
struct wlr_scene_tree *xdg_popup_tree;
|
|
|
|
|
|
|
|
|
|
/* Tree for all non-layer xdg/xwayland-shell surfaces with always-on-top/below */
|
2022-04-09 01:16:09 +02:00
|
|
|
struct wlr_scene_tree *view_tree_always_on_top;
|
2023-05-11 22:26:41 +01:00
|
|
|
struct wlr_scene_tree *view_tree_always_on_bottom;
|
2022-02-22 07:57:17 +01:00
|
|
|
#if HAVE_XWAYLAND
|
|
|
|
|
/* Tree for unmanaged xsurfaces without initialized view (usually popups) */
|
|
|
|
|
struct wlr_scene_tree *unmanaged_tree;
|
|
|
|
|
#endif
|
|
|
|
|
/* Tree for built in menu */
|
2022-02-19 02:05:38 +01:00
|
|
|
struct wlr_scene_tree *menu_tree;
|
2022-02-11 23:12:45 +00:00
|
|
|
|
2022-06-15 01:07:45 +02:00
|
|
|
/* Workspaces */
|
|
|
|
|
struct wl_list workspaces; /* struct workspace.link */
|
|
|
|
|
struct workspace *workspace_current;
|
2022-06-18 03:09:18 +03:00
|
|
|
struct workspace *workspace_last;
|
2022-06-15 01:07:45 +02:00
|
|
|
|
2019-11-19 21:00:26 +00:00
|
|
|
struct wl_list outputs;
|
|
|
|
|
struct wl_listener new_output;
|
2020-10-02 21:19:56 +01:00
|
|
|
struct wlr_output_layout *output_layout;
|
2020-05-25 13:42:40 +01:00
|
|
|
|
2021-02-27 23:15:02 -05:00
|
|
|
struct wl_listener output_layout_change;
|
|
|
|
|
struct wlr_output_manager_v1 *output_manager;
|
|
|
|
|
struct wl_listener output_manager_apply;
|
2022-09-20 01:17:22 -04:00
|
|
|
/*
|
|
|
|
|
* While an output layout change is in process, this counter is
|
|
|
|
|
* non-zero and causes change-events from the wlr_output_layout
|
|
|
|
|
* to be ignored (to prevent, for example, moving views in a
|
|
|
|
|
* transitory layout state). Once the counter reaches zero,
|
|
|
|
|
* do_output_layout_change() must be called explicitly.
|
|
|
|
|
*/
|
|
|
|
|
int pending_output_layout_change;
|
2021-02-27 23:15:02 -05:00
|
|
|
|
2023-03-30 22:19:05 +01:00
|
|
|
struct session_lock *session_lock;
|
|
|
|
|
|
2021-08-05 12:18:10 +01:00
|
|
|
struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager;
|
|
|
|
|
|
2022-03-26 04:51:54 +00:00
|
|
|
struct wlr_drm_lease_v1_manager *drm_lease_manager;
|
|
|
|
|
struct wl_listener drm_lease_request;
|
|
|
|
|
|
2022-03-06 04:46:11 +00:00
|
|
|
struct wlr_output_power_manager_v1 *output_power_manager_v1;
|
|
|
|
|
struct wl_listener output_power_manager_set_mode;
|
|
|
|
|
|
2021-10-17 16:54:35 -04:00
|
|
|
struct wlr_relative_pointer_manager_v1 *relative_pointer_manager;
|
|
|
|
|
struct wlr_pointer_constraints_v1 *constraints;
|
|
|
|
|
struct wl_listener new_constraint;
|
|
|
|
|
|
2020-09-04 20:25:20 +01:00
|
|
|
/* Set when in cycle (alt-tab) mode */
|
2022-04-26 22:06:22 +02:00
|
|
|
struct osd_state {
|
|
|
|
|
struct view *cycle_view;
|
2022-04-26 23:56:27 +02:00
|
|
|
bool preview_was_enabled;
|
2022-04-26 22:06:22 +02:00
|
|
|
struct wlr_scene_node *preview_node;
|
|
|
|
|
struct wlr_scene_node *preview_anchor;
|
2022-08-22 00:42:01 +02:00
|
|
|
struct multi_rect *preview_outline;
|
2022-04-26 22:06:22 +02:00
|
|
|
} osd_state;
|
2020-10-19 22:14:17 +01:00
|
|
|
|
2021-02-21 21:54:40 +00:00
|
|
|
struct theme *theme;
|
2022-02-12 19:43:32 +00:00
|
|
|
|
2022-02-19 02:05:38 +01:00
|
|
|
struct menu *menu_current;
|
2023-10-09 20:59:04 +01:00
|
|
|
struct wl_list menus;
|
2019-11-19 21:00:26 +00:00
|
|
|
};
|
|
|
|
|
|
2022-03-02 20:39:46 +00:00
|
|
|
#define LAB_NR_LAYERS (4)
|
2022-04-04 20:53:36 +01:00
|
|
|
|
2019-12-27 20:48:58 +00:00
|
|
|
struct output {
|
2023-10-02 19:47:59 +01:00
|
|
|
struct wl_list link; /* server.outputs */
|
2019-12-27 20:48:58 +00:00
|
|
|
struct server *server;
|
2019-11-19 21:00:26 +00:00
|
|
|
struct wlr_output *wlr_output;
|
2022-02-11 23:12:45 +00:00
|
|
|
struct wlr_scene_output *scene_output;
|
2022-03-02 20:39:46 +00:00
|
|
|
struct wlr_scene_tree *layer_tree[LAB_NR_LAYERS];
|
2022-03-03 17:56:38 +00:00
|
|
|
struct wlr_scene_tree *layer_popup_tree;
|
2022-04-20 17:45:10 +01:00
|
|
|
struct wlr_scene_tree *osd_tree;
|
2023-03-30 22:19:05 +01:00
|
|
|
struct wlr_scene_tree *session_lock_tree;
|
2022-06-15 01:07:45 +02:00
|
|
|
struct wlr_scene_buffer *workspace_osd;
|
2021-07-12 21:39:09 +01:00
|
|
|
struct wlr_box usable_area;
|
2022-02-11 23:12:45 +00:00
|
|
|
|
2022-07-06 16:57:25 +02:00
|
|
|
struct wl_list regions; /* struct region.link */
|
|
|
|
|
|
2022-02-11 23:12:45 +00:00
|
|
|
struct lab_data_buffer *osd_buffer;
|
2021-07-12 21:39:09 +01:00
|
|
|
|
2020-09-29 19:53:46 +01:00
|
|
|
struct wl_listener destroy;
|
2022-02-11 23:12:45 +00:00
|
|
|
struct wl_listener frame;
|
2022-06-16 05:56:38 +00:00
|
|
|
|
|
|
|
|
bool leased;
|
2019-11-19 21:00:26 +00:00
|
|
|
};
|
2022-04-04 20:53:36 +01:00
|
|
|
|
2022-03-02 20:39:46 +00:00
|
|
|
#undef LAB_NR_LAYERS
|
2019-11-19 21:00:26 +00:00
|
|
|
|
2021-10-17 16:54:35 -04:00
|
|
|
struct constraint {
|
|
|
|
|
struct seat *seat;
|
|
|
|
|
struct wlr_pointer_constraint_v1 *constraint;
|
|
|
|
|
struct wl_listener destroy;
|
|
|
|
|
};
|
|
|
|
|
|
2021-03-02 20:37:23 +00:00
|
|
|
void xdg_popup_create(struct view *view, struct wlr_xdg_popup *wlr_popup);
|
2023-10-20 22:04:08 +01:00
|
|
|
void xdg_shell_init(struct server *server);
|
2019-12-26 21:37:31 +00:00
|
|
|
|
2021-08-05 12:18:10 +01:00
|
|
|
void foreign_toplevel_handle_create(struct view *view);
|
2023-02-02 07:16:57 +01:00
|
|
|
void foreign_toplevel_update_outputs(struct view *view);
|
2020-09-11 20:48:28 +01:00
|
|
|
|
2021-10-16 19:44:54 +01:00
|
|
|
/*
|
|
|
|
|
* desktop.c routines deal with a collection of views
|
|
|
|
|
*
|
|
|
|
|
* Definition of a few keywords used in desktop.c
|
|
|
|
|
* raise - Bring view to front.
|
|
|
|
|
* focus - Give keyboard focus to view.
|
|
|
|
|
* activate - Set view surface as active so that client window decorations
|
|
|
|
|
* are painted to show that the window is active,typically by
|
|
|
|
|
* using a different color. Although xdg-shell protocol says you
|
|
|
|
|
* cannot assume this means that the window actually has keyboard
|
|
|
|
|
* or pointer focus, in this compositor are they called together.
|
|
|
|
|
*/
|
2023-10-02 22:37:12 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* desktop_focus_view() - do multiple things to make a view "active" and
|
|
|
|
|
* ready to use:
|
|
|
|
|
* - unminimize
|
|
|
|
|
* - switch to the workspace it's on
|
|
|
|
|
* - give input (keyboard) focus
|
|
|
|
|
* - optionally raise above other views
|
|
|
|
|
*
|
|
|
|
|
* It's okay to call this function even if the view isn't mapped or the
|
|
|
|
|
* session is locked/input is inhibited; it will simply do nothing.
|
|
|
|
|
*/
|
2023-09-27 18:37:28 -04:00
|
|
|
void desktop_focus_view(struct view *view, bool raise);
|
2022-06-30 20:02:24 +02:00
|
|
|
void desktop_arrange_all_views(struct server *server);
|
2023-03-05 17:16:23 +01:00
|
|
|
void desktop_focus_output(struct output *output);
|
2023-09-23 11:51:47 -04:00
|
|
|
struct view *desktop_topmost_focusable_view(struct server *server);
|
2020-09-11 20:48:28 +01:00
|
|
|
|
2021-11-26 19:27:50 +00:00
|
|
|
enum lab_cycle_dir {
|
2021-10-17 22:53:43 +00:00
|
|
|
LAB_CYCLE_DIR_NONE,
|
|
|
|
|
LAB_CYCLE_DIR_FORWARD,
|
|
|
|
|
LAB_CYCLE_DIR_BACKWARD,
|
|
|
|
|
};
|
|
|
|
|
|
2020-09-11 20:48:28 +01:00
|
|
|
/**
|
2020-10-31 14:46:33 +00:00
|
|
|
* desktop_cycle_view - return view to 'cycle' to
|
2022-06-15 01:22:44 +02:00
|
|
|
* @start_view: reference point for finding next view to cycle to
|
|
|
|
|
* Note: If !start_view, the second focusable view is returned
|
2020-09-11 20:48:28 +01:00
|
|
|
*/
|
2022-06-15 01:22:44 +02:00
|
|
|
struct view *desktop_cycle_view(struct server *server, struct view *start_view,
|
2021-12-26 23:29:01 +00:00
|
|
|
enum lab_cycle_dir dir);
|
2023-10-02 22:37:12 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* desktop_focus_topmost_view() - focus the topmost view on the current
|
|
|
|
|
* workspace, skipping views that claim not to want focus (those can
|
|
|
|
|
* still be focused by explicit request, e.g. by clicking in them).
|
|
|
|
|
*
|
|
|
|
|
* This function is typically called when the focused view is hidden
|
|
|
|
|
* (closes, is minimized, etc.) to focus the "next" view underneath.
|
|
|
|
|
*/
|
2023-09-23 11:51:47 -04:00
|
|
|
void desktop_focus_topmost_view(struct server *server);
|
2021-07-12 16:44:30 +01:00
|
|
|
|
2022-11-02 16:37:24 -04:00
|
|
|
void keyboard_cancel_keybind_repeat(struct keyboard *keyboard);
|
2022-09-26 07:17:19 +01:00
|
|
|
void keyboard_key_notify(struct wl_listener *listener, void *data);
|
|
|
|
|
void keyboard_modifiers_notify(struct wl_listener *listener, void *data);
|
2023-10-08 22:26:26 -04:00
|
|
|
void keyboard_set_numlock(struct wlr_keyboard *keyboard);
|
2020-10-02 21:19:56 +01:00
|
|
|
void keyboard_init(struct seat *seat);
|
2022-06-15 01:19:31 +02:00
|
|
|
bool keyboard_any_modifiers_pressed(struct wlr_keyboard *keyboard);
|
2021-12-31 23:30:25 +00:00
|
|
|
void keyboard_finish(struct seat *seat);
|
2020-10-06 21:31:01 +01:00
|
|
|
|
2021-12-31 23:50:31 +00:00
|
|
|
void touch_init(struct seat *seat);
|
|
|
|
|
void touch_finish(struct seat *seat);
|
|
|
|
|
|
2020-10-02 21:19:56 +01:00
|
|
|
void seat_init(struct server *server);
|
|
|
|
|
void seat_finish(struct server *server);
|
2021-10-10 12:03:18 -04:00
|
|
|
void seat_reconfigure(struct server *server);
|
2020-10-08 20:22:52 +01:00
|
|
|
void seat_focus_surface(struct seat *seat, struct wlr_surface *surface);
|
2023-10-15 02:59:58 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* seat_focus_lock_surface() - ONLY to be called from session-lock.c to
|
|
|
|
|
* focus lock screen surfaces. Use seat_focus_surface() otherwise.
|
|
|
|
|
*/
|
|
|
|
|
void seat_focus_lock_surface(struct seat *seat, struct wlr_surface *surface);
|
|
|
|
|
|
2020-10-31 15:09:13 +00:00
|
|
|
void seat_set_focus_layer(struct seat *seat, struct wlr_layer_surface_v1 *layer);
|
2022-09-13 10:55:59 -04:00
|
|
|
void seat_set_pressed(struct seat *seat, struct view *view,
|
2022-09-10 01:57:39 -04:00
|
|
|
struct wlr_scene_node *node, struct wlr_surface *surface,
|
2022-09-14 23:09:36 -04:00
|
|
|
struct wlr_surface *toplevel, uint32_t resize_edges);
|
2022-09-01 17:50:28 -04:00
|
|
|
void seat_reset_pressed(struct seat *seat);
|
2020-09-04 20:25:20 +01:00
|
|
|
|
2023-01-31 11:43:45 +01:00
|
|
|
void interactive_begin(struct view *view, enum input_mode mode, uint32_t edges);
|
2022-11-19 12:58:52 -05:00
|
|
|
void interactive_finish(struct view *view);
|
|
|
|
|
void interactive_cancel(struct view *view);
|
2020-05-29 21:27:34 +01:00
|
|
|
|
2020-10-02 21:19:56 +01:00
|
|
|
void output_init(struct server *server);
|
2021-02-27 23:15:02 -05:00
|
|
|
void output_manager_init(struct server *server);
|
2021-09-22 20:24:02 +01:00
|
|
|
struct output *output_from_wlr_output(struct server *server,
|
|
|
|
|
struct wlr_output *wlr_output);
|
2023-03-05 17:16:23 +01:00
|
|
|
struct output *output_from_name(struct server *server, const char *name);
|
2023-02-03 15:22:54 -05:00
|
|
|
struct output *output_nearest_to(struct server *server, int lx, int ly);
|
|
|
|
|
struct output *output_nearest_to_cursor(struct server *server);
|
2023-02-16 12:24:27 -05:00
|
|
|
bool output_is_usable(struct output *output);
|
2022-11-16 12:43:59 -05:00
|
|
|
void output_update_usable_area(struct output *output);
|
2023-01-06 19:54:51 +01:00
|
|
|
void output_update_all_usable_areas(struct server *server, bool layout_changed);
|
2021-07-21 22:04:54 +01:00
|
|
|
struct wlr_box output_usable_area_in_layout_coords(struct output *output);
|
2023-08-05 23:53:01 +02:00
|
|
|
struct wlr_box output_usable_area_scaled(struct output *output);
|
2022-03-06 04:46:11 +00:00
|
|
|
void handle_output_power_manager_set_mode(struct wl_listener *listener,
|
|
|
|
|
void *data);
|
2021-02-27 23:15:02 -05:00
|
|
|
|
2020-06-03 18:39:46 +01:00
|
|
|
void server_init(struct server *server);
|
|
|
|
|
void server_start(struct server *server);
|
|
|
|
|
void server_finish(struct server *server);
|
2019-12-26 21:37:31 +00:00
|
|
|
|
2022-04-26 23:56:27 +02:00
|
|
|
/* Updates onscreen display 'alt-tab' buffer */
|
2021-08-16 07:16:56 +01:00
|
|
|
void osd_update(struct server *server);
|
2022-04-26 23:56:27 +02:00
|
|
|
/* Closes the OSD */
|
|
|
|
|
void osd_finish(struct server *server);
|
|
|
|
|
/* Moves preview views back into their original stacking order and state */
|
|
|
|
|
void osd_preview_restore(struct server *server);
|
2022-08-22 02:54:40 +02:00
|
|
|
/* Notify OSD about a destroying view */
|
|
|
|
|
void osd_on_view_destroy(struct view *view);
|
2020-06-03 18:39:46 +01:00
|
|
|
|
2021-09-22 20:24:02 +01:00
|
|
|
/*
|
2021-08-25 19:59:49 +01:00
|
|
|
* wlroots "input inhibitor" extension (required for swaylock) blocks
|
2021-08-21 17:12:02 +01:00
|
|
|
* any client other than the requesting client from receiving events
|
|
|
|
|
*/
|
|
|
|
|
bool input_inhibit_blocks_surface(struct seat *seat,
|
2021-08-25 19:59:49 +01:00
|
|
|
struct wl_resource *resource);
|
2021-08-21 17:12:02 +01:00
|
|
|
|
2021-10-17 16:54:35 -04:00
|
|
|
void create_constraint(struct wl_listener *listener, void *data);
|
|
|
|
|
void constrain_cursor(struct server *server, struct wlr_pointer_constraint_v1
|
|
|
|
|
*constraint);
|
|
|
|
|
|
2023-05-13 16:10:33 +03:00
|
|
|
#endif /* LABWC_H */
|