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.
This commit is contained in:
Peter Hutterer 2007-05-31 17:05:14 +09:30
parent 182ab3a3d5
commit 26b21157cf
3 changed files with 25 additions and 3 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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;