summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2007-05-31 17:05:14 +0930
committerPeter Hutterer <peter@cs.unisa.edu.au>2007-05-31 17:05:14 +0930
commit26b21157cf934ae387b15faa9ebb060120e6a0d6 (patch)
treeb2043d1fea523f8b9f65df3b17c4bff86d0b21a4
parent182ab3a3d5b28daa86e6d6155e76ce759687ae6d (diff)
Add a deviceMask to the GrabRec and don't interfere with passiveGrabs.
This quickfixes event delivery problems with XI events when a grab was on. deviceMask is only used when the grab was from a ButtonPress to preserve potential XI event masks. This is not an ideal solution but it works until I have time to work on PassiveGrabs.
-rw-r--r--Xi/exevents.c3
-rw-r--r--dix/events.c21
-rw-r--r--include/inputstr.h4
3 files changed, 25 insertions, 3 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 98c28851c..2e9e8267f 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -126,6 +126,9 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count)
ValuatorClassPtr v = device->valuator;
deviceValuator *xV = (deviceValuator *) xE;
+ if (grab && grab->coreGrab && !device->deviceGrab.fromPassiveGrab)
+ return;
+
if (xE->u.u.type != DeviceValuator && xE->u.u.type != GenericEvent) {
DeviceIntPtr mouse = NULL, kbd = NULL;
GetSpritePosition(device, &rootX, &rootY);
diff --git a/dix/events.c b/dix/events.c
index 9dddf2c46..ba1463a01 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1839,6 +1839,10 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
* Deliver events to a window. At this point, we do not yet know if the event
* actually needs to be delivered. May activate a grab if the event is a
* button press.
+ *
+ * Core events are always delivered to the window owner. If the filter is
+ * something other than CantBeFiltered, the event is also delivered to other
+ * clients with the matching mask on the window.
*
* More than one event may be delivered at a time. This is the case with
* DeviceMotionNotifies which may be followed by DeviceValuator events.
@@ -1964,6 +1968,7 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
if ((type == ButtonPress) && deliveries && (!grab))
{
GrabRec tempGrab;
+ OtherInputMasks *inputMasks;
tempGrab.device = pDev;
tempGrab.resource = client->clientAsMask;
@@ -1975,6 +1980,11 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
tempGrab.confineTo = NullWindow;
tempGrab.cursor = NullCursor;
tempGrab.coreGrab = True;
+
+ /* get the XI device mask */
+ inputMasks = wOtherInputMasks(pWin);
+ tempGrab.deviceMask = (inputMasks) ? inputMasks->inputEvents[pDev->id]: 0;
+
tempGrab.genericMasks = NULL;
(*inputInfo.pointer->deviceGrab.ActivateGrab)(pDev, &tempGrab,
currentTime, TRUE);
@@ -3221,10 +3231,14 @@ DeliverGrabbedEvent(xEvent *xE, DeviceIntPtr thisDev,
grab);
} else
{
+ Mask mask = grab->eventMask;
+ if (grabinfo->fromPassiveGrab && (xE->u.u.type &
+ EXTENSION_EVENT_BASE))
+ mask = grab->deviceMask;
+
FixUpEventFromWindow(thisDev, xE, grab->window, None, TRUE);
deliveries = TryClientEvents(rClient(grab), xE, count,
- (Mask)grab->eventMask,
- filters[xE->u.u.type], grab);
+ mask, filters[xE->u.u.type], grab);
}
if (deliveries && (xE->u.u.type == MotionNotify
#ifdef XINPUT
@@ -5716,7 +5730,8 @@ IsInterferingGrab(ClientPtr client, DeviceIntPtr dev, xEvent* event)
{
if (it != dev)
{
- if (it->deviceGrab.grab && SameClient(it->deviceGrab.grab, client))
+ if (it->deviceGrab.grab && SameClient(it->deviceGrab.grab, client)
+ && !it->deviceGrab.fromPassiveGrab)
{
return TRUE;
}
diff --git a/include/inputstr.h b/include/inputstr.h
index a53588461..986232c79 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -117,6 +117,9 @@ typedef struct _GenericMaskRec {
* ButtonPressMask).
* If the grab is a device grab (GrabDevice), then the eventMask is a
* combination of event masks for a given XI event type (see SetEventInfo).
+ *
+ * If the grab is a result of a ButtonPress, then eventMask is the core mask
+ * and deviceMask is set to the XI event mask for the grab.
*/
typedef struct _GrabRec {
GrabPtr next; /* for chain of passive grabs */
@@ -135,6 +138,7 @@ typedef struct _GrabRec {
WindowPtr confineTo; /* always NULL for keyboards */
CursorPtr cursor; /* always NULL for keyboards */
Mask eventMask;
+ Mask deviceMask;
GenericMaskPtr genericMasks; /* null terminated list */
} GrabRec;