[Xcb] [PATCH][util-keysyms] Duplicate Keycodes in xcb_key_symbols_get_keycode
Bastien Dejean
nihilhill at gmail.com
Wed Jan 2 12:21:28 PST 2013
Hi,
Please see the attached patch.
Greetings,
--
b.d
(| |)
^ ^
-------------- next part --------------
>From f115d93bb27a8f4a4f82b8dc746cc9d4bbdd7f1f Mon Sep 17 00:00:00 2001
From: Bastien Dejean <nihilhill at gmail.com>
Date: Wed, 2 Jan 2013 21:13:12 +0100
Subject: [PATCH] Duplicate keycodes are unnecessary
When multiple keysym matches occur on one keycode, we do not want to
return that keycode multiple times.
---
keysyms/keysyms.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/keysyms/keysyms.c b/keysyms/keysyms.c
index 7584ccc..daa863f 100644
--- a/keysyms/keysyms.c
+++ b/keysyms/keysyms.c
@@ -251,8 +251,8 @@ xcb_key_symbols_get_keycode(xcb_key_symbols_t *syms,
min = xcb_get_setup(syms->c)->min_keycode;
max = xcb_get_setup(syms->c)->max_keycode;
- for(j = 0; j < syms->u.reply->keysyms_per_keycode; j++)
- for(i = min; i && i <= max; i++)
+ for(i = min; i && i <= max; i++)
+ for(j = 0; j < syms->u.reply->keysyms_per_keycode; j++)
{
ks = xcb_key_symbols_get_keysym(syms, i, j);
if(ks == keysym)
@@ -270,6 +270,7 @@ xcb_key_symbols_get_keycode(xcb_key_symbols_t *syms,
result = result_np;
result[nresult - 1] = i;
result[nresult] = XCB_NO_SYMBOL;
+ break;
}
}
}
--
1.8.1
More information about the Xcb
mailing list