diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-04-26 17:14:24 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2017-04-26 17:14:24 -0400 |
commit | 537261f23f194e152c0adf25a2740375929e9cd3 (patch) | |
tree | 97fabe0d36c2c5574a2ff47238eeed58fa200fd0 /sway | |
parent | Update sway(5) (diff) | |
download | sway-537261f23f194e152c0adf25a2740375929e9cd3.tar.gz sway-537261f23f194e152c0adf25a2740375929e9cd3.tar.zst sway-537261f23f194e152c0adf25a2740375929e9cd3.zip |
Fix handling of floating windows
Diffstat (limited to 'sway')
-rw-r--r-- | sway/handlers.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sway/handlers.c b/sway/handlers.c index 5e031321..da765d6d 100644 --- a/sway/handlers.c +++ b/sway/handlers.c | |||
@@ -460,11 +460,7 @@ static bool handle_view_created(wlc_handle handle) { | |||
460 | 460 | ||
461 | if (newview) { | 461 | if (newview) { |
462 | ipc_event_window(newview, "new"); | 462 | ipc_event_window(newview, "new"); |
463 | swayc_t *workspace = swayc_parent_by_type(newview, C_WORKSPACE); | 463 | set_focused_container(newview); |
464 | if ((workspace && workspace->children->length == 1) | ||
465 | || !criteria_any(newview, config->no_focus)) { | ||
466 | set_focused_container(newview); | ||
467 | } | ||
468 | wlc_view_set_mask(handle, VISIBLE); | 464 | wlc_view_set_mask(handle, VISIBLE); |
469 | swayc_t *output = swayc_parent_by_type(newview, C_OUTPUT); | 465 | swayc_t *output = swayc_parent_by_type(newview, C_OUTPUT); |
470 | arrange_windows(output, -1, -1); | 466 | arrange_windows(output, -1, -1); |
@@ -483,7 +479,7 @@ static bool handle_view_created(wlc_handle handle) { | |||
483 | // refocus in-between command lists | 479 | // refocus in-between command lists |
484 | set_focused_container(newview); | 480 | set_focused_container(newview); |
485 | } | 481 | } |
486 | workspace = swayc_parent_by_type(focused, C_WORKSPACE); | 482 | swayc_t *workspace = swayc_parent_by_type(focused, C_WORKSPACE); |
487 | if (workspace && workspace->fullscreen) { | 483 | if (workspace && workspace->fullscreen) { |
488 | set_focused_container(workspace->fullscreen); | 484 | set_focused_container(workspace->fullscreen); |
489 | } | 485 | } |
@@ -506,6 +502,16 @@ static bool handle_view_created(wlc_handle handle) { | |||
506 | workspace_switch(current_ws); | 502 | workspace_switch(current_ws); |
507 | set_focused_container(get_focused_container(current_ws)); | 503 | set_focused_container(get_focused_container(current_ws)); |
508 | } | 504 | } |
505 | if (prev_focus && prev_focus->type == C_VIEW | ||
506 | && newview && criteria_any(newview, config->no_focus)) { | ||
507 | // Restore focus | ||
508 | swayc_t *ws = swayc_parent_by_type(newview, C_WORKSPACE); | ||
509 | if (!ws || ws != newview->parent | ||
510 | || ws->children->length + ws->floating->length != 1) { | ||
511 | sway_log(L_DEBUG, "no_focus: restoring focus to %s", prev_focus->name); | ||
512 | set_focused_container(prev_focus); | ||
513 | } | ||
514 | } | ||
509 | 515 | ||
510 | suspend_workspace_cleanup = false; | 516 | suspend_workspace_cleanup = false; |
511 | ws_cleanup(); | 517 | ws_cleanup(); |