diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-08-18 15:24:39 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-08-18 15:24:39 -0400 |
commit | 62a21d9d4d3041ed7fc4a9140d98cc29fbdb2759 (patch) | |
tree | 51572f9329c240d6ddff10e99932b21f89ef278b /sway | |
parent | ef2f3d31155bb2e962a93e5a068858b502f3544c (diff) | |
parent | 7756f423c3449e58746dfc66517b389abee8b88f (diff) |
Merge pull request #71 from Luminarys/master
Added in proper focus handling for floating containers.
Diffstat (limited to 'sway')
-rw-r--r-- | sway/handlers.c | 19 |
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) { } // if workspace, search floating if (lookup->type == C_WORKSPACE) { - len = lookup->floating->length; - for (i = 0; i < len; ++i) { + i = len = lookup->floating->length; + bool got_floating = false; + while (--i > -1) { if (pointer_test(lookup->floating->items[i], &mouse_origin)) { lookup = lookup->floating->items[i]; + got_floating = true; break; } } - if (i < len) { + if (got_floating) { continue; } } @@ -441,6 +443,17 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w } swayc_t *pointer = container_under_pointer(); set_focused_container(pointer); + if (pointer->is_floating) { + int i; + for (i = 0; i < pointer->parent->floating->length; i++) { + if (pointer->parent->floating->items[i] == pointer) { + list_del(pointer->parent->floating, i); + list_add(pointer->parent->floating, pointer); + break; + } + } + arrange_windows(pointer->parent, -1, -1); + } return (pointer && pointer != focused); } else { sway_log(L_DEBUG, "Mouse button %u released", button); |