Merge pull request #2116 from RedSoxFan/fix-2113
Fix focusing after splitting tabs/stacks
This commit is contained in:
commit
22c1c4beb4
|
@ -874,11 +874,10 @@ struct sway_container *container_split(struct sway_container *child,
|
||||||
cont->x = child->x;
|
cont->x = child->x;
|
||||||
cont->y = child->y;
|
cont->y = child->y;
|
||||||
|
|
||||||
|
struct sway_seat *seat = input_manager_get_default_seat(input_manager);
|
||||||
|
bool set_focus = (seat_get_focus(seat) == child);
|
||||||
if (child->type == C_WORKSPACE) {
|
if (child->type == C_WORKSPACE) {
|
||||||
struct sway_seat *seat = input_manager_get_default_seat(input_manager);
|
|
||||||
struct sway_container *workspace = child;
|
struct sway_container *workspace = child;
|
||||||
bool set_focus = (seat_get_focus(seat) == workspace);
|
|
||||||
|
|
||||||
while (workspace->children->length) {
|
while (workspace->children->length) {
|
||||||
struct sway_container *ws_child = workspace->children->items[0];
|
struct sway_container *ws_child = workspace->children->items[0];
|
||||||
container_remove_child(ws_child);
|
container_remove_child(ws_child);
|
||||||
|
@ -890,10 +889,6 @@ struct sway_container *container_split(struct sway_container *child,
|
||||||
enum sway_container_layout old_layout = workspace->layout;
|
enum sway_container_layout old_layout = workspace->layout;
|
||||||
workspace->layout = layout;
|
workspace->layout = layout;
|
||||||
cont->layout = old_layout;
|
cont->layout = old_layout;
|
||||||
|
|
||||||
if (set_focus) {
|
|
||||||
seat_set_focus(seat, cont);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
struct sway_container *old_parent = child->parent;
|
struct sway_container *old_parent = child->parent;
|
||||||
cont->layout = layout;
|
cont->layout = layout;
|
||||||
|
@ -902,6 +897,11 @@ struct sway_container *container_split(struct sway_container *child,
|
||||||
wl_signal_emit(&child->events.reparent, old_parent);
|
wl_signal_emit(&child->events.reparent, old_parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (set_focus) {
|
||||||
|
seat_set_focus(seat, cont);
|
||||||
|
seat_set_focus(seat, child);
|
||||||
|
}
|
||||||
|
|
||||||
container_notify_subtree_changed(cont);
|
container_notify_subtree_changed(cont);
|
||||||
|
|
||||||
return cont;
|
return cont;
|
||||||
|
|
Loading…
Reference in a new issue