aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seatop_default.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/input/seatop_default.c')
-rw-r--r--sway/input/seatop_default.c41
1 files changed, 33 insertions, 8 deletions
diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c
index b8265441..46595fdd 100644
--- a/sway/input/seatop_default.c
+++ b/sway/input/seatop_default.c
@@ -194,9 +194,9 @@ static void state_add_button(struct seatop_default_event *e, uint32_t button) {
194 e->pressed_button_count++; 194 e->pressed_button_count++;
195} 195}
196 196
197/*----------------------------------\ 197/*-------------------------------------------\
198 * Functions used by handle_button / 198 * Functions used by handle_tablet_tool_tip /
199 *--------------------------------*/ 199 *-----------------------------------------*/
200 200
201static void handle_tablet_tool_tip(struct sway_seat *seat, 201static void handle_tablet_tool_tip(struct sway_seat *seat,
202 struct sway_tablet_tool *tool, uint32_t time_msec, 202 struct sway_tablet_tool *tool, uint32_t time_msec,
@@ -204,23 +204,48 @@ static void handle_tablet_tool_tip(struct sway_seat *seat,
204 if (state == WLR_TABLET_TOOL_TIP_UP) { 204 if (state == WLR_TABLET_TOOL_TIP_UP) {
205 wlr_tablet_v2_tablet_tool_notify_up(tool->tablet_v2_tool); 205 wlr_tablet_v2_tablet_tool_notify_up(tool->tablet_v2_tool);
206 return; 206 return;
207 } else if (state == WLR_TABLET_TOOL_TIP_DOWN) {
208 wlr_tablet_v2_tablet_tool_notify_down(tool->tablet_v2_tool);
209 wlr_tablet_tool_v2_start_implicit_grab(tool->tablet_v2_tool);
210 } 207 }
211 208
212 struct sway_cursor *cursor = seat->cursor; 209 struct sway_cursor *cursor = seat->cursor;
213
214 struct wlr_surface *surface = NULL; 210 struct wlr_surface *surface = NULL;
215 double sx, sy; 211 double sx, sy;
216 struct sway_node *node = node_at_coords(seat, 212 struct sway_node *node = node_at_coords(seat,
217 cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); 213 cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy);
218 214
219 if (surface && node && node->type == N_CONTAINER) { 215 if (!sway_assert(surface,
216 "Expected null-surface tablet input to route through pointer emulation")) {
217 return;
218 }
219
220 struct sway_container *cont = node && node->type == N_CONTAINER ?
221 node->sway_container : NULL;
222
223 if (cont) {
224 bool is_floating_or_child = container_is_floating_or_child(cont);
225 bool is_fullscreen_or_child = container_is_fullscreen_or_child(cont);
226 struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat->wlr_seat);
227 bool mod_pressed = keyboard &&
228 (wlr_keyboard_get_modifiers(keyboard) & config->floating_mod);
229
230 // Handle beginning floating move
231 if (is_floating_or_child && !is_fullscreen_or_child && mod_pressed) {
232 seat_set_focus_container(seat,
233 seat_get_focus_inactive_view(seat, &cont->node));
234 seatop_begin_move_floating(seat, container_toplevel_ancestor(cont));
235 return;
236 }
237
220 seatop_begin_down(seat, node->sway_container, time_msec, sx, sy); 238 seatop_begin_down(seat, node->sway_container, time_msec, sx, sy);
221 } 239 }
240
241 wlr_tablet_v2_tablet_tool_notify_down(tool->tablet_v2_tool);
242 wlr_tablet_tool_v2_start_implicit_grab(tool->tablet_v2_tool);
222} 243}
223 244
245/*----------------------------------\
246 * Functions used by handle_button /
247 *--------------------------------*/
248
224static void handle_button(struct sway_seat *seat, uint32_t time_msec, 249static void handle_button(struct sway_seat *seat, uint32_t time_msec,
225 struct wlr_input_device *device, uint32_t button, 250 struct wlr_input_device *device, uint32_t button,
226 enum wlr_button_state state) { 251 enum wlr_button_state state) {