Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sway: extensions: make locking give back focus #1014

Merged
merged 2 commits into from
Dec 26, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions sway/extensions.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down