diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-01-05 05:17:03 -0500 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-01-09 11:07:39 +1000 |
commit | 2e5ee5c5f7728e288a915ce61b57385f98439744 (patch) | |
tree | 3f1566ceb3f86e08a2c78c263f30dfe4dc5f491d | |
parent | 2b537d3bad97ff18c2a9f949305655fb5055a8d1 (diff) |
xts5: Fix XSetDeviceFocus-4
XDeviceKeyEvent and XKeyEvent are _not_ binary compatible. Expecting a random
byte location inside the device event to be of the value it'd have in a core
event is an amusing pasttime, but highly inappropriate for a test.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
-rw-r--r-- | xts5/XI/XSetDeviceFocus.m | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/xts5/XI/XSetDeviceFocus.m b/xts5/XI/XSetDeviceFocus.m index 181c61c8..be420907 100644 --- a/xts5/XI/XSetDeviceFocus.m +++ b/xts5/XI/XSetDeviceFocus.m @@ -379,6 +379,7 @@ XEventClass classes[2], nevclass; CHECK; if (config.alt_screen != -1) { + XDeviceKeyEvent *kev; altroot = RootWindow(display, config.alt_screen); trace("Testing with root of alternate screen as source (0x%x) and PointerRoot.", (unsigned)altroot); @@ -391,22 +392,25 @@ XEventClass classes[2], nevclass; if (!getevent(display, &ev)) { report("No event received."); FAIL; - } else if (ev.type != dkp && ev.type != dkr) { - report("First event was of unexpected type: %s.", eventname(ev.type)); - FAIL; - } else if (ev.xkey.window != altroot) { - report("First event had unexpected window: 0x%x instead of focus (altroot) 0x%x.", - (unsigned)ev.xkey.window, (unsigned)altroot); - FAIL; - } else if (!ev.xkey.same_screen) { - report("same_screen unexpectedly False."); - FAIL; - } else if (ev.xkey.root != altroot) { - report("First event had unexpected root window: 0x%x instead of 0x%x.", - (unsigned)ev.xkey.root, (unsigned)altroot); - FAIL; - } else - CHECK; + } else { + kev = (XDeviceKeyEvent*)&ev; + if (ev.type != dkp && ev.type != dkr) { + report("First event was of unexpected type: %s.", eventname(ev.type)); + FAIL; + } else if (kev->window != altroot) { + report("First event had unexpected window: 0x%x instead of focus (altroot) 0x%x.", + (unsigned)ev.xkey.window, (unsigned)altroot); + FAIL; + } else if (!kev->same_screen) { + report("same_screen unexpectedly False."); + FAIL; + } else if (kev->root != altroot) { + report("First event had unexpected root window: 0x%x instead of 0x%x.", + (unsigned)ev.xkey.root, (unsigned)altroot); + FAIL; + } else + CHECK; + } CHECKPASS(4); } else { report("Tested as far as possible with just one screen."); |