Only decrement buttonsDown when the button count is greater than 0.
Device drivers flush their buttons on device init and cause a button down
event to be generated. If we unconditionally decrease the buttons, we won't be
able to ever get a passive device grab.
Format documentation for CheckDeviceGrabs to make it readable.
(cherry picked from commit 3e894974cd
)
Conflicts:
Xi/exevents.c
This commit is contained in:
parent
24ee89fd60
commit
87564543d9
|
@ -248,7 +248,9 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr other, int count)
|
||||||
SetMaskForEvent(Motion_Filter(b), DeviceMotionNotify);
|
SetMaskForEvent(Motion_Filter(b), DeviceMotionNotify);
|
||||||
if (!grab)
|
if (!grab)
|
||||||
if (CheckDeviceGrabs(other, xE, 0, count))
|
if (CheckDeviceGrabs(other, xE, 0, count))
|
||||||
return;
|
/* if a passive grab was activated, the event has been sent
|
||||||
|
* already */
|
||||||
|
return;
|
||||||
|
|
||||||
} else if (xE->u.u.type == DeviceButtonRelease) {
|
} else if (xE->u.u.type == DeviceButtonRelease) {
|
||||||
if (!b)
|
if (!b)
|
||||||
|
@ -258,7 +260,7 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr other, int count)
|
||||||
*kptr &= ~bit;
|
*kptr &= ~bit;
|
||||||
if (other->valuator)
|
if (other->valuator)
|
||||||
other->valuator->motionHintWindow = NullWindow;
|
other->valuator->motionHintWindow = NullWindow;
|
||||||
if (!--b->buttonsDown)
|
if (b->buttonsDown >= 1 && !--b->buttonsDown)
|
||||||
b->motionMask = 0;
|
b->motionMask = 0;
|
||||||
xE->u.u.detail = b->map[key];
|
xE->u.u.detail = b->map[key];
|
||||||
if (xE->u.u.detail == 0)
|
if (xE->u.u.detail == 0)
|
||||||
|
|
31
dix/events.c
31
dix/events.c
|
@ -2629,6 +2629,7 @@ BorderSizeNotEmpty(WindowPtr pWin)
|
||||||
/**
|
/**
|
||||||
* "CheckPassiveGrabsOnWindow" checks to see if the event passed in causes a
|
* "CheckPassiveGrabsOnWindow" checks to see if the event passed in causes a
|
||||||
* passive grab set on the window to be activated.
|
* passive grab set on the window to be activated.
|
||||||
|
* If a passive grab is activated, the event will be delivered to the client.
|
||||||
*
|
*
|
||||||
* @param pWin The window that may be subject to a passive grab.
|
* @param pWin The window that may be subject to a passive grab.
|
||||||
* @param device Device that caused the event.
|
* @param device Device that caused the event.
|
||||||
|
@ -2728,16 +2729,26 @@ CheckPassiveGrabsOnWindow(
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
"CheckDeviceGrabs" handles both keyboard and pointer events that may cause
|
* CheckDeviceGrabs handles both keyboard and pointer events that may cause
|
||||||
a passive grab to be activated. If the event is a keyboard event, the
|
* a passive grab to be activated.
|
||||||
ancestors of the focus window are traced down and tried to see if they have
|
*
|
||||||
any passive grabs to be activated. If the focus window itself is reached and
|
* If the event is a keyboard event, the ancestors of the focus window are
|
||||||
it's descendants contain they pointer, the ancestors of the window that the
|
* traced down and tried to see if they have any passive grabs to be
|
||||||
pointer is in are then traced down starting at the focus window, otherwise no
|
* activated. If the focus window itself is reached and it's descendants
|
||||||
grabs are activated. If the event is a pointer event, the ancestors of the
|
* contain the pointer, the ancestors of the window that the pointer is in
|
||||||
window that the pointer is in are traced down starting at the root until
|
* are then traced down starting at the focus window, otherwise no grabs are
|
||||||
CheckPassiveGrabs causes a passive grab to activate or all the windows are
|
* activated.
|
||||||
tried. PRH
|
* If the event is a pointer event, the ancestors of the window that the
|
||||||
|
* pointer is in are traced down starting at the root until CheckPassiveGrabs
|
||||||
|
* causes a passive grab to activate or all the windows are
|
||||||
|
* tried. PRH
|
||||||
|
*
|
||||||
|
* If a grab is activated, the event has been sent to the client already!
|
||||||
|
*
|
||||||
|
* @param device The device that caused the event.
|
||||||
|
* @param xE The event to handle (most likely {Device}ButtonPress).
|
||||||
|
* @param count Number of events in list.
|
||||||
|
* @return TRUE if a grab has been activated or false otherwise.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
|
|
Loading…
Reference in New Issue