struct session_lock_manager {
struct server *server;
struct wlr_session_lock_manager_v1 *wlr_manager;
+ /* View re-focused on unlock */
+ struct view *last_active_view;
struct wlr_surface *focused;
/*
* When not locked: lock=NULL, locked=false
wl_container_of(listener, manager, lock_unlock);
session_lock_destroy(manager);
manager->locked = false;
- desktop_focus_topmost_view(manager->server);
+
+ if (manager->last_active_view) {
+ desktop_focus_view(manager->last_active_view, /* raise */ false);
+ } else {
+ desktop_focus_topmost_view(manager->server);
+ }
+ manager->last_active_view = NULL;
+
cursor_update_focus(manager->server);
}
}
assert(wl_list_empty(&manager->lock_outputs));
+ /* Remember the focused view to restore it on unlock */
+ manager->last_active_view = manager->server->active_view;
+
struct output *output;
wl_list_for_each(output, &manager->server->outputs, link) {
session_lock_output_create(manager, output);
server->active_view = NULL;
}
+ if (server->session_lock_manager->last_active_view == view) {
+ server->session_lock_manager->last_active_view = NULL;
+ }
+
if (server->last_raised_view == view) {
server->last_raised_view = NULL;
}