[PATCH weston 04/14] Ignore repeat keys in notify_key

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


Let compositors just blithely post through every event they get,
including repeating keys.

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

diff --git a/src/compositor.c b/src/compositor.c
index d914b67..52ef89e 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1858,8 +1858,12 @@ notify_key(struct wl_seat *seat, uint32_t time, uint32_t key,
 	mods = update_modifier_state(ws, key, state);
 	end = seat->keyboard->keys.data + seat->keyboard->keys.size;
 	for (k = seat->keyboard->keys.data; k < end; k++) {
-		if (*k == key)
+		if (*k == key) {
+			/* Ignore server-generated repeats. */
+			if (state == WL_KEYBOARD_KEY_STATE_PRESSED)
+				return;
 			*k = *--end;
+		}
 	}
 	seat->keyboard->keys.size = (void *) end - seat->keyboard->keys.data;
 	if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
-- 
1.7.10



More information about the wayland-devel mailing list