mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
session-lock: restore focused view on unlock
Before this commit, the topmost view is focused on unlock. This commit changes it to remember the focused view on lock then restore it on unlock.
This commit is contained in:
parent
880522d142
commit
6bc93cf468
3 changed files with 17 additions and 1 deletions
|
|
@ -10,6 +10,8 @@ struct server;
|
|||
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
|
||||
|
|
|
|||
|
|
@ -269,7 +269,14 @@ handle_lock_unlock(struct wl_listener *listener, void *data)
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
@ -309,6 +316,9 @@ handle_new_session_lock(struct wl_listener *listener, void *data)
|
|||
}
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -2396,6 +2396,10 @@ view_destroy(struct view *view)
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue