[PATCH weston 2/6] shell: Always set focus when restoring focus state

Jonas Ådahl jadahl at gmail.com
Wed Aug 29 13:12:59 PDT 2012


To avoid having a surface on a hidden workspace in focus always set the
focus (even to NULL) when restoring.

Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
---
 src/shell.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/shell.c b/src/shell.c
index 4d6bc4f..b37ea25 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -439,11 +439,13 @@ static void
 restore_focus_state(struct desktop_shell *shell, struct workspace *ws)
 {
 	struct focus_state *state, *next;
+	struct wl_surface *surface;
 
 	wl_list_for_each_safe(state, next, &ws->focus_list, link) {
-		if (state->keyboard_focus)
-			wl_keyboard_set_focus(state->seat->seat.keyboard,
-					      &state->keyboard_focus->surface);
+		surface = state->keyboard_focus ?
+			&state->keyboard_focus->surface : NULL;
+
+		wl_keyboard_set_focus(state->seat->seat.keyboard, surface);
 	}
 }
 
-- 
1.7.9.5



More information about the wayland-devel mailing list