Blob Blame History Raw
From 13f334e3699d8ca1fe02d07b1cbff8a348c47e49 Mon Sep 17 00:00:00 2001
From: Adam Jackson <ajax@redhat.com>
Date: Wed, 2 Oct 2013 11:01:16 -0400
Subject: [PATCH 2/6] dix: Add PostDispatchCallback

This is required to Xineramify the Damage extension, since we need to
collect regions across screens.  You can't quite use FlushCallback for
this since WriteEventsToClient can itself trigger FlushCallback and you
recurse.

There are probably other cases where this would be useful though, for
example some of our abuse of BlockHandler may want to move to this
callback.

Signed-off-by: Adam Jackson <ajax@redhat.com>
---
 dix/dispatch.c      | 5 ++++-
 include/dixstruct.h | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/dix/dispatch.c b/dix/dispatch.c
index 4fecfea..53cabdf 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -167,6 +167,7 @@ static int nextFreeClientID;    /* always MIN free client ID */
 static int nClients;            /* number of authorized clients */
 
 CallbackListPtr ClientStateCallback;
+CallbackListPtr PostDispatchCallback;
 
 /* dispatchException & isItTimeToYield must be declared volatile since they
  * are modified by signal handlers - otherwise optimizer may assume it doesn't
@@ -428,9 +429,11 @@ Dispatch(void)
                     result = BadLength;
                 else {
                     result = XaceHookDispatch(client, client->majorOp);
-                    if (result == Success)
+                    if (result == Success) {
                         result =
                             (*client->requestVector[client->majorOp]) (client);
+                        CallCallbacks(&PostDispatchCallback, &result);
+                    }
                     XaceHookAuditEnd(client, result);
                 }
 #ifdef XSERVER_DTRACE
diff --git a/include/dixstruct.h b/include/dixstruct.h
index 456e633..d55b047 100644
--- a/include/dixstruct.h
+++ b/include/dixstruct.h
@@ -39,6 +39,7 @@ SOFTWARE.
  */
 
 extern _X_EXPORT CallbackListPtr ClientStateCallback;
+extern _X_EXPORT CallbackListPtr PostDispatchCallback;
 
 typedef struct {
     ClientPtr client;
-- 
1.8.3.1