summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2014-04-09 16:33:32 +0100
committerKristian Høgsberg <krh@bitplanet.net>2014-04-10 09:40:28 -0700
commitb4a91708e3c440e2d56d476ce71e82af8f79563f (patch)
tree9937cfd0a78fc9a32543ad1234da3269499db1ca
parent4237f50e11826445319864518289ba1733e11223 (diff)
Reset the keyboard focus on all seats when the compositor is locked
Before commit 2f5faff7f9142 when the compositor is locked it would reset the keyboard focus on all of the seats as part of pushing the focus_state. This was removed because it now always keeps track of the focus_state in the workspace instead of waiting until the state is pushed. However this had the side effect that the active surface would retain focus when the compositor is locked. This patch just makes it explicitly set the keyboard focus to NULL on all of the seats when locking. This will be restored based on the workspace's state when unlocking. https://bugs.freedesktop.org/show_bug.cgi?id=73905
-rw-r--r--desktop-shell/shell.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index b13b224e..a6f8a766 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -4501,6 +4501,19 @@ touch_to_activate_binding(struct weston_seat *seat, uint32_t time, void *data)
}
static void
+unfocus_all_seats(struct desktop_shell *shell)
+{
+ struct weston_seat *seat, *next;
+
+ wl_list_for_each_safe(seat, next, &shell->compositor->seat_list, link) {
+ if (seat->keyboard == NULL)
+ continue;
+
+ weston_keyboard_set_focus(seat->keyboard, NULL);
+ }
+}
+
+static void
lock(struct desktop_shell *shell)
{
struct workspace *ws = get_current_workspace(shell);
@@ -4526,6 +4539,11 @@ lock(struct desktop_shell *shell)
launch_screensaver(shell);
+ /* Remove the keyboard focus on all seats. This will be
+ * restored to the workspace's saved state via
+ * restore_focus_state when the compositor is unlocked */
+ unfocus_all_seats(shell);
+
/* TODO: disable bindings that should not work while locked. */
/* All this must be undone in resume_desktop(). */