diff options
Diffstat (limited to 'sway/input/cursor.c')
-rw-r--r-- | sway/input/cursor.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index b0f8e531..dc66d82d 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -26,6 +26,10 @@ | |||
26 | #include "sway/tree/workspace.h" | 26 | #include "sway/tree/workspace.h" |
27 | #include "wlr-layer-shell-unstable-v1-protocol.h" | 27 | #include "wlr-layer-shell-unstable-v1-protocol.h" |
28 | 28 | ||
29 | // When doing a tiling drag, this is the thickness of the dropzone | ||
30 | // when dragging to the edge of a layout container. | ||
31 | #define DROP_LAYOUT_BORDER 30 | ||
32 | |||
29 | static uint32_t get_current_time_msec() { | 33 | static uint32_t get_current_time_msec() { |
30 | struct timespec now; | 34 | struct timespec now; |
31 | clock_gettime(CLOCK_MONOTONIC, &now); | 35 | clock_gettime(CLOCK_MONOTONIC, &now); |
@@ -229,7 +233,7 @@ static void handle_move_floating_motion(struct sway_seat *seat, | |||
229 | } | 233 | } |
230 | 234 | ||
231 | static void resize_box(struct wlr_box *box, enum wlr_edges edge, | 235 | static void resize_box(struct wlr_box *box, enum wlr_edges edge, |
232 | size_t thickness) { | 236 | int thickness) { |
233 | switch (edge) { | 237 | switch (edge) { |
234 | case WLR_EDGE_TOP: | 238 | case WLR_EDGE_TOP: |
235 | box->height = thickness; | 239 | box->height = thickness; |
@@ -297,15 +301,17 @@ static void handle_move_tiling_motion(struct sway_seat *seat, | |||
297 | con->parent ? container_get_box(con->parent, &parent) : | 301 | con->parent ? container_get_box(con->parent, &parent) : |
298 | workspace_get_box(con->workspace, &parent); | 302 | workspace_get_box(con->workspace, &parent); |
299 | if (layout == L_HORIZ || layout == L_TABBED) { | 303 | if (layout == L_HORIZ || layout == L_TABBED) { |
300 | if (cursor->cursor->y < parent.y + 30) { | 304 | if (cursor->cursor->y < parent.y + DROP_LAYOUT_BORDER) { |
301 | edge = WLR_EDGE_TOP; | 305 | edge = WLR_EDGE_TOP; |
302 | } else if (cursor->cursor->y > parent.y + parent.height - 30) { | 306 | } else if (cursor->cursor->y > parent.y + parent.height |
307 | - DROP_LAYOUT_BORDER) { | ||
303 | edge = WLR_EDGE_BOTTOM; | 308 | edge = WLR_EDGE_BOTTOM; |
304 | } | 309 | } |
305 | } else if (layout == L_VERT || layout == L_STACKED) { | 310 | } else if (layout == L_VERT || layout == L_STACKED) { |
306 | if (cursor->cursor->x < parent.x + 30) { | 311 | if (cursor->cursor->x < parent.x + DROP_LAYOUT_BORDER) { |
307 | edge = WLR_EDGE_LEFT; | 312 | edge = WLR_EDGE_LEFT; |
308 | } else if (cursor->cursor->x > parent.x + parent.width - 30) { | 313 | } else if (cursor->cursor->x > parent.x + parent.width |
314 | - DROP_LAYOUT_BORDER) { | ||
309 | edge = WLR_EDGE_RIGHT; | 315 | edge = WLR_EDGE_RIGHT; |
310 | } | 316 | } |
311 | } | 317 | } |
@@ -313,7 +319,7 @@ static void handle_move_tiling_motion(struct sway_seat *seat, | |||
313 | seat->op_target_node = node_get_parent(&con->node); | 319 | seat->op_target_node = node_get_parent(&con->node); |
314 | seat->op_target_edge = edge; | 320 | seat->op_target_edge = edge; |
315 | node_get_box(seat->op_target_node, &seat->op_drop_box); | 321 | node_get_box(seat->op_target_node, &seat->op_drop_box); |
316 | resize_box(&seat->op_drop_box, edge, 30); | 322 | resize_box(&seat->op_drop_box, edge, DROP_LAYOUT_BORDER); |
317 | desktop_damage_box(&seat->op_drop_box); | 323 | desktop_damage_box(&seat->op_drop_box); |
318 | return; | 324 | return; |
319 | } | 325 | } |
@@ -890,8 +896,8 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
890 | } | 896 | } |
891 | 897 | ||
892 | // Handle moving a tiling container | 898 | // Handle moving a tiling container |
893 | if (config->tiling_drag && mod_pressed && !is_floating_or_child && | 899 | if (config->tiling_drag && mod_pressed && state == WLR_BUTTON_PRESSED && |
894 | !cont->is_fullscreen) { | 900 | !is_floating_or_child && !cont->is_fullscreen) { |
895 | seat_pointer_notify_button(seat, time_msec, button, state); | 901 | seat_pointer_notify_button(seat, time_msec, button, state); |
896 | seat_begin_move_tiling(seat, cont, button); | 902 | seat_begin_move_tiling(seat, cont, button); |
897 | return; | 903 | return; |