aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sway/handlers.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/sway/handlers.c b/sway/handlers.c
index ec2b123e..534b4e4f 100644
--- a/sway/handlers.c
+++ b/sway/handlers.c
@@ -57,14 +57,16 @@ swayc_t *container_under_pointer(void) {
57 } 57 }
58 // if workspace, search floating 58 // if workspace, search floating
59 if (lookup->type == C_WORKSPACE) { 59 if (lookup->type == C_WORKSPACE) {
60 len = lookup->floating->length; 60 i = len = lookup->floating->length;
61 for (i = 0; i < len; ++i) { 61 bool got_floating = false;
62 while (--i > -1) {
62 if (pointer_test(lookup->floating->items[i], &mouse_origin)) { 63 if (pointer_test(lookup->floating->items[i], &mouse_origin)) {
63 lookup = lookup->floating->items[i]; 64 lookup = lookup->floating->items[i];
65 got_floating = true;
64 break; 66 break;
65 } 67 }
66 } 68 }
67 if (i < len) { 69 if (got_floating) {
68 continue; 70 continue;
69 } 71 }
70 } 72 }
@@ -441,6 +443,17 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w
441 } 443 }
442 swayc_t *pointer = container_under_pointer(); 444 swayc_t *pointer = container_under_pointer();
443 set_focused_container(pointer); 445 set_focused_container(pointer);
446 if (pointer->is_floating) {
447 int i;
448 for (i = 0; i < pointer->parent->floating->length; i++) {
449 if (pointer->parent->floating->items[i] == pointer) {
450 list_del(pointer->parent->floating, i);
451 list_add(pointer->parent->floating, pointer);
452 break;
453 }
454 }
455 arrange_windows(pointer->parent, -1, -1);
456 }
444 return (pointer && pointer != focused); 457 return (pointer && pointer != focused);
445 } else { 458 } else {
446 sway_log(L_DEBUG, "Mouse button %u released", button); 459 sway_log(L_DEBUG, "Mouse button %u released", button);