Ignore repeat keys in notify_key

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

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
Daniel Stone 2012-06-22 13:21:31 +01:00 committed by Kristian Høgsberg
parent 71c3877a40
commit c6587ea155
1 changed files with 5 additions and 1 deletions

View File

@ -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) {