aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2016-12-26 09:06:20 -0700
committerGitHub <noreply@github.com>2016-12-26 09:06:20 -0700
commit725582c2f1fdb4aed7175f313274fbac605420d6 (patch)
treee2978c06bc8cce8fbcb94d3bb397871ff08d6eb2
parent36e48fcf8db273a7d16356248f67aadb27d58ee1 (diff)
parent09259021abed0ebc75e214ebf947ceef6d458aa7 (diff)
downloadsway-0.11.zip
sway-0.11.tar.gz
sway-0.11.tar.bz2
Merge pull request #1014 from cyphar/swaylock-fix-focus0.11
sway: extensions: make locking give back focus
-rw-r--r--sway/extensions.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sway/extensions.c b/sway/extensions.c
index 40702e2..5fee7d3 100644
--- a/sway/extensions.c
+++ b/sway/extensions.c
@@ -65,10 +65,20 @@ void lock_surface_destructor(struct wl_resource *resource) {
if (surface == resource) {
list_del(desktop_shell.lock_surfaces, i);
arrange_windows(&root_container, -1, -1);
- desktop_shell.is_locked = false;
break;
}
}
+ if (desktop_shell.lock_surfaces->length == 0) {
+ sway_log(L_DEBUG, "Desktop shell unlocked");
+ desktop_shell.is_locked = false;
+
+ // We need to now give focus back to the focus which we internally
+ // track, since when we lock sway we don't actually change our internal
+ // focus tracking.
+ swayc_t *focus = get_focused_container(swayc_active_workspace());
+ set_focused_container(focus);
+ wlc_view_focus(focus->handle);
+ }
}
static void set_background(struct wl_client *client, struct wl_resource *resource,
@@ -157,10 +167,6 @@ static void set_lock_surface(struct wl_client *client, struct wl_resource *resou
desktop_shell.is_locked = true;
input_init();
arrange_windows(workspace, -1, -1);
- swayc_t *focus_output = swayc_active_output();
- if (focus_output == output) {
- set_focused_container(view);
- }
list_add(desktop_shell.lock_surfaces, surface);
wl_resource_set_destructor(surface, lock_surface_destructor);
} else {