[PATCH xserver 07/12] dix: split DeliverEventToWindowMask up a bit more.

Peter Hutterer peter.hutterer at who-t.net
Thu Jun 2 00:13:41 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 |   52 +++++++++++++++++++++++++++++++++-------------------
 1 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index 71ea516..3d41231 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2076,35 +2076,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;
 
-    if (!GetClientsForDelivery(dev, win, events, filter, &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))
@@ -2125,12 +2117,34 @@ 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;
+
+    if (!GetClientsForDelivery(dev, win, events, filter, &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