[PATCH 2/8] dix: split client list retrieval out of DeliverEventToClients

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


No functional change, but "other" was renamed to "clients".

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

diff --git a/dix/events.c b/dix/events.c
index ec4bf59..cab5185 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2037,31 +2037,26 @@ DeliverToWindowOwner(DeviceIntPtr dev, WindowPtr win,
     return EVENT_NOT_DELIVERED;
 }
 
+
 /**
- * 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.
+ * Get the list of clients that should be tried for event delivery on the
+ * given window.
  */
-static enum EventDeliveryState
-DeliverEventToClients(DeviceIntPtr dev, WindowPtr win, xEvent *events,
-                      int count, Mask filter, GrabPtr grab,
-                      ClientPtr *client_return, Mask *mask_return)
+static InputClients *
+GetClientsForDelivery(DeviceIntPtr dev, WindowPtr win,
+                      xEvent *events, Mask filter)
 {
-    int attempt;
-    enum EventDeliveryState rc = EVENT_SKIP;
-    InputClients *other;
+    InputClients *clients = NULL;
 
     if (core_get_type(events) != 0)
-        other = (InputClients *)wOtherClients(win);
+        clients = (InputClients *)wOtherClients(win);
     else if (xi2_get_type(events) != 0)
     {
         OtherInputMasks *inputMasks = wOtherInputMasks(win);
         /* Has any client selected for the event? */
         if (!GetWindowXI2Mask(dev, win, events))
             goto out;
-        other = inputMasks->inputClients;
+        clients = inputMasks->inputClients;
     } else {
         OtherInputMasks *inputMasks = wOtherInputMasks(win);
         /* Has any client selected for the event? */
@@ -2069,9 +2064,34 @@ DeliverEventToClients(DeviceIntPtr dev, WindowPtr win, xEvent *events,
             !(inputMasks->inputEvents[dev->id] & filter))
             goto out;
 
-        other = inputMasks->inputClients;
+        clients = inputMasks->inputClients;
     }
 
+out:
+    return clients;
+}
+
+/**
+ * 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
+DeliverEventToClients(DeviceIntPtr dev, 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;
+
+    other = GetClientsForDelivery(dev, win, events, filter);
+
+    if (!other)
+        goto out;
+
     rc = EVENT_NOT_DELIVERED;
 
     for (; other; other = other->next)
-- 
1.7.5.1



More information about the xorg-devel mailing list