diff options
Diffstat (limited to 'include/sway/input/seat.h')
-rw-r--r-- | include/sway/input/seat.h | 121 |
1 files changed, 86 insertions, 35 deletions
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h index 4118df66..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; | |||
15 | struct sway_seatop_impl { | 17 | struct 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_event_pointer_axis *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 | ||
53 | struct 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 | |||
66 | struct sway_drag { | 77 | struct 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, | |||
141 | void seat_configure_device(struct sway_seat *seat, | 160 | void seat_configure_device(struct sway_seat *seat, |
142 | struct sway_input_device *device); | 161 | struct sway_input_device *device); |
143 | 162 | ||
163 | void seat_configure_device_mapping(struct sway_seat *seat, | ||
164 | struct sway_input_device *input_device); | ||
165 | |||
144 | void seat_reset_device(struct sway_seat *seat, | 166 | void 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, | |||
171 | void seat_set_focus_layer(struct sway_seat *seat, | 193 | void seat_set_focus_layer(struct sway_seat *seat, |
172 | struct wlr_layer_surface_v1 *layer); | 194 | struct wlr_layer_surface_v1 *layer); |
173 | 195 | ||
174 | void seat_set_exclusive_client(struct sway_seat *seat, | 196 | void seat_unfocus_unless_client(struct sway_seat *seat, struct wl_client *client); |
175 | struct wl_client *client); | ||
176 | 197 | ||
177 | struct sway_node *seat_get_focus(struct sway_seat *seat); | 198 | struct sway_node *seat_get_focus(struct sway_seat *seat); |
178 | 199 | ||
@@ -231,7 +252,7 @@ void seat_idle_notify_activity(struct sway_seat *seat, | |||
231 | 252 | ||
232 | bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface); | 253 | bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface); |
233 | 254 | ||
234 | void drag_icon_update_position(struct sway_drag_icon *icon); | 255 | void drag_icons_update_position(struct sway_seat *seat); |
235 | 256 | ||
236 | enum wlr_edges find_resize_edge(struct sway_container *cont, | 257 | enum wlr_edges find_resize_edge(struct sway_container *cont, |
237 | struct wlr_surface *surface, struct sway_cursor *cursor); | 258 | struct wlr_surface *surface, struct sway_cursor *cursor); |
@@ -239,7 +260,13 @@ enum wlr_edges find_resize_edge(struct sway_container *cont, | |||
239 | void seatop_begin_default(struct sway_seat *seat); | 260 | void seatop_begin_default(struct sway_seat *seat); |
240 | 261 | ||
241 | void seatop_begin_down(struct sway_seat *seat, struct sway_container *con, | 262 | void seatop_begin_down(struct sway_seat *seat, struct sway_container *con, |
242 | uint32_t time_msec, int sx, int sy); | 263 | double sx, double sy); |
264 | |||
265 | void seatop_begin_down_on_surface(struct sway_seat *seat, | ||
266 | struct wlr_surface *surface, double sx, double sy); | ||
267 | |||
268 | void 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); | ||
243 | 270 | ||
244 | void seatop_begin_move_floating(struct sway_seat *seat, | 271 | void seatop_begin_move_floating(struct sway_seat *seat, |
245 | struct sway_container *con); | 272 | struct sway_container *con); |
@@ -260,18 +287,18 @@ struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat, | |||
260 | struct sway_workspace *workspace); | 287 | struct sway_workspace *workspace); |
261 | 288 | ||
262 | void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec, | 289 | void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec, |
263 | uint32_t button, enum wlr_button_state state); | 290 | uint32_t button, enum wl_pointer_button_state state); |
264 | 291 | ||
265 | void seat_consider_warp_to_focus(struct sway_seat *seat); | 292 | void seat_consider_warp_to_focus(struct sway_seat *seat); |
266 | 293 | ||
267 | void seatop_button(struct sway_seat *seat, uint32_t time_msec, | 294 | void seatop_button(struct sway_seat *seat, uint32_t time_msec, |
268 | struct wlr_input_device *device, uint32_t button, | 295 | struct wlr_input_device *device, uint32_t button, |
269 | enum wlr_button_state state); | 296 | enum wl_pointer_button_state state); |
270 | 297 | ||
271 | void seatop_pointer_motion(struct sway_seat *seat, uint32_t time_msec); | 298 | void seatop_pointer_motion(struct sway_seat *seat, uint32_t time_msec); |
272 | 299 | ||
273 | void seatop_pointer_axis(struct sway_seat *seat, | 300 | void seatop_pointer_axis(struct sway_seat *seat, |
274 | struct wlr_event_pointer_axis *event); | 301 | struct wlr_pointer_axis_event *event); |
275 | 302 | ||
276 | void seatop_tablet_tool_tip(struct sway_seat *seat, | 303 | void seatop_tablet_tool_tip(struct sway_seat *seat, |
277 | struct sway_tablet_tool *tool, uint32_t time_msec, | 304 | struct sway_tablet_tool *tool, uint32_t time_msec, |
@@ -280,6 +307,37 @@ void seatop_tablet_tool_tip(struct sway_seat *seat, | |||
280 | void seatop_tablet_tool_motion(struct sway_seat *seat, | 307 | void seatop_tablet_tool_motion(struct sway_seat *seat, |
281 | struct sway_tablet_tool *tool, uint32_t time_msec); | 308 | struct sway_tablet_tool *tool, uint32_t time_msec); |
282 | 309 | ||
310 | void seatop_hold_begin(struct sway_seat *seat, | ||
311 | struct wlr_pointer_hold_begin_event *event); | ||
312 | void seatop_hold_end(struct sway_seat *seat, | ||
313 | struct wlr_pointer_hold_end_event *event); | ||
314 | |||
315 | void seatop_pinch_begin(struct sway_seat *seat, | ||
316 | struct wlr_pointer_pinch_begin_event *event); | ||
317 | void seatop_pinch_update(struct sway_seat *seat, | ||
318 | struct wlr_pointer_pinch_update_event *event); | ||
319 | void seatop_pinch_end(struct sway_seat *seat, | ||
320 | struct wlr_pointer_pinch_end_event *event); | ||
321 | |||
322 | void seatop_swipe_begin(struct sway_seat *seat, | ||
323 | struct wlr_pointer_swipe_begin_event *event); | ||
324 | void seatop_swipe_update(struct sway_seat *seat, | ||
325 | struct wlr_pointer_swipe_update_event *event); | ||
326 | void seatop_swipe_end(struct sway_seat *seat, | ||
327 | struct wlr_pointer_swipe_end_event *event); | ||
328 | |||
329 | void seatop_touch_motion(struct sway_seat *seat, | ||
330 | struct wlr_touch_motion_event *event, double lx, double ly); | ||
331 | |||
332 | void seatop_touch_up(struct sway_seat *seat, | ||
333 | struct wlr_touch_up_event *event); | ||
334 | |||
335 | void seatop_touch_down(struct sway_seat *seat, | ||
336 | struct wlr_touch_down_event *event, double lx, double ly); | ||
337 | |||
338 | void seatop_touch_cancel(struct sway_seat *seat, | ||
339 | struct wlr_touch_cancel_event *event); | ||
340 | |||
283 | void seatop_rebase(struct sway_seat *seat, uint32_t time_msec); | 341 | void seatop_rebase(struct sway_seat *seat, uint32_t time_msec); |
284 | 342 | ||
285 | /** | 343 | /** |
@@ -294,13 +352,6 @@ void seatop_end(struct sway_seat *seat); | |||
294 | */ | 352 | */ |
295 | void seatop_unref(struct sway_seat *seat, struct sway_container *con); | 353 | void seatop_unref(struct sway_seat *seat, struct sway_container *con); |
296 | 354 | ||
297 | /** | ||
298 | * Instructs a seatop to render anything that it needs to render | ||
299 | * (eg. dropzone for move-tiling) | ||
300 | */ | ||
301 | void seatop_render(struct sway_seat *seat, struct sway_output *output, | ||
302 | pixman_region32_t *damage); | ||
303 | |||
304 | bool seatop_allows_set_cursor(struct sway_seat *seat); | 355 | bool seatop_allows_set_cursor(struct sway_seat *seat); |
305 | 356 | ||
306 | /** | 357 | /** |