summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2008-04-10 14:36:57 +0930
committerPeter Hutterer <peter@cs.unisa.edu.au>2008-04-10 14:42:26 +0930
commita88386ee277d136caaaeec305f8753f23f9b6274 (patch)
tree5dacfa038d3cac556e1402b7063b873f9ec5c7fb
parent48249425275cc90242497aee9968e5f1ffc86698 (diff)
Xi: only DeliverFocusedEvents if the event is not a pointer event.
A pointer device may have a focus class, but even if so, pointer events must be delivered to the sprite window, not the focus window.
-rw-r--r--Xi/exevents.c28
-rw-r--r--dix/events.c4
-rw-r--r--include/dix.h1
3 files changed, 30 insertions, 3 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c
index ba7f3b2bb..a93fef452 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -104,6 +104,32 @@ RegisterOtherDevice(DeviceIntPtr device)
device->public.realInputProc = ProcessOtherEvent;
}
+_X_EXPORT Bool
+IsPointerEvent(xEvent* xE)
+{
+ switch(xE->u.u.type)
+ {
+ case ButtonPress:
+ case ButtonRelease:
+ case MotionNotify:
+ case EnterNotify:
+ case LeaveNotify:
+ return TRUE;
+ default:
+ if (xE->u.u.type == DeviceButtonPress ||
+ xE->u.u.type == DeviceButtonRelease ||
+ xE->u.u.type == DeviceMotionNotify ||
+ xE->u.u.type == DeviceEnterNotify ||
+ xE->u.u.type == DeviceLeaveNotify ||
+ xE->u.u.type == ProximityIn ||
+ xE->u.u.type == ProximityOut)
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
/**
* Copy the device->key into master->key and send a mapping notify to the
* clients if appropriate.
@@ -830,7 +856,7 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count)
if (grab)
DeliverGrabbedEvent(xE, device, deactivateDeviceGrab, count);
- else if (device->focus)
+ else if (device->focus && !IsPointerEvent(xE))
DeliverFocusedEvent(device, xE, GetSpriteWindow(device), count);
else
DeliverDeviceEvents(GetSpriteWindow(device), xE, NullGrab, NullWindow,
diff --git a/dix/events.c b/dix/events.c
index 305502ac9..144591469 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1397,7 +1397,7 @@ ComputeFreezes(void)
replayDev->spriteInfo->sprite->spriteTrace[i])
{
if (!CheckDeviceGrabs(replayDev, xE, i+1, count)) {
- if (replayDev->focus)
+ if (replayDev->focus && !IsPointerEvent(xE))
DeliverFocusedEvent(replayDev, xE, w, count);
else
DeliverDeviceEvents(w, xE, NullGrab, NullWindow,
@@ -1407,7 +1407,7 @@ ComputeFreezes(void)
}
}
/* must not still be in the same stack */
- if (replayDev->focus)
+ if (replayDev->focus && !IsPointerEvent(xE))
DeliverFocusedEvent(replayDev, xE, w, count);
else
DeliverDeviceEvents(w, xE, NullGrab, NullWindow, replayDev, count);
diff --git a/include/dix.h b/include/dix.h
index e00df29a2..57ffee9b9 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -615,6 +615,7 @@ extern int XItoCoreType(int xi_type);
extern Bool DevHasCursor(DeviceIntPtr pDev);
extern Bool IsPointerDevice( DeviceIntPtr dev);
extern Bool IsKeyboardDevice(DeviceIntPtr dev);
+extern Bool IsPointerEvent(xEvent* xE);
/*
* These are deprecated compatibility functions and will be removed soon!