xserver: Branch 'mpx' - 2 commits

Peter Hutterer whot at kemper.freedesktop.org
Fri Jun 15 00:48:54 PDT 2007


 Xi/exevents.c |    4 +++-
 dix/events.c  |   31 +++++++++++++++++++++----------
 dix/grabs.c   |    2 ++
 3 files changed, 26 insertions(+), 11 deletions(-)

New commits:
diff-tree 3e894974cdd6a75683d4601f71622d1da7ec4395 (from 0aaf51546666f71e8d1711978bc7988ec2ecc7d9)
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Fri Jun 15 17:16:16 2007 +0930

    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.

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 2e9e826..622e8cc 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -279,6 +279,8 @@ ProcessOtherEvent(xEventPtr xE, DeviceIn
 	SetMaskForEvent(Motion_Filter(b), DeviceMotionNotify);
         if (!grab)
             if (CheckDeviceGrabs(device, xE, 0, count))
+                /* if a passive grab was activated, the event has been sent
+                 * already */
                 return;
 
     } else if (xE->u.u.type == DeviceButtonRelease) {
@@ -289,7 +291,7 @@ ProcessOtherEvent(xEventPtr xE, DeviceIn
 	*kptr &= ~bit;
 	if (device->valuator)
 	    device->valuator->motionHintWindow = NullWindow;
-	if (!--b->buttonsDown)
+        if (b->buttonsDown >= 1 && !--b->buttonsDown)
 	    b->motionMask = 0;
 	xE->u.u.detail = b->map[key];
 	if (xE->u.u.detail == 0)
diff --git a/dix/events.c b/dix/events.c
index ba1463a..4c5f5b9 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2963,6 +2963,7 @@ BorderSizeNotEmpty(DeviceIntPtr pDev, Wi
 /** 
  * "CheckPassiveGrabsOnWindow" checks to see if the event passed in causes a
  * 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 device Device that caused the event.
@@ -3064,16 +3065,26 @@ CheckPassiveGrabsOnWindow(
 }
 
 /**
-"CheckDeviceGrabs" handles both keyboard and pointer events that may cause
-a passive grab to be activated.  If the event is a keyboard event, the
-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
-it's descendants contain they pointer, the ancestors of the window that the
-pointer is in are then traced down starting at the focus window, otherwise no
-grabs are activated.  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
+ * CheckDeviceGrabs handles both keyboard and pointer events that may cause
+ * a passive grab to be activated.  
+ *
+ * If the event is a keyboard event, the 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 it's descendants
+ * contain the pointer, the ancestors of the window that the pointer is in
+ * are then traced down starting at the focus window, otherwise no grabs are
+ * activated.  
+ * 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
diff-tree 0aaf51546666f71e8d1711978bc7988ec2ecc7d9 (from 26b21157cf934ae387b15faa9ebb060120e6a0d6)
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Tue Jun 12 16:55:26 2007 +0930

    Zero deviceMask and genericMask when creating a grab via CreateGrab().

diff --git a/dix/grabs.c b/dix/grabs.c
index 714fea3..e1dd6c5 100644
--- a/dix/grabs.c
+++ b/dix/grabs.c
@@ -91,6 +91,7 @@ CreateGrab(
 		      (device == inputInfo.pointer));
     grab->window = window;
     grab->eventMask = eventMask;
+    grab->deviceMask = 0;
     grab->ownerEvents = ownerEvents;
     grab->keyboardMode = keyboardMode;
     grab->pointerMode = pointerMode;
@@ -104,6 +105,7 @@ CreateGrab(
     grab->detail.pMask = NULL;
     grab->confineTo = confineTo;
     grab->cursor = cursor;
+    grab->genericMasks = NULL;
     if (cursor)
 	cursor->refcnt++;
     return grab;


More information about the xorg-commit mailing list