[PATCH xserver v2 2/5] dix: Add a callback chain for window property state change

Pekka Paalanen ppaalanen at gmail.com
Fri Dec 9 12:24:13 UTC 2016


From: Adam Jackson <ajax at redhat.com>

This will be used by in-server features that need to react to property
changes. The first one will be _XWAYLAND_ALLOW_COMMITS.

Signed-off-by: Adam Jackson <ajax at redhat.com>
[Pekka: add commit message body]
Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
 dix/property.c     | 9 +++++++++
 include/property.h | 8 ++++++++
 2 files changed, 17 insertions(+)

diff --git a/dix/property.c b/dix/property.c
index 3447bca..ff1d669 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -105,10 +105,17 @@ dixLookupProperty(PropertyPtr *result, WindowPtr pWin, Atom propertyName,
     return rc;
 }
 
+CallbackListPtr PropertyStateCallback;
+
 static void
 deliverPropertyNotifyEvent(WindowPtr pWin, int state, PropertyPtr pProp)
 {
     xEvent event;
+    PropertyStateRec rec = {
+        .win = pWin,
+        .prop = pProp,
+        .state = state
+    };
     UpdateCurrentTimeIf();
     event = (xEvent) {
         .u.property.window = pWin->drawable.id,
@@ -117,6 +124,8 @@ deliverPropertyNotifyEvent(WindowPtr pWin, int state, PropertyPtr pProp)
         .u.property.time = currentTime.milliseconds,
     };
     event.u.u.type = PropertyNotify;
+
+    CallCallbacks(&PropertyStateCallback, &rec);
     DeliverEvents(pWin, &event, 1, (WindowPtr) NULL);
 }
 
diff --git a/include/property.h b/include/property.h
index be875e9..d7ccff3 100644
--- a/include/property.h
+++ b/include/property.h
@@ -51,6 +51,14 @@ SOFTWARE.
 
 typedef struct _Property *PropertyPtr;
 
+typedef struct _PropertyStateRec {
+    WindowPtr win;
+    PropertyPtr prop;
+    int state;
+} PropertyStateRec;
+
+extern CallbackListPtr PropertyStateCallback;
+
 extern _X_EXPORT int dixLookupProperty(PropertyPtr * /*result */ ,
                                        WindowPtr /*pWin */ ,
                                        Atom /*proprty */ ,
-- 
2.7.3



More information about the xorg-devel mailing list