mirror of
https://github.com/swaywm/sway.git
synced 2024-11-26 18:01:29 +00:00
Fix handling of floating windows
This commit is contained in:
parent
ffd0d020d6
commit
537261f23f
|
@ -460,11 +460,7 @@ static bool handle_view_created(wlc_handle handle) {
|
||||||
|
|
||||||
if (newview) {
|
if (newview) {
|
||||||
ipc_event_window(newview, "new");
|
ipc_event_window(newview, "new");
|
||||||
swayc_t *workspace = swayc_parent_by_type(newview, C_WORKSPACE);
|
|
||||||
if ((workspace && workspace->children->length == 1)
|
|
||||||
|| !criteria_any(newview, config->no_focus)) {
|
|
||||||
set_focused_container(newview);
|
set_focused_container(newview);
|
||||||
}
|
|
||||||
wlc_view_set_mask(handle, VISIBLE);
|
wlc_view_set_mask(handle, VISIBLE);
|
||||||
swayc_t *output = swayc_parent_by_type(newview, C_OUTPUT);
|
swayc_t *output = swayc_parent_by_type(newview, C_OUTPUT);
|
||||||
arrange_windows(output, -1, -1);
|
arrange_windows(output, -1, -1);
|
||||||
|
@ -483,7 +479,7 @@ static bool handle_view_created(wlc_handle handle) {
|
||||||
// refocus in-between command lists
|
// refocus in-between command lists
|
||||||
set_focused_container(newview);
|
set_focused_container(newview);
|
||||||
}
|
}
|
||||||
workspace = swayc_parent_by_type(focused, C_WORKSPACE);
|
swayc_t *workspace = swayc_parent_by_type(focused, C_WORKSPACE);
|
||||||
if (workspace && workspace->fullscreen) {
|
if (workspace && workspace->fullscreen) {
|
||||||
set_focused_container(workspace->fullscreen);
|
set_focused_container(workspace->fullscreen);
|
||||||
}
|
}
|
||||||
|
@ -506,6 +502,16 @@ static bool handle_view_created(wlc_handle handle) {
|
||||||
workspace_switch(current_ws);
|
workspace_switch(current_ws);
|
||||||
set_focused_container(get_focused_container(current_ws));
|
set_focused_container(get_focused_container(current_ws));
|
||||||
}
|
}
|
||||||
|
if (prev_focus && prev_focus->type == C_VIEW
|
||||||
|
&& newview && criteria_any(newview, config->no_focus)) {
|
||||||
|
// Restore focus
|
||||||
|
swayc_t *ws = swayc_parent_by_type(newview, C_WORKSPACE);
|
||||||
|
if (!ws || ws != newview->parent
|
||||||
|
|| ws->children->length + ws->floating->length != 1) {
|
||||||
|
sway_log(L_DEBUG, "no_focus: restoring focus to %s", prev_focus->name);
|
||||||
|
set_focused_container(prev_focus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
suspend_workspace_cleanup = false;
|
suspend_workspace_cleanup = false;
|
||||||
ws_cleanup();
|
ws_cleanup();
|
||||||
|
|
Loading…
Reference in a new issue