Add pScreen->NameWindowPixmap hook

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

(ABI break.)

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Daniel Stone 2014-04-03 18:22:50 +01:00 committed by Keith Packard
parent b4d0bec22c
commit b851ca968b
2 changed files with 15 additions and 1 deletions

View File

@ -239,6 +239,7 @@ ProcCompositeNameWindowPixmap(ClientPtr client)
WindowPtr pWin; WindowPtr pWin;
CompWindowPtr cw; CompWindowPtr cw;
PixmapPtr pPixmap; PixmapPtr pPixmap;
ScreenPtr pScreen;
int rc; int rc;
REQUEST(xCompositeNameWindowPixmapReq); REQUEST(xCompositeNameWindowPixmapReq);
@ -246,6 +247,8 @@ ProcCompositeNameWindowPixmap(ClientPtr client)
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq); REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess); VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess);
pScreen = pWin->drawable.pScreen;
if (!pWin->viewable) if (!pWin->viewable)
return BadMatch; return BadMatch;
@ -255,7 +258,7 @@ ProcCompositeNameWindowPixmap(ClientPtr client)
if (!cw) if (!cw)
return BadMatch; return BadMatch;
pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin); pPixmap = (*pScreen->GetWindowPixmap) (pWin);
if (!pPixmap) if (!pPixmap)
return BadMatch; return BadMatch;
@ -270,6 +273,14 @@ ProcCompositeNameWindowPixmap(ClientPtr client)
if (!AddResource(stuff->pixmap, RT_PIXMAP, (void *) pPixmap)) if (!AddResource(stuff->pixmap, RT_PIXMAP, (void *) pPixmap))
return BadAlloc; return BadAlloc;
if (pScreen->NameWindowPixmap) {
rc = pScreen->NameWindowPixmap(pWin, pPixmap, stuff->pixmap);
if (rc != Success) {
FreeResource(stuff->pixmap, RT_NONE);
return rc;
}
}
return Success; return Success;
} }

View File

@ -356,6 +356,8 @@ typedef Bool (*ReplaceScanoutPixmapProcPtr)(DrawablePtr, PixmapPtr, Bool);
typedef WindowPtr (*XYToWindowProcPtr)(ScreenPtr pScreen, typedef WindowPtr (*XYToWindowProcPtr)(ScreenPtr pScreen,
SpritePtr pSprite, int x, int y); SpritePtr pSprite, int x, int y);
typedef int (*NameWindowPixmapProcPtr)(WindowPtr, PixmapPtr, CARD32);
typedef struct _Screen { typedef struct _Screen {
int myNum; /* index of this instance in Screens[] */ int myNum; /* index of this instance in Screens[] */
ATOM id; ATOM id;
@ -466,6 +468,7 @@ typedef struct _Screen {
SetWindowPixmapProcPtr SetWindowPixmap; SetWindowPixmapProcPtr SetWindowPixmap;
GetScreenPixmapProcPtr GetScreenPixmap; GetScreenPixmapProcPtr GetScreenPixmap;
SetScreenPixmapProcPtr SetScreenPixmap; SetScreenPixmapProcPtr SetScreenPixmap;
NameWindowPixmapProcPtr NameWindowPixmap;
PixmapPtr pScratchPixmap; /* scratch pixmap "pool" */ PixmapPtr pScratchPixmap; /* scratch pixmap "pool" */