mirror of
https://github.com/swaywm/sway.git
synced 2024-11-26 01:41:30 +00:00
Added in proper focus handling for floating windows
This commit is contained in:
parent
ef2f3d3115
commit
01c6caced6
|
@ -57,20 +57,25 @@ swayc_t *container_under_pointer(void) {
|
||||||
}
|
}
|
||||||
// if workspace, search floating
|
// if workspace, search floating
|
||||||
if (lookup->type == C_WORKSPACE) {
|
if (lookup->type == C_WORKSPACE) {
|
||||||
len = lookup->floating->length;
|
i = len = lookup->floating->length;
|
||||||
for (i = 0; i < len; ++i) {
|
bool got_floating = false;
|
||||||
|
while (--i > -1) {
|
||||||
|
sway_log(L_DEBUG, "Checking index %d of floating items", i);
|
||||||
if (pointer_test(lookup->floating->items[i], &mouse_origin)) {
|
if (pointer_test(lookup->floating->items[i], &mouse_origin)) {
|
||||||
|
sway_log(L_DEBUG, "Got hit for floatin on %d", i);
|
||||||
lookup = lookup->floating->items[i];
|
lookup = lookup->floating->items[i];
|
||||||
|
got_floating = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i < len) {
|
if (got_floating) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// search children
|
// search children
|
||||||
len = lookup->children->length;
|
len = lookup->children->length;
|
||||||
for (i = 0; i < len; ++i) {
|
for (i = 0; i < len; ++i) {
|
||||||
|
sway_log(L_DEBUG, "Checking index %d of standard children", i);
|
||||||
if (pointer_test(lookup->children->items[i], &mouse_origin)) {
|
if (pointer_test(lookup->children->items[i], &mouse_origin)) {
|
||||||
lookup = lookup->children->items[i];
|
lookup = lookup->children->items[i];
|
||||||
break;
|
break;
|
||||||
|
@ -441,6 +446,17 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w
|
||||||
}
|
}
|
||||||
swayc_t *pointer = container_under_pointer();
|
swayc_t *pointer = container_under_pointer();
|
||||||
set_focused_container(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);
|
return (pointer && pointer != focused);
|
||||||
} else {
|
} else {
|
||||||
sway_log(L_DEBUG, "Mouse button %u released", button);
|
sway_log(L_DEBUG, "Mouse button %u released", button);
|
||||||
|
|
Loading…
Reference in a new issue