[PATCH 4/8] dix: split DeliverEventToWindowMask up a bit more.

Peter Hutterer peter.hutterer at who-t.net
Thu May 26 22:13:54 PDT 2011


Move out the actual event delivery, it needs to be used from elsewhere.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 dix/events.c |   56 +++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 35 insertions(+), 21 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index 076a46b..791441b 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2072,37 +2072,27 @@ out:
 }
 
 /**
- * Deliver events to clients registered on the window.
- *
- * @param client_return On successful delivery, set to the recipient.
- * @param mask_return On successful delivery, set to the recipient's event
- * mask for this event.
+ * Try delivery on each client in inputclients, provided the event mask
+ * accepts it and there is no interfering core grab..
  */
 static enum EventDeliveryState
-DeliverEventToWindowMask(DeviceIntPtr dev, WindowPtr win, xEvent *events,
-                         int count, Mask filter, GrabPtr grab,
-                         ClientPtr *client_return, Mask *mask_return)
+DeliverEventToInputClients(DeviceIntPtr dev, InputClients *inputclients,
+                           WindowPtr win, xEvent *events,
+                           int count, Mask filter, GrabPtr grab,
+                           ClientPtr *client_return, Mask *mask_return)
 {
     int attempt;
-    enum EventDeliveryState rc = EVENT_SKIP;
-    InputClients *other;
+    enum EventDeliveryState rc = EVENT_NOT_DELIVERED;
 
-    other = GetClientsForDelivery(dev, win, events, filter);
-
-    if (!other)
-        goto out;
-
-    rc = EVENT_NOT_DELIVERED;
-
-    for (; other; other = other->next)
+    for (; inputclients; inputclients = inputclients->next)
     {
         Mask mask;
-        ClientPtr client = rClient(other);
+        ClientPtr client = rClient(inputclients);
 
         if (IsInterferingGrab(client, dev, events))
             continue;
 
-        mask = GetEventMask(dev, events, other);
+        mask = GetEventMask(dev, events, inputclients);
 
         if (XaceHook(XACE_RECEIVE_ACCESS, client, win,
                     events, count))
@@ -2123,12 +2113,36 @@ DeliverEventToWindowMask(DeviceIntPtr dev, WindowPtr win, xEvent *events,
         }
     }
 
-out:
     return rc;
 }
 
 
 /**
+ * Deliver events to clients registered on the window.
+ *
+ * @param client_return On successful delivery, set to the recipient.
+ * @param mask_return On successful delivery, set to the recipient's event
+ * mask for this event.
+ */
+static enum EventDeliveryState
+DeliverEventToWindowMask(DeviceIntPtr dev, WindowPtr win, xEvent *events,
+                         int count, Mask filter, GrabPtr grab,
+                         ClientPtr *client_return, Mask *mask_return)
+{
+    InputClients *clients;
+
+    clients = GetClientsForDelivery(dev, win, events, filter);
+
+    if (!clients)
+        return EVENT_SKIP;
+
+    return DeliverEventToInputClients(dev, clients, win, events, count, filter,
+                                      grab, client_return, mask_return);
+
+}
+
+
+/**
  * 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.
-- 
1.7.5.1



More information about the xorg-devel mailing list