[PATCH weston] shell: Don't send extra configure events on click

Derek Foreman derekf at osg.samsung.com
Thu Dec 10 10:54:33 PST 2015


The click_to_activate handler fires on every mouse click for a surface
so let's be a little quicker to early return if you're clicking on the
surface that already has activation.

This prevents (among other side effects) the sending of two xdg_configure
events for every mouse click.

This should also make having two seats with keyboards behave in the same
way as a single seat.  Previously the second seat could have a keyboard
focus on the surface and prevent some of the extra processing (including
the extra configure events) from taking place.

Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
---
 desktop-shell/shell.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 780902d..335d34a 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -5051,17 +5051,20 @@ activate(struct desktop_shell *shell, struct weston_surface *es,
 	shsurf = get_shell_surface(main_surface);
 	assert(shsurf);
 
+	state = ensure_focus_state(shell, seat);
+	if (state == NULL)
+		return;
+
+	old_es = state->keyboard_focus;
+	if (old_es == es)
+		return;
+
 	/* Only demote fullscreen surfaces on the output of activated shsurf.
 	 * Leave fullscreen surfaces on unrelated outputs alone. */
 	lower_fullscreen_layer(shell, shsurf->output);
 
 	weston_surface_activate(es, seat);
 
-	state = ensure_focus_state(shell, seat);
-	if (state == NULL)
-		return;
-
-	old_es = state->keyboard_focus;
 	focus_state_set_focus(state, es);
 
 	if (shsurf->state.fullscreen && configure)
-- 
2.6.3



More information about the wayland-devel mailing list