summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2010-07-05 16:18:36 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2010-11-15 13:30:47 +1000
commit999ef55457008b491b7acad7cee130893d0d7ab2 (patch)
treefd5577fe8157dc1fd9237194666b18767e1df90d
parent99f45dcaf34f6dbb7c9a2e6944e42b9b166761c9 (diff)
Xlib13: fix XSetModfierMapping test 1/8.HEADmaster
XSetModfierMapping reports FAIL due to a different ordering of the modifiers in the return value. The server keeps the modifiers in a different format than used by the core protocol. The modifier map returned by XGetModifierMapping(3) always has the keycodes in ascending order for each modifier. A straight input_map[i] == output_map[i] comparison is not enough if the input map is not in order. Instead, all values for each modifier need to be compared to find the right modifier. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--xts5/Xlib13/XSetModifierMapping.m25
1 files changed, 19 insertions, 6 deletions
diff --git a/xts5/Xlib13/XSetModifierMapping.m b/xts5/Xlib13/XSetModifierMapping.m
index 459c91b8..f1df566e 100644
--- a/xts5/Xlib13/XSetModifierMapping.m
+++ b/xts5/Xlib13/XSetModifierMapping.m
@@ -171,15 +171,28 @@ XModifierKeymap *newmap;
modmap->max_keypermod);
FAIL;
}
- for (i = 0; i < kpm*8; i++) {
- if (modmap->modifiermap[i] == newmap->modifiermap[i])
- CHECK;
- else {
+
+ /* Returned modmap is in ascending keycode order for each modifier */
+ for (i = 0; i < kpm*8; i += kpm) {
+ int j, k;
+ for (j = i; j < i + kpm; j++) {
+ int found = 0;
+
+ for (k = i; !found && k < i + kpm; k++) {
+ if (modmap->modifiermap[j] == newmap->modifiermap[k]) {
+ CHECK;
+ found = 1;
+ }
+ }
+
+ if (!found) {
report("Modifier map was not set correctly");
FAIL;
break;
- }
- }
+ }
+ }
+ }
+
CHECKPASS(1+kpm*8);
XFreeModifiermap(newmap);