[PATCH weston 1/3] input: Activate view no matter the keyboard focus

Jonas Ådahl jadahl at gmail.com
Tue Mar 15 13:14:13 UTC 2016


Activate a view even though it effectively may already be active.
Without this, in later patches, it won't be possibe to track what view
was activated by clicking last, as a view which surface already had
keyboard focus, won't be activated.

To keep avoiding sending xdg_surface.configure events, only change the
keyboard focus if the focus actually changed.

Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
---

The patch that introduced the early-out if the surface already had keyboard
focus broke activated-view tracking later used by pointer constraints. I partly
reverted that but added a guard for changing the keyboard focus to the same
focus, which was the reason xdg_surface.configure was sent twice per click.

We still do various other unnecessary things on the redundant activation, but
I left that for the future.


 desktop-shell/shell.c | 7 -------
 src/input.c           | 2 +-
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index e1fefae..56bb62e 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -5169,13 +5169,6 @@ activate_binding(struct weston_seat *seat,
 	if (get_shell_surface_type(main_surface) == SHELL_SURFACE_NONE)
 		return;
 
-	state = ensure_focus_state(shell, seat);
-	if (state == NULL)
-		return;
-
-	if (state->keyboard_focus == focus)
-		return;
-
 	activate(shell, focus, seat, true);
 }
 
diff --git a/src/input.c b/src/input.c
index 8c106dd..cc7e088 100644
--- a/src/input.c
+++ b/src/input.c
@@ -1299,7 +1299,7 @@ weston_surface_activate(struct weston_surface *surface,
 	struct weston_compositor *compositor = seat->compositor;
 	struct weston_keyboard *keyboard = weston_seat_get_keyboard(seat);
 
-	if (keyboard) {
+	if (keyboard && keyboard->focus != surface) {
 		weston_keyboard_set_focus(keyboard, surface);
 		wl_data_device_set_keyboard_focus(seat);
 	}
-- 
2.4.3



More information about the wayland-devel mailing list