diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2019-01-10 22:04:42 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2019-01-10 22:04:42 +1000 |
commit | ed5aafd90bd850ad27dcb36ac4438ed926480394 (patch) | |
tree | 46d0b5fe8488e5d9415cbc9a732e86c1e7100ffe /sway/input/cursor.c | |
parent | Merge pull request #3341 from RedSoxFan/mouse-bindings-improved (diff) | |
download | sway-ed5aafd90bd850ad27dcb36ac4438ed926480394.tar.gz sway-ed5aafd90bd850ad27dcb36ac4438ed926480394.tar.zst sway-ed5aafd90bd850ad27dcb36ac4438ed926480394.zip |
Refactor seat operations to use an interface
This splits each seat operation (drag/move tiling/floating etc) into a
separate file and introduces a struct sway_seatop_impl to abstract the
operation.
The move_tiling_threshold operation has been merged into move_tiling.
The main logic for each operation is untouched aside from variable
renames.
The following previously-static functions have been made public:
* node_at_coords
* container_raise_floating
* render_rect
* premultiply_alpha
* scale_box
Diffstat (limited to 'sway/input/cursor.c')
-rw-r--r-- | sway/input/cursor.c | 396 |
1 files changed, 15 insertions, 381 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 9af7ef57..06294b8b 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -27,10 +27,6 @@ | |||
27 | #include "sway/tree/workspace.h" | 27 | #include "sway/tree/workspace.h" |
28 | #include "wlr-layer-shell-unstable-v1-protocol.h" | 28 | #include "wlr-layer-shell-unstable-v1-protocol.h" |
29 | 29 | ||
30 | // When doing a tiling drag, this is the thickness of the dropzone | ||
31 | // when dragging to the edge of a layout container. | ||
32 | #define DROP_LAYOUT_BORDER 30 | ||
33 | |||
34 | static uint32_t get_current_time_msec(void) { | 30 | static uint32_t get_current_time_msec(void) { |
35 | struct timespec now; | 31 | struct timespec now; |
36 | clock_gettime(CLOCK_MONOTONIC, &now); | 32 | clock_gettime(CLOCK_MONOTONIC, &now); |
@@ -59,7 +55,7 @@ static struct wlr_surface *layer_surface_at(struct sway_output *output, | |||
59 | * Returns the node at the cursor's position. If there is a surface at that | 55 | * Returns the node at the cursor's position. If there is a surface at that |
60 | * location, it is stored in **surface (it may not be a view). | 56 | * location, it is stored in **surface (it may not be a view). |
61 | */ | 57 | */ |
62 | static struct sway_node *node_at_coords( | 58 | struct sway_node *node_at_coords( |
63 | struct sway_seat *seat, double lx, double ly, | 59 | struct sway_seat *seat, double lx, double ly, |
64 | struct wlr_surface **surface, double *sx, double *sy) { | 60 | struct wlr_surface **surface, double *sx, double *sy) { |
65 | // check for unmanaged views first | 61 | // check for unmanaged views first |
@@ -226,347 +222,6 @@ static enum wlr_edges find_resize_edge(struct sway_container *cont, | |||
226 | return edge; | 222 | return edge; |
227 | } | 223 | } |
228 | 224 | ||
229 | static void handle_down_motion(struct sway_seat *seat, | ||
230 | struct sway_cursor *cursor, uint32_t time_msec) { | ||
231 | struct sway_container *con = seat->op_container; | ||
232 | if (seat_is_input_allowed(seat, con->view->surface)) { | ||
233 | double moved_x = cursor->cursor->x - seat->op_ref_lx; | ||
234 | double moved_y = cursor->cursor->y - seat->op_ref_ly; | ||
235 | double sx = seat->op_ref_con_lx + moved_x; | ||
236 | double sy = seat->op_ref_con_ly + moved_y; | ||
237 | wlr_seat_pointer_notify_motion(seat->wlr_seat, time_msec, sx, sy); | ||
238 | } | ||
239 | seat->op_moved = true; | ||
240 | } | ||
241 | |||
242 | static void handle_move_floating_motion(struct sway_seat *seat, | ||
243 | struct sway_cursor *cursor) { | ||
244 | struct sway_container *con = seat->op_container; | ||
245 | desktop_damage_whole_container(con); | ||
246 | container_floating_translate(con, | ||
247 | cursor->cursor->x - cursor->previous.x, | ||
248 | cursor->cursor->y - cursor->previous.y); | ||
249 | desktop_damage_whole_container(con); | ||
250 | } | ||
251 | |||
252 | static void resize_box(struct wlr_box *box, enum wlr_edges edge, | ||
253 | int thickness) { | ||
254 | switch (edge) { | ||
255 | case WLR_EDGE_TOP: | ||
256 | box->height = thickness; | ||
257 | break; | ||
258 | case WLR_EDGE_LEFT: | ||
259 | box->width = thickness; | ||
260 | break; | ||
261 | case WLR_EDGE_RIGHT: | ||
262 | box->x = box->x + box->width - thickness; | ||
263 | box->width = thickness; | ||
264 | break; | ||
265 | case WLR_EDGE_BOTTOM: | ||
266 | box->y = box->y + box->height - thickness; | ||
267 | box->height = thickness; | ||
268 | break; | ||
269 | case WLR_EDGE_NONE: | ||
270 | box->x += thickness; | ||
271 | box->y += thickness; | ||
272 | box->width -= thickness * 2; | ||
273 | box->height -= thickness * 2; | ||
274 | break; | ||
275 | } | ||
276 | } | ||
277 | |||
278 | static void handle_move_tiling_motion(struct sway_seat *seat, | ||
279 | struct sway_cursor *cursor) { | ||
280 | struct wlr_surface *surface = NULL; | ||
281 | double sx, sy; | ||
282 | struct sway_node *node = node_at_coords(seat, | ||
283 | cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); | ||
284 | // Damage the old location | ||
285 | desktop_damage_box(&seat->op_drop_box); | ||
286 | |||
287 | if (!node) { | ||
288 | // Eg. hovered over a layer surface such as swaybar | ||
289 | seat->op_target_node = NULL; | ||
290 | seat->op_target_edge = WLR_EDGE_NONE; | ||
291 | return; | ||
292 | } | ||
293 | |||
294 | if (node->type == N_WORKSPACE) { | ||
295 | // Emtpy workspace | ||
296 | seat->op_target_node = node; | ||
297 | seat->op_target_edge = WLR_EDGE_NONE; | ||
298 | workspace_get_box(node->sway_workspace, &seat->op_drop_box); | ||
299 | desktop_damage_box(&seat->op_drop_box); | ||
300 | return; | ||
301 | } | ||
302 | |||
303 | // Deny moving within own workspace if this is the only child | ||
304 | struct sway_container *con = node->sway_container; | ||
305 | if (workspace_num_tiling_views(seat->op_container->workspace) == 1 && | ||
306 | con->workspace == seat->op_container->workspace) { | ||
307 | seat->op_target_node = NULL; | ||
308 | seat->op_target_edge = WLR_EDGE_NONE; | ||
309 | return; | ||
310 | } | ||
311 | |||
312 | // Traverse the ancestors, trying to find a layout container perpendicular | ||
313 | // to the edge. Eg. close to the top or bottom of a horiz layout. | ||
314 | while (con) { | ||
315 | enum wlr_edges edge = WLR_EDGE_NONE; | ||
316 | enum sway_container_layout layout = container_parent_layout(con); | ||
317 | struct wlr_box parent; | ||
318 | con->parent ? container_get_box(con->parent, &parent) : | ||
319 | workspace_get_box(con->workspace, &parent); | ||
320 | if (layout == L_HORIZ || layout == L_TABBED) { | ||
321 | if (cursor->cursor->y < parent.y + DROP_LAYOUT_BORDER) { | ||
322 | edge = WLR_EDGE_TOP; | ||
323 | } else if (cursor->cursor->y > parent.y + parent.height | ||
324 | - DROP_LAYOUT_BORDER) { | ||
325 | edge = WLR_EDGE_BOTTOM; | ||
326 | } | ||
327 | } else if (layout == L_VERT || layout == L_STACKED) { | ||
328 | if (cursor->cursor->x < parent.x + DROP_LAYOUT_BORDER) { | ||
329 | edge = WLR_EDGE_LEFT; | ||
330 | } else if (cursor->cursor->x > parent.x + parent.width | ||
331 | - DROP_LAYOUT_BORDER) { | ||
332 | edge = WLR_EDGE_RIGHT; | ||
333 | } | ||
334 | } | ||
335 | if (edge) { | ||
336 | seat->op_target_node = node_get_parent(&con->node); | ||
337 | seat->op_target_edge = edge; | ||
338 | node_get_box(seat->op_target_node, &seat->op_drop_box); | ||
339 | resize_box(&seat->op_drop_box, edge, DROP_LAYOUT_BORDER); | ||
340 | desktop_damage_box(&seat->op_drop_box); | ||
341 | return; | ||
342 | } | ||
343 | con = con->parent; | ||
344 | } | ||
345 | |||
346 | // Use the hovered view - but we must be over the actual surface | ||
347 | con = node->sway_container; | ||
348 | if (!con->view->surface || node == &seat->op_container->node) { | ||
349 | seat->op_target_node = NULL; | ||
350 | seat->op_target_edge = WLR_EDGE_NONE; | ||
351 | return; | ||
352 | } | ||
353 | |||
354 | // Find the closest edge | ||
355 | size_t thickness = fmin(con->content_width, con->content_height) * 0.3; | ||
356 | size_t closest_dist = INT_MAX; | ||
357 | size_t dist; | ||
358 | seat->op_target_edge = WLR_EDGE_NONE; | ||
359 | if ((dist = cursor->cursor->y - con->y) < closest_dist) { | ||
360 | closest_dist = dist; | ||
361 | seat->op_target_edge = WLR_EDGE_TOP; | ||
362 | } | ||
363 | if ((dist = cursor->cursor->x - con->x) < closest_dist) { | ||
364 | closest_dist = dist; | ||
365 | seat->op_target_edge = WLR_EDGE_LEFT; | ||
366 | } | ||
367 | if ((dist = con->x + con->width - cursor->cursor->x) < closest_dist) { | ||
368 | closest_dist = dist; | ||
369 | seat->op_target_edge = WLR_EDGE_RIGHT; | ||
370 | } | ||
371 | if ((dist = con->y + con->height - cursor->cursor->y) < closest_dist) { | ||
372 | closest_dist = dist; | ||
373 | seat->op_target_edge = WLR_EDGE_BOTTOM; | ||
374 | } | ||
375 | |||
376 | if (closest_dist > thickness) { | ||
377 | seat->op_target_edge = WLR_EDGE_NONE; | ||
378 | } | ||
379 | |||
380 | seat->op_target_node = node; | ||
381 | seat->op_drop_box.x = con->content_x; | ||
382 | seat->op_drop_box.y = con->content_y; | ||
383 | seat->op_drop_box.width = con->content_width; | ||
384 | seat->op_drop_box.height = con->content_height; | ||
385 | resize_box(&seat->op_drop_box, seat->op_target_edge, thickness); | ||
386 | desktop_damage_box(&seat->op_drop_box); | ||
387 | } | ||
388 | |||
389 | static void handle_move_tiling_threshold_motion(struct sway_seat *seat, | ||
390 | struct sway_cursor *cursor) { | ||
391 | double cx = seat->cursor->cursor->x; | ||
392 | double cy = seat->cursor->cursor->y; | ||
393 | double sx = seat->op_ref_lx; | ||
394 | double sy = seat->op_ref_ly; | ||
395 | |||
396 | // Get the scaled threshold for the output. Even if the operation goes | ||
397 | // across multiple outputs of varying scales, just use the scale for the | ||
398 | // output that the cursor is currently on for simplicity. | ||
399 | struct wlr_output *wlr_output = wlr_output_layout_output_at( | ||
400 | root->output_layout, cx, cy); | ||
401 | double output_scale = wlr_output ? wlr_output->scale : 1; | ||
402 | double threshold = config->tiling_drag_threshold * output_scale; | ||
403 | threshold *= threshold; | ||
404 | |||
405 | // If the threshold has been exceeded, start the actual drag | ||
406 | if ((cx - sx) * (cx - sx) + (cy - sy) * (cy - sy) > threshold) { | ||
407 | seat->operation = OP_MOVE_TILING; | ||
408 | cursor_set_image(cursor, "grab", NULL); | ||
409 | handle_move_tiling_motion(seat, cursor); | ||
410 | } | ||
411 | } | ||
412 | |||
413 | static void calculate_floating_constraints(struct sway_container *con, | ||
414 | int *min_width, int *max_width, int *min_height, int *max_height) { | ||
415 | if (config->floating_minimum_width == -1) { // no minimum | ||
416 | *min_width = 0; | ||
417 | } else if (config->floating_minimum_width == 0) { // automatic | ||
418 | *min_width = 75; | ||
419 | } else { | ||
420 | *min_width = config->floating_minimum_width; | ||
421 | } | ||
422 | |||
423 | if (config->floating_minimum_height == -1) { // no minimum | ||
424 | *min_height = 0; | ||
425 | } else if (config->floating_minimum_height == 0) { // automatic | ||
426 | *min_height = 50; | ||
427 | } else { | ||
428 | *min_height = config->floating_minimum_height; | ||
429 | } | ||
430 | |||
431 | if (config->floating_maximum_width == -1) { // no maximum | ||
432 | *max_width = INT_MAX; | ||
433 | } else if (config->floating_maximum_width == 0) { // automatic | ||
434 | *max_width = con->workspace->width; | ||
435 | } else { | ||
436 | *max_width = config->floating_maximum_width; | ||
437 | } | ||
438 | |||
439 | if (config->floating_maximum_height == -1) { // no maximum | ||
440 | *max_height = INT_MAX; | ||
441 | } else if (config->floating_maximum_height == 0) { // automatic | ||
442 | *max_height = con->workspace->height; | ||
443 | } else { | ||
444 | *max_height = config->floating_maximum_height; | ||
445 | } | ||
446 | } | ||
447 | |||
448 | static void handle_resize_floating_motion(struct sway_seat *seat, | ||
449 | struct sway_cursor *cursor) { | ||
450 | struct sway_container *con = seat->op_container; | ||
451 | enum wlr_edges edge = seat->op_resize_edge; | ||
452 | |||
453 | // The amount the mouse has moved since the start of the resize operation | ||
454 | // Positive is down/right | ||
455 | double mouse_move_x = cursor->cursor->x - seat->op_ref_lx; | ||
456 | double mouse_move_y = cursor->cursor->y - seat->op_ref_ly; | ||
457 | |||
458 | if (edge == WLR_EDGE_TOP || edge == WLR_EDGE_BOTTOM) { | ||
459 | mouse_move_x = 0; | ||
460 | } | ||
461 | if (edge == WLR_EDGE_LEFT || edge == WLR_EDGE_RIGHT) { | ||
462 | mouse_move_y = 0; | ||
463 | } | ||
464 | |||
465 | double grow_width = edge & WLR_EDGE_LEFT ? -mouse_move_x : mouse_move_x; | ||
466 | double grow_height = edge & WLR_EDGE_TOP ? -mouse_move_y : mouse_move_y; | ||
467 | |||
468 | if (seat->op_resize_preserve_ratio) { | ||
469 | double x_multiplier = grow_width / seat->op_ref_width; | ||
470 | double y_multiplier = grow_height / seat->op_ref_height; | ||
471 | double max_multiplier = fmax(x_multiplier, y_multiplier); | ||
472 | grow_width = seat->op_ref_width * max_multiplier; | ||
473 | grow_height = seat->op_ref_height * max_multiplier; | ||
474 | } | ||
475 | |||
476 | // Determine new width/height, and accommodate for floating min/max values | ||
477 | double width = seat->op_ref_width + grow_width; | ||
478 | double height = seat->op_ref_height + grow_height; | ||
479 | int min_width, max_width, min_height, max_height; | ||
480 | calculate_floating_constraints(con, &min_width, &max_width, | ||
481 | &min_height, &max_height); | ||
482 | width = fmax(min_width, fmin(width, max_width)); | ||
483 | height = fmax(min_height, fmin(height, max_height)); | ||
484 | |||
485 | // Apply the view's min/max size | ||
486 | if (con->view) { | ||
487 | double view_min_width, view_max_width, view_min_height, view_max_height; | ||
488 | view_get_constraints(con->view, &view_min_width, &view_max_width, | ||
489 | &view_min_height, &view_max_height); | ||
490 | width = fmax(view_min_width, fmin(width, view_max_width)); | ||
491 | height = fmax(view_min_height, fmin(height, view_max_height)); | ||
492 | } | ||
493 | |||
494 | // Recalculate these, in case we hit a min/max limit | ||
495 | grow_width = width - seat->op_ref_width; | ||
496 | grow_height = height - seat->op_ref_height; | ||
497 | |||
498 | // Determine grow x/y values - these are relative to the container's x/y at | ||
499 | // the start of the resize operation. | ||
500 | double grow_x = 0, grow_y = 0; | ||
501 | if (edge & WLR_EDGE_LEFT) { | ||
502 | grow_x = -grow_width; | ||
503 | } else if (edge & WLR_EDGE_RIGHT) { | ||
504 | grow_x = 0; | ||
505 | } else { | ||
506 | grow_x = -grow_width / 2; | ||
507 | } | ||
508 | if (edge & WLR_EDGE_TOP) { | ||
509 | grow_y = -grow_height; | ||
510 | } else if (edge & WLR_EDGE_BOTTOM) { | ||
511 | grow_y = 0; | ||
512 | } else { | ||
513 | grow_y = -grow_height / 2; | ||
514 | } | ||
515 | |||
516 | // Determine the amounts we need to bump everything relative to the current | ||
517 | // size. | ||
518 | int relative_grow_width = width - con->width; | ||
519 | int relative_grow_height = height - con->height; | ||
520 | int relative_grow_x = (seat->op_ref_con_lx + grow_x) - con->x; | ||
521 | int relative_grow_y = (seat->op_ref_con_ly + grow_y) - con->y; | ||
522 | |||
523 | // Actually resize stuff | ||
524 | con->x += relative_grow_x; | ||
525 | con->y += relative_grow_y; | ||
526 | con->width += relative_grow_width; | ||
527 | con->height += relative_grow_height; | ||
528 | |||
529 | con->content_x += relative_grow_x; | ||
530 | con->content_y += relative_grow_y; | ||
531 | con->content_width += relative_grow_width; | ||
532 | con->content_height += relative_grow_height; | ||
533 | |||
534 | arrange_container(con); | ||
535 | } | ||
536 | |||
537 | static void handle_resize_tiling_motion(struct sway_seat *seat, | ||
538 | struct sway_cursor *cursor) { | ||
539 | int amount_x = 0; | ||
540 | int amount_y = 0; | ||
541 | int moved_x = cursor->cursor->x - seat->op_ref_lx; | ||
542 | int moved_y = cursor->cursor->y - seat->op_ref_ly; | ||
543 | enum wlr_edges edge_x = WLR_EDGE_NONE; | ||
544 | enum wlr_edges edge_y = WLR_EDGE_NONE; | ||
545 | struct sway_container *con = seat->op_container; | ||
546 | |||
547 | if (seat->op_resize_edge & WLR_EDGE_TOP) { | ||
548 | amount_y = (seat->op_ref_height - moved_y) - con->height; | ||
549 | edge_y = WLR_EDGE_TOP; | ||
550 | } else if (seat->op_resize_edge & WLR_EDGE_BOTTOM) { | ||
551 | amount_y = (seat->op_ref_height + moved_y) - con->height; | ||
552 | edge_y = WLR_EDGE_BOTTOM; | ||
553 | } | ||
554 | if (seat->op_resize_edge & WLR_EDGE_LEFT) { | ||
555 | amount_x = (seat->op_ref_width - moved_x) - con->width; | ||
556 | edge_x = WLR_EDGE_LEFT; | ||
557 | } else if (seat->op_resize_edge & WLR_EDGE_RIGHT) { | ||
558 | amount_x = (seat->op_ref_width + moved_x) - con->width; | ||
559 | edge_x = WLR_EDGE_RIGHT; | ||
560 | } | ||
561 | |||
562 | if (amount_x != 0) { | ||
563 | container_resize_tiled(seat->op_container, edge_x, amount_x); | ||
564 | } | ||
565 | if (amount_y != 0) { | ||
566 | container_resize_tiled(seat->op_container, edge_y, amount_y); | ||
567 | } | ||
568 | } | ||
569 | |||
570 | static void cursor_do_rebase(struct sway_cursor *cursor, uint32_t time_msec, | 225 | static void cursor_do_rebase(struct sway_cursor *cursor, uint32_t time_msec, |
571 | struct sway_node *node, struct wlr_surface *surface, | 226 | struct sway_node *node, struct wlr_surface *surface, |
572 | double sx, double sy) { | 227 | double sx, double sy) { |
@@ -669,29 +324,8 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, | |||
669 | struct sway_seat *seat = cursor->seat; | 324 | struct sway_seat *seat = cursor->seat; |
670 | struct wlr_seat *wlr_seat = seat->wlr_seat; | 325 | struct wlr_seat *wlr_seat = seat->wlr_seat; |
671 | 326 | ||
672 | if (seat->operation != OP_NONE) { | 327 | if (seat_doing_seatop(seat)) { |
673 | switch (seat->operation) { | 328 | seatop_motion(seat, time_msec); |
674 | case OP_DOWN: | ||
675 | handle_down_motion(seat, cursor, time_msec); | ||
676 | break; | ||
677 | case OP_MOVE_FLOATING: | ||
678 | handle_move_floating_motion(seat, cursor); | ||
679 | break; | ||
680 | case OP_MOVE_TILING_THRESHOLD: | ||
681 | handle_move_tiling_threshold_motion(seat, cursor); | ||
682 | break; | ||
683 | case OP_MOVE_TILING: | ||
684 | handle_move_tiling_motion(seat, cursor); | ||
685 | break; | ||
686 | case OP_RESIZE_FLOATING: | ||
687 | handle_resize_floating_motion(seat, cursor); | ||
688 | break; | ||
689 | case OP_RESIZE_TILING: | ||
690 | handle_resize_tiling_motion(seat, cursor); | ||
691 | break; | ||
692 | case OP_NONE: | ||
693 | break; | ||
694 | } | ||
695 | cursor->previous.x = cursor->cursor->x; | 329 | cursor->previous.x = cursor->cursor->x; |
696 | cursor->previous.y = cursor->cursor->y; | 330 | cursor->previous.y = cursor->cursor->y; |
697 | return; | 331 | return; |
@@ -868,9 +502,9 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
868 | struct sway_seat *seat = cursor->seat; | 502 | struct sway_seat *seat = cursor->seat; |
869 | 503 | ||
870 | // Handle existing seat operation | 504 | // Handle existing seat operation |
871 | if (cursor->seat->operation != OP_NONE) { | 505 | if (seat_doing_seatop(seat)) { |
872 | if (button == cursor->seat->op_button && state == WLR_BUTTON_RELEASED) { | 506 | if (button == seat->seatop_button && state == WLR_BUTTON_RELEASED) { |
873 | seat_end_mouse_operation(seat); | 507 | seatop_finish(seat); |
874 | seat_pointer_notify_button(seat, time_msec, button, state); | 508 | seat_pointer_notify_button(seat, time_msec, button, state); |
875 | } | 509 | } |
876 | if (state == WLR_BUTTON_PRESSED) { | 510 | if (state == WLR_BUTTON_PRESSED) { |
@@ -943,7 +577,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
943 | if (cont && resize_edge && button == BTN_LEFT && | 577 | if (cont && resize_edge && button == BTN_LEFT && |
944 | state == WLR_BUTTON_PRESSED && !is_floating) { | 578 | state == WLR_BUTTON_PRESSED && !is_floating) { |
945 | seat_set_focus_container(seat, cont); | 579 | seat_set_focus_container(seat, cont); |
946 | seat_begin_resize_tiling(seat, cont, button, edge); | 580 | seatop_begin_resize_tiling(seat, cont, button, edge); |
947 | return; | 581 | return; |
948 | } | 582 | } |
949 | 583 | ||
@@ -973,7 +607,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
973 | } | 607 | } |
974 | cursor_set_image(seat->cursor, image, NULL); | 608 | cursor_set_image(seat->cursor, image, NULL); |
975 | seat_set_focus_container(seat, cont); | 609 | seat_set_focus_container(seat, cont); |
976 | seat_begin_resize_tiling(seat, cont, button, edge); | 610 | seatop_begin_resize_tiling(seat, cont, button, edge); |
977 | return; | 611 | return; |
978 | } | 612 | } |
979 | } | 613 | } |
@@ -988,7 +622,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
988 | cont = cont->parent; | 622 | cont = cont->parent; |
989 | } | 623 | } |
990 | seat_set_focus_container(seat, cont); | 624 | seat_set_focus_container(seat, cont); |
991 | seat_begin_move_floating(seat, cont, button); | 625 | seatop_begin_move_floating(seat, cont, button); |
992 | return; | 626 | return; |
993 | } | 627 | } |
994 | } | 628 | } |
@@ -998,7 +632,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
998 | state == WLR_BUTTON_PRESSED) { | 632 | state == WLR_BUTTON_PRESSED) { |
999 | // Via border | 633 | // Via border |
1000 | if (button == BTN_LEFT && resize_edge != WLR_EDGE_NONE) { | 634 | if (button == BTN_LEFT && resize_edge != WLR_EDGE_NONE) { |
1001 | seat_begin_resize_floating(seat, cont, button, resize_edge); | 635 | seatop_begin_resize_floating(seat, cont, button, resize_edge); |
1002 | return; | 636 | return; |
1003 | } | 637 | } |
1004 | 638 | ||
@@ -1015,7 +649,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
1015 | WLR_EDGE_RIGHT : WLR_EDGE_LEFT; | 649 | WLR_EDGE_RIGHT : WLR_EDGE_LEFT; |
1016 | edge |= cursor->cursor->y > floater->y + floater->height / 2 ? | 650 | edge |= cursor->cursor->y > floater->y + floater->height / 2 ? |
1017 | WLR_EDGE_BOTTOM : WLR_EDGE_TOP; | 651 | WLR_EDGE_BOTTOM : WLR_EDGE_TOP; |
1018 | seat_begin_resize_floating(seat, floater, button, edge); | 652 | seatop_begin_resize_floating(seat, floater, button, edge); |
1019 | return; | 653 | return; |
1020 | } | 654 | } |
1021 | } | 655 | } |
@@ -1035,9 +669,9 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
1035 | 669 | ||
1036 | // If moving a container by it's title bar, use a threshold for the drag | 670 | // If moving a container by it's title bar, use a threshold for the drag |
1037 | if (!mod_pressed && config->tiling_drag_threshold > 0) { | 671 | if (!mod_pressed && config->tiling_drag_threshold > 0) { |
1038 | seat_begin_move_tiling_threshold(seat, cont, button); | 672 | seatop_begin_move_tiling_threshold(seat, cont, button); |
1039 | } else { | 673 | } else { |
1040 | seat_begin_move_tiling(seat, cont, button); | 674 | seatop_begin_move_tiling(seat, cont, button); |
1041 | } | 675 | } |
1042 | return; | 676 | return; |
1043 | } | 677 | } |
@@ -1046,7 +680,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
1046 | if (surface && cont && state == WLR_BUTTON_PRESSED) { | 680 | if (surface && cont && state == WLR_BUTTON_PRESSED) { |
1047 | seat_set_focus_container(seat, cont); | 681 | seat_set_focus_container(seat, cont); |
1048 | seat_pointer_notify_button(seat, time_msec, button, state); | 682 | seat_pointer_notify_button(seat, time_msec, button, state); |
1049 | seat_begin_down(seat, cont, button, sx, sy); | 683 | seatop_begin_down(seat, cont, button, sx, sy); |
1050 | return; | 684 | return; |
1051 | } | 685 | } |
1052 | 686 | ||
@@ -1350,7 +984,7 @@ static void handle_request_set_cursor(struct wl_listener *listener, | |||
1350 | void *data) { | 984 | void *data) { |
1351 | struct sway_cursor *cursor = | 985 | struct sway_cursor *cursor = |
1352 | wl_container_of(listener, cursor, request_set_cursor); | 986 | wl_container_of(listener, cursor, request_set_cursor); |
1353 | if (cursor->seat->operation != OP_NONE) { | 987 | if (seat_doing_seatop(cursor->seat)) { |
1354 | return; | 988 | return; |
1355 | } | 989 | } |
1356 | struct wlr_seat_pointer_request_set_cursor_event *event = data; | 990 | struct wlr_seat_pointer_request_set_cursor_event *event = data; |