[PATCH v2] Add pScreen->NameWindowPixmap hook

Daniel Stone daniels at collabora.com
Thu Apr 3 10:22:50 PDT 2014


This hook allows drivers to be notified when a pixmap gains a new ID.

(ABI break.)

Signed-off-by: Daniel Stone <daniels at collabora.com>
---
 composite/compext.c  | 13 ++++++++++++-
 include/scrnintstr.h |  3 +++
 2 files changed, 15 insertions(+), 1 deletion(-)

v2: Change return type to return an error directly. (ajax)
    Call FreeResource instead of DestroyPixmap. (ajax)
    Hoist pScreen.

diff --git a/composite/compext.c b/composite/compext.c
index a945f72..cadedbd 100644
--- a/composite/compext.c
+++ b/composite/compext.c
@@ -239,6 +239,7 @@ ProcCompositeNameWindowPixmap(ClientPtr client)
     WindowPtr pWin;
     CompWindowPtr cw;
     PixmapPtr pPixmap;
+    ScreenPtr pScreen;
     int rc;
 
     REQUEST(xCompositeNameWindowPixmapReq);
@@ -246,6 +247,8 @@ ProcCompositeNameWindowPixmap(ClientPtr client)
     REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
     VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess);
 
+    pScreen = pWin->drawable.pScreen;
+
     if (!pWin->viewable)
         return BadMatch;
 
@@ -255,7 +258,7 @@ ProcCompositeNameWindowPixmap(ClientPtr client)
     if (!cw)
         return BadMatch;
 
-    pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin);
+    pPixmap = (*pScreen->GetWindowPixmap) (pWin);
     if (!pPixmap)
         return BadMatch;
 
@@ -270,6 +273,14 @@ ProcCompositeNameWindowPixmap(ClientPtr client)
     if (!AddResource(stuff->pixmap, RT_PIXMAP, (void *) pPixmap))
         return BadAlloc;
 
+    if (pScreen->NameWindowPixmap) {
+        rc = pScreen->NameWindowPixmap(pWin, pPixmap, stuff->pixmap);
+        if (rc != Success) {
+            FreeResource(stuff->pixmap, RT_NONE);
+            return rc;
+        }
+    }
+
     return Success;
 }
 
diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index 86da789..c122a22 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -353,6 +353,8 @@ typedef Bool (*StopPixmapTrackingProcPtr)(PixmapPtr, PixmapPtr);
 
 typedef Bool (*ReplaceScanoutPixmapProcPtr)(DrawablePtr, PixmapPtr, Bool);
 
+typedef int (*NameWindowPixmapProcPtr)(WindowPtr, PixmapPtr, CARD32);
+
 typedef struct _Screen {
     int myNum;                  /* index of this instance in Screens[] */
     ATOM id;
@@ -463,6 +465,7 @@ typedef struct _Screen {
     SetWindowPixmapProcPtr SetWindowPixmap;
     GetScreenPixmapProcPtr GetScreenPixmap;
     SetScreenPixmapProcPtr SetScreenPixmap;
+    NameWindowPixmapProcPtr NameWindowPixmap;
 
     PixmapPtr pScratchPixmap;   /* scratch pixmap "pool" */
 
-- 
1.9.0



More information about the xorg-devel mailing list