No functional changes, just for readability.

Signed-off-by: Peter Hutterer <[email protected]>
---
 dix/events.c |   79 ++++++++++++++++++++++++++++++---------------------------
 1 files changed, 42 insertions(+), 37 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index bc981a2..35548ea 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2045,6 +2045,47 @@ out:
     return rc;
 }
 
+static void
+ActivateImplicitGrab(DeviceIntPtr dev, ClientPtr client, WindowPtr win,
+                     xEvent *event, Mask deliveryMask)
+{
+    GrabRec tempGrab;
+    OtherInputMasks *inputMasks;
+    int type = event->u.u.type;
+
+    memset(&tempGrab, 0, sizeof(GrabRec));
+    tempGrab.next = NULL;
+    tempGrab.device = dev;
+    tempGrab.resource = client->clientAsMask;
+    tempGrab.window = win;
+    tempGrab.ownerEvents = (deliveryMask & OwnerGrabButtonMask) ? TRUE : FALSE;
+    tempGrab.eventMask = deliveryMask;
+    tempGrab.keyboardMode = GrabModeAsync;
+    tempGrab.pointerMode = GrabModeAsync;
+    tempGrab.confineTo = NullWindow;
+    tempGrab.cursor = NullCursor;
+    tempGrab.type = type;
+    if (type == ButtonPress)
+        tempGrab.grabtype = GRABTYPE_CORE;
+    else if (type == DeviceButtonPress)
+        tempGrab.grabtype = GRABTYPE_XI;
+    else
+    {
+        tempGrab.type = ((xGenericEvent*)event)->evtype;
+        tempGrab.grabtype = GRABTYPE_XI2;
+    }
+
+    /* get the XI and XI2 device mask */
+    inputMasks = wOtherInputMasks(win);
+    tempGrab.deviceMask = (inputMasks) ? inputMasks->inputEvents[dev->id]: 0;
+
+    if (inputMasks)
+        memcpy(tempGrab.xi2mask, inputMasks->xi2mask,
+                sizeof(tempGrab.xi2mask));
+
+    (*dev->deviceGrab.ActivateGrab)(dev, &tempGrab,
+            currentTime, TRUE | ImplicitGrabMask);
+}
 
 /**
  * @return TRUE if the event provided is any of core, XI or XI2 button
@@ -2145,43 +2186,7 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, 
xEvent
      * be activated on a core grab, stopping the XI events.
      */
     if (IsButtonPressEvent(pEvents) && deliveries && (!grab))
-    {
-       GrabRec tempGrab;
-        OtherInputMasks *inputMasks;
-
-        memset(&tempGrab, 0, sizeof(GrabRec));
-        tempGrab.next = NULL;
-       tempGrab.device = pDev;
-       tempGrab.resource = client->clientAsMask;
-       tempGrab.window = pWin;
-       tempGrab.ownerEvents = (deliveryMask & OwnerGrabButtonMask) ? TRUE : 
FALSE;
-       tempGrab.eventMask = deliveryMask;
-       tempGrab.keyboardMode = GrabModeAsync;
-       tempGrab.pointerMode = GrabModeAsync;
-       tempGrab.confineTo = NullWindow;
-       tempGrab.cursor = NullCursor;
-        tempGrab.type = type;
-        if (type == ButtonPress)
-            tempGrab.grabtype = GRABTYPE_CORE;
-        else if (type == DeviceButtonPress)
-            tempGrab.grabtype = GRABTYPE_XI;
-        else
-        {
-            tempGrab.type = ((xGenericEvent*)pEvents)->evtype;
-            tempGrab.grabtype = GRABTYPE_XI2;
-        }
-
-        /* get the XI and XI2 device mask */
-        inputMasks = wOtherInputMasks(pWin);
-        tempGrab.deviceMask = (inputMasks) ? 
inputMasks->inputEvents[pDev->id]: 0;
-
-        if (inputMasks)
-            memcpy(tempGrab.xi2mask, inputMasks->xi2mask,
-                    sizeof(tempGrab.xi2mask));
-
-       (*pDev->deviceGrab.ActivateGrab)(pDev, &tempGrab,
-                                        currentTime, TRUE | ImplicitGrabMask);
-    }
+        ActivateImplicitGrab(pDev, client, pWin, pEvents, deliveryMask);
     else if ((type == MotionNotify) && deliveries)
        pDev->valuator->motionHintWindow = pWin;
     else
-- 
1.7.4.4

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to