[PATCH XTS v2 2/2] xts5: fix XSetDeviceFocus-5

Peter Hutterer peter.hutterer at who-t.net
Thu Jan 5 14:28:52 PST 2012


t003() selects for key events on the root window. t005() takes over and then
complains when the focus correctly follows the pointer and an event is
delivered to the root window. If you don't expect events on the root window,
unselect them first.

We could also XCloseDisplay() at the end of each test but who knows what that
does to the other tests.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
Reviewed-by: Chase Douglas <chase.douglas at canonical.com>
---
Changes to v1:
- hah! there is a macro for the "no event" class after all. use that.

Chase, I figured your rev-by still stands given that this is the same effect
but much saner.

 xts5/XI/XSetDeviceFocus.m |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/xts5/XI/XSetDeviceFocus.m b/xts5/XI/XSetDeviceFocus.m
index be42090..0fafc4f 100644
--- a/xts5/XI/XSetDeviceFocus.m
+++ b/xts5/XI/XSetDeviceFocus.m
@@ -430,6 +430,7 @@ XEvent	ev;
 int	n, sav_revert;
 int	dkp, dkr;
 XEventClass classes[2];
+XEventClass none_class;
 
 	if (noext(0))
 		return;
@@ -446,6 +447,9 @@ XEventClass classes[2];
 	DeviceKeyRelease(device, dkr, classes[1]);
 	win = defwin(display);
 	XSelectExtensionEvent(display, win, classes, 2);
+	/* previous test selected for events on the root window */
+	NoExtensionEvent(device, 0, none_class);
+	XSelectExtensionEvent(display, DRW(display), &none_class, 1);
 
 	focus = FollowKeyboard;
 	XCALL;
-- 
1.7.7.4


More information about the xorg-devel mailing list