aboutsummaryrefslogtreecommitdiffstats
path: root/include/sway/input/seat.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/sway/input/seat.h')
-rw-r--r--include/sway/input/seat.h120
1 files changed, 82 insertions, 38 deletions
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h
index 47726159..428f9679 100644
--- a/include/sway/input/seat.h
+++ b/include/sway/input/seat.h
@@ -3,7 +3,9 @@
3 3
4#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h> 4#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h>
5#include <wlr/types/wlr_layer_shell_v1.h> 5#include <wlr/types/wlr_layer_shell_v1.h>
6#include <wlr/types/wlr_scene.h>
6#include <wlr/types/wlr_seat.h> 7#include <wlr/types/wlr_seat.h>
8#include <wlr/types/wlr_touch.h>
7#include <wlr/util/edges.h> 9#include <wlr/util/edges.h>
8#include "sway/config.h" 10#include "sway/config.h"
9#include "sway/input/input-manager.h" 11#include "sway/input/input-manager.h"
@@ -15,19 +17,41 @@ struct sway_seat;
15struct sway_seatop_impl { 17struct sway_seatop_impl {
16 void (*button)(struct sway_seat *seat, uint32_t time_msec, 18 void (*button)(struct sway_seat *seat, uint32_t time_msec,
17 struct wlr_input_device *device, uint32_t button, 19 struct wlr_input_device *device, uint32_t button,
18 enum wlr_button_state state); 20 enum wl_pointer_button_state state);
19 void (*pointer_motion)(struct sway_seat *seat, uint32_t time_msec); 21 void (*pointer_motion)(struct sway_seat *seat, uint32_t time_msec);
20 void (*pointer_axis)(struct sway_seat *seat, 22 void (*pointer_axis)(struct sway_seat *seat,
21 struct wlr_pointer_axis_event *event); 23 struct wlr_pointer_axis_event *event);
24 void (*hold_begin)(struct sway_seat *seat,
25 struct wlr_pointer_hold_begin_event *event);
26 void (*hold_end)(struct sway_seat *seat,
27 struct wlr_pointer_hold_end_event *event);
28 void (*pinch_begin)(struct sway_seat *seat,
29 struct wlr_pointer_pinch_begin_event *event);
30 void (*pinch_update)(struct sway_seat *seat,
31 struct wlr_pointer_pinch_update_event *event);
32 void (*pinch_end)(struct sway_seat *seat,
33 struct wlr_pointer_pinch_end_event *event);
34 void (*swipe_begin)(struct sway_seat *seat,
35 struct wlr_pointer_swipe_begin_event *event);
36 void (*swipe_update)(struct sway_seat *seat,
37 struct wlr_pointer_swipe_update_event *event);
38 void (*swipe_end)(struct sway_seat *seat,
39 struct wlr_pointer_swipe_end_event *event);
22 void (*rebase)(struct sway_seat *seat, uint32_t time_msec); 40 void (*rebase)(struct sway_seat *seat, uint32_t time_msec);
41 void (*touch_motion)(struct sway_seat *seat,
42 struct wlr_touch_motion_event *event, double lx, double ly);
43 void (*touch_up)(struct sway_seat *seat,
44 struct wlr_touch_up_event *event);
45 void (*touch_down)(struct sway_seat *seat,
46 struct wlr_touch_down_event *event, double lx, double ly);
47 void (*touch_cancel)(struct sway_seat *seat,
48 struct wlr_touch_cancel_event *event);
23 void (*tablet_tool_motion)(struct sway_seat *seat, 49 void (*tablet_tool_motion)(struct sway_seat *seat,
24 struct sway_tablet_tool *tool, uint32_t time_msec); 50 struct sway_tablet_tool *tool, uint32_t time_msec);
25 void (*tablet_tool_tip)(struct sway_seat *seat, struct sway_tablet_tool *tool, 51 void (*tablet_tool_tip)(struct sway_seat *seat, struct sway_tablet_tool *tool,
26 uint32_t time_msec, enum wlr_tablet_tool_tip_state state); 52 uint32_t time_msec, enum wlr_tablet_tool_tip_state state);
27 void (*end)(struct sway_seat *seat); 53 void (*end)(struct sway_seat *seat);
28 void (*unref)(struct sway_seat *seat, struct sway_container *con); 54 void (*unref)(struct sway_seat *seat, struct sway_container *con);
29 void (*render)(struct sway_seat *seat, struct sway_output *output,
30 pixman_region32_t *damage);
31 bool allow_set_cursor; 55 bool allow_set_cursor;
32}; 56};
33 57
@@ -50,19 +74,6 @@ struct sway_seat_node {
50 struct wl_listener destroy; 74 struct wl_listener destroy;
51}; 75};
52 76
53struct sway_drag_icon {
54 struct sway_seat *seat;
55 struct wlr_drag_icon *wlr_drag_icon;
56 struct wl_list link; // sway_root::drag_icons
57
58 double x, y; // in layout-local coordinates
59
60 struct wl_listener surface_commit;
61 struct wl_listener map;
62 struct wl_listener unmap;
63 struct wl_listener destroy;
64};
65
66struct sway_drag { 77struct sway_drag {
67 struct sway_seat *seat; 78 struct sway_seat *seat;
68 struct wlr_drag *wlr_drag; 79 struct wlr_drag *wlr_drag;
@@ -73,16 +84,23 @@ struct sway_seat {
73 struct wlr_seat *wlr_seat; 84 struct wlr_seat *wlr_seat;
74 struct sway_cursor *cursor; 85 struct sway_cursor *cursor;
75 86
87 // Seat scene tree structure
88 // - scene_tree
89 // - drag icons
90 // - drag icon 1
91 // - drag icon 2
92 // - seatop specific stuff
93 struct wlr_scene_tree *scene_tree;
94 struct wlr_scene_tree *drag_icons;
95
76 bool has_focus; 96 bool has_focus;
77 struct wl_list focus_stack; // list of containers in focus order 97 struct wl_list focus_stack; // list of containers in focus order
78 struct sway_workspace *workspace; 98 struct sway_workspace *workspace;
79 char *prev_workspace_name; // for workspace back_and_forth 99 char *prev_workspace_name; // for workspace back_and_forth
80 100
81 // If the focused layer is set, views cannot receive keyboard focus
82 struct wlr_layer_surface_v1 *focused_layer; 101 struct wlr_layer_surface_v1 *focused_layer;
83 102 // If the exclusive layer is set, views cannot receive keyboard focus
84 // If exclusive_client is set, no other clients will receive input events 103 bool has_exclusive_layer;
85 struct wl_client *exclusive_client;
86 104
87 // Last touch point 105 // Last touch point
88 int32_t touch_id; 106 int32_t touch_id;
@@ -106,6 +124,7 @@ struct sway_seat {
106 struct wl_listener start_drag; 124 struct wl_listener start_drag;
107 struct wl_listener request_set_selection; 125 struct wl_listener request_set_selection;
108 struct wl_listener request_set_primary_selection; 126 struct wl_listener request_set_primary_selection;
127 struct wl_listener destroy;
109 128
110 struct wl_list devices; // sway_seat_device::link 129 struct wl_list devices; // sway_seat_device::link
111 struct wl_list keyboard_groups; // sway_keyboard_group::link 130 struct wl_list keyboard_groups; // sway_keyboard_group::link
@@ -141,6 +160,9 @@ void seat_add_device(struct sway_seat *seat,
141void seat_configure_device(struct sway_seat *seat, 160void seat_configure_device(struct sway_seat *seat,
142 struct sway_input_device *device); 161 struct sway_input_device *device);
143 162
163void seat_configure_device_mapping(struct sway_seat *seat,
164 struct sway_input_device *input_device);
165
144void seat_reset_device(struct sway_seat *seat, 166void seat_reset_device(struct sway_seat *seat,
145 struct sway_input_device *input_device); 167 struct sway_input_device *input_device);
146 168
@@ -171,8 +193,7 @@ void seat_set_focus_surface(struct sway_seat *seat,
171void seat_set_focus_layer(struct sway_seat *seat, 193void seat_set_focus_layer(struct sway_seat *seat,
172 struct wlr_layer_surface_v1 *layer); 194 struct wlr_layer_surface_v1 *layer);
173 195
174void seat_set_exclusive_client(struct sway_seat *seat, 196void seat_unfocus_unless_client(struct sway_seat *seat, struct wl_client *client);
175 struct wl_client *client);
176 197
177struct sway_node *seat_get_focus(struct sway_seat *seat); 198struct sway_node *seat_get_focus(struct sway_seat *seat);
178 199
@@ -185,10 +206,6 @@ struct sway_workspace *seat_get_last_known_workspace(struct sway_seat *seat);
185 206
186struct sway_container *seat_get_focused_container(struct sway_seat *seat); 207struct sway_container *seat_get_focused_container(struct sway_seat *seat);
187 208
188// Force focus to a particular surface that is not part of the workspace
189// hierarchy (used for lockscreen)
190void sway_force_focus(struct wlr_surface *surface);
191
192/** 209/**
193 * Return the last container to be focused for the seat (or the most recently 210 * Return the last container to be focused for the seat (or the most recently
194 * opened if no container has received focused) that is a child of the given 211 * opened if no container has received focused) that is a child of the given
@@ -235,7 +252,7 @@ void seat_idle_notify_activity(struct sway_seat *seat,
235 252
236bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface); 253bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface);
237 254
238void drag_icon_update_position(struct sway_drag_icon *icon); 255void drag_icons_update_position(struct sway_seat *seat);
239 256
240enum wlr_edges find_resize_edge(struct sway_container *cont, 257enum wlr_edges find_resize_edge(struct sway_container *cont,
241 struct wlr_surface *surface, struct sway_cursor *cursor); 258 struct wlr_surface *surface, struct sway_cursor *cursor);
@@ -243,10 +260,13 @@ enum wlr_edges find_resize_edge(struct sway_container *cont,
243void seatop_begin_default(struct sway_seat *seat); 260void seatop_begin_default(struct sway_seat *seat);
244 261
245void seatop_begin_down(struct sway_seat *seat, struct sway_container *con, 262void seatop_begin_down(struct sway_seat *seat, struct sway_container *con,
246 uint32_t time_msec, double sx, double sy); 263 double sx, double sy);
247 264
248void seatop_begin_down_on_surface(struct sway_seat *seat, 265void seatop_begin_down_on_surface(struct sway_seat *seat,
249 struct wlr_surface *surface, uint32_t time_msec, double sx, double sy); 266 struct wlr_surface *surface, double sx, double sy);
267
268void seatop_begin_touch_down(struct sway_seat *seat, struct wlr_surface *surface,
269 struct wlr_touch_down_event *event, double sx, double sy, double lx, double ly);
250 270
251void seatop_begin_move_floating(struct sway_seat *seat, 271void seatop_begin_move_floating(struct sway_seat *seat,
252 struct sway_container *con); 272 struct sway_container *con);
@@ -267,13 +287,13 @@ struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat,
267 struct sway_workspace *workspace); 287 struct sway_workspace *workspace);
268 288
269void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec, 289void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec,
270 uint32_t button, enum wlr_button_state state); 290 uint32_t button, enum wl_pointer_button_state state);
271 291
272void seat_consider_warp_to_focus(struct sway_seat *seat); 292void seat_consider_warp_to_focus(struct sway_seat *seat);
273 293
274void seatop_button(struct sway_seat *seat, uint32_t time_msec, 294void seatop_button(struct sway_seat *seat, uint32_t time_msec,
275 struct wlr_input_device *device, uint32_t button, 295 struct wlr_input_device *device, uint32_t button,
276 enum wlr_button_state state); 296 enum wl_pointer_button_state state);
277 297
278void seatop_pointer_motion(struct sway_seat *seat, uint32_t time_msec); 298void seatop_pointer_motion(struct sway_seat *seat, uint32_t time_msec);
279 299
@@ -287,6 +307,37 @@ void seatop_tablet_tool_tip(struct sway_seat *seat,
287void seatop_tablet_tool_motion(struct sway_seat *seat, 307void seatop_tablet_tool_motion(struct sway_seat *seat,
288 struct sway_tablet_tool *tool, uint32_t time_msec); 308 struct sway_tablet_tool *tool, uint32_t time_msec);
289 309
310void seatop_hold_begin(struct sway_seat *seat,
311 struct wlr_pointer_hold_begin_event *event);
312void seatop_hold_end(struct sway_seat *seat,
313 struct wlr_pointer_hold_end_event *event);
314
315void seatop_pinch_begin(struct sway_seat *seat,
316 struct wlr_pointer_pinch_begin_event *event);
317void seatop_pinch_update(struct sway_seat *seat,
318 struct wlr_pointer_pinch_update_event *event);
319void seatop_pinch_end(struct sway_seat *seat,
320 struct wlr_pointer_pinch_end_event *event);
321
322void seatop_swipe_begin(struct sway_seat *seat,
323 struct wlr_pointer_swipe_begin_event *event);
324void seatop_swipe_update(struct sway_seat *seat,
325 struct wlr_pointer_swipe_update_event *event);
326void seatop_swipe_end(struct sway_seat *seat,
327 struct wlr_pointer_swipe_end_event *event);
328
329void seatop_touch_motion(struct sway_seat *seat,
330 struct wlr_touch_motion_event *event, double lx, double ly);
331
332void seatop_touch_up(struct sway_seat *seat,
333 struct wlr_touch_up_event *event);
334
335void seatop_touch_down(struct sway_seat *seat,
336 struct wlr_touch_down_event *event, double lx, double ly);
337
338void seatop_touch_cancel(struct sway_seat *seat,
339 struct wlr_touch_cancel_event *event);
340
290void seatop_rebase(struct sway_seat *seat, uint32_t time_msec); 341void seatop_rebase(struct sway_seat *seat, uint32_t time_msec);
291 342
292/** 343/**
@@ -301,13 +352,6 @@ void seatop_end(struct sway_seat *seat);
301 */ 352 */
302void seatop_unref(struct sway_seat *seat, struct sway_container *con); 353void seatop_unref(struct sway_seat *seat, struct sway_container *con);
303 354
304/**
305 * Instructs a seatop to render anything that it needs to render
306 * (eg. dropzone for move-tiling)
307 */
308void seatop_render(struct sway_seat *seat, struct sway_output *output,
309 pixman_region32_t *damage);
310
311bool seatop_allows_set_cursor(struct sway_seat *seat); 355bool seatop_allows_set_cursor(struct sway_seat *seat);
312 356
313/** 357/**