[PATCH weston 05/14] Run key bindings on keyboard focus in

Daniel Stone daniel at fooishbar.org
Fri Jun 22 05:21:32 PDT 2012


This is mainly for X11's benefit; the common case is using Logo+S to
take a screenshot, where GNOME Shell has grabbed Logo, and replays the
event down to the nested compositor after S is pressed.  This means we
get an enter event with both Logo and S down, and even if Shell delivers
the key press event for S (which isn't mandatory, and not all window
managers do), then we never run the binding since notify_key realises
that S is already down and exits early.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
 src/compositor.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/compositor.c b/src/compositor.c
index 52ef89e..17e6735 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1937,6 +1937,12 @@ notify_keyboard_focus_in(struct wl_seat *seat, struct wl_array *keys,
 					      WL_KEYBOARD_KEY_STATE_PRESSED);
 	}
 
+	/* Run key bindings after we've updated the state. */
+	wl_array_for_each(k, &seat->keyboard->keys) {
+		weston_compositor_run_key_binding(compositor, ws, 0, *k,
+						  WL_KEYBOARD_KEY_STATE_PRESSED);
+	}
+
 	surface = ws->saved_kbd_focus;
 
 	if (surface) {
-- 
1.7.10



More information about the wayland-devel mailing list