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.h85
1 files changed, 47 insertions, 38 deletions
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h
index c2041742..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,7 +17,7 @@ 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);
@@ -36,14 +38,20 @@ struct sway_seatop_impl {
36 void (*swipe_end)(struct sway_seat *seat, 38 void (*swipe_end)(struct sway_seat *seat,
37 struct wlr_pointer_swipe_end_event *event); 39 struct wlr_pointer_swipe_end_event *event);
38 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);
39 void (*tablet_tool_motion)(struct sway_seat *seat, 49 void (*tablet_tool_motion)(struct sway_seat *seat,
40 struct sway_tablet_tool *tool, uint32_t time_msec); 50 struct sway_tablet_tool *tool, uint32_t time_msec);
41 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,
42 uint32_t time_msec, enum wlr_tablet_tool_tip_state state); 52 uint32_t time_msec, enum wlr_tablet_tool_tip_state state);
43 void (*end)(struct sway_seat *seat); 53 void (*end)(struct sway_seat *seat);
44 void (*unref)(struct sway_seat *seat, struct sway_container *con); 54 void (*unref)(struct sway_seat *seat, struct sway_container *con);
45 void (*render)(struct sway_seat *seat, struct sway_output *output,
46 pixman_region32_t *damage);
47 bool allow_set_cursor; 55 bool allow_set_cursor;
48}; 56};
49 57
@@ -66,19 +74,6 @@ struct sway_seat_node {
66 struct wl_listener destroy; 74 struct wl_listener destroy;
67}; 75};
68 76
69struct sway_drag_icon {
70 struct sway_seat *seat;
71 struct wlr_drag_icon *wlr_drag_icon;
72 struct wl_list link; // sway_root::drag_icons
73
74 double x, y; // in layout-local coordinates
75
76 struct wl_listener surface_commit;
77 struct wl_listener map;
78 struct wl_listener unmap;
79 struct wl_listener destroy;
80};
81
82struct sway_drag { 77struct sway_drag {
83 struct sway_seat *seat; 78 struct sway_seat *seat;
84 struct wlr_drag *wlr_drag; 79 struct wlr_drag *wlr_drag;
@@ -89,16 +84,23 @@ struct sway_seat {
89 struct wlr_seat *wlr_seat; 84 struct wlr_seat *wlr_seat;
90 struct sway_cursor *cursor; 85 struct sway_cursor *cursor;
91 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
92 bool has_focus; 96 bool has_focus;
93 struct wl_list focus_stack; // list of containers in focus order 97 struct wl_list focus_stack; // list of containers in focus order
94 struct sway_workspace *workspace; 98 struct sway_workspace *workspace;
95 char *prev_workspace_name; // for workspace back_and_forth 99 char *prev_workspace_name; // for workspace back_and_forth
96 100
97 // If the focused layer is set, views cannot receive keyboard focus
98 struct wlr_layer_surface_v1 *focused_layer; 101 struct wlr_layer_surface_v1 *focused_layer;
99 102 // If the exclusive layer is set, views cannot receive keyboard focus
100 // If exclusive_client is set, no other clients will receive input events 103 bool has_exclusive_layer;
101 struct wl_client *exclusive_client;
102 104
103 // Last touch point 105 // Last touch point
104 int32_t touch_id; 106 int32_t touch_id;
@@ -122,6 +124,7 @@ struct sway_seat {
122 struct wl_listener start_drag; 124 struct wl_listener start_drag;
123 struct wl_listener request_set_selection; 125 struct wl_listener request_set_selection;
124 struct wl_listener request_set_primary_selection; 126 struct wl_listener request_set_primary_selection;
127 struct wl_listener destroy;
125 128
126 struct wl_list devices; // sway_seat_device::link 129 struct wl_list devices; // sway_seat_device::link
127 struct wl_list keyboard_groups; // sway_keyboard_group::link 130 struct wl_list keyboard_groups; // sway_keyboard_group::link
@@ -157,6 +160,9 @@ void seat_add_device(struct sway_seat *seat,
157void seat_configure_device(struct sway_seat *seat, 160void seat_configure_device(struct sway_seat *seat,
158 struct sway_input_device *device); 161 struct sway_input_device *device);
159 162
163void seat_configure_device_mapping(struct sway_seat *seat,
164 struct sway_input_device *input_device);
165
160void seat_reset_device(struct sway_seat *seat, 166void seat_reset_device(struct sway_seat *seat,
161 struct sway_input_device *input_device); 167 struct sway_input_device *input_device);
162 168
@@ -187,8 +193,7 @@ void seat_set_focus_surface(struct sway_seat *seat,
187void seat_set_focus_layer(struct sway_seat *seat, 193void seat_set_focus_layer(struct sway_seat *seat,
188 struct wlr_layer_surface_v1 *layer); 194 struct wlr_layer_surface_v1 *layer);
189 195
190void seat_set_exclusive_client(struct sway_seat *seat, 196void seat_unfocus_unless_client(struct sway_seat *seat, struct wl_client *client);
191 struct wl_client *client);
192 197
193struct sway_node *seat_get_focus(struct sway_seat *seat); 198struct sway_node *seat_get_focus(struct sway_seat *seat);
194 199
@@ -201,10 +206,6 @@ struct sway_workspace *seat_get_last_known_workspace(struct sway_seat *seat);
201 206
202struct sway_container *seat_get_focused_container(struct sway_seat *seat); 207struct sway_container *seat_get_focused_container(struct sway_seat *seat);
203 208
204// Force focus to a particular surface that is not part of the workspace
205// hierarchy (used for lockscreen)
206void sway_force_focus(struct wlr_surface *surface);
207
208/** 209/**
209 * 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
210 * 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
@@ -251,7 +252,7 @@ void seat_idle_notify_activity(struct sway_seat *seat,
251 252
252bool 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);
253 254
254void drag_icon_update_position(struct sway_drag_icon *icon); 255void drag_icons_update_position(struct sway_seat *seat);
255 256
256enum wlr_edges find_resize_edge(struct sway_container *cont, 257enum wlr_edges find_resize_edge(struct sway_container *cont,
257 struct wlr_surface *surface, struct sway_cursor *cursor); 258 struct wlr_surface *surface, struct sway_cursor *cursor);
@@ -259,10 +260,13 @@ enum wlr_edges find_resize_edge(struct sway_container *cont,
259void seatop_begin_default(struct sway_seat *seat); 260void seatop_begin_default(struct sway_seat *seat);
260 261
261void seatop_begin_down(struct sway_seat *seat, struct sway_container *con, 262void seatop_begin_down(struct sway_seat *seat, struct sway_container *con,
262 uint32_t time_msec, double sx, double sy); 263 double sx, double sy);
263 264
264void seatop_begin_down_on_surface(struct sway_seat *seat, 265void seatop_begin_down_on_surface(struct sway_seat *seat,
265 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);
266 270
267void seatop_begin_move_floating(struct sway_seat *seat, 271void seatop_begin_move_floating(struct sway_seat *seat,
268 struct sway_container *con); 272 struct sway_container *con);
@@ -283,13 +287,13 @@ struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat,
283 struct sway_workspace *workspace); 287 struct sway_workspace *workspace);
284 288
285void 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,
286 uint32_t button, enum wlr_button_state state); 290 uint32_t button, enum wl_pointer_button_state state);
287 291
288void seat_consider_warp_to_focus(struct sway_seat *seat); 292void seat_consider_warp_to_focus(struct sway_seat *seat);
289 293
290void seatop_button(struct sway_seat *seat, uint32_t time_msec, 294void seatop_button(struct sway_seat *seat, uint32_t time_msec,
291 struct wlr_input_device *device, uint32_t button, 295 struct wlr_input_device *device, uint32_t button,
292 enum wlr_button_state state); 296 enum wl_pointer_button_state state);
293 297
294void seatop_pointer_motion(struct sway_seat *seat, uint32_t time_msec); 298void seatop_pointer_motion(struct sway_seat *seat, uint32_t time_msec);
295 299
@@ -322,6 +326,18 @@ void seatop_swipe_update(struct sway_seat *seat,
322void seatop_swipe_end(struct sway_seat *seat, 326void seatop_swipe_end(struct sway_seat *seat,
323 struct wlr_pointer_swipe_end_event *event); 327 struct wlr_pointer_swipe_end_event *event);
324 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
325void seatop_rebase(struct sway_seat *seat, uint32_t time_msec); 341void seatop_rebase(struct sway_seat *seat, uint32_t time_msec);
326 342
327/** 343/**
@@ -336,13 +352,6 @@ void seatop_end(struct sway_seat *seat);
336 */ 352 */
337void seatop_unref(struct sway_seat *seat, struct sway_container *con); 353void seatop_unref(struct sway_seat *seat, struct sway_container *con);
338 354
339/**
340 * Instructs a seatop to render anything that it needs to render
341 * (eg. dropzone for move-tiling)
342 */
343void seatop_render(struct sway_seat *seat, struct sway_output *output,
344 pixman_region32_t *damage);
345
346bool seatop_allows_set_cursor(struct sway_seat *seat); 355bool seatop_allows_set_cursor(struct sway_seat *seat);
347 356
348/** 357/**