[PATCH xserver 1/2] dix: Add a RootWindowCreatedCallback callback list

Aaron Plattner aplattner at nvidia.com
Mon Sep 26 15:01:56 PDT 2011


It is sometimes useful to be able execute code after the root window
has been created, which happens after driver and extension init.
Instead of doing something hacky like wrapping CreateWindow or
installing a wakeup handler, add a callback list that modules can use.

Signed-off-by: Aaron Plattner <aplattner at nvidia.com>
---
 dix/window.c  |    4 ++++
 include/dix.h |    2 ++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/dix/window.c b/dix/window.c
index 1953f02..f8e47cf 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -146,6 +146,8 @@ Equipment Corporation.
 
 Bool bgNoneRoot = FALSE;
 
+CallbackListPtr RootWindowCreatedCallback;
+
 static unsigned char _back_lsb[4] = {0x88, 0x22, 0x44, 0x11};
 static unsigned char _back_msb[4] = {0x11, 0x44, 0x22, 0x88};
 
@@ -584,6 +586,8 @@ InitRootWindow(WindowPtr pWin)
     (*pScreen->ChangeWindowAttributes)(pWin, backFlag);
 
     MapWindow(pWin, serverClient);
+
+    CallCallbacks(&RootWindowCreatedCallback, pWin);
 }
 
 /* Set the region to the intersection of the rectangle and the
diff --git a/include/dix.h b/include/dix.h
index b1bf9ed..de3019f 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -569,6 +569,8 @@ typedef struct {
     DeviceIntPtr device;
 } DeviceEventInfoRec;
 
+extern _X_EXPORT CallbackListPtr RootWindowCreatedCallback;
+
 extern int XItoCoreType(int xi_type);
 extern Bool DevHasCursor(DeviceIntPtr pDev);
 extern Bool _X_EXPORT IsPointerDevice( DeviceIntPtr dev);
-- 
1.7.4.1



More information about the xorg-devel mailing list