From 2e5ee5c5f7728e288a915ce61b57385f98439744 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 5 Jan 2012 05:17:03 -0500 Subject: 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 Reviewed-by: Chase Douglas --- xts5/XI/XSetDeviceFocus.m | 36 ++++++++++++++++++++---------------- 1 file 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."); -- cgit v1.2.3