Compare commits

...

53 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult fdd85258ad Revert "DEBUG 13"
This reverts commit 3ea4291907ea00bf3cf2e73f2e3ab268a2e1c1b4.
2025-04-25 15:43:33 +02:00
Enrico Weigelt, metux IT consult 68746123a5 DEBUG 13 2025-04-25 15:43:33 +02:00
Enrico Weigelt, metux IT consult efa4633733 glamor: use PixmapDestroy hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new pixmap destroy notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:33 +02:00
Enrico Weigelt, metux IT consult 7d0c83c8ce exa: use PixmapDestroy hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new pixmap destroy notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:33 +02:00
Enrico Weigelt, metux IT consult b7efaadba0 damage: use PixmapDestroy hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new pixmap destroy notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:33 +02:00
Enrico Weigelt, metux IT consult 2244e57dac Xext: xv: use PixmapDestroy hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new pixmap destroy notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:33 +02:00
Enrico Weigelt, metux IT consult 5cdcf18555 Xext: shm: use PixmapDestroy hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new pixmap destroy notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:33 +02:00
Enrico Weigelt, metux IT consult fdd17e158e dix: add per-screen pixmap destructor mechanism
Right now, extension specific pixmap destruction procedures are implemented
by wrapping the ScreenRec's DestroyPixmap() proc pointer: the extensions are
storing the original pointer in their private data and putting in their own one.
On each call, their proc restores the original one, calls it, and switches back
again. When multiple extensions doing so, they're forming a kind of daisy chain.
(the same is done for lots of other procs)

While that approach is looking nice and elegant on the drawing board, it's
complicated, dangerous like a chainsaw and makes debugging hard, leading to
pretty blurred API borders.

It's even getting worse: the proc also has to do ref counting, and only destroy
the pixmap if refconter reaching zero - that's all done in the individual screen
drivers. Therefore, all extensions must check for refcnt == 1, in order to know
when to really act.

This commit introduces a simple approach for letting extension hook into the
pixmap destruction safely, w/o having to care much about side effects with
the call chain. Extensions now can simply register their destructor proc
(and an opaque pointer) and get called back - w/o ever having to mess with
the ScreenRec's internal structures.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:33 +02:00
Enrico Weigelt, metux IT consult 4f96e73717 dri3: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:33 +02:00
Enrico Weigelt, metux IT consult 6dff41795b render: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:33 +02:00
Enrico Weigelt, metux IT consult a66f25a240 xvmc: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:33 +02:00
Enrico Weigelt, metux IT consult 67f388835f xv: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:33 +02:00
Enrico Weigelt, metux IT consult cc993c3133 xfixes: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:33 +02:00
Enrico Weigelt, metux IT consult 938e006c43 Xext: shm: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:33 +02:00
Enrico Weigelt, metux IT consult 8e43be7a3a dix: add per-screen close notify hook
Right now, extension specific actions on screen closing implemented by wrapping
the ScreenRec's PositionWindow() proc pointer: the extensions are storing the
original pointer in their private data and putting in their own one. On each
call, their proc restores the original one, calls it, and switches back again.
When multiple extensions doing so, they're forming a kind of daisy chain.
(the same is done for lots of other procs)

While that approach is looking nice and elegant on the drawing board, it's
complicated, dangerous like a chainsaw and makes debugging hard, leading to
pretty blurred API borders.

This commit introduces a simple approach for letting extension hook into the
screen closing path safely, w/o having to care much about side effects with
the call chain. Extensions now can simply register their hook proc (and an
opaque pointer) and get called back - w/o ever having to mess with the
ScreenRec's internal structures. These hooks are called before the original
vector (usually handled by DDX/screen driver directly) is called.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:33 +02:00
Enrico Weigelt, metux IT consult 242d11e338 rootless: use window position notify hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new window position notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:33 +02:00
Enrico Weigelt, metux IT consult 7e52c2a486 dbe: use window position notify hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new window position notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:33 +02:00
Enrico Weigelt, metux IT consult 2da166e165 composite: use window position notify hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new window position notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:33 +02:00
Enrico Weigelt, metux IT consult cffe310ed6 dix: add per-screen window position notify hook
Right now, extension specific actions on window positioning are implemented
by wrapping the ScreenRec's PositionWindow() proc pointer: the extensions are
storing the original pointer in their private data and putting in their own one.
On each call, their proc restores the original one, calls it, and switches back
again. When multiple extensions doing so, they're forming a kind of daisy chain.
(the same is done for lots of other procs)

While that approach is looking nice and elegant on the drawing board, it's
complicated, dangerous like a chainsaw and makes debugging hard, leading to
pretty blurred API borders.

This commit introduces a simple approach for letting extension hook into the
window positioning path safely, w/o having to care much about side effects
with the call chain. Extensions now can simply register their hook proc
(and an opaque pointer) and get called back - w/o ever having to mess with
the ScreenRec's internal structures. These hooks are called before the original
vector (usually handled by DDX/screen driver directly) is called.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:33 +02:00
Enrico Weigelt, metux IT consult af14ff6b62 xwayland: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new window destructor hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:33 +02:00
Enrico Weigelt, metux IT consult af3c898daa xfree86: dri: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new window destructor hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:33 +02:00
Enrico Weigelt, metux IT consult 93fadb1d7a xfree86: xv: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new window destructor hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:32 +02:00
Enrico Weigelt, metux IT consult 6c97fda209 kdrive: xv: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new window destructor hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:32 +02:00
Enrico Weigelt, metux IT consult b59a5e85c4 rootless: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new window destructor hook instead.

2do: should check whether it's better to directly assign the screen procs,
w/o any wrapping at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:32 +02:00
Enrico Weigelt, metux IT consult aecb404ffc composite: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new window destructor hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:32 +02:00
Enrico Weigelt, metux IT consult 3319de0d2b xv: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new window destructor hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:32 +02:00
Enrico Weigelt, metux IT consult fa21d6fd0b damage: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new window destructor hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:32 +02:00
Enrico Weigelt, metux IT consult 9577590f98 render: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new window destructor hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:32 +02:00
Enrico Weigelt, metux IT consult afa1352985 present: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new window destructor hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:32 +02:00
Enrico Weigelt, metux IT consult 2494b55db2 dbe: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new window destructor hook instead.
2025-04-25 15:43:32 +02:00
Enrico Weigelt, metux IT consult 98fad8b1f1 dix: add per-screen window destructor hook
Right now, extension specific window destruction procedures are implemented
by wrapping the ScreenRec's DestroyWindow() proc pointer: the extensions are
storing the original pointer in their private data and putting in their own one.
On each call, their proc restores the original one, calls it, and switches back
again. When multiple extensions doing so, they're forming a kind of daisy chain.
(the same is done for lots of other procs)

While that approach is looking nice and elegant on the drawing board, it's
complicated, dangerous like a chainsaw and makes debugging hard, leading to
pretty blurred API borders.

This commit introduces a simple approach for letting extension hook into the
window destruction safely, w/o having to care much about side effects with
the call chain. Extensions now can simply register their destructor proc
(and an opaque pointer) and get called back - w/o ever having to mess with
the ScreenRec's internal structures.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:32 +02:00
Enrico Weigelt, metux IT consult 09f25e0e9e dix: make DeleteCallbackList() non-static and document it
Allow using it by other places outside this file, so we can also support
callback lists in dynamically allocated structures:

Those cases need to explicitly call DeleteCallbackList() before free()ing
the structures - otherwise we're getting heap corruptions, because the
actual deletion can happen asynchronously.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:32 +02:00
Enrico Weigelt, metux IT consult 4cc92e13b5 (!1705) xwin: drop wrapping on ScreenRec->ModifyPixmapHeader()
Instead of complicated wrapping, just call fbModifyPixmapHeader() directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:26 +02:00
Enrico Weigelt, metux IT consult e4559f5737 (!1705) xwin: drop winResizeWindowMultiWindow()
This wrapping function for Screen->ResizeWindow() is does nothing more than
just call the original functions. So no need to keep wrapping it at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:26 +02:00
Enrico Weigelt, metux IT consult 491093bb61 (!1705) xwin: drop wrapping on ScreenRec->MoveWindow()
Instead of complicated wrapping, just call fbMoveWindow() directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:26 +02:00
Enrico Weigelt, metux IT consult 7ca497cc96 (!1705) xwin: drop wrapping on ScreenRec->RestackWindow()
This proc vector is optional (callers check for non-null) and neither fb nor
mi set it, so we can just assign our function directly. No need for wrapping.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:26 +02:00
Enrico Weigelt, metux IT consult 3d99c87d39 (!1705) xwin: drop wrapping on ScreenRec->ReparentWindow()
This proc vector is optional (callers check for non-null) and neither fb nor
mi set it, so we can just assign our function directly. No need for wrapping.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:26 +02:00
Enrico Weigelt, metux IT consult 7eee4fbc76 (!1705) xwin: drop wrapping on ScreenRec->UnrealizeWindow()
Instead of complicated wrapping, just call fbUnrealizeWindow() directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:26 +02:00
Enrico Weigelt, metux IT consult e8b370c9a9 (!1705) xwin: drop wrapping on ScreenRec->RealizeWindow()
Instead of complicated wrapping, just call fbRealizeWindow() directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:26 +02:00
Enrico Weigelt, metux IT consult 903f873084 (!1705) xwin: drop wrapping on ScreenRec->SetShape()
Instead of complicated wrapping, just call fbSetShape() directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:26 +02:00
Enrico Weigelt, metux IT consult 03e2f11217 (!1705) xwin: drop winCopyWindowMultiWindow()
This wrapping function for Screen->CopyWindow() is does nothing more than
just call the original functions. So no need to keep wrapping it at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:26 +02:00
Enrico Weigelt, metux IT consult 69f3f94e21 (!1705) xwin: call winFinishScreenInitFB() directly
Both engines, GDI as well as DirectDraw, using the same screen init finish function,
so no need to keep indirection via per-engine callback pointer.

The winFinishScreenInitFB() can also be made static now.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:26 +02:00
Enrico Weigelt, metux IT consult 5a2b94e024 (!1705) xwin: glx: drop glxWinUnrealizeWindow()
It does nothing more than just calling the original/wrapped function,
so we don't need that at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:26 +02:00
Enrico Weigelt, metux IT consult ec87d336c3 (!1705) xwin: glx: drop glxWinRealizeWindow()
It does nothing more than just calling the original/wrapped function,
so we don't need that at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:26 +02:00
Enrico Weigelt, metux IT consult 9af0a3ec51 (!1705) xwin: drop wrapping on ScreenRec->ChangeWindowAttributes()
Instead of complicated wrapping, just call fbCreateWindow directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:26 +02:00
Enrico Weigelt, metux IT consult b336fe7140 (!1705) xwin: drop wrapping on ScreenRec->CreateWindow()
Instead of complicated wrapping, just call fbCreateWindow directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:26 +02:00
Enrico Weigelt, metux IT consult 1d96b6838f (!1705) xwin: drop wrapping on ScreenRec->PositionWindow()
Instead of complicated wrapping, just call fbPositionWindow directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:26 +02:00
Enrico Weigelt, metux IT consult 23b24ddd27 (!1705) xwin: drop wrapping on ScreenRec->DestroyWindow()
Instead of complicated wrapping, just call fbDestroyWindow directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:26 +02:00
Enrico Weigelt, metux IT consult 1d2c4f40ea (!1905) dix: consolidate screen destruction in dixFreeScreen()
Consolidate duplicated screen destruction logic into new function
dixFreeScreen().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:26 +02:00
Enrico Weigelt, metux IT consult 7a33d3da96 (!1905) dix: replace FreeDefaultStipple()
It's just a one-liner only called once, so no actual need for it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:26 +02:00
Enrico Weigelt, metux IT consult 453df97210 (!1905) dix: let FreeGCperDepth() operate on ScreenPtr and NULL protect it
Instead of retrieving the screen index from ScreenRec and passing this,
so the ScreenRec is looked up again, just pass in the ScreenPtr that
already have anyways.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:26 +02:00
Enrico Weigelt, metux IT consult f56b42d81a (!1905) dix: NULL-protect FreeGC()
Make it possible to call FreeGC() w/o prior NULL checks.
In case of NULL, BadMatch is returned.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:43:26 +02:00
Enrico Weigelt, metux IT consult e6c004eab4 (!1936) xwin: fix missing include of mi/mi_priv.h
xwin relies on mi_priv.h being included indirectly, thus depending
on exact include within other header files. This can easily break if
something in other headers slightly changes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-04-25 15:26:55 +02:00
69 changed files with 690 additions and 876 deletions

View File

@ -96,9 +96,7 @@ in this Software without prior written authorization from The Open Group.
#endif /* XINERAMA */ #endif /* XINERAMA */
typedef struct _ShmScrPrivateRec { typedef struct _ShmScrPrivateRec {
CloseScreenProcPtr CloseScreen;
ShmFuncsPtr shmFuncs; ShmFuncsPtr shmFuncs;
DestroyPixmapProcPtr destroyPixmap;
} ShmScrPrivateRec; } ShmScrPrivateRec;
Bool noMITShmExtension = FALSE; Bool noMITShmExtension = FALSE;
@ -109,8 +107,6 @@ static void ShmResetProc(ExtensionEntry *extEntry);
static void SShmCompletionEvent(xShmCompletionEvent *from, static void SShmCompletionEvent(xShmCompletionEvent *from,
xShmCompletionEvent *to); xShmCompletionEvent *to);
static Bool ShmDestroyPixmap(PixmapPtr pPixmap);
static unsigned char ShmReqCode; static unsigned char ShmReqCode;
int ShmCompletionCode; int ShmCompletionCode;
int BadShmSegCode; int BadShmSegCode;
@ -195,15 +191,13 @@ CheckForShmSyscall(void)
#endif #endif
static Bool static void
ShmCloseScreen(ScreenPtr pScreen) ShmScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{ {
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen); ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
pScreen->CloseScreen = screen_priv->CloseScreen;
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, NULL); dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, NULL);
free(screen_priv); free(screen_priv);
return (*pScreen->CloseScreen) (pScreen);
} }
static ShmScrPrivateRec * static ShmScrPrivateRec *
@ -213,9 +207,8 @@ ShmInitScreenPriv(ScreenPtr pScreen)
if (!screen_priv) { if (!screen_priv) {
screen_priv = calloc(1, sizeof(ShmScrPrivateRec)); screen_priv = calloc(1, sizeof(ShmScrPrivateRec));
screen_priv->CloseScreen = pScreen->CloseScreen;
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv); dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv);
pScreen->CloseScreen = ShmCloseScreen; dixScreenHookClose(pScreen, ShmScreenClose);
} }
return screen_priv; return screen_priv;
} }
@ -247,28 +240,6 @@ ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs)
ShmInitScreenPriv(pScreen)->shmFuncs = funcs; ShmInitScreenPriv(pScreen)->shmFuncs = funcs;
} }
static Bool
ShmDestroyPixmap(PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
void *shmdesc = NULL;
Bool ret = TRUE;
if (pPixmap->refcnt == 1)
shmdesc = dixLookupPrivate(&pPixmap->devPrivates, shmPixmapPrivateKey);
pScreen->DestroyPixmap = screen_priv->destroyPixmap;
if (pScreen->DestroyPixmap)
ret = pScreen->DestroyPixmap(pPixmap);
screen_priv->destroyPixmap = pScreen->DestroyPixmap;
pScreen->DestroyPixmap = ShmDestroyPixmap;
if (shmdesc)
ShmDetachSegment(shmdesc, 0);
return ret;
}
void void
ShmRegisterFbFuncs(ScreenPtr pScreen) ShmRegisterFbFuncs(ScreenPtr pScreen)
@ -437,6 +408,9 @@ ShmDetachSegment(void *value, /* must conform to DeleteType */
ShmDescPtr shmdesc = (ShmDescPtr) value; ShmDescPtr shmdesc = (ShmDescPtr) value;
ShmDescPtr *prev; ShmDescPtr *prev;
if (!shmdesc)
return Success;
if (--shmdesc->refcnt) if (--shmdesc->refcnt)
return TRUE; return TRUE;
#if SHM_FD_PASSING #if SHM_FD_PASSING
@ -1514,6 +1488,14 @@ SProcShmDispatch(ClientPtr client)
} }
} }
static void ShmPixmapDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
{
ShmDetachSegment(
dixLookupPrivate(&pPixmap->devPrivates, shmPixmapPrivateKey),
0);
dixSetPrivate(&pPixmap->devPrivates, shmPixmapPrivateKey, NULL);
}
void void
ShmExtensionInit(void) ShmExtensionInit(void)
{ {
@ -1542,13 +1524,8 @@ ShmExtensionInit(void)
sharedPixmaps = xFalse; sharedPixmaps = xFalse;
} }
if (sharedPixmaps) if (sharedPixmaps)
for (i = 0; i < screenInfo.numScreens; i++) { for (i = 0; i < screenInfo.numScreens; i++)
ShmScrPrivateRec *screen_priv = dixScreenHookPixmapDestroy(screenInfo.screens[i], ShmPixmapDestroy);
ShmGetScreenPriv(screenInfo.screens[i]);
screen_priv->destroyPixmap =
screenInfo.screens[i]->DestroyPixmap;
screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap;
}
} }
ShmSegType = CreateNewResourceType(ShmDetachSegment, "ShmSeg"); ShmSegType = CreateNewResourceType(ShmDetachSegment, "ShmSeg");
if (ShmSegType && if (ShmSegType &&

View File

@ -173,9 +173,6 @@ typedef struct {
int version, revision; int version, revision;
int nAdaptors; int nAdaptors;
XvAdaptorPtr pAdaptors; XvAdaptorPtr pAdaptors;
DestroyWindowProcPtr DestroyWindow;
DestroyPixmapProcPtr DestroyPixmap;
CloseScreenProcPtr CloseScreen;
} XvScreenRec, *XvScreenPtr; } XvScreenRec, *XvScreenPtr;
extern _X_EXPORT int XvScreenInit(ScreenPtr); extern _X_EXPORT int XvScreenInit(ScreenPtr);

View File

@ -141,9 +141,7 @@ static void WriteSwappedVideoNotifyEvent(xvEvent *, xvEvent *);
static void WriteSwappedPortNotifyEvent(xvEvent *, xvEvent *); static void WriteSwappedPortNotifyEvent(xvEvent *, xvEvent *);
static Bool CreateResourceTypes(void); static Bool CreateResourceTypes(void);
static Bool XvCloseScreen(ScreenPtr); static void XvScreenClose(CallbackListPtr *pcbl, ScreenPtr, void *arg);
static Bool XvDestroyPixmap(PixmapPtr);
static Bool XvDestroyWindow(WindowPtr);
static void XvResetProc(ExtensionEntry *); static void XvResetProc(ExtensionEntry *);
static int XvdiDestroyGrab(void *, XID); static int XvdiDestroyGrab(void *, XID);
static int XvdiDestroyEncoding(void *, XID); static int XvdiDestroyEncoding(void *, XID);
@ -152,6 +150,7 @@ static int XvdiDestroyPortNotify(void *, XID);
static int XvdiDestroyVideoNotifyList(void *, XID); static int XvdiDestroyVideoNotifyList(void *, XID);
static int XvdiDestroyPort(void *, XID); static int XvdiDestroyPort(void *, XID);
static int XvdiSendVideoNotify(XvPortPtr, DrawablePtr, int); static int XvdiSendVideoNotify(XvPortPtr, DrawablePtr, int);
static void XvStopAdaptors(DrawablePtr pDrawable);
/* /*
** XvExtensionInit ** XvExtensionInit
@ -257,6 +256,16 @@ CreateResourceTypes(void)
} }
static void XvWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin)
{
XvStopAdaptors(&pWin->drawable);
}
static void XvPixmapDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
{
XvStopAdaptors(&pPixmap->drawable);
}
int int
XvScreenInit(ScreenPtr pScreen) XvScreenInit(ScreenPtr pScreen)
{ {
@ -290,34 +299,26 @@ XvScreenInit(ScreenPtr pScreen)
dixSetPrivate(&pScreen->devPrivates, XvScreenKey, pxvs); dixSetPrivate(&pScreen->devPrivates, XvScreenKey, pxvs);
pxvs->DestroyPixmap = pScreen->DestroyPixmap; dixScreenHookWindowDestroy(pScreen, XvWindowDestroy);
pxvs->DestroyWindow = pScreen->DestroyWindow; dixScreenHookClose(pScreen, XvScreenClose);
pxvs->CloseScreen = pScreen->CloseScreen; dixScreenHookPixmapDestroy(pScreen, XvPixmapDestroy);
pScreen->DestroyPixmap = XvDestroyPixmap;
pScreen->DestroyWindow = XvDestroyWindow;
pScreen->CloseScreen = XvCloseScreen;
return Success; return Success;
} }
static Bool static void XvScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
XvCloseScreen(ScreenPtr pScreen)
{ {
XvScreenPtr pxvs; XvScreenPtr pxvs;
pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XvScreenKey); pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
pScreen->DestroyPixmap = pxvs->DestroyPixmap; dixScreenUnhookWindowDestroy(pScreen, XvWindowDestroy);
pScreen->DestroyWindow = pxvs->DestroyWindow; dixScreenUnhookClose(pScreen, XvScreenClose);
pScreen->CloseScreen = pxvs->CloseScreen; dixScreenUnhookPixmapDestroy(pScreen, XvPixmapDestroy);
free(pxvs); free(pxvs);
dixSetPrivate(&pScreen->devPrivates, XvScreenKey, NULL); dixSetPrivate(&pScreen->devPrivates, XvScreenKey, NULL);
return (*pScreen->CloseScreen) (pScreen);
} }
static void static void
@ -367,40 +368,6 @@ XvStopAdaptors(DrawablePtr pDrawable)
} }
} }
static Bool
XvDestroyPixmap(PixmapPtr pPix)
{
ScreenPtr pScreen = pPix->drawable.pScreen;
Bool status = TRUE;
if (pPix->refcnt == 1)
XvStopAdaptors(&pPix->drawable);
SCREEN_PROLOGUE(pScreen, DestroyPixmap);
if (pScreen->DestroyPixmap)
status = pScreen->DestroyPixmap(pPix);
SCREEN_EPILOGUE(pScreen, DestroyPixmap, XvDestroyPixmap);
return status;
}
static Bool
XvDestroyWindow(WindowPtr pWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
Bool status;
XvStopAdaptors(&pWin->drawable);
SCREEN_PROLOGUE(pScreen, DestroyWindow);
status = (*pScreen->DestroyWindow) (pWin);
SCREEN_EPILOGUE(pScreen, DestroyWindow, XvDestroyWindow);
return status;
}
static int static int
XvdiDestroyPort(void *pPort, XID id) XvdiDestroyPort(void *pPort, XID id)
{ {

View File

@ -48,7 +48,6 @@ static RESTYPE XvMCRTSubpicture;
typedef struct { typedef struct {
int num_adaptors; int num_adaptors;
XvMCAdaptorPtr adaptors; XvMCAdaptorPtr adaptors;
CloseScreenProcPtr CloseScreen;
char clientDriverName[DR_CLIENT_DRIVER_NAME_SIZE]; char clientDriverName[DR_CLIENT_DRIVER_NAME_SIZE];
char busID[DR_BUSID_SIZE]; char busID[DR_BUSID_SIZE];
int major; int major;
@ -733,16 +732,12 @@ XvMCExtensionInit(void)
extEntry->errorBase + XvMCBadSubpicture); extEntry->errorBase + XvMCBadSubpicture);
} }
static Bool static void XvMCScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
XvMCCloseScreen(ScreenPtr pScreen)
{ {
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pScreen); XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pScreen);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
free(pScreenPriv); free(pScreenPriv);
dixSetPrivate(&pScreen->devPrivates, XvMCScreenKey, NULL);
return (*pScreen->CloseScreen) (pScreen); dixScreenUnhookClose(pScreen, XvMCScreenClose);
} }
int int
@ -758,8 +753,7 @@ XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
dixSetPrivate(&pScreen->devPrivates, XvMCScreenKey, pScreenPriv); dixSetPrivate(&pScreen->devPrivates, XvMCScreenKey, pScreenPriv);
pScreenPriv->CloseScreen = pScreen->CloseScreen; dixScreenHookClose(pScreen, XvMCScreenClose);
pScreen->CloseScreen = XvMCCloseScreen;
pScreenPriv->num_adaptors = num; pScreenPriv->num_adaptors = num;
pScreenPriv->adaptors = pAdapt; pScreenPriv->adaptors = pAdapt;

View File

@ -76,12 +76,13 @@ compCloseScreen(ScreenPtr pScreen)
pScreen->ClipNotify = cs->ClipNotify; pScreen->ClipNotify = cs->ClipNotify;
pScreen->UnrealizeWindow = cs->UnrealizeWindow; pScreen->UnrealizeWindow = cs->UnrealizeWindow;
pScreen->RealizeWindow = cs->RealizeWindow; pScreen->RealizeWindow = cs->RealizeWindow;
pScreen->DestroyWindow = cs->DestroyWindow;
pScreen->CreateWindow = cs->CreateWindow; pScreen->CreateWindow = cs->CreateWindow;
pScreen->CopyWindow = cs->CopyWindow; pScreen->CopyWindow = cs->CopyWindow;
pScreen->PositionWindow = cs->PositionWindow;
pScreen->SourceValidate = cs->SourceValidate; pScreen->SourceValidate = cs->SourceValidate;
dixScreenUnhookWindowDestroy(pScreen, compWindowDestroy);
dixScreenUnhookWindowPosition(pScreen, compWindowPosition);
free(cs); free(cs);
dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL); dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL);
ret = (*pScreen->CloseScreen) (pScreen); ret = (*pScreen->CloseScreen) (pScreen);
@ -368,8 +369,8 @@ compScreenInit(ScreenPtr pScreen)
if (!disableBackingStore) if (!disableBackingStore)
pScreen->backingStoreSupport = WhenMapped; pScreen->backingStoreSupport = WhenMapped;
cs->PositionWindow = pScreen->PositionWindow; dixScreenHookWindowDestroy(pScreen, compWindowDestroy);
pScreen->PositionWindow = compPositionWindow; dixScreenHookWindowPosition(pScreen, compWindowPosition);
cs->CopyWindow = pScreen->CopyWindow; cs->CopyWindow = pScreen->CopyWindow;
pScreen->CopyWindow = compCopyWindow; pScreen->CopyWindow = compCopyWindow;
@ -377,9 +378,6 @@ compScreenInit(ScreenPtr pScreen)
cs->CreateWindow = pScreen->CreateWindow; cs->CreateWindow = pScreen->CreateWindow;
pScreen->CreateWindow = compCreateWindow; pScreen->CreateWindow = compCreateWindow;
cs->DestroyWindow = pScreen->DestroyWindow;
pScreen->DestroyWindow = compDestroyWindow;
cs->RealizeWindow = pScreen->RealizeWindow; cs->RealizeWindow = pScreen->RealizeWindow;
pScreen->RealizeWindow = compRealizeWindow; pScreen->RealizeWindow = compRealizeWindow;

View File

@ -125,10 +125,8 @@ typedef struct _CompImplicitRedirectException {
} CompImplicitRedirectException; } CompImplicitRedirectException;
typedef struct _CompScreen { typedef struct _CompScreen {
PositionWindowProcPtr PositionWindow;
CopyWindowProcPtr CopyWindow; CopyWindowProcPtr CopyWindow;
CreateWindowProcPtr CreateWindow; CreateWindowProcPtr CreateWindow;
DestroyWindowProcPtr DestroyWindow;
RealizeWindowProcPtr RealizeWindow; RealizeWindowProcPtr RealizeWindow;
UnrealizeWindowProcPtr UnrealizeWindow; UnrealizeWindowProcPtr UnrealizeWindow;
ClipNotifyProcPtr ClipNotify; ClipNotifyProcPtr ClipNotify;
@ -280,8 +278,9 @@ void
Bool Bool
compCheckRedirect(WindowPtr pWin); compCheckRedirect(WindowPtr pWin);
Bool void compWindowPosition(CallbackListPtr *pcbl,
compPositionWindow(WindowPtr pWin, int x, int y); ScreenPtr pScreen,
XorgScreenWindowPositionParamRec *param);
Bool Bool
compRealizeWindow(WindowPtr pWin); compRealizeWindow(WindowPtr pWin);
@ -309,8 +308,7 @@ void
Bool Bool
compCreateWindow(WindowPtr pWin); compCreateWindow(WindowPtr pWin);
Bool void compWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin);
compDestroyWindow(WindowPtr pWin);
void void
compSetRedirectBorderClip(WindowPtr pWin, RegionPtr pRegion); compSetRedirectBorderClip(WindowPtr pWin, RegionPtr pRegion);

View File

@ -224,14 +224,9 @@ updateOverlayWindow(ScreenPtr pScreen)
return Success; return Success;
} }
Bool void compWindowPosition(CallbackListPtr *pcbl, ScreenPtr pScreen, XorgScreenWindowPositionParamRec *param)
compPositionWindow(WindowPtr pWin, int x, int y)
{ {
ScreenPtr pScreen = pWin->drawable.pScreen; WindowPtr pWin = param->window;
CompScreenPtr cs = GetCompScreen(pScreen);
Bool ret = TRUE;
pScreen->PositionWindow = cs->PositionWindow;
/* /*
* "Shouldn't need this as all possible places should be wrapped * "Shouldn't need this as all possible places should be wrapped
* *
@ -255,14 +250,8 @@ compPositionWindow(WindowPtr pWin, int x, int y)
} }
} }
if (!(*pScreen->PositionWindow) (pWin, x, y))
ret = FALSE;
cs->PositionWindow = pScreen->PositionWindow;
pScreen->PositionWindow = compPositionWindow;
compCheckTree(pWin->drawable.pScreen); compCheckTree(pWin->drawable.pScreen);
if (updateOverlayWindow(pScreen) != Success) updateOverlayWindow(pScreen);
ret = FALSE;
return ret;
} }
Bool Bool
@ -596,16 +585,12 @@ compCreateWindow(WindowPtr pWin)
return ret; return ret;
} }
Bool void compWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin)
compDestroyWindow(WindowPtr pWin)
{ {
ScreenPtr pScreen = pWin->drawable.pScreen;
CompScreenPtr cs = GetCompScreen(pScreen); CompScreenPtr cs = GetCompScreen(pScreen);
CompWindowPtr cw; CompWindowPtr cw;
CompSubwindowsPtr csw; CompSubwindowsPtr csw;
Bool ret;
pScreen->DestroyWindow = cs->DestroyWindow;
while ((cw = GetCompWindow(pWin))) while ((cw = GetCompWindow(pWin)))
FreeResource(cw->clients->id, X11_RESTYPE_NONE); FreeResource(cw->clients->id, X11_RESTYPE_NONE);
while ((csw = GetCompSubwindows(pWin))) while ((csw = GetCompSubwindows(pWin)))
@ -617,16 +602,12 @@ compDestroyWindow(WindowPtr pWin)
compSetParentPixmap(pWin); compSetParentPixmap(pWin);
dixDestroyPixmap(pPixmap, 0); dixDestroyPixmap(pPixmap, 0);
} }
ret = (*pScreen->DestroyWindow) (pWin);
cs->DestroyWindow = pScreen->DestroyWindow;
pScreen->DestroyWindow = compDestroyWindow;
/* Did we just destroy the overlay window? */ /* Did we just destroy the overlay window? */
if (pWin == cs->pOverlayWin) if (pWin == cs->pOverlayWin)
cs->pOverlayWin = NULL; cs->pOverlayWin = NULL;
/* compCheckTree (pWin->drawable.pScreen); can't check -- tree isn't good*/ /* compCheckTree (pWin->drawable.pScreen); can't check -- tree isn't good*/
return ret;
} }
void void

View File

@ -81,12 +81,6 @@ DbeStubScreen(DbeScreenPrivPtr pDbeScreenPriv, int *nStubbedScreens)
/* Stub DIX. */ /* Stub DIX. */
pDbeScreenPriv->SetupBackgroundPainter = NULL; pDbeScreenPriv->SetupBackgroundPainter = NULL;
/* Do not unwrap PositionWindow nor DestroyWindow. If the DDX
* initialization function failed, we assume that it did not wrap
* PositionWindow. Also, DestroyWindow is only wrapped if the DDX
* initialization function succeeded.
*/
/* Stub DDX. */ /* Stub DDX. */
pDbeScreenPriv->GetVisualInfo = NULL; pDbeScreenPriv->GetVisualInfo = NULL;
pDbeScreenPriv->AllocBackBufferName = NULL; pDbeScreenPriv->AllocBackBufferName = NULL;
@ -1201,7 +1195,9 @@ DbeWindowPrivDelete(void *pDbeWinPriv, XID id)
return Success; return Success;
} /* DbeWindowPrivDelete() */ } /* DbeWindowPrivDelete() */
static void miDbeWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin);
/****************************************************************************** /******************************************************************************
* *
* DBE DIX Procedure: DbeResetProc * DBE DIX Procedure: DbeResetProc
@ -1225,94 +1221,39 @@ DbeResetProc(ExtensionEntry * extEntry)
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
if (pDbeScreenPriv) { if (pDbeScreenPriv) {
/* Unwrap DestroyWindow, which was wrapped in DbeExtensionInit(). */ dixScreenUnhookWindowDestroy(pScreen, miDbeWindowDestroy);
pScreen->DestroyWindow = pDbeScreenPriv->DestroyWindow; dixScreenUnhookWindowPosition(pScreen, miDbeWindowPosition);
pScreen->PositionWindow = pDbeScreenPriv->PositionWindow;
free(pDbeScreenPriv); free(pDbeScreenPriv);
} }
} }
} /* DbeResetProc() */ }
/******************************************************************************
*
* DBE DIX Procedure: DbeDestroyWindow
*
* Description:
*
* This is the wrapper for pScreen->DestroyWindow.
* This function frees buffer resources for a window before it is
* destroyed.
*
*****************************************************************************/
static Bool /**
DbeDestroyWindow(WindowPtr pWin) * @brief window destroy callback
*
* Called by DIX when window is being destroyed.
*
*/
static void miDbeWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin)
{ {
DbeScreenPrivPtr pDbeScreenPriv;
DbeWindowPrivPtr pDbeWindowPriv;
ScreenPtr pScreen;
Bool ret;
/* /*
************************************************************************** **************************************************************************
** 1. Unwrap the member routine.
**************************************************************************
*/
pScreen = pWin->drawable.pScreen;
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
pScreen->DestroyWindow = pDbeScreenPriv->DestroyWindow;
/*
**************************************************************************
** 2. Do any work necessary before the member routine is called.
**
** Call the window priv delete function for all buffer IDs associated ** Call the window priv delete function for all buffer IDs associated
** with this window. ** with this window.
************************************************************************** **************************************************************************
*/ */
if ((pDbeWindowPriv = DBE_WINDOW_PRIV(pWin))) { DbeWindowPrivPtr pDbeWindowPriv;
while (pDbeWindowPriv) { while ((pDbeWindowPriv = DBE_WINDOW_PRIV(pWin))) {
/* *DbeWinPrivDelete() will free the window private and set it to /* *DbeWinPrivDelete() will free the window private and set it to
* NULL if there are no more buffer IDs associated with this * NULL if there are no more buffer IDs associated with this
* window. * window.
*/ */
FreeResource(pDbeWindowPriv->IDs[0], X11_RESTYPE_NONE); FreeResource(pDbeWindowPriv->IDs[0], X11_RESTYPE_NONE);
pDbeWindowPriv = DBE_WINDOW_PRIV(pWin); pDbeWindowPriv = DBE_WINDOW_PRIV(pWin);
}
} }
}
/*
**************************************************************************
** 3. Call the member routine, saving its result if necessary.
**************************************************************************
*/
ret = (*pScreen->DestroyWindow) (pWin);
/*
**************************************************************************
** 4. Rewrap the member routine, restoring the wrapper value first in case
** the wrapper (or something that it wrapped) change this value.
**************************************************************************
*/
pDbeScreenPriv->DestroyWindow = pScreen->DestroyWindow;
pScreen->DestroyWindow = DbeDestroyWindow;
/*
**************************************************************************
** 5. Do any work necessary after the member routine has been called.
**
** In this case we do not need to do anything.
**************************************************************************
*/
return ret;
} /* DbeDestroyWindow() */
/****************************************************************************** /******************************************************************************
* *
* DBE DIX Procedure: DbeExtensionInit * DBE DIX Procedure: DbeExtensionInit
@ -1395,12 +1336,10 @@ DbeExtensionInit(void)
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
if (ddxInitSuccess) { if (ddxInitSuccess) {
/* Wrap DestroyWindow. The DDX initialization function /* Hook in our window destructor. The DDX initialization function
* already wrapped PositionWindow for us. * already added WindowPosition hook for us.
*/ */
dixScreenHookWindowDestroy(pScreen, miDbeWindowDestroy);
pDbeScreenPriv->DestroyWindow = pScreen->DestroyWindow;
pScreen->DestroyWindow = DbeDestroyWindow;
} }
else { else {
/* DDX initialization failed. Stub the screen. */ /* DDX initialization failed. Stub the screen. */

View File

@ -169,13 +169,6 @@ typedef struct _DbeWindowPrivRec {
*/ */
typedef struct _DbeScreenPrivRec { typedef struct _DbeScreenPrivRec {
/* Wrapped functions
* It is the responsibility of the DDX layer to wrap PositionWindow().
* DbeExtensionInit wraps DestroyWindow().
*/
PositionWindowProcPtr PositionWindow;
DestroyWindowProcPtr DestroyWindow;
/* Per-screen DIX routines */ /* Per-screen DIX routines */
Bool (*SetupBackgroundPainter) (WindowPtr /*pWin */ , Bool (*SetupBackgroundPainter) (WindowPtr /*pWin */ ,
GCPtr /*pGC */ GCPtr /*pGC */

View File

@ -375,14 +375,13 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
* the resources associated with a DBE buffer ID. There are 5 ways that * the resources associated with a DBE buffer ID. There are 5 ways that
* miDbeWinPrivDelete() can be called by FreeResource(). They are: * miDbeWinPrivDelete() can be called by FreeResource(). They are:
* *
* - A DBE window is destroyed, in which case the DbeDestroyWindow() * - A DBE window is destroyed, in which case the DbeWindowDestroy()
* wrapper is invoked. The wrapper calls FreeResource() for all DBE * callback is invoked. It calls FreeResource() for all DBE buffer IDs.
* buffer IDs.
* *
* - miDbeAllocBackBufferName() calls FreeResource() to clean up resources * - miDbeAllocBackBufferName() calls FreeResource() to clean up resources
* after a buffer allocation failure. * after a buffer allocation failure.
* *
* - The PositionWindow wrapper, miDbePositionWindow(), calls * - The WindowPosition hook, miDbeWindowPosition(), calls
* FreeResource() when it fails to create buffers of the new size. * FreeResource() when it fails to create buffers of the new size.
* FreeResource() is called for all DBE buffer IDs. * FreeResource() is called for all DBE buffer IDs.
* *
@ -432,22 +431,20 @@ miDbeWinPrivDelete(DbeWindowPrivPtr pDbeWindowPriv, XID bufId)
if (pDbeWindowPriv->pBackBuffer) if (pDbeWindowPriv->pBackBuffer)
dixDestroyPixmap(pDbeWindowPriv->pBackBuffer, 0); dixDestroyPixmap(pDbeWindowPriv->pBackBuffer, 0);
} /* miDbeWinPrivDelete() */ } /* miDbeWinPrivDelete() */
/****************************************************************************** /******************************************************************************
* *
* DBE MI Procedure: miDbePositionWindow * DBE MI Procedure: miDbeWindowPosition
* *
* Description: * Description:
* *
* This function was cloned from miMbxPositionWindow() in mimultibuf.c. * This function was cloned from miMbxWindowPosition() in mimultibuf.c.
* This function resizes the buffer when the window is resized. * This function resizes the buffer when the window is resized.
* *
*****************************************************************************/ *****************************************************************************/
static Bool void miDbeWindowPosition(CallbackListPtr *pcbl, ScreenPtr pScreen, XorgScreenWindowPositionParamRec *param)
miDbePositionWindow(WindowPtr pWin, int x, int y)
{ {
ScreenPtr pScreen;
DbeScreenPrivPtr pDbeScreenPriv; DbeScreenPrivPtr pDbeScreenPriv;
DbeWindowPrivPtr pDbeWindowPriv; DbeWindowPrivPtr pDbeWindowPriv;
int width, height; int width, height;
@ -460,43 +457,9 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
Bool clear; Bool clear;
GCPtr pGC; GCPtr pGC;
xRectangle clearRect; xRectangle clearRect;
Bool ret;
/* WindowPtr pWin = param->window;
**************************************************************************
** 1. Unwrap the member routine.
**************************************************************************
*/
pScreen = pWin->drawable.pScreen;
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
pScreen->PositionWindow = pDbeScreenPriv->PositionWindow;
/*
**************************************************************************
** 2. Do any work necessary before the member routine is called.
**
** In this case we do not need to do anything.
**************************************************************************
*/
/*
**************************************************************************
** 3. Call the member routine, saving its result if necessary.
**************************************************************************
*/
ret = (*pScreen->PositionWindow) (pWin, x, y);
/*
**************************************************************************
** 4. Rewrap the member routine, restoring the wrapper value first in case
** the wrapper (or something that it wrapped) change this value.
**************************************************************************
*/
pDbeScreenPriv->PositionWindow = pScreen->PositionWindow;
pScreen->PositionWindow = miDbePositionWindow;
/* /*
************************************************************************** **************************************************************************
@ -504,14 +467,12 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
************************************************************************** **************************************************************************
*/ */
if (!(pDbeWindowPriv = DBE_WINDOW_PRIV(pWin))) { if (!(pDbeWindowPriv = DBE_WINDOW_PRIV(pWin)))
return ret; return;
}
if (pDbeWindowPriv->width == pWin->drawable.width && if (pDbeWindowPriv->width == pWin->drawable.width &&
pDbeWindowPriv->height == pWin->drawable.height) { pDbeWindowPriv->height == pWin->drawable.height)
return ret; return;
}
width = pWin->drawable.width; width = pWin->drawable.width;
height = pWin->drawable.height; height = pWin->drawable.height;
@ -595,7 +556,7 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
} }
FreeScratchGC(pGC); FreeScratchGC(pGC);
return FALSE; return;
} }
else { else {
@ -645,11 +606,8 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
FreeScratchGC(pGC); FreeScratchGC(pGC);
} }
}
return ret;
} /* miDbePositionWindow() */
/****************************************************************************** /******************************************************************************
* *
* DBE MI Procedure: miDbeInit * DBE MI Procedure: miDbeInit
@ -663,9 +621,7 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
Bool Bool
miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv) miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv)
{ {
/* Wrap functions. */ dixScreenHookWindowPosition(pScreen, miDbeWindowPosition);
pDbeScreenPriv->PositionWindow = pScreen->PositionWindow;
pScreen->PositionWindow = miDbePositionWindow;
/* Initialize the per-screen DBE function pointers. */ /* Initialize the per-screen DBE function pointers. */
pDbeScreenPriv->GetVisualInfo = miDbeGetVisualInfo; pDbeScreenPriv->GetVisualInfo = miDbeGetVisualInfo;

View File

@ -53,4 +53,6 @@ extern DevPrivateKeyRec dbeWindowPrivKeyRec;
extern RESTYPE dbeDrawableResType; extern RESTYPE dbeDrawableResType;
extern RESTYPE dbeWindowPrivResType; extern RESTYPE dbeWindowPrivResType;
void miDbeWindowPosition(CallbackListPtr *pcbl, ScreenPtr pScreen, XorgScreenWindowPositionParamRec *param);
#endif /* MIDBE_H */ #endif /* MIDBE_H */

View File

@ -10,4 +10,15 @@
void InitCallbackManager(void); void InitCallbackManager(void);
void DeleteCallbackManager(void); void DeleteCallbackManager(void);
/*
* @brief delete a callback list
*
* Calling this is necessary if a CallbackListPtr is used inside a dynamically
* allocated structure, before it is freed. If it's not done, memory corruption
* or segfault can happen at a much later point (eg. next server incarnation)
*
* @param pcbl pointer to the list head (CallbackListPtr)
*/
void DeleteCallbackList(CallbackListPtr *pcbl);
#endif /* _XSERVER_CALLBACK_PRIV_H */ #endif /* _XSERVER_CALLBACK_PRIV_H */

View File

@ -1462,6 +1462,8 @@ int
dixDestroyPixmap(void *value, XID pid) dixDestroyPixmap(void *value, XID pid)
{ {
PixmapPtr pPixmap = (PixmapPtr) value; PixmapPtr pPixmap = (PixmapPtr) value;
if (pPixmap && pPixmap->refcnt == 1)
dixScreenRaisePixmapDestroy(pPixmap);
if (pPixmap && pPixmap->drawable.pScreen && pPixmap->drawable.pScreen->DestroyPixmap) if (pPixmap && pPixmap->drawable.pScreen && pPixmap->drawable.pScreen->DestroyPixmap)
return pPixmap->drawable.pScreen->DestroyPixmap(pPixmap); return pPixmap->drawable.pScreen->DestroyPixmap(pPixmap);
return TRUE; return TRUE;

View File

@ -255,4 +255,59 @@ extern Bool enableBackingStore;
/* in generated BuiltInAtoms.c */ /* in generated BuiltInAtoms.c */
void MakePredeclaredAtoms(void); void MakePredeclaredAtoms(void);
void dixFreeScreen(ScreenPtr pScreen);
/*
* @brief call screen's window destructors
* @see dixScreenHookWindowDestroy
* @param pWin the window thats being destroyed
* @result the ScreenRec's DestroyWindow() return value
*
* Call the pluggable window destructors that extensions might have registered on
* the screen, and finally call ScreenRec's DestroyWindow proc.
*
* Should only be called by DIX itself.
*/
int dixScreenRaiseWindowDestroy(WindowPtr pWin);
/*
* @brief call screen's window position notification hooks
* @see dixScreenHookWindowPosition
* @param pWin the window to notify on
*
* Call the pluggable window position hooks that extensions might have registered on
* the screen, and finally call ScreenRec's PositionWindow proc.
*
* Should only be called by DIX itself.
*/
void dixScreenRaiseWindowPosition(WindowPtr pWin, uint32_t x, uint32_t y);
/*
* @brief call screen's close hooks
* @see dixScreenHookClose
* @param pScreen the screen being closed
*
* Call the pluggable screen close hooks that extensions might have registered on
* the screen, and finally call ScreenRec's CloseScreen proc.
*
* Should only be called by DIX itself.
*/
void dixScreenRaiseClose(ScreenPtr pScreen);
/*
* @brief call screen's PixmapDestroy hook
* @see dixScreenHookPixmapDestroy
* @param pPixmap the pixmap being destroyed
*
* Call the pluggable pixmap destroy pixmap hooks that extensions might have
* registered on the screen.
* Note that it's *only* called, when the pixmap is really being destroyed
* (instead of just unref'ed)
*
* Should only be called by DIX itself, by dixDestroyPixmap()
* It must be called *before* the ScreenRec->DestroyPixmap() is called, any
* only if the reference counter reaches 1.
*/
void dixScreenRaisePixmapDestroy(PixmapPtr pPixmap);
#endif /* _XSERVER_DIX_PRIV_H */ #endif /* _XSERVER_DIX_PRIV_H */

View File

@ -695,8 +695,6 @@ _DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, void *data)
return FALSE; return FALSE;
} }
static void DeleteCallbackList(CallbackListPtr *pcbl);
void void
_CallCallbacks(CallbackListPtr *pcbl, void *call_data) _CallCallbacks(CallbackListPtr *pcbl, void *call_data)
{ {
@ -747,25 +745,26 @@ _CallCallbacks(CallbackListPtr *pcbl, void *call_data)
} }
} }
static void void DeleteCallbackList(CallbackListPtr *pcbl)
_DeleteCallbackList(CallbackListPtr *pcbl)
{ {
if (!pcbl || !*pcbl)
return;
CallbackListPtr cbl = *pcbl; CallbackListPtr cbl = *pcbl;
CallbackPtr cbr, nextcbr;
int i;
if (cbl->inCallback) { if (cbl->inCallback) {
cbl->deleted = TRUE; cbl->deleted = TRUE;
return; return;
} }
for (i = 0; i < numCallbackListsToCleanup; i++) { for (int i = 0; i < numCallbackListsToCleanup; i++) {
if (listsToCleanup[i] == pcbl) { if (listsToCleanup[i] == pcbl) {
listsToCleanup[i] = NULL; listsToCleanup[i] = NULL;
break; break;
} }
} }
CallbackPtr cbr, nextcbr;
for (cbr = cbl->list; cbr != NULL; cbr = nextcbr) { for (cbr = cbl->list; cbr != NULL; cbr = nextcbr) {
nextcbr = cbr->next; nextcbr = cbr->next;
free(cbr); free(cbr);
@ -829,13 +828,6 @@ DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, void *data)
return _DeleteCallback(pcbl, callback, data); return _DeleteCallback(pcbl, callback, data);
} }
static void DeleteCallbackList(CallbackListPtr *pcbl)
{
if (!pcbl || !*pcbl)
return;
_DeleteCallbackList(pcbl);
}
void void
DeleteCallbackManager(void) DeleteCallbackManager(void)
{ {

View File

@ -768,6 +768,8 @@ int
FreeGC(void *value, XID gid) FreeGC(void *value, XID gid)
{ {
GCPtr pGC = (GCPtr) value; GCPtr pGC = (GCPtr) value;
if (!pGC)
return BadMatch;
CloseFont(pGC->font, (Font) 0); CloseFont(pGC->font, (Font) 0);
if (pGC->funcs) if (pGC->funcs)
@ -819,13 +821,14 @@ CreateScratchGC(ScreenPtr pScreen, unsigned depth)
} }
void void
FreeGCperDepth(int screenNum) FreeGCperDepth(ScreenPtr pScreen)
{ {
int i; int i;
ScreenPtr pScreen;
GCPtr *ppGC; GCPtr *ppGC;
pScreen = screenInfo.screens[screenNum]; if (!pScreen)
return;
ppGC = pScreen->GCperDepth; ppGC = pScreen->GCperDepth;
for (i = 0; i <= pScreen->numDepths; i++) { for (i = 0; i <= pScreen->numDepths; i++) {
@ -900,13 +903,6 @@ CreateDefaultStipple(int screenNum)
return TRUE; return TRUE;
} }
void
FreeDefaultStipple(int screenNum)
{
ScreenPtr pScreen = screenInfo.screens[screenNum];
dixDestroyPixmap(pScreen->defaultStipple, 0);
}
int int
SetDashes(GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pdash) SetDashes(GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pdash)
{ {

View File

@ -22,14 +22,12 @@ int CopyGC(GCPtr pgcSrc, GCPtr pgcDst, BITS32 mask);
int FreeGC(void *pGC, XID gid); int FreeGC(void *pGC, XID gid);
void FreeGCperDepth(int screenNum); void FreeGCperDepth(ScreenPtr pScreen);
Bool CreateGCperDepth(int screenNum); Bool CreateGCperDepth(int screenNum);
Bool CreateDefaultStipple(int screenNum); Bool CreateDefaultStipple(int screenNum);
void FreeDefaultStipple(int screenNum);
int SetDashes(GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pdash); int SetDashes(GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pdash);
int VerifyRectOrder(int nrects, xRectangle *prects, int ordering); int VerifyRectOrder(int nrects, xRectangle *prects, int ordering);

View File

@ -318,23 +318,16 @@ dix_main(int argc, char *argv[], char *envp[])
CloseDownEvents(); CloseDownEvents();
for (i = screenInfo.numGPUScreens - 1; i >= 0; i--) { for (i = screenInfo.numGPUScreens - 1; i >= 0; i--) {
ScreenPtr pScreen = screenInfo.gpuscreens[i]; dixFreeScreen(screenInfo.gpuscreens[i]);
dixFreeScreenSpecificPrivates(pScreen);
(*pScreen->CloseScreen) (pScreen);
dixFreePrivates(pScreen->devPrivates, PRIVATE_SCREEN);
free(pScreen);
screenInfo.numGPUScreens = i; screenInfo.numGPUScreens = i;
} }
memset(&screenInfo.numGPUScreens, 0, sizeof(screenInfo.numGPUScreens));
for (i = screenInfo.numScreens - 1; i >= 0; i--) { for (i = screenInfo.numScreens - 1; i >= 0; i--) {
FreeGCperDepth(i); dixFreeScreen(screenInfo.screens[i]);
FreeDefaultStipple(i);
dixFreeScreenSpecificPrivates(screenInfo.screens[i]);
(*screenInfo.screens[i]->CloseScreen) (screenInfo.screens[i]);
dixFreePrivates(screenInfo.screens[i]->devPrivates, PRIVATE_SCREEN);
free(screenInfo.screens[i]);
screenInfo.numScreens = i; screenInfo.numScreens = i;
} }
memset(&screenInfo.screens, 0, sizeof(screenInfo.numGPUScreens));
ReleaseClientIds(serverClient); ReleaseClientIds(serverClient);
dixFreePrivates(serverClient->devPrivates, PRIVATE_CLIENT); dixFreePrivates(serverClient->devPrivates, PRIVATE_CLIENT);

View File

@ -27,7 +27,9 @@ srcs_dix = [
'region.c', 'region.c',
'registry.c', 'registry.c',
'resource.c', 'resource.c',
'screen_hooks.c',
'selection.c', 'selection.c',
'screen.c',
'swaprep.c', 'swaprep.c',
'swapreq.c', 'swapreq.c',
'tables.c', 'tables.c',

28
dix/screen.c Normal file
View File

@ -0,0 +1,28 @@
/* SPDX-License-Identifier: MIT OR X11
*
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
*/
#include <dix-config.h>
#include "dix/callback_priv.h"
#include "dix/dix_priv.h"
#include "dix/gc_priv.h"
#include "include/screenint.h"
#include "include/scrnintstr.h"
void dixFreeScreen(ScreenPtr pScreen)
{
if (!pScreen)
return;
FreeGCperDepth(pScreen);
dixDestroyPixmap(pScreen->defaultStipple, 0);
dixFreeScreenSpecificPrivates(pScreen);
pScreen->CloseScreen(pScreen);
dixFreePrivates(pScreen->devPrivates, PRIVATE_SCREEN);
DeleteCallbackList(&pScreen->hookWindowDestroy);
DeleteCallbackList(&pScreen->hookWindowPosition);
DeleteCallbackList(&pScreen->hookClose);
DeleteCallbackList(&pScreen->hookPixmapDestroy);
free(pScreen);
}

79
dix/screen_hooks.c Normal file
View File

@ -0,0 +1,79 @@
/* SPDX-License-Identifier: MIT OR X11
*
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
*/
#include <dix-config.h>
#include "dix/dix_priv.h"
#include "include/dix.h"
#include "include/os.h"
#include "include/scrnintstr.h"
#include "include/windowstr.h"
#define DECLARE_HOOK_PROC(NAME, FIELD, TYPE) \
void dixScreenHook##NAME(ScreenPtr pScreen, TYPE func) \
{ \
AddCallback(&pScreen->FIELD, (CallbackProcPtr)func, pScreen); \
} \
\
void dixScreenUnhook##NAME(ScreenPtr pScreen, TYPE func) \
{ \
DeleteCallback(&pScreen->FIELD, (CallbackProcPtr)func, pScreen); \
}
DECLARE_HOOK_PROC(WindowDestroy, hookWindowDestroy, XorgScreenWindowDestroyProcPtr);
DECLARE_HOOK_PROC(WindowPosition, hookWindowPosition, XorgScreenWindowPositionProcPtr);
DECLARE_HOOK_PROC(Close, hookClose, XorgScreenCloseProcPtr);
DECLARE_HOOK_PROC(PixmapDestroy, hookPixmapDestroy, XorgScreenPixmapDestroyProcPtr);
int dixScreenRaiseWindowDestroy(WindowPtr pWin)
{
if (!pWin)
return Success;
ScreenPtr pScreen = pWin->drawable.pScreen;
CallCallbacks(&pScreen->hookWindowDestroy, pWin);
return (pScreen->DestroyWindow ? pScreen->DestroyWindow(pWin) : Success);
}
void dixScreenRaiseWindowPosition(WindowPtr pWin, uint32_t x, uint32_t y)
{
if (!pWin)
return;
ScreenPtr pScreen = pWin->drawable.pScreen;
XorgScreenWindowPositionParamRec param = {
.window = pWin,
.x = x,
.y = y,
};
CallCallbacks(&pScreen->hookWindowPosition, &param);
if (pScreen->PositionWindow)
pScreen->PositionWindow(pWin, x, y);
}
void dixScreenRaiseClose(ScreenPtr pScreen) {
if (!pScreen)
return;
CallCallbacks(&pScreen->hookClose, NULL);
if (pScreen->CloseScreen)
pScreen->CloseScreen(pScreen);
}
void dixScreenRaisePixmapDestroy(PixmapPtr pPixmap)
{
if (!pPixmap)
return;
ScreenPtr pScreen = pPixmap->drawable.pScreen;
CallCallbacks(&pScreen->hookPixmapDestroy, pPixmap);
/* we must not call the original ScreenRec->DestroyPixmap() here */
}

View File

@ -670,7 +670,8 @@ InitRootWindow(WindowPtr pWin)
if (!(*pScreen->CreateWindow) (pWin)) if (!(*pScreen->CreateWindow) (pWin))
return; /* XXX */ return; /* XXX */
(*pScreen->PositionWindow) (pWin, 0, 0);
dixScreenRaiseWindowPosition(pWin, 0, 0);
pWin->cursorIsNone = FALSE; pWin->cursorIsNone = FALSE;
pWin->optional->cursor = RefCursor(rootCursor); pWin->optional->cursor = RefCursor(rootCursor);
@ -928,7 +929,7 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
return NullWindow; return NullWindow;
} }
/* We SHOULD check for an error value here XXX */ /* We SHOULD check for an error value here XXX */
(*pScreen->PositionWindow) (pWin, pWin->drawable.x, pWin->drawable.y); dixScreenRaiseWindowPosition(pWin, pWin->drawable.x, pWin->drawable.y);
if (!(vmask & CWEventMask)) if (!(vmask & CWEventMask))
RecalculateDeliverableEvents(pWin); RecalculateDeliverableEvents(pWin);
@ -998,8 +999,6 @@ DisposeWindowOptional(WindowPtr pWin)
static void static void
FreeWindowResources(WindowPtr pWin) FreeWindowResources(WindowPtr pWin)
{ {
ScreenPtr pScreen = pWin->drawable.pScreen;
DeleteWindowFromAnySaveSet(pWin); DeleteWindowFromAnySaveSet(pWin);
DeleteWindowFromAnySelections(pWin); DeleteWindowFromAnySelections(pWin);
DeleteWindowFromAnyEvents(pWin, TRUE); DeleteWindowFromAnyEvents(pWin, TRUE);
@ -1019,8 +1018,9 @@ FreeWindowResources(WindowPtr pWin)
dixDestroyPixmap(pWin->background.pixmap, 0); dixDestroyPixmap(pWin->background.pixmap, 0);
DeleteAllWindowProperties(pWin); DeleteAllWindowProperties(pWin);
/* We SHOULD check for an error value here XXX */ /* We SHOULD check for an error value here XXX */
(*pScreen->DestroyWindow) (pWin); dixScreenRaiseWindowDestroy(pWin);
DisposeWindowOptional(pWin); DisposeWindowOptional(pWin);
} }
@ -1849,12 +1849,9 @@ GravityTranslate(int x, int y, int oldx, int oldy,
void void
ResizeChildrenWinSize(WindowPtr pWin, int dx, int dy, int dw, int dh) ResizeChildrenWinSize(WindowPtr pWin, int dx, int dy, int dw, int dh)
{ {
ScreenPtr pScreen;
WindowPtr pSib, pChild; WindowPtr pSib, pChild;
Bool resized = (dw || dh); Bool resized = (dw || dh);
pScreen = pWin->drawable.pScreen;
for (pSib = pWin->firstChild; pSib; pSib = pSib->nextSib) { for (pSib = pWin->firstChild; pSib; pSib = pSib->nextSib) {
if (resized && (pSib->winGravity > NorthWestGravity)) { if (resized && (pSib->winGravity > NorthWestGravity)) {
int cwsx, cwsy; int cwsx, cwsy;
@ -1879,7 +1876,8 @@ ResizeChildrenWinSize(WindowPtr pWin, int dx, int dy, int dw, int dh)
pSib->drawable.y = pWin->drawable.y + pSib->origin.y; pSib->drawable.y = pWin->drawable.y + pSib->origin.y;
SetWinSize(pSib); SetWinSize(pSib);
SetBorderSize(pSib); SetBorderSize(pSib);
(*pScreen->PositionWindow) (pSib, pSib->drawable.x, pSib->drawable.y);
dixScreenRaiseWindowPosition(pSib, pSib->drawable.x, pSib->drawable.y);
if ((pChild = pSib->firstChild)) { if ((pChild = pSib->firstChild)) {
while (1) { while (1) {
@ -1889,9 +1887,9 @@ ResizeChildrenWinSize(WindowPtr pWin, int dx, int dy, int dw, int dh)
pChild->origin.y; pChild->origin.y;
SetWinSize(pChild); SetWinSize(pChild);
SetBorderSize(pChild); SetBorderSize(pChild);
(*pScreen->PositionWindow) (pChild, dixScreenRaiseWindowPosition(pChild,
pChild->drawable.x, pChild->drawable.x,
pChild->drawable.y); pChild->drawable.y);
if (pChild->firstChild) { if (pChild->firstChild) {
pChild = pChild->firstChild; pChild = pChild->firstChild;
continue; continue;
@ -2585,7 +2583,8 @@ ReparentWindow(WindowPtr pWin, WindowPtr pParent,
if (pScreen->ReparentWindow) if (pScreen->ReparentWindow)
(*pScreen->ReparentWindow) (pWin, pPriorParent); (*pScreen->ReparentWindow) (pWin, pPriorParent);
(*pScreen->PositionWindow) (pWin, pWin->drawable.x, pWin->drawable.y);
dixScreenRaiseWindowPosition(pWin, pWin->drawable.x, pWin->drawable.y);
ResizeChildrenWinSize(pWin, 0, 0, 0, 0); ResizeChildrenWinSize(pWin, 0, 0, 0, 0);
CheckWindowOptionalNeed(pWin); CheckWindowOptionalNeed(pWin);

View File

@ -29,15 +29,11 @@ DevPrivateKeyRec dri3_screen_private_key;
static int dri3_screen_generation; static int dri3_screen_generation;
static Bool static void dri3_screen_close(CallbackListPtr *pcbl, ScreenPtr screen, void *unused)
dri3_close_screen(ScreenPtr screen)
{ {
dri3_screen_priv_ptr screen_priv = dri3_screen_priv(screen); dri3_screen_priv_ptr screen_priv = dri3_screen_priv(screen);
dixScreenUnhookClose(screen, dri3_screen_close);
unwrap(screen_priv, screen, CloseScreen);
free(screen_priv); free(screen_priv);
return (*screen->CloseScreen) (screen);
} }
Bool Bool
@ -53,7 +49,7 @@ dri3_screen_init(ScreenPtr screen, const dri3_screen_info_rec *info)
if (!screen_priv) if (!screen_priv)
return FALSE; return FALSE;
wrap(screen_priv, screen, CloseScreen, dri3_close_screen); dixScreenHookClose(screen, dri3_screen_close);
screen_priv->info = info; screen_priv->info = info;

View File

@ -42,9 +42,7 @@ typedef struct dri3_dmabuf_format {
} dri3_dmabuf_format_rec, *dri3_dmabuf_format_ptr; } dri3_dmabuf_format_rec, *dri3_dmabuf_format_ptr;
typedef struct dri3_screen_priv { typedef struct dri3_screen_priv {
CloseScreenProcPtr CloseScreen;
ConfigNotifyProcPtr ConfigNotify; ConfigNotifyProcPtr ConfigNotify;
DestroyWindowProcPtr DestroyWindow;
Bool formats_cached; Bool formats_cached;
CARD32 num_formats; CARD32 num_formats;

View File

@ -740,6 +740,11 @@ exaCloseScreen(ScreenPtr pScreen)
ExaScreenPriv(pScreen); ExaScreenPriv(pScreen);
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
/* doesn't matter which one actually was registered */
dixScreenUnhookPixmapDestroy(pScreen, exaPixmapDestroy_classic);
dixScreenUnhookPixmapDestroy(pScreen, exaPixmapDestroy_driver);
dixScreenUnhookPixmapDestroy(pScreen, exaPixmapDestroy_mixed);
if (ps->Glyphs == exaGlyphs) if (ps->Glyphs == exaGlyphs)
exaGlyphsFini(pScreen); exaGlyphsFini(pScreen);
@ -753,8 +758,6 @@ exaCloseScreen(ScreenPtr pScreen)
unwrap(pExaScr, pScreen, GetSpans); unwrap(pExaScr, pScreen, GetSpans);
if (pExaScr->SavedCreatePixmap) if (pExaScr->SavedCreatePixmap)
unwrap(pExaScr, pScreen, CreatePixmap); unwrap(pExaScr, pScreen, CreatePixmap);
if (pExaScr->SavedDestroyPixmap)
unwrap(pExaScr, pScreen, DestroyPixmap);
if (pExaScr->SavedModifyPixmapHeader) if (pExaScr->SavedModifyPixmapHeader)
unwrap(pExaScr, pScreen, ModifyPixmapHeader); unwrap(pExaScr, pScreen, ModifyPixmapHeader);
unwrap(pExaScr, pScreen, CopyWindow); unwrap(pExaScr, pScreen, CopyWindow);
@ -955,8 +958,9 @@ exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo)
} }
if (pExaScr->info->flags & EXA_HANDLES_PIXMAPS) { if (pExaScr->info->flags & EXA_HANDLES_PIXMAPS) {
if (pExaScr->info->flags & EXA_MIXED_PIXMAPS) { if (pExaScr->info->flags & EXA_MIXED_PIXMAPS) {
dixScreenHookPixmapDestroy(pScreen, exaPixmapDestroy_mixed);
wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_mixed); wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_mixed);
wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_mixed);
wrap(pExaScr, pScreen, ModifyPixmapHeader, wrap(pExaScr, pScreen, ModifyPixmapHeader,
exaModifyPixmapHeader_mixed); exaModifyPixmapHeader_mixed);
wrap(pExaScr, pScreen, SharePixmapBacking, exaSharePixmapBacking_mixed); wrap(pExaScr, pScreen, SharePixmapBacking, exaSharePixmapBacking_mixed);
@ -969,8 +973,9 @@ exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo)
pExaScr->prepare_access_reg = exaPrepareAccessReg_mixed; pExaScr->prepare_access_reg = exaPrepareAccessReg_mixed;
} }
else { else {
dixScreenHookPixmapDestroy(pScreen, exaPixmapDestroy_driver);
wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_driver); wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_driver);
wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_driver);
wrap(pExaScr, pScreen, ModifyPixmapHeader, wrap(pExaScr, pScreen, ModifyPixmapHeader,
exaModifyPixmapHeader_driver); exaModifyPixmapHeader_driver);
pExaScr->do_migration = NULL; pExaScr->do_migration = NULL;
@ -981,8 +986,9 @@ exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo)
} }
} }
else { else {
dixScreenHookPixmapDestroy(pScreen, exaPixmapDestroy_classic);
wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_classic); wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_classic);
wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_classic);
wrap(pExaScr, pScreen, ModifyPixmapHeader, wrap(pExaScr, pScreen, ModifyPixmapHeader,
exaModifyPixmapHeader_classic); exaModifyPixmapHeader_classic);
pExaScr->do_migration = exaDoMigration_classic; pExaScr->do_migration = exaDoMigration_classic;

View File

@ -206,42 +206,26 @@ exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height,
return ret; return ret;
} }
Bool void exaPixmapDestroy_classic(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
exaDestroyPixmap_classic(PixmapPtr pPixmap)
{ {
ScreenPtr pScreen = pPixmap->drawable.pScreen; ExaPixmapPriv(pPixmap);
if (!pExaPixmap) // we're called on an error path
return;
ExaScreenPriv(pScreen); exaDestroyPixmap(pPixmap);
Bool ret = TRUE;
if (pPixmap->refcnt == 1) { if (pExaPixmap->area) {
ExaPixmapPriv(pPixmap); DBG_PIXMAP(("-- 0x%p (0x%x) (%dx%d)\n",
if (!pExaPixmap) // we're called on an error path (void *) pPixmap->drawable.id,
goto out; ExaGetPixmapPriv(pPixmap)->area->offset,
pPixmap->drawable.width, pPixmap->drawable.height));
exaDestroyPixmap(pPixmap); /* Free the offscreen area */
exaOffscreenFree(pPixmap->drawable.pScreen, pExaPixmap->area);
if (pExaPixmap->area) { pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
DBG_PIXMAP(("-- 0x%p (0x%x) (%dx%d)\n", pPixmap->devKind = pExaPixmap->sys_pitch;
(void *) pPixmap->drawable.id,
ExaGetPixmapPriv(pPixmap)->area->offset,
pPixmap->drawable.width, pPixmap->drawable.height));
/* Free the offscreen area */
exaOffscreenFree(pPixmap->drawable.pScreen, pExaPixmap->area);
pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
pPixmap->devKind = pExaPixmap->sys_pitch;
}
RegionUninit(&pExaPixmap->validSys);
RegionUninit(&pExaPixmap->validFB);
} }
RegionUninit(&pExaPixmap->validSys);
out: RegionUninit(&pExaPixmap->validFB);
// restore original (screen driver's) DestroyPixmap() handler and call it
swap(pExaScr, pScreen, DestroyPixmap);
dixDestroyPixmap(pPixmap, 0);
swap(pExaScr, pScreen, DestroyPixmap);
return ret;
} }
Bool Bool

View File

@ -185,33 +185,19 @@ exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height,
return ret; return ret;
} }
Bool void exaPixmapDestroy_driver(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
exaDestroyPixmap_driver(PixmapPtr pPixmap)
{ {
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ExaScreenPriv(pScreen); ExaScreenPriv(pScreen);
Bool ret = TRUE;
if (pPixmap->refcnt == 1) { ExaPixmapPriv(pPixmap);
ExaPixmapPriv(pPixmap); if (!pExaPixmap) // we're called on an error path
if (!pExaPixmap) // we're called on an error path return;
goto out;
exaDestroyPixmap(pPixmap); exaDestroyPixmap(pPixmap);
if (pExaPixmap->driverPriv) if (pExaPixmap->driverPriv)
pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv); pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
pExaPixmap->driverPriv = NULL; pExaPixmap->driverPriv = NULL;
}
out:
// restore original (screen driver's) DestroyPixmap() handler and call it
swap(pExaScr, pScreen, DestroyPixmap);
dixDestroyPixmap(pPixmap, 0);
swap(pExaScr, pScreen, DestroyPixmap);
return ret;
} }
Bool Bool

View File

@ -239,42 +239,28 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
return ret; return ret;
} }
Bool void exaPixmapDestroy_mixed(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
exaDestroyPixmap_mixed(PixmapPtr pPixmap)
{ {
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ExaScreenPriv(pScreen); ExaScreenPriv(pScreen);
Bool ret = TRUE;
if (pPixmap->refcnt == 1) { ExaPixmapPriv(pPixmap);
ExaPixmapPriv(pPixmap); if (!pExaPixmap) // we're called on an error path
if (!pExaPixmap) return;
goto out; // we're called on an error path
exaDestroyPixmap(pPixmap); exaDestroyPixmap(pPixmap);
if (pExaScr->deferred_mixed_pixmap == pPixmap) if (pExaScr->deferred_mixed_pixmap == pPixmap)
pExaScr->deferred_mixed_pixmap = NULL; pExaScr->deferred_mixed_pixmap = NULL;
if (pExaPixmap->driverPriv) if (pExaPixmap->driverPriv)
pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv); pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
pExaPixmap->driverPriv = NULL; pExaPixmap->driverPriv = NULL;
if (pExaPixmap->pDamage) { if (pExaPixmap->pDamage) {
free(pExaPixmap->sys_ptr); free(pExaPixmap->sys_ptr);
pExaPixmap->sys_ptr = NULL; pExaPixmap->sys_ptr = NULL;
pExaPixmap->pDamage = NULL; pExaPixmap->pDamage = NULL;
}
} }
out:
// restore original (screen driver's) DestroyPixmap() handler and call it
swap(pExaScr, pScreen, DestroyPixmap);
dixDestroyPixmap(pPixmap, 0);
swap(pExaScr, pScreen, DestroyPixmap);
return ret;
} }
Bool Bool

View File

@ -156,7 +156,6 @@ typedef struct {
GetImageProcPtr SavedGetImage; GetImageProcPtr SavedGetImage;
GetSpansProcPtr SavedGetSpans; GetSpansProcPtr SavedGetSpans;
CreatePixmapProcPtr SavedCreatePixmap; CreatePixmapProcPtr SavedCreatePixmap;
DestroyPixmapProcPtr SavedDestroyPixmap;
CopyWindowProcPtr SavedCopyWindow; CopyWindowProcPtr SavedCopyWindow;
ChangeWindowAttributesProcPtr SavedChangeWindowAttributes; ChangeWindowAttributesProcPtr SavedChangeWindowAttributes;
BitmapToRegionProcPtr SavedBitmapToRegion; BitmapToRegionProcPtr SavedBitmapToRegion;
@ -590,8 +589,7 @@ exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height,
int depth, int bitsPerPixel, int devKind, int depth, int bitsPerPixel, int devKind,
void *pPixData); void *pPixData);
Bool void exaPixmapDestroy_classic(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap);
exaDestroyPixmap_classic(PixmapPtr pPixmap);
Bool Bool
exaPixmapHasGpuCopy_classic(PixmapPtr pPixmap); exaPixmapHasGpuCopy_classic(PixmapPtr pPixmap);
@ -608,8 +606,7 @@ exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height,
int depth, int bitsPerPixel, int devKind, int depth, int bitsPerPixel, int devKind,
void *pPixData); void *pPixData);
Bool void exaPixmapDestroy_driver(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap);
exaDestroyPixmap_driver(PixmapPtr pPixmap);
Bool Bool
exaPixmapHasGpuCopy_driver(PixmapPtr pPixmap); exaPixmapHasGpuCopy_driver(PixmapPtr pPixmap);
@ -625,8 +622,7 @@ Bool
exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth, exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
int bitsPerPixel, int devKind, void *pPixData); int bitsPerPixel, int devKind, void *pPixData);
Bool void exaPixmapDestroy_mixed(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap);
exaDestroyPixmap_mixed(PixmapPtr pPixmap);
Bool Bool
exaPixmapHasGpuCopy_mixed(PixmapPtr pPixmap); exaPixmapHasGpuCopy_mixed(PixmapPtr pPixmap);

View File

@ -842,6 +842,12 @@ fbPolyFillRect(DrawablePtr pDrawable,
#define fbFillPolygon miFillPolygon #define fbFillPolygon miFillPolygon
#define fbSetShape miSetShape
#define fbMoveWindow miMoveWindow
#define fbModifyPixmapHeader miModifyPixmapHeader
/* /*
* fbfillsp.c * fbfillsp.c
*/ */

View File

@ -604,6 +604,11 @@ glamor_setup_formats(ScreenPtr screen)
glamor_priv->cbcr_format.texture_only = FALSE; glamor_priv->cbcr_format.texture_only = FALSE;
} }
static void glamor_pixmap_destroy(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
{
glamor_pixmap_destroy_fbo(pPixmap);
}
/** Set up glamor for an already-configured GL context. */ /** Set up glamor for an already-configured GL context. */
Bool Bool
glamor_init(ScreenPtr screen, unsigned int flags) glamor_init(ScreenPtr screen, unsigned int flags)
@ -652,8 +657,7 @@ glamor_init(ScreenPtr screen, unsigned int flags)
glamor_priv->saved_procs.close_screen = screen->CloseScreen; glamor_priv->saved_procs.close_screen = screen->CloseScreen;
screen->CloseScreen = glamor_close_screen; screen->CloseScreen = glamor_close_screen;
glamor_priv->saved_procs.destroy_pixmap = screen->DestroyPixmap; dixScreenHookPixmapDestroy(screen, glamor_pixmap_destroy);
screen->DestroyPixmap = glamor_destroy_pixmap;
/* If we are using egl screen, call egl screen init to /* If we are using egl screen, call egl screen init to
* register correct close screen function. */ * register correct close screen function. */
@ -879,7 +883,7 @@ glamor_init(ScreenPtr screen, unsigned int flags)
fail: fail:
/* Restore default CloseScreen and DestroyPixmap handlers */ /* Restore default CloseScreen and DestroyPixmap handlers */
screen->CloseScreen = glamor_priv->saved_procs.close_screen; screen->CloseScreen = glamor_priv->saved_procs.close_screen;
screen->DestroyPixmap = glamor_priv->saved_procs.destroy_pixmap; dixScreenUnhookPixmapDestroy(screen, glamor_pixmap_destroy);
free_glamor_private: free_glamor_private:
free(glamor_priv); free(glamor_priv);
@ -913,9 +917,10 @@ glamor_close_screen(ScreenPtr screen)
glamor_set_glvnd_vendor(screen, NULL); glamor_set_glvnd_vendor(screen, NULL);
screen->CloseScreen = glamor_priv->saved_procs.close_screen; screen->CloseScreen = glamor_priv->saved_procs.close_screen;
dixScreenUnhookPixmapDestroy(screen, glamor_pixmap_destroy);
screen->CreateGC = glamor_priv->saved_procs.create_gc; screen->CreateGC = glamor_priv->saved_procs.create_gc;
screen->CreatePixmap = glamor_priv->saved_procs.create_pixmap; screen->CreatePixmap = glamor_priv->saved_procs.create_pixmap;
screen->DestroyPixmap = glamor_priv->saved_procs.destroy_pixmap;
screen->GetSpans = glamor_priv->saved_procs.get_spans; screen->GetSpans = glamor_priv->saved_procs.get_spans;
screen->ChangeWindowAttributes = screen->ChangeWindowAttributes =
glamor_priv->saved_procs.change_window_attributes; glamor_priv->saved_procs.change_window_attributes;

View File

@ -62,7 +62,6 @@ struct glamor_egl_screen_private {
Bool force_vendor; /* if GLVND vendor is forced from options */ Bool force_vendor; /* if GLVND vendor is forced from options */
CloseScreenProcPtr saved_close_screen; CloseScreenProcPtr saved_close_screen;
DestroyPixmapProcPtr saved_destroy_pixmap;
xf86FreeScreenProc *saved_free_screen; xf86FreeScreenProc *saved_free_screen;
}; };
@ -756,31 +755,18 @@ glamor_egl_get_driver_name(ScreenPtr screen)
return NULL; return NULL;
} }
static void glamor_egl_pixmap_destroy(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pixmap)
static Bool
glamor_egl_destroy_pixmap(PixmapPtr pixmap)
{ {
ScreenPtr screen = pixmap->drawable.pScreen; ScreenPtr screen = pixmap->drawable.pScreen;
ScrnInfoPtr scrn = xf86ScreenToScrn(screen); ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
struct glamor_egl_screen_private *glamor_egl = struct glamor_egl_screen_private *glamor_egl =
glamor_egl_get_screen_private(scrn); glamor_egl_get_screen_private(scrn);
Bool ret = TRUE;
if (pixmap->refcnt == 1) { struct glamor_pixmap_private *pixmap_priv =
struct glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
glamor_get_pixmap_private(pixmap);
if (pixmap_priv->image) if (pixmap_priv->image)
eglDestroyImageKHR(glamor_egl->display, pixmap_priv->image); eglDestroyImageKHR(glamor_egl->display, pixmap_priv->image);
}
screen->DestroyPixmap = glamor_egl->saved_destroy_pixmap;
if (screen->DestroyPixmap)
ret = screen->DestroyPixmap(pixmap);
glamor_egl->saved_destroy_pixmap = screen->DestroyPixmap;
screen->DestroyPixmap = glamor_egl_destroy_pixmap;
return ret;
} }
void void
@ -822,6 +808,7 @@ glamor_egl_close_screen(ScreenPtr screen)
eglDestroyImageKHR(glamor_egl->display, pixmap_priv->image); eglDestroyImageKHR(glamor_egl->display, pixmap_priv->image);
pixmap_priv->image = NULL; pixmap_priv->image = NULL;
dixScreenUnhookPixmapDestroy(screen, glamor_egl_pixmap_destroy);
screen->CloseScreen = glamor_egl->saved_close_screen; screen->CloseScreen = glamor_egl->saved_close_screen;
return screen->CloseScreen(screen); return screen->CloseScreen(screen);
@ -907,8 +894,7 @@ glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx)
glamor_egl->saved_close_screen = screen->CloseScreen; glamor_egl->saved_close_screen = screen->CloseScreen;
screen->CloseScreen = glamor_egl_close_screen; screen->CloseScreen = glamor_egl_close_screen;
glamor_egl->saved_destroy_pixmap = screen->DestroyPixmap; dixScreenHookPixmapDestroy(screen, glamor_egl_pixmap_destroy);
screen->DestroyPixmap = glamor_egl_destroy_pixmap;
glamor_ctx->ctx = glamor_egl->context; glamor_ctx->ctx = glamor_egl->context;
glamor_ctx->display = glamor_egl->display; glamor_ctx->display = glamor_egl->display;

View File

@ -209,7 +209,6 @@ struct glamor_saved_procs {
CloseScreenProcPtr close_screen; CloseScreenProcPtr close_screen;
CreateGCProcPtr create_gc; CreateGCProcPtr create_gc;
CreatePixmapProcPtr create_pixmap; CreatePixmapProcPtr create_pixmap;
DestroyPixmapProcPtr destroy_pixmap;
GetSpansProcPtr get_spans; GetSpansProcPtr get_spans;
GetImageProcPtr get_image; GetImageProcPtr get_image;
CompositeProcPtr composite; CompositeProcPtr composite;

View File

@ -82,9 +82,10 @@ static int KdXVPutImage(DrawablePtr, XvPortPtr, GCPtr,
static int KdXVQueryImageAttributes(XvPortPtr, XvImagePtr, static int KdXVQueryImageAttributes(XvPortPtr, XvImagePtr,
CARD16 *, CARD16 *, int *, int *); CARD16 *, CARD16 *, int *, int *);
static void KdXVWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin);
/* ScreenRec fields */ /* ScreenRec fields */
static Bool KdXVDestroyWindow(WindowPtr pWin);
static void KdXVWindowExposures(WindowPtr pWin, RegionPtr r1); static void KdXVWindowExposures(WindowPtr pWin, RegionPtr r1);
static void KdXVClipNotify(WindowPtr pWin, int dx, int dy); static void KdXVClipNotify(WindowPtr pWin, int dx, int dy);
static Bool KdXVCloseScreen(ScreenPtr); static Bool KdXVCloseScreen(ScreenPtr);
@ -139,14 +140,14 @@ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num)
if (!ScreenPriv) if (!ScreenPriv)
return FALSE; return FALSE;
ScreenPriv->DestroyWindow = pScreen->DestroyWindow; dixScreenHookWindowDestroy(pScreen, KdXVWindowDestroy);
ScreenPriv->WindowExposures = pScreen->WindowExposures; ScreenPriv->WindowExposures = pScreen->WindowExposures;
ScreenPriv->ClipNotify = pScreen->ClipNotify; ScreenPriv->ClipNotify = pScreen->ClipNotify;
ScreenPriv->CloseScreen = pScreen->CloseScreen; ScreenPriv->CloseScreen = pScreen->CloseScreen;
/* fprintf(stderr,"XV: Wrapping screen funcs\n"); */ /* fprintf(stderr,"XV: Wrapping screen funcs\n"); */
pScreen->DestroyWindow = KdXVDestroyWindow;
pScreen->WindowExposures = KdXVWindowExposures; pScreen->WindowExposures = KdXVWindowExposures;
pScreen->ClipNotify = KdXVClipNotify; pScreen->ClipNotify = KdXVClipNotify;
pScreen->CloseScreen = KdXVCloseScreen; pScreen->CloseScreen = KdXVCloseScreen;
@ -755,13 +756,10 @@ KdXVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
/**** ScreenRec fields ****/ /**** ScreenRec fields ****/
static Bool static void
KdXVDestroyWindow(WindowPtr pWin) KdXVWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin)
{ {
ScreenPtr pScreen = pWin->drawable.pScreen;
KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
KdXVWindowPtr tmp, WinPriv = GET_KDXV_WINDOW(pWin); KdXVWindowPtr tmp, WinPriv = GET_KDXV_WINDOW(pWin);
int ret;
while (WinPriv) { while (WinPriv) {
XvPortRecPrivatePtr pPriv = WinPriv->PortRec; XvPortRecPrivatePtr pPriv = WinPriv->PortRec;
@ -779,12 +777,6 @@ KdXVDestroyWindow(WindowPtr pWin)
} }
dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, NULL); dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, NULL);
pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
ret = (*pScreen->DestroyWindow) (pWin);
pScreen->DestroyWindow = KdXVDestroyWindow;
return ret;
} }
static void static void
@ -919,7 +911,6 @@ KdXVCloseScreen(ScreenPtr pScreen)
if (!ScreenPriv) if (!ScreenPriv)
return TRUE; return TRUE;
pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
pScreen->WindowExposures = ScreenPriv->WindowExposures; pScreen->WindowExposures = ScreenPriv->WindowExposures;
pScreen->ClipNotify = ScreenPriv->ClipNotify; pScreen->ClipNotify = ScreenPriv->ClipNotify;
pScreen->CloseScreen = ScreenPriv->CloseScreen; pScreen->CloseScreen = ScreenPriv->CloseScreen;

View File

@ -151,7 +151,6 @@ Bool
/*** These are DDX layer privates ***/ /*** These are DDX layer privates ***/
typedef struct { typedef struct {
DestroyWindowProcPtr DestroyWindow;
ClipNotifyProcPtr ClipNotify; ClipNotifyProcPtr ClipNotify;
WindowExposuresProcPtr WindowExposures; WindowExposuresProcPtr WindowExposures;
CloseScreenProcPtr CloseScreen; CloseScreenProcPtr CloseScreen;

View File

@ -81,9 +81,10 @@ static int xf86XVPutImage(DrawablePtr, XvPortPtr, GCPtr,
static int xf86XVQueryImageAttributes(XvPortPtr, XvImagePtr, static int xf86XVQueryImageAttributes(XvPortPtr, XvImagePtr,
CARD16 *, CARD16 *, int *, int *); CARD16 *, CARD16 *, int *, int *);
static void xf86XVWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin);
/* ScreenRec fields */ /* ScreenRec fields */
static Bool xf86XVDestroyWindow(WindowPtr pWin);
static void xf86XVWindowExposures(WindowPtr pWin, RegionPtr r1); static void xf86XVWindowExposures(WindowPtr pWin, RegionPtr r1);
static void xf86XVPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin, static void xf86XVPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin,
VTKind kind); VTKind kind);
@ -253,7 +254,6 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
pScrn = xf86ScreenToScrn(pScreen); pScrn = xf86ScreenToScrn(pScreen);
ScreenPriv->DestroyWindow = pScreen->DestroyWindow;
ScreenPriv->WindowExposures = pScreen->WindowExposures; ScreenPriv->WindowExposures = pScreen->WindowExposures;
ScreenPriv->PostValidateTree = PostValidateTreeUndefined; ScreenPriv->PostValidateTree = PostValidateTreeUndefined;
ScreenPriv->ClipNotify = pScreen->ClipNotify; ScreenPriv->ClipNotify = pScreen->ClipNotify;
@ -263,7 +263,6 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
ScreenPriv->AdjustFrame = pScrn->AdjustFrame; ScreenPriv->AdjustFrame = pScrn->AdjustFrame;
ScreenPriv->ModeSet = pScrn->ModeSet; ScreenPriv->ModeSet = pScrn->ModeSet;
pScreen->DestroyWindow = xf86XVDestroyWindow;
pScreen->WindowExposures = xf86XVWindowExposures; pScreen->WindowExposures = xf86XVWindowExposures;
pScreen->ClipNotify = xf86XVClipNotify; pScreen->ClipNotify = xf86XVClipNotify;
pScreen->CloseScreen = xf86XVCloseScreen; pScreen->CloseScreen = xf86XVCloseScreen;
@ -991,13 +990,10 @@ xf86XVReputOrStopAllPorts(ScrnInfoPtr pScrn, Bool onlyChanged)
/**** ScreenRec fields ****/ /**** ScreenRec fields ****/
static Bool static void
xf86XVDestroyWindow(WindowPtr pWin) xf86XVWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin)
{ {
ScreenPtr pScreen = pWin->drawable.pScreen;
XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
XF86XVWindowPtr tmp, WinPriv = GET_XF86XV_WINDOW(pWin); XF86XVWindowPtr tmp, WinPriv = GET_XF86XV_WINDOW(pWin);
int ret;
while (WinPriv) { while (WinPriv) {
XvPortRecPrivatePtr pPriv = WinPriv->PortRec; XvPortRecPrivatePtr pPriv = WinPriv->PortRec;
@ -1015,12 +1011,6 @@ xf86XVDestroyWindow(WindowPtr pWin)
} }
dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, NULL); dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, NULL);
pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
ret = (*pScreen->DestroyWindow) (pWin);
pScreen->DestroyWindow = xf86XVDestroyWindow;
return ret;
} }
static void static void
@ -1148,7 +1138,8 @@ xf86XVCloseScreen(ScreenPtr pScreen)
if (!ScreenPriv) if (!ScreenPriv)
return TRUE; return TRUE;
pScreen->DestroyWindow = ScreenPriv->DestroyWindow; dixScreenUnhookWindowDestroy(pScreen, xf86XVWindowDestroy);
pScreen->WindowExposures = ScreenPriv->WindowExposures; pScreen->WindowExposures = ScreenPriv->WindowExposures;
pScreen->ClipNotify = ScreenPriv->ClipNotify; pScreen->ClipNotify = ScreenPriv->ClipNotify;
pScreen->CloseScreen = ScreenPriv->CloseScreen; pScreen->CloseScreen = ScreenPriv->CloseScreen;

View File

@ -1,4 +1,3 @@
/* /*
* Copyright (c) 2003 by The XFree86 Project, Inc. * Copyright (c) 2003 by The XFree86 Project, Inc.
* *
@ -37,7 +36,6 @@
extern _X_EXPORT DevPrivateKey XF86XvScreenKey; extern _X_EXPORT DevPrivateKey XF86XvScreenKey;
typedef struct { typedef struct {
DestroyWindowProcPtr DestroyWindow;
ClipNotifyProcPtr ClipNotify; ClipNotifyProcPtr ClipNotify;
WindowExposuresProcPtr WindowExposures; WindowExposuresProcPtr WindowExposures;
PostValidateTreeProcPtr PostValidateTree; PostValidateTreeProcPtr PostValidateTree;

View File

@ -634,7 +634,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
return TRUE; return TRUE;
} }
static Bool DRIDestroyWindow(WindowPtr pWin); static void DRIWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin);
Bool Bool
DRIFinishScreenInit(ScreenPtr pScreen) DRIFinishScreenInit(ScreenPtr pScreen)
@ -648,8 +648,7 @@ DRIFinishScreenInit(ScreenPtr pScreen)
pScreen->WindowExposures = pDRIInfo->wrap.WindowExposures; pScreen->WindowExposures = pDRIInfo->wrap.WindowExposures;
} }
pDRIPriv->DestroyWindow = pScreen->DestroyWindow; dixScreenHookWindowDestroy(pScreen, DRIWindowDestroy);
pScreen->DestroyWindow = DRIDestroyWindow;
pDRIPriv->xf86_crtc_notify = xf86_wrap_crtc_notify(pScreen, pDRIPriv->xf86_crtc_notify = xf86_wrap_crtc_notify(pScreen,
dri_crtc_notify); dri_crtc_notify);
@ -696,11 +695,8 @@ DRICloseScreen(ScreenPtr pScreen)
pScreen->WindowExposures = pDRIPriv->wrap.WindowExposures; pScreen->WindowExposures = pDRIPriv->wrap.WindowExposures;
pDRIPriv->wrap.WindowExposures = NULL; pDRIPriv->wrap.WindowExposures = NULL;
} }
if (pDRIPriv->DestroyWindow) {
pScreen->DestroyWindow = pDRIPriv->DestroyWindow;
pDRIPriv->DestroyWindow = NULL;
}
dixScreenUnhookWindowDestroy(pScreen, DRIWindowDestroy);
xf86_unwrap_crtc_notify(pScreen, pDRIPriv->xf86_crtc_notify); xf86_unwrap_crtc_notify(pScreen, pDRIPriv->xf86_crtc_notify);
if (pDRIInfo->wrap.CopyWindow) { if (pDRIInfo->wrap.CopyWindow) {
@ -1922,29 +1918,9 @@ DRITreeTraversal(WindowPtr pWin, void *data)
return WT_WALKCHILDREN; return WT_WALKCHILDREN;
} }
static Bool static void DRIWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin)
DRIDestroyWindow(WindowPtr pWin)
{ {
ScreenPtr pScreen = pWin->drawable.pScreen;
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
Bool retval = TRUE;
DRIDrawablePrivDestroy(pWin); DRIDrawablePrivDestroy(pWin);
/* call lower wrapped functions */
if (pDRIPriv->DestroyWindow) {
/* unwrap */
pScreen->DestroyWindow = pDRIPriv->DestroyWindow;
/* call lower layers */
retval = (*pScreen->DestroyWindow) (pWin);
/* rewrap */
pDRIPriv->DestroyWindow = pScreen->DestroyWindow;
pScreen->DestroyWindow = DRIDestroyWindow;
}
return retval;
} }
void void

View File

@ -90,7 +90,6 @@ typedef struct _DRIScreenPrivRec {
DrawablePtr fullscreen; /* pointer to fullscreen drawable */ DrawablePtr fullscreen; /* pointer to fullscreen drawable */
drm_clip_rect_t fullscreen_rect; /* fake rect for fullscreen mode */ drm_clip_rect_t fullscreen_rect; /* fake rect for fullscreen mode */
DRIWrappedFuncsRec wrap; DRIWrappedFuncsRec wrap;
DestroyWindowProcPtr DestroyWindow;
DrawablePtr DRIDrawables[SAREA_MAX_DRAWABLES]; DrawablePtr DRIDrawables[SAREA_MAX_DRAWABLES];
DRIContextPrivPtr dummyCtxPriv; /* Pointer to dummy context */ DRIContextPrivPtr dummyCtxPriv; /* Pointer to dummy context */
Bool createDummyCtx; Bool createDummyCtx;

View File

@ -1135,8 +1135,7 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
xwl_screen->UnrealizeWindow = pScreen->UnrealizeWindow; xwl_screen->UnrealizeWindow = pScreen->UnrealizeWindow;
pScreen->UnrealizeWindow = xwl_unrealize_window; pScreen->UnrealizeWindow = xwl_unrealize_window;
xwl_screen->DestroyWindow = pScreen->DestroyWindow; dixScreenHookWindowDestroy(pScreen, xwl_window_destroy);
pScreen->DestroyWindow = xwl_destroy_window;
xwl_screen->CloseScreen = pScreen->CloseScreen; xwl_screen->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = xwl_close_screen; pScreen->CloseScreen = xwl_close_screen;

View File

@ -74,7 +74,6 @@ struct xwl_screen {
ConfigNotifyProcPtr ConfigNotify; ConfigNotifyProcPtr ConfigNotify;
RealizeWindowProcPtr RealizeWindow; RealizeWindowProcPtr RealizeWindow;
UnrealizeWindowProcPtr UnrealizeWindow; UnrealizeWindowProcPtr UnrealizeWindow;
DestroyWindowProcPtr DestroyWindow;
XYToWindowProcPtr XYToWindow; XYToWindowProcPtr XYToWindow;
SetWindowPixmapProcPtr SetWindowPixmap; SetWindowPixmapProcPtr SetWindowPixmap;
ChangeWindowAttributesProcPtr ChangeWindowAttributes; ChangeWindowAttributesProcPtr ChangeWindowAttributes;

View File

@ -1939,31 +1939,17 @@ xwl_window_create_frame_callback(struct xwl_window *xwl_window)
xwl_present_for_each_frame_callback(xwl_window, xwl_present_reset_timer); xwl_present_for_each_frame_callback(xwl_window, xwl_present_reset_timer);
} }
Bool void
xwl_destroy_window(WindowPtr window) xwl_window_destroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr window)
{ {
ScreenPtr screen = window->drawable.pScreen; struct xwl_screen *xwl_screen = xwl_screen_get(pScreen);
struct xwl_screen *xwl_screen = xwl_screen_get(screen);
struct xwl_window *xwl_window = xwl_window_get(window); struct xwl_window *xwl_window = xwl_window_get(window);
Bool ret;
if (xwl_screen->present) if (xwl_screen->present)
xwl_present_cleanup(window); xwl_present_cleanup(window);
if (xwl_window) if (xwl_window)
xwl_window_dispose(xwl_window); xwl_window_dispose(xwl_window);
screen->DestroyWindow = xwl_screen->DestroyWindow;
if (screen->DestroyWindow)
ret = screen->DestroyWindow (window);
else
ret = TRUE;
xwl_screen->DestroyWindow = screen->DestroyWindow;
screen->DestroyWindow = xwl_destroy_window;
return ret;
} }
static Bool static Bool

View File

@ -146,7 +146,7 @@ void xwl_move_window(WindowPtr window,
int x, int y, int x, int y,
WindowPtr next_sib, WindowPtr next_sib,
VTKind kind); VTKind kind);
Bool xwl_destroy_window(WindowPtr window); void xwl_window_destroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr window);
void xwl_window_post_damage(struct xwl_window *xwl_window); void xwl_window_post_damage(struct xwl_window *xwl_window);
void xwl_window_create_frame_callback(struct xwl_window *xwl_window); void xwl_window_create_frame_callback(struct xwl_window *xwl_window);
void xwl_window_surface_do_destroy(struct xwl_wl_surface *xwl_wl_surface); void xwl_window_surface_do_destroy(struct xwl_wl_surface *xwl_wl_surface);

View File

@ -373,8 +373,6 @@ static __GLXdrawable *glxWinCreateDrawable(ClientPtr client,
int type, int type,
XID glxDrawId, __GLXconfig * conf); XID glxDrawId, __GLXconfig * conf);
static Bool glxWinRealizeWindow(WindowPtr pWin);
static Bool glxWinUnrealizeWindow(WindowPtr pWin);
static void glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, static void glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg,
RegionPtr prgnSrc); RegionPtr prgnSrc);
static Bool glxWinSetPixelFormat(HDC hdc, int bppOverride, int drawableTypeOverride, static Bool glxWinSetPixelFormat(HDC hdc, int bppOverride, int drawableTypeOverride,
@ -704,11 +702,7 @@ glxWinScreenProbe(ScreenPtr pScreen)
// dump out fbConfigs now fbConfigIds and visualIDs have been assigned // dump out fbConfigs now fbConfigIds and visualIDs have been assigned
fbConfigsDump(screen->base.numFBConfigs, screen->base.fbconfigs, &rejects); fbConfigsDump(screen->base.numFBConfigs, screen->base.fbconfigs, &rejects);
/* Wrap RealizeWindow, UnrealizeWindow and CopyWindow on this screen */ /* Wrap CopyWindow on this screen */
screen->RealizeWindow = pScreen->RealizeWindow;
pScreen->RealizeWindow = glxWinRealizeWindow;
screen->UnrealizeWindow = pScreen->UnrealizeWindow;
pScreen->UnrealizeWindow = glxWinUnrealizeWindow;
screen->CopyWindow = pScreen->CopyWindow; screen->CopyWindow = pScreen->CopyWindow;
pScreen->CopyWindow = glxWinCopyWindow; pScreen->CopyWindow = glxWinCopyWindow;
@ -730,23 +724,6 @@ glxWinScreenProbe(ScreenPtr pScreen)
* Window functions * Window functions
*/ */
static Bool
glxWinRealizeWindow(WindowPtr pWin)
{
Bool result;
ScreenPtr pScreen = pWin->drawable.pScreen;
glxWinScreen *screenPriv = (glxWinScreen *) glxGetScreen(pScreen);
GLWIN_DEBUG_MSG("glxWinRealizeWindow");
/* Allow the window to be created (RootlessRealizeWindow is inside our wrap) */
pScreen->RealizeWindow = screenPriv->RealizeWindow;
result = pScreen->RealizeWindow(pWin);
pScreen->RealizeWindow = glxWinRealizeWindow;
return result;
}
static void static void
glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc) glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{ {
@ -778,22 +755,6 @@ glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
pScreen->CopyWindow = glxWinCopyWindow; pScreen->CopyWindow = glxWinCopyWindow;
} }
static Bool
glxWinUnrealizeWindow(WindowPtr pWin)
{
Bool result;
ScreenPtr pScreen = pWin->drawable.pScreen;
glxWinScreen *screenPriv = (glxWinScreen *) glxGetScreen(pScreen);
GLWIN_DEBUG_MSG("glxWinUnrealizeWindow");
pScreen->UnrealizeWindow = screenPriv->UnrealizeWindow;
result = pScreen->UnrealizeWindow(pWin);
pScreen->UnrealizeWindow = glxWinUnrealizeWindow;
return result;
}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
/* /*
* Drawable functions * Drawable functions

View File

@ -72,8 +72,6 @@ struct __GLXWinScreen {
Bool has_WGL_ARB_framebuffer_sRGB; Bool has_WGL_ARB_framebuffer_sRGB;
/* wrapped screen functions */ /* wrapped screen functions */
RealizeWindowProcPtr RealizeWindow;
UnrealizeWindowProcPtr UnrealizeWindow;
CopyWindowProcPtr CopyWindow; CopyWindowProcPtr CopyWindow;
}; };

View File

@ -485,7 +485,6 @@ typedef struct _winPrivScreenRec {
winInitVisualsProcPtr pwinInitVisuals; winInitVisualsProcPtr pwinInitVisuals;
winAdjustVideoModeProcPtr pwinAdjustVideoMode; winAdjustVideoModeProcPtr pwinAdjustVideoMode;
winCreateBoundingWindowProcPtr pwinCreateBoundingWindow; winCreateBoundingWindowProcPtr pwinCreateBoundingWindow;
winFinishScreenInitProcPtr pwinFinishScreenInit;
winBltExposedRegionsProcPtr pwinBltExposedRegions; winBltExposedRegionsProcPtr pwinBltExposedRegions;
winBltExposedWindowRegionProcPtr pwinBltExposedWindowRegion; winBltExposedWindowRegionProcPtr pwinBltExposedWindowRegion;
winActivateAppProcPtr pwinActivateApp; winActivateAppProcPtr pwinActivateApp;
@ -500,23 +499,10 @@ typedef struct _winPrivScreenRec {
winCreateScreenResourcesProc pwinCreateScreenResources; winCreateScreenResourcesProc pwinCreateScreenResources;
/* Window Procedures for Rootless mode */ /* Window Procedures for Rootless mode */
CreateWindowProcPtr CreateWindow;
DestroyWindowProcPtr DestroyWindow;
PositionWindowProcPtr PositionWindow;
ChangeWindowAttributesProcPtr ChangeWindowAttributes;
RealizeWindowProcPtr RealizeWindow;
UnrealizeWindowProcPtr UnrealizeWindow;
ValidateTreeProcPtr ValidateTree; ValidateTreeProcPtr ValidateTree;
PostValidateTreeProcPtr PostValidateTree; PostValidateTreeProcPtr PostValidateTree;
CopyWindowProcPtr CopyWindow;
ClearToBackgroundProcPtr ClearToBackground; ClearToBackgroundProcPtr ClearToBackground;
ClipNotifyProcPtr ClipNotify; ClipNotifyProcPtr ClipNotify;
RestackWindowProcPtr RestackWindow;
ReparentWindowProcPtr ReparentWindow;
ResizeWindowProcPtr ResizeWindow;
MoveWindowProcPtr MoveWindow;
SetShapeProcPtr SetShape;
ModifyPixmapHeaderProcPtr ModifyPixmapHeader;
winCursorRec cursor; winCursorRec cursor;
@ -831,9 +817,6 @@ void
Bool Bool
winScreenInit(ScreenPtr pScreen, int argc, char **argv); winScreenInit(ScreenPtr pScreen, int argc, char **argv);
Bool
winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv);
/* /*
* winshadddnl.c * winshadddnl.c
*/ */
@ -925,19 +908,9 @@ void
winReorderWindowsMultiWindow(void); winReorderWindowsMultiWindow(void);
void void
winResizeWindowMultiWindow(WindowPtr pWin, int x, int y, unsigned int w,
unsigned int h, WindowPtr pSib);
void
winMoveWindowMultiWindow(WindowPtr pWin, int x, int y, winMoveWindowMultiWindow(WindowPtr pWin, int x, int y,
WindowPtr pSib, VTKind kind); WindowPtr pSib, VTKind kind);
void
winCopyWindowMultiWindow(WindowPtr pWin, DDXPointRec oldpt,
RegionPtr oldRegion);
PixmapPtr PixmapPtr
winCreatePixmapMultiwindow(ScreenPtr pScreen, int width, int height, int depth, winCreatePixmapMultiwindow(ScreenPtr pScreen, int width, int height, int depth,
unsigned usage_hint); unsigned usage_hint);

View File

@ -33,6 +33,8 @@
#include <xwin-config.h> #include <xwin-config.h>
#endif #endif
#include "mi/mi_priv.h"
#include "win.h" #include "win.h"
/* /*
@ -50,9 +52,7 @@ winSetShapeMultiWindow(WindowPtr pWin, int kind)
ErrorF("winSetShapeMultiWindow - pWin: %p kind: %i\n", pWin, kind); ErrorF("winSetShapeMultiWindow - pWin: %p kind: %i\n", pWin, kind);
#endif #endif
WIN_UNWRAP(SetShape); fbSetShape(pWin, kind);
(*pScreen->SetShape) (pWin, kind);
WIN_WRAP(SetShape, winSetShapeMultiWindow);
/* Update the Windows window's shape */ /* Update the Windows window's shape */
winReshapeMultiWindow(pWin); winReshapeMultiWindow(pWin);

View File

@ -36,6 +36,8 @@
#include <xwin-config.h> #include <xwin-config.h>
#endif #endif
#include "mi/mi_priv.h"
#include "win.h" #include "win.h"
#include "dixevents.h" #include "dixevents.h"
#include "winmultiwindowclass.h" #include "winmultiwindowclass.h"
@ -109,9 +111,7 @@ winCreateWindowMultiWindow(WindowPtr pWin)
winTrace("winCreateWindowMultiWindow - pWin: %p\n", pWin); winTrace("winCreateWindowMultiWindow - pWin: %p\n", pWin);
#endif #endif
WIN_UNWRAP(CreateWindow); fbCreateWindow(pWin);
fResult = (*pScreen->CreateWindow) (pWin);
WIN_WRAP(CreateWindow, winCreateWindowMultiWindow);
/* Initialize some privates values */ /* Initialize some privates values */
pWinPriv->hRgn = NULL; pWinPriv->hRgn = NULL;
@ -142,9 +142,7 @@ winDestroyWindowMultiWindow(WindowPtr pWin)
ErrorF("winDestroyWindowMultiWindow - pWin: %p\n", pWin); ErrorF("winDestroyWindowMultiWindow - pWin: %p\n", pWin);
#endif #endif
WIN_UNWRAP(DestroyWindow); fbDestroyWindow(pWin);
fResult = (*pScreen->DestroyWindow) (pWin);
WIN_WRAP(DestroyWindow, winDestroyWindowMultiWindow);
/* Flag that the window has been destroyed */ /* Flag that the window has been destroyed */
pWinPriv->fXKilled = TRUE; pWinPriv->fXKilled = TRUE;
@ -188,9 +186,7 @@ winPositionWindowMultiWindow(WindowPtr pWin, int x, int y)
winTrace("winPositionWindowMultiWindow - pWin: %p\n", pWin); winTrace("winPositionWindowMultiWindow - pWin: %p\n", pWin);
#endif #endif
WIN_UNWRAP(PositionWindow); fbPositionWindow(pWin, x, y);
fResult = (*pScreen->PositionWindow) (pWin, x, y);
WIN_WRAP(PositionWindow, winPositionWindowMultiWindow);
#if ENABLE_DEBUG #if ENABLE_DEBUG
ErrorF("winPositionWindowMultiWindow: (x, y) = (%d, %d)\n", x, y); ErrorF("winPositionWindowMultiWindow: (x, y) = (%d, %d)\n", x, y);
@ -291,9 +287,7 @@ winChangeWindowAttributesMultiWindow(WindowPtr pWin, unsigned long mask)
ErrorF("winChangeWindowAttributesMultiWindow - pWin: %p\n", pWin); ErrorF("winChangeWindowAttributesMultiWindow - pWin: %p\n", pWin);
#endif #endif
WIN_UNWRAP(ChangeWindowAttributes); fbChangeWindowAttributes(pWin, mask);
fResult = (*pScreen->ChangeWindowAttributes) (pWin, mask);
WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesMultiWindow);
/* /*
* NOTE: We do not currently need to do anything here. * NOTE: We do not currently need to do anything here.
@ -320,9 +314,7 @@ winUnmapWindowMultiWindow(WindowPtr pWin)
ErrorF("winUnmapWindowMultiWindow - pWin: %p\n", pWin); ErrorF("winUnmapWindowMultiWindow - pWin: %p\n", pWin);
#endif #endif
WIN_UNWRAP(UnrealizeWindow); fbUnrealizeWindow(pWin);
fResult = (*pScreen->UnrealizeWindow) (pWin);
WIN_WRAP(UnrealizeWindow, winUnmapWindowMultiWindow);
/* Flag that the window has been killed */ /* Flag that the window has been killed */
pWinPriv->fXKilled = TRUE; pWinPriv->fXKilled = TRUE;
@ -351,9 +343,7 @@ winMapWindowMultiWindow(WindowPtr pWin)
ErrorF("winMapWindowMultiWindow - pWin: %p\n", pWin); ErrorF("winMapWindowMultiWindow - pWin: %p\n", pWin);
#endif #endif
WIN_UNWRAP(RealizeWindow); fbRealizeWindow(pWin);
fResult = (*pScreen->RealizeWindow) (pWin);
WIN_WRAP(RealizeWindow, winMapWindowMultiWindow);
/* Flag that this window has not been destroyed */ /* Flag that this window has not been destroyed */
pWinPriv->fXKilled = FALSE; pWinPriv->fXKilled = FALSE;
@ -385,11 +375,6 @@ winReparentWindowMultiWindow(WindowPtr pWin, WindowPtr pPriorParent)
pPriorParent, (unsigned int)pPriorParent->drawable.id, pPriorParent, (unsigned int)pPriorParent->drawable.id,
pWin->parent, (unsigned int)pWin->parent->drawable.id); pWin->parent, (unsigned int)pWin->parent->drawable.id);
WIN_UNWRAP(ReparentWindow);
if (pScreen->ReparentWindow)
(*pScreen->ReparentWindow) (pWin, pPriorParent);
WIN_WRAP(ReparentWindow, winReparentWindowMultiWindow);
/* Update the Windows window associated with this X window */ /* Update the Windows window associated with this X window */
winUpdateWindowsWindow(pWin); winUpdateWindowsWindow(pWin);
} }
@ -415,11 +400,6 @@ winRestackWindowMultiWindow(WindowPtr pWin, WindowPtr pOldNextSib)
winTrace("winRestackMultiWindow - %p\n", pWin); winTrace("winRestackMultiWindow - %p\n", pWin);
#endif #endif
WIN_UNWRAP(RestackWindow);
if (pScreen->RestackWindow)
(*pScreen->RestackWindow) (pWin, pOldNextSib);
WIN_WRAP(RestackWindow, winRestackWindowMultiWindow);
#if 1 #if 1
/* /*
* Calling winReorderWindowsMultiWindow here means our window manager * Calling winReorderWindowsMultiWindow here means our window manager
@ -799,24 +779,6 @@ winReorderWindowsMultiWindow(void)
fRestacking = FALSE; fRestacking = FALSE;
} }
/*
* CopyWindow - See Porting Layer Definition - p. 39
*/
void
winCopyWindowMultiWindow(WindowPtr pWin, DDXPointRec oldpt, RegionPtr oldRegion)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
winScreenPriv(pScreen);
#if ENABLE_DEBUG
ErrorF("CopyWindowMultiWindow\n");
#endif
WIN_UNWRAP(CopyWindow);
(*pScreen->CopyWindow) (pWin, oldpt, oldRegion);
WIN_WRAP(CopyWindow, winCopyWindowMultiWindow);
}
/* /*
* MoveWindow - See Porting Layer Definition - p. 42 * MoveWindow - See Porting Layer Definition - p. 42
*/ */
@ -832,28 +794,7 @@ winMoveWindowMultiWindow(WindowPtr pWin, int x, int y,
ErrorF("MoveWindowMultiWindow to (%d, %d)\n", x, y); ErrorF("MoveWindowMultiWindow to (%d, %d)\n", x, y);
#endif #endif
WIN_UNWRAP(MoveWindow); fbMoveWindow(pWin, x, y, pSib, kind);
(*pScreen->MoveWindow) (pWin, x, y, pSib, kind);
WIN_WRAP(MoveWindow, winMoveWindowMultiWindow);
}
/*
* ResizeWindow - See Porting Layer Definition - p. 42
*/
void
winResizeWindowMultiWindow(WindowPtr pWin, int x, int y, unsigned int w,
unsigned int h, WindowPtr pSib)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
winScreenPriv(pScreen);
#if ENABLE_DEBUG
ErrorF("ResizeWindowMultiWindow to (%d, %d) - %dx%d\n", x, y, w, h);
#endif
WIN_UNWRAP(ResizeWindow);
(*pScreen->ResizeWindow) (pWin, x, y, w, h, pSib);
WIN_WRAP(ResizeWindow, winResizeWindowMultiWindow);
} }
/* /*
@ -1153,7 +1094,6 @@ winModifyPixmapHeaderMultiwindow(PixmapPtr pPixmap,
{ {
int i; int i;
winPrivPixmapPtr pPixmapPriv = winGetPixmapPriv(pPixmap); winPrivPixmapPtr pPixmapPriv = winGetPixmapPriv(pPixmap);
Bool fResult;
/* reinitialize everything */ /* reinitialize everything */
pPixmap->drawable.depth = depth; pPixmap->drawable.depth = depth;
@ -1204,13 +1144,5 @@ winModifyPixmapHeaderMultiwindow(PixmapPtr pPixmap,
winDebug("winModifyPixmapHeaderMultiwindow: falling back\n"); winDebug("winModifyPixmapHeaderMultiwindow: falling back\n");
{ return fbModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel, devKind, pPixData);
ScreenPtr pScreen = pPixmap->drawable.pScreen;
winScreenPriv(pScreen);
WIN_UNWRAP(ModifyPixmapHeader);
fResult = (*pScreen->ModifyPixmapHeader) (pPixmap, width, height, depth, bitsPerPixel, devKind, pPixData);
WIN_WRAP(ModifyPixmapHeader, winModifyPixmapHeaderMultiwindow);
}
return fResult;
} }

View File

@ -38,6 +38,8 @@
#include "win.h" #include "win.h"
#include "winmsg.h" #include "winmsg.h"
static Bool winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv);
/* /*
* Determine what type of screen we are initializing * Determine what type of screen we are initializing
* and call the appropriate procedure to initialize * and call the appropriate procedure to initialize
@ -165,9 +167,8 @@ winScreenInit(ScreenPtr pScreen, int argc, char **argv)
/* Clear the visuals list */ /* Clear the visuals list */
miClearVisualTypes(); miClearVisualTypes();
/* Call the engine dependent screen initialization procedure */ if (!winFinishScreenInitFB(pScreen->myNum, pScreen, argc, argv)) {
if (!((*pScreenPriv->pwinFinishScreenInit) (pScreen->myNum, pScreen, argc, argv))) { ErrorF("%s(): winFinishScreenInitFB () failed\n", __FUNCTION__);
ErrorF("winScreenInit - winFinishScreenInit () failed\n");
/* call the engine dependent screen close procedure to clean up from a failure */ /* call the engine dependent screen close procedure to clean up from a failure */
pScreenPriv->pwinCloseScreen(pScreen); pScreenPriv->pwinCloseScreen(pScreen);
@ -221,7 +222,7 @@ winCreateScreenResources(ScreenPtr pScreen)
} }
/* See Porting Layer Definition - p. 20 */ /* See Porting Layer Definition - p. 20 */
Bool static Bool
winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv) winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv)
{ {
winScreenPriv(pScreen); winScreenPriv(pScreen);
@ -376,15 +377,6 @@ winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv)
pScreenPriv->a = NULL; \ pScreenPriv->a = NULL; \
} }
/* Save a pointer to each lower-level window procedure */
WRAP(CreateWindow);
WRAP(DestroyWindow);
WRAP(RealizeWindow);
WRAP(UnrealizeWindow);
WRAP(PositionWindow);
WRAP(ChangeWindowAttributes);
WRAP(SetShape);
/* Assign rootless window procedures to be top level procedures */ /* Assign rootless window procedures to be top level procedures */
pScreen->CreateWindow = winCreateWindowRootless; pScreen->CreateWindow = winCreateWindowRootless;
pScreen->DestroyWindow = winDestroyWindowRootless; pScreen->DestroyWindow = winDestroyWindowRootless;
@ -409,21 +401,6 @@ winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv)
pScreenPriv->a = NULL; \ pScreenPriv->a = NULL; \
} }
/* Save a pointer to each lower-level window procedure */
WRAP(CreateWindow);
WRAP(DestroyWindow);
WRAP(RealizeWindow);
WRAP(UnrealizeWindow);
WRAP(PositionWindow);
WRAP(ChangeWindowAttributes);
WRAP(ReparentWindow);
WRAP(RestackWindow);
WRAP(ResizeWindow);
WRAP(MoveWindow);
WRAP(CopyWindow);
WRAP(SetShape);
WRAP(ModifyPixmapHeader);
/* Assign multi-window window procedures to be top level procedures */ /* Assign multi-window window procedures to be top level procedures */
pScreen->CreateWindow = winCreateWindowMultiWindow; pScreen->CreateWindow = winCreateWindowMultiWindow;
pScreen->DestroyWindow = winDestroyWindowMultiWindow; pScreen->DestroyWindow = winDestroyWindowMultiWindow;
@ -433,9 +410,7 @@ winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv)
pScreen->UnrealizeWindow = winUnmapWindowMultiWindow; pScreen->UnrealizeWindow = winUnmapWindowMultiWindow;
pScreen->ReparentWindow = winReparentWindowMultiWindow; pScreen->ReparentWindow = winReparentWindowMultiWindow;
pScreen->RestackWindow = winRestackWindowMultiWindow; pScreen->RestackWindow = winRestackWindowMultiWindow;
pScreen->ResizeWindow = winResizeWindowMultiWindow;
pScreen->MoveWindow = winMoveWindowMultiWindow; pScreen->MoveWindow = winMoveWindowMultiWindow;
pScreen->CopyWindow = winCopyWindowMultiWindow;
pScreen->SetShape = winSetShapeMultiWindow; pScreen->SetShape = winSetShapeMultiWindow;
if (pScreenInfo->fCompositeWM) { if (pScreenInfo->fCompositeWM) {

View File

@ -1193,7 +1193,6 @@ winSetEngineFunctionsShadowDDNL(ScreenPtr pScreen)
winCreateBoundingWindowFullScreen; winCreateBoundingWindowFullScreen;
else else
pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowDDNL; pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowDDNL;
pScreenPriv->pwinBltExposedWindowRegion = NULL; pScreenPriv->pwinBltExposedWindowRegion = NULL;
pScreenPriv->pwinActivateApp = winActivateAppShadowDDNL; pScreenPriv->pwinActivateApp = winActivateAppShadowDDNL;

View File

@ -1265,7 +1265,6 @@ winSetEngineFunctionsShadowGDI(ScreenPtr pScreen)
winCreateBoundingWindowFullScreen; winCreateBoundingWindowFullScreen;
else else
pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowGDI; pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowGDI;
pScreenPriv->pwinBltExposedWindowRegion = winBltExposedWindowRegionShadowGDI; pScreenPriv->pwinBltExposedWindowRegion = winBltExposedWindowRegionShadowGDI;
pScreenPriv->pwinActivateApp = winActivateAppShadowGDI; pScreenPriv->pwinActivateApp = winActivateAppShadowGDI;

View File

@ -32,6 +32,9 @@
#ifdef HAVE_XWIN_CONFIG_H #ifdef HAVE_XWIN_CONFIG_H
#include <xwin-config.h> #include <xwin-config.h>
#endif #endif
#include "mi/mi_priv.h"
#include "win.h" #include "win.h"
/* /*
@ -65,9 +68,7 @@ winCreateWindowRootless(WindowPtr pWin)
winTrace("winCreateWindowRootless (%p)\n", pWin); winTrace("winCreateWindowRootless (%p)\n", pWin);
#endif #endif
WIN_UNWRAP(CreateWindow); fResult = fbCreateWindow(pWin);
fResult = (*pScreen->CreateWindow) (pWin);
WIN_WRAP(CreateWindow, winCreateWindowRootless);
pWinPriv->hRgn = NULL; pWinPriv->hRgn = NULL;
@ -90,9 +91,7 @@ winDestroyWindowRootless(WindowPtr pWin)
winTrace("winDestroyWindowRootless (%p)\n", pWin); winTrace("winDestroyWindowRootless (%p)\n", pWin);
#endif #endif
WIN_UNWRAP(DestroyWindow); fbDestroyWindow(pWin);
fResult = (*pScreen->DestroyWindow) (pWin);
WIN_WRAP(DestroyWindow, winDestroyWindowRootless);
if (pWinPriv->hRgn != NULL) { if (pWinPriv->hRgn != NULL) {
DeleteObject(pWinPriv->hRgn); DeleteObject(pWinPriv->hRgn);
@ -119,9 +118,7 @@ winPositionWindowRootless(WindowPtr pWin, int x, int y)
winTrace("winPositionWindowRootless (%p)\n", pWin); winTrace("winPositionWindowRootless (%p)\n", pWin);
#endif #endif
WIN_UNWRAP(PositionWindow); fbPositionWindow(pWin, x, y);
fResult = (*pScreen->PositionWindow) (pWin, x, y);
WIN_WRAP(PositionWindow, winPositionWindowRootless);
winUpdateRgnRootless(pWin); winUpdateRgnRootless(pWin);
@ -143,9 +140,7 @@ winChangeWindowAttributesRootless(WindowPtr pWin, unsigned long mask)
winTrace("winChangeWindowAttributesRootless (%p)\n", pWin); winTrace("winChangeWindowAttributesRootless (%p)\n", pWin);
#endif #endif
WIN_UNWRAP(ChangeWindowAttributes); fbChangeWindowAttributes(pWin, mask);
fResult = (*pScreen->ChangeWindowAttributes) (pWin, mask);
WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesRootless);
winUpdateRgnRootless(pWin); winUpdateRgnRootless(pWin);
@ -169,9 +164,7 @@ winUnmapWindowRootless(WindowPtr pWin)
winTrace("winUnmapWindowRootless (%p)\n", pWin); winTrace("winUnmapWindowRootless (%p)\n", pWin);
#endif #endif
WIN_UNWRAP(UnrealizeWindow); fbUnrealizeWindow(pWin);
fResult = (*pScreen->UnrealizeWindow) (pWin);
WIN_WRAP(UnrealizeWindow, winUnmapWindowRootless);
if (pWinPriv->hRgn != NULL) { if (pWinPriv->hRgn != NULL) {
DeleteObject(pWinPriv->hRgn); DeleteObject(pWinPriv->hRgn);
@ -199,9 +192,7 @@ winMapWindowRootless(WindowPtr pWin)
winTrace("winMapWindowRootless (%p)\n", pWin); winTrace("winMapWindowRootless (%p)\n", pWin);
#endif #endif
WIN_UNWRAP(RealizeWindow); fbRealizeWindow(pWin);
fResult = (*pScreen->RealizeWindow) (pWin);
WIN_WRAP(RealizeWindow, winMapWindowRootless);
winReshapeRootless(pWin); winReshapeRootless(pWin);
@ -221,9 +212,7 @@ winSetShapeRootless(WindowPtr pWin, int kind)
winTrace("winSetShapeRootless (%p, %i)\n", pWin, kind); winTrace("winSetShapeRootless (%p, %i)\n", pWin, kind);
#endif #endif
WIN_UNWRAP(SetShape); fbSetShape(pWin, kind);
(*pScreen->SetShape) (pWin, kind);
WIN_WRAP(SetShape, winSetShapeRootless);
winReshapeRootless(pWin); winReshapeRootless(pWin);
winUpdateRgnRootless(pWin); winUpdateRgnRootless(pWin);

178
include/dix_screen_hooks.h Normal file
View File

@ -0,0 +1,178 @@
/* SPDX-License-Identifier: MIT OR X11
*
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
*
* @brief exported API entry points for hooking into screen operations
*
* These hooks are replacing the old, complicated approach of wrapping
* ScreenRec's proc vectors. Unlike the wrapping, these hooks are designed
* to be safe against changes in setup/teardown order and are called
* independently of the ScreenProc call vectors. It is guaranteed that the
* objects to operate on already/still exist (eg. destructors are callled
* before the object is actually destroyed, while post-create hooks are
* called after the object is created)
*
* Main consumers are extensions that need to associate extra data or
* doing other things additional to the original operation. In some cases
* they might even be used in drivers (in order to split device specific
* from generic logic)
*/
#ifndef DIX_SCREEN_HOOKS_H
#define DIX_SCREEN_HOOKS_H
#include <X11/Xfuncproto.h>
#include "include/callback.h"
#include "screenint.h" /* ScreenPtr */
#include "window.h" /* WindowPtr */
/* prototype of a window destructor */
typedef void (*XorgScreenWindowDestroyProcPtr)(CallbackListPtr *pcbl,
ScreenPtr pScreen,
WindowPtr pWindow);
/**
* @brief register a window on the given screen
*
* @param pScreen pointer to the screen to register the destructor into
* @param func pointer to the window destructor function
* @param arg opaque pointer passed to the destructor
*
* Window destructors are the replacement for fragile and complicated wrapping of
* pScreen->DestroyWindow(): extensions can safely register there custom destructors
* here, without ever caring about anybody else.
+
* The destructors are run right before pScreen->DestroyWindow() - when the window
* is already removed from hierarchy (thus cannot receive any events anymore) and
* most of it's data already destroyed - and supposed to do necessary per-extension
* cleanup duties. Their execution order is *unspecified*.
*
* Screen drivers (DDX'es, xf86 video drivers, ...) shall not use these, but still
* set the pScreen->DestroyWindow pointer - and these should be the *only* ones
* ever setting it.
*
* When registration fails, the server aborts.
*
**/
_X_EXPORT void dixScreenHookWindowDestroy(ScreenPtr pScreen,
XorgScreenWindowDestroyProcPtr func);
/**
* @brief unregister a window destructor on the given screen
*
* @param pScreen pointer to the screen to unregister the destructor from
* @param func pointer to the window destructor function
* @param arg opaque pointer passed to the destructor
*
* @see dixScreenHookWindowDestroy
*
* Unregister a window destructor hook registered via @ref dixScreenHookWindowDestroy
**/
_X_EXPORT void dixScreenUnhookWindowDestroy(ScreenPtr pScreen,
XorgScreenWindowDestroyProcPtr func);
typedef struct {
WindowPtr window;
int32_t x;
int32_t y;
} XorgScreenWindowPositionParamRec;
/* prototype of a window move notification handler */
typedef void (*XorgScreenWindowPositionProcPtr)(CallbackListPtr *pcbl,
ScreenPtr pScreen,
XorgScreenWindowPositionParamRec *param);
/**
* @brief register a position notify hook on the given screen
*
* @param pScreen pointer to the screen to register the notify hook into
* @param func pointer to the window hook function
* @param arg opaque pointer passed to the hook
*
* When registration fails, the server aborts.
*
**/
_X_EXPORT void dixScreenHookWindowPosition(ScreenPtr pScreen,
XorgScreenWindowPositionProcPtr func);
/**
* @brief unregister a window position notify hook on the given screen
*
* @param pScreen pointer to the screen to unregister the hook from
* @param func pointer to the hook function
* @param arg opaque pointer passed to the destructor
*
* @see dixScreenHookWindowPosition
*
* Unregister a window position notify hook registered via @ref dixScreenHookWindowPosition
**/
_X_EXPORT void dixScreenUnhookWindowPosition(ScreenPtr pScreen,
XorgScreenWindowPositionProcPtr func);
/* prototype of screen close notification handler */
typedef void (*XorgScreenCloseProcPtr)(CallbackListPtr *pcbl,
ScreenPtr pScreen,
void *unused);
/**
* @brief register a screen close notify hook on the given screen
*
* @param pScreen pointer to the screen to register the notify hook into
* @param func pointer to the hook function
*
* When registration fails, the server aborts.
*
**/
_X_EXPORT void dixScreenHookClose(ScreenPtr pScreen,
XorgScreenCloseProcPtr func);
/**
* @brief unregister a screen close notify hook on the given screen
*
* @param pScreen pointer to the screen to unregister the hook from
* @param func pointer to the hook function
* @param arg opaque pointer passed to the destructor
*
* @see dixScreenHookClose
*
* Unregister a screen close notify hook registered via @ref dixScreenHookClose
**/
_X_EXPORT void dixScreenUnhookClose(ScreenPtr pScreen,
XorgScreenCloseProcPtr func);
/* prototype of pixmap destroy notification handler */
typedef void (*XorgScreenPixmapDestroyProcPtr)(CallbackListPtr *pcbl,
ScreenPtr pScreen,
PixmapPtr pPixmap);
/**
* @brief register a pixmap destroy hook on the given screen
*
* @param pScreen pointer to the screen to register the notify hook into
* @param func pointer to the hook function
* @param arg opaque pointer passed to the hook
*
* When registration fails, the server aborts.
* This hook is called only when the pixmap is really to be destroyed,
* (unlike ScreenRec->DestroyPixmap())
*
**/
_X_EXPORT void dixScreenHookPixmapDestroy(ScreenPtr pScreen,
XorgScreenPixmapDestroyProcPtr func);
/**
* @brief unregister a pixmap destroy notify hook on the given screen
*
* @param pScreen pointer to the screen to unregister the hook from
* @param func pointer to the hook function
* @param arg opaque pointer passed to the destructor
*
* @see dixScreenHookClose
*
* Unregister a screen close notify hook registered via @ref dixScreenHookPixmapDestroy
**/
_X_EXPORT void dixScreenUnhookPixmapDestroy(ScreenPtr pScreen,
XorgScreenPixmapDestroyProcPtr func);
#endif /* DIX_SCREEN_HOOKS_H */

View File

@ -444,6 +444,7 @@ if with_dtrace
dtrace_hdr += dtrace_header.process(dtrace_tmpl) dtrace_hdr += dtrace_header.process(dtrace_tmpl)
endif endif
# install SDK headers
if build_xorg if build_xorg
install_data( install_data(
[ [
@ -457,6 +458,7 @@ if build_xorg
'cursor.h', 'cursor.h',
'cursorstr.h', 'cursorstr.h',
'dix.h', 'dix.h',
'dix_screen_hooks.h',
'dixaccess.h', 'dixaccess.h',
'dixevents.h', 'dixevents.h',
'dixfont.h', 'dixfont.h',

View File

@ -57,6 +57,8 @@ SOFTWARE.
#include "privates.h" #include "privates.h"
#include <X11/extensions/randr.h> #include <X11/extensions/randr.h>
#include "dix_screen_hooks.h"
typedef struct _PixmapFormat { typedef struct _PixmapFormat {
unsigned char depth; unsigned char depth;
unsigned char bitsPerPixel; unsigned char bitsPerPixel;
@ -490,8 +492,17 @@ typedef void (*DPMSProcPtr)(ScreenPtr pScreen, int level);
required. Unwrap occurs at the top of each function, just after required. Unwrap occurs at the top of each function, just after
entry, and Wrap occurs at the bottom of each function, just entry, and Wrap occurs at the bottom of each function, just
before returning. before returning.
DestroyWindow() should NOT be wrapped anymore
use dixScreenHookWindowDestroy() instead.
*/ */
#define _SCREEN_HOOK_TYPE(NAME, FUNCTYPE, ARRSIZE) \
struct { \
FUNCTYPE func; \
void *arg; \
} NAME[ARRSIZE];
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;
@ -658,6 +669,22 @@ typedef struct _Screen {
ReplaceScanoutPixmapProcPtr ReplaceScanoutPixmap; ReplaceScanoutPixmapProcPtr ReplaceScanoutPixmap;
XYToWindowProcPtr XYToWindow; XYToWindowProcPtr XYToWindow;
DPMSProcPtr DPMS; DPMSProcPtr DPMS;
/* additional window destructors (replaces wrapping DestroyWindow).
should NOT be touched outside of DIX core */
CallbackListPtr hookWindowDestroy;
/* additional window position notify hooks (replaces wrapping PositionWindow)
should NOT be touched outside of DIX core */
CallbackListPtr hookWindowPosition;
/* additional screen close notify hooks (replaces wrapping CloseScreen)
should NOT be touched outside of DIX core */
CallbackListPtr hookClose;
/* additional pixmap destroy notify hooks (replaces wrapping DestroyPixmap)
should NOT be touched outside of DIX core */
CallbackListPtr hookPixmapDestroy;
} ScreenRec; } ScreenRec;
static inline RegionPtr static inline RegionPtr

View File

@ -214,4 +214,10 @@
/* byte order */ /* byte order */
#mesondefine X_BYTE_ORDER #mesondefine X_BYTE_ORDER
/* announce server API features */
#define XORG_API_DIX_SCREEN_HOOK_WINDOW_DESTROY 1
#define XORG_API_DIX_SCREEN_HOOK_WINDOW_POSITION 1
#define XORG_API_DIX_SCREEN_HOOK_CLOSE 1
#define XORG_API_DIX_SCREEN_HOOK_PIXMAP_DESTROY 1
#endif /* _XORG_SERVER_H_ */ #endif /* _XORG_SERVER_H_ */

View File

@ -50,6 +50,7 @@ SOFTWARE.
#include <X11/extensions/shapeconst.h> #include <X11/extensions/shapeconst.h>
#include "dix/cursor_priv.h" #include "dix/cursor_priv.h"
#include "dix/dix_priv.h"
#include "dix/input_priv.h" #include "dix/input_priv.h"
#include "mi/mi_priv.h" #include "mi/mi_priv.h"
@ -276,7 +277,7 @@ miMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pNextSib, VTKind kind)
SetWinSize(pWin); SetWinSize(pWin);
SetBorderSize(pWin); SetBorderSize(pWin);
(*pScreen->PositionWindow) (pWin, x, y); dixScreenRaiseWindowPosition(pWin, x, y);
windowToValidate = MoveWindowInStack(pWin, pNextSib); windowToValidate = MoveWindowInStack(pWin, pNextSib);
@ -446,7 +447,7 @@ miResizeWindow(WindowPtr pWin, int x, int y, unsigned int w, unsigned int h,
ResizeChildrenWinSize(pWin, x - oldx, y - oldy, dw, dh); ResizeChildrenWinSize(pWin, x - oldx, y - oldy, dw, dh);
/* let the hardware adjust background and border pixmaps, if any */ /* let the hardware adjust background and border pixmaps, if any */
(*pScreen->PositionWindow) (pWin, x, y); dixScreenRaiseWindowPosition(pWin, x, y);
pFirstChange = MoveWindowInStack(pWin, pSib); pFirstChange = MoveWindowInStack(pWin, pSib);

View File

@ -1484,28 +1484,16 @@ damageInsertDamage(DamagePtr * pPrev, DamagePtr pDamage)
*pPrev = pDamage; *pPrev = pDamage;
} }
static Bool static void damagePixmapDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
damageDestroyPixmap(PixmapPtr pPixmap)
{ {
ScreenPtr pScreen = pPixmap->drawable.pScreen; DamagePtr *pPrev = getPixmapDamageRef(pPixmap);
DamagePtr pDamage;
damageScrPriv(pScreen); while ((pDamage = *pPrev)) {
damageRemoveDamage(pPrev, pDamage);
if (pPixmap->refcnt == 1) { if (!pDamage->isWindow)
DamagePtr *pPrev = getPixmapDamageRef(pPixmap); DamageDestroy(pDamage);
DamagePtr pDamage;
while ((pDamage = *pPrev)) {
damageRemoveDamage(pPrev, pDamage);
if (!pDamage->isWindow)
DamageDestroy(pDamage);
}
} }
unwrap(pScrPriv, pScreen, DestroyPixmap);
if (pScreen->DestroyPixmap)
pScreen->DestroyPixmap(pPixmap);
wrap(pScrPriv, pScreen, DestroyPixmap, damageDestroyPixmap);
return TRUE;
} }
static void static void
@ -1576,22 +1564,14 @@ damageSetWindowPixmap(WindowPtr pWindow, PixmapPtr pPixmap)
} }
} }
static Bool static void
damageDestroyWindow(WindowPtr pWindow) damageWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWindow)
{ {
DamagePtr pDamage; DamagePtr pDamage;
ScreenPtr pScreen = pWindow->drawable.pScreen;
Bool ret;
damageScrPriv(pScreen);
while ((pDamage = damageGetWinPriv(pWindow))) { while ((pDamage = damageGetWinPriv(pWindow))) {
DamageDestroy(pDamage); DamageDestroy(pDamage);
} }
unwrap(pScrPriv, pScreen, DestroyWindow);
ret = (*pScreen->DestroyWindow) (pWindow);
wrap(pScrPriv, pScreen, DestroyWindow, damageDestroyWindow);
return ret;
} }
static Bool static Bool
@ -1599,7 +1579,9 @@ damageCloseScreen(ScreenPtr pScreen)
{ {
damageScrPriv(pScreen); damageScrPriv(pScreen);
unwrap(pScrPriv, pScreen, DestroyPixmap); dixScreenUnhookWindowDestroy(pScreen, damageWindowDestroy);
dixScreenUnhookPixmapDestroy(pScreen, damagePixmapDestroy);
unwrap(pScrPriv, pScreen, CreateGC); unwrap(pScrPriv, pScreen, CreateGC);
unwrap(pScrPriv, pScreen, CopyWindow); unwrap(pScrPriv, pScreen, CopyWindow);
unwrap(pScrPriv, pScreen, CloseScreen); unwrap(pScrPriv, pScreen, CloseScreen);
@ -1691,9 +1673,10 @@ DamageSetup(ScreenPtr pScreen)
pScrPriv->internalLevel = 0; pScrPriv->internalLevel = 0;
pScrPriv->pScreenDamage = 0; pScrPriv->pScreenDamage = 0;
wrap(pScrPriv, pScreen, DestroyPixmap, damageDestroyPixmap); dixScreenHookWindowDestroy(pScreen, damageWindowDestroy);
dixScreenHookPixmapDestroy(pScreen, damagePixmapDestroy);
wrap(pScrPriv, pScreen, CreateGC, damageCreateGC); wrap(pScrPriv, pScreen, CreateGC, damageCreateGC);
wrap(pScrPriv, pScreen, DestroyWindow, damageDestroyWindow);
wrap(pScrPriv, pScreen, SetWindowPixmap, damageSetWindowPixmap); wrap(pScrPriv, pScreen, SetWindowPixmap, damageSetWindowPixmap);
wrap(pScrPriv, pScreen, CopyWindow, damageCopyWindow); wrap(pScrPriv, pScreen, CopyWindow, damageCopyWindow);
wrap(pScrPriv, pScreen, CloseScreen, damageCloseScreen); wrap(pScrPriv, pScreen, CloseScreen, damageCloseScreen);

View File

@ -63,9 +63,7 @@ typedef struct _damageScrPriv {
CopyWindowProcPtr CopyWindow; CopyWindowProcPtr CopyWindow;
CloseScreenProcPtr CloseScreen; CloseScreenProcPtr CloseScreen;
CreateGCProcPtr CreateGC; CreateGCProcPtr CreateGC;
DestroyPixmapProcPtr DestroyPixmap;
SetWindowPixmapProcPtr SetWindowPixmap; SetWindowPixmapProcPtr SetWindowPixmap;
DestroyWindowProcPtr DestroyWindow;
CompositeProcPtr Composite; CompositeProcPtr Composite;
GlyphsProcPtr Glyphs; GlyphsProcPtr Glyphs;
AddTrapsProcPtr AddTraps; AddTrapsProcPtr AddTraps;

View File

@ -84,7 +84,6 @@ typedef struct _RootlessScreenRec {
CloseScreenProcPtr CloseScreen; CloseScreenProcPtr CloseScreen;
CreateWindowProcPtr CreateWindow; CreateWindowProcPtr CreateWindow;
DestroyWindowProcPtr DestroyWindow;
RealizeWindowProcPtr RealizeWindow; RealizeWindowProcPtr RealizeWindow;
UnrealizeWindowProcPtr UnrealizeWindow; UnrealizeWindowProcPtr UnrealizeWindow;
MoveWindowProcPtr MoveWindow; MoveWindowProcPtr MoveWindow;
@ -92,7 +91,6 @@ typedef struct _RootlessScreenRec {
RestackWindowProcPtr RestackWindow; RestackWindowProcPtr RestackWindow;
ReparentWindowProcPtr ReparentWindow; ReparentWindowProcPtr ReparentWindow;
ChangeBorderWidthProcPtr ChangeBorderWidth; ChangeBorderWidthProcPtr ChangeBorderWidth;
PositionWindowProcPtr PositionWindow;
ChangeWindowAttributesProcPtr ChangeWindowAttributes; ChangeWindowAttributesProcPtr ChangeWindowAttributes;
PaintWindowProcPtr PaintWindow; PaintWindowProcPtr PaintWindow;

View File

@ -649,6 +649,9 @@ RootlessWrap(ScreenPtr pScreen)
{ {
RootlessScreenRec *s = SCREENREC(pScreen); RootlessScreenRec *s = SCREENREC(pScreen);
dixScreenHookWindowDestroy(pScreen, RootlessWindowDestroy);
dixScreenHookWindowPosition(pScreen, RootlessWindowPosition);
#define WRAP(a) \ #define WRAP(a) \
if (pScreen->a) { \ if (pScreen->a) { \
s->a = pScreen->a; \ s->a = pScreen->a; \
@ -666,11 +669,9 @@ RootlessWrap(ScreenPtr pScreen)
WRAP(GetImage); WRAP(GetImage);
WRAP(SourceValidate); WRAP(SourceValidate);
WRAP(CreateWindow); WRAP(CreateWindow);
WRAP(DestroyWindow);
WRAP(RealizeWindow); WRAP(RealizeWindow);
WRAP(UnrealizeWindow); WRAP(UnrealizeWindow);
WRAP(MoveWindow); WRAP(MoveWindow);
WRAP(PositionWindow);
WRAP(ResizeWindow); WRAP(ResizeWindow);
WRAP(RestackWindow); WRAP(RestackWindow);
WRAP(ReparentWindow); WRAP(ReparentWindow);

View File

@ -189,24 +189,14 @@ RootlessDestroyFrame(WindowPtr pWin, RootlessWindowPtr winRec)
} }
/* /*
* RootlessDestroyWindow * @brief window destructor: remove physical window associated with given window
* Destroy the physical window associated with the given window.
*/ */
Bool void
RootlessDestroyWindow(WindowPtr pWin) RootlessWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin)
{ {
RootlessWindowRec *winRec = WINREC(pWin); RootlessWindowRec *winRec = WINREC(pWin);
Bool result; if (winRec != NULL)
if (winRec != NULL) {
RootlessDestroyFrame(pWin, winRec); RootlessDestroyFrame(pWin, winRec);
}
SCREEN_UNWRAP(pWin->drawable.pScreen, DestroyWindow);
result = pWin->drawable.pScreen->DestroyWindow(pWin);
SCREEN_WRAP(pWin->drawable.pScreen, DestroyWindow);
return result;
} }
static Bool static Bool
@ -313,20 +303,20 @@ RootlessChangeWindowAttributes(WindowPtr pWin, unsigned long vmask)
} }
/* /*
* RootlessPositionWindow * @brief DIX move/resize hook
* This is a hook for when DIX moves or resizes a window. *
* Update the frame position now although the physical window is moved * This is a hook for when DIX moves or resizes a window.
* in RootlessMoveWindow. (x, y) are *inside* position. After this, * Update the frame position now although the physical window is moved
* mi and fb are expecting the pixmap to be at the new location. * in RootlessMoveWindow. (x, y) are *inside* position. After this,
* mi and fb are expecting the pixmap to be at the new location.
*/ */
Bool void RootlessWindowPosition(CallbackListPtr *pcbl, ScreenPtr pScreen, XorgScreenWindowPositionParamRec *param)
RootlessPositionWindow(WindowPtr pWin, int x, int y)
{ {
ScreenPtr pScreen = pWin->drawable.pScreen; WindowPtr pWin = param->window;
RootlessWindowRec *winRec = WINREC(pWin); RootlessWindowRec *winRec = WINREC(pWin);
Bool result;
RL_DEBUG_MSG("positionwindow start (win %p (%lu) @ %i, %i)\n", pWin, RootlessWID(pWin), x, y); RL_DEBUG_MSG("positionwindow start (win %p (%lu) @ %i, %i)\n", pWin,
RootlessWID(pWin), param->x, param->y);
if (winRec) { if (winRec) {
if (winRec->is_drawing) { if (winRec->is_drawing) {
@ -334,16 +324,11 @@ RootlessPositionWindow(WindowPtr pWin, int x, int y)
int bw = wBorderWidth(pWin); int bw = wBorderWidth(pWin);
winRec->pixmap->devPrivate.ptr = winRec->pixelData; winRec->pixmap->devPrivate.ptr = winRec->pixelData;
SetPixmapBaseToScreen(winRec->pixmap, x - bw, y - bw); SetPixmapBaseToScreen(winRec->pixmap, param->x - bw, param->y - bw);
} }
} }
SCREEN_UNWRAP(pScreen, PositionWindow);
result = pScreen->PositionWindow(pWin, x, y);
SCREEN_WRAP(pScreen, PositionWindow);
RL_DEBUG_MSG("positionwindow end\n"); RL_DEBUG_MSG("positionwindow end\n");
return result;
} }
/* /*

View File

@ -37,12 +37,12 @@
#include "rootlessCommon.h" #include "rootlessCommon.h"
Bool RootlessCreateWindow(WindowPtr pWin); Bool RootlessCreateWindow(WindowPtr pWin);
Bool RootlessDestroyWindow(WindowPtr pWin); void RootlessWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin, void *arg);
void RootlessSetShape(WindowPtr pWin, int kind); void RootlessSetShape(WindowPtr pWin, int kind);
Bool RootlessChangeWindowAttributes(WindowPtr pWin, unsigned long vmask); Bool RootlessChangeWindowAttributes(WindowPtr pWin, unsigned long vmask);
Bool RootlessPositionWindow(WindowPtr pWin, int x, int y); void RootlessWindowPosition(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin, void *arg, int32_t x, int32_t y);
Bool RootlessRealizeWindow(WindowPtr pWin); Bool RootlessRealizeWindow(WindowPtr pWin);
Bool RootlessUnrealizeWindow(WindowPtr pWin); Bool RootlessUnrealizeWindow(WindowPtr pWin);
void RootlessRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib); void RootlessRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib);

View File

@ -165,7 +165,6 @@ struct present_screen_priv {
ScreenPtr pScreen; ScreenPtr pScreen;
CloseScreenProcPtr CloseScreen; CloseScreenProcPtr CloseScreen;
ConfigNotifyProcPtr ConfigNotify; ConfigNotifyProcPtr ConfigNotify;
DestroyWindowProcPtr DestroyWindow;
ClipNotifyProcPtr ClipNotify; ClipNotifyProcPtr ClipNotify;
present_vblank_ptr flip_pending; present_vblank_ptr flip_pending;

View File

@ -86,10 +86,9 @@ present_free_window_vblank(WindowPtr window)
/* /*
* Hook the close window function to clean up our window private * Hook the close window function to clean up our window private
*/ */
static Bool static void
present_destroy_window(WindowPtr window) present_destroy_window(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr window)
{ {
Bool ret;
ScreenPtr screen = window->drawable.pScreen; ScreenPtr screen = window->drawable.pScreen;
present_screen_priv_ptr screen_priv = present_screen_priv(screen); present_screen_priv_ptr screen_priv = present_screen_priv(screen);
present_window_priv_ptr window_priv = present_window_priv(window); present_window_priv_ptr window_priv = present_window_priv(window);
@ -112,13 +111,6 @@ present_destroy_window(WindowPtr window)
free(window_priv); free(window_priv);
} }
unwrap(screen_priv, screen, DestroyWindow);
if (screen->DestroyWindow)
ret = screen->DestroyWindow (window);
else
ret = TRUE;
wrap(screen_priv, screen, DestroyWindow, present_destroy_window);
return ret;
} }
/* /*
@ -183,7 +175,9 @@ present_screen_priv_init(ScreenPtr screen)
return NULL; return NULL;
wrap(screen_priv, screen, CloseScreen, present_close_screen); wrap(screen_priv, screen, CloseScreen, present_close_screen);
wrap(screen_priv, screen, DestroyWindow, present_destroy_window);
dixScreenHookWindowDestroy(screen, present_destroy_window);
wrap(screen_priv, screen, ConfigNotify, present_config_notify); wrap(screen_priv, screen, ConfigNotify, present_config_notify);
wrap(screen_priv, screen, ClipNotify, present_clip_notify); wrap(screen_priv, screen, ClipNotify, present_clip_notify);

View File

@ -60,7 +60,6 @@ typedef struct _AnimCur {
} AnimCurRec, *AnimCurPtr; } AnimCurRec, *AnimCurPtr;
typedef struct _AnimScrPriv { typedef struct _AnimScrPriv {
CloseScreenProcPtr CloseScreen;
CursorLimitsProcPtr CursorLimits; CursorLimitsProcPtr CursorLimits;
DisplayCursorProcPtr DisplayCursor; DisplayCursorProcPtr DisplayCursor;
SetCursorPositionProcPtr SetCursorPosition; SetCursorPositionProcPtr SetCursorPosition;
@ -84,13 +83,11 @@ static DevPrivateKeyRec AnimCurScreenPrivateKeyRec;
#define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func) #define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func)
#define Unwrap(as,s,elt) ((s)->elt = (as)->elt) #define Unwrap(as,s,elt) ((s)->elt = (as)->elt)
static Bool static void AnimCurScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
AnimCurCloseScreen(ScreenPtr pScreen)
{ {
AnimCurScreenPtr as = GetAnimCurScreen(pScreen); AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
Bool ret;
Unwrap(as, pScreen, CloseScreen); dixScreenUnhookClose(pScreen, AnimCurScreenClose);
Unwrap(as, pScreen, CursorLimits); Unwrap(as, pScreen, CursorLimits);
Unwrap(as, pScreen, DisplayCursor); Unwrap(as, pScreen, DisplayCursor);
@ -98,8 +95,6 @@ AnimCurCloseScreen(ScreenPtr pScreen)
Unwrap(as, pScreen, RealizeCursor); Unwrap(as, pScreen, RealizeCursor);
Unwrap(as, pScreen, UnrealizeCursor); Unwrap(as, pScreen, UnrealizeCursor);
Unwrap(as, pScreen, RecolorCursor); Unwrap(as, pScreen, RecolorCursor);
ret = (*pScreen->CloseScreen) (pScreen);
return ret;
} }
static void static void
@ -286,7 +281,7 @@ AnimCurInit(ScreenPtr pScreen)
as = GetAnimCurScreen(pScreen); as = GetAnimCurScreen(pScreen);
Wrap(as, pScreen, CloseScreen, AnimCurCloseScreen); dixScreenHookClose(pScreen, AnimCurScreenClose);
Wrap(as, pScreen, CursorLimits, AnimCurCursorLimits); Wrap(as, pScreen, CursorLimits, AnimCurCursorLimits);
Wrap(as, pScreen, DisplayCursor, AnimCurDisplayCursor); Wrap(as, pScreen, DisplayCursor, AnimCurDisplayCursor);

View File

@ -63,13 +63,10 @@ PictureWindowFormat(WindowPtr pWindow)
WindowGetVisual(pWindow)); WindowGetVisual(pWindow));
} }
static Bool static void
PictureDestroyWindow(WindowPtr pWindow) picture_window_destructor(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWindow)
{ {
ScreenPtr pScreen = pWindow->drawable.pScreen;
PicturePtr pPicture; PicturePtr pPicture;
PictureScreenPtr ps = GetPictureScreen(pScreen);
Bool ret;
while ((pPicture = GetPictureWindow(pWindow))) { while ((pPicture = GetPictureWindow(pWindow))) {
SetPictureWindow(pWindow, pPicture->pNext); SetPictureWindow(pWindow, pPicture->pNext);
@ -77,22 +74,13 @@ PictureDestroyWindow(WindowPtr pWindow)
FreeResource(pPicture->id, PictureType); FreeResource(pPicture->id, PictureType);
FreePicture((void *) pPicture, pPicture->id); FreePicture((void *) pPicture, pPicture->id);
} }
pScreen->DestroyWindow = ps->DestroyWindow;
ret = (*pScreen->DestroyWindow) (pWindow);
ps->DestroyWindow = pScreen->DestroyWindow;
pScreen->DestroyWindow = PictureDestroyWindow;
return ret;
} }
static Bool static void PictureScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
PictureCloseScreen(ScreenPtr pScreen)
{ {
PictureScreenPtr ps = GetPictureScreen(pScreen); PictureScreenPtr ps = GetPictureScreen(pScreen);
Bool ret;
int n; int n;
pScreen->CloseScreen = ps->CloseScreen;
ret = (*pScreen->CloseScreen) (pScreen);
PictureResetFilters(pScreen); PictureResetFilters(pScreen);
for (n = 0; n < ps->nformats; n++) for (n = 0; n < ps->nformats; n++)
if (ps->formats[n].type == PictTypeIndexed) if (ps->formats[n].type == PictTypeIndexed)
@ -101,7 +89,7 @@ PictureCloseScreen(ScreenPtr pScreen)
SetPictureScreen(pScreen, 0); SetPictureScreen(pScreen, 0);
free(ps->formats); free(ps->formats);
free(ps); free(ps);
return ret; dixScreenUnhookClose(pScreen, PictureScreenClose);
} }
static void static void
@ -692,13 +680,12 @@ PictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
ps->subpixel = SubPixelUnknown; ps->subpixel = SubPixelUnknown;
ps->CloseScreen = pScreen->CloseScreen;
ps->DestroyWindow = pScreen->DestroyWindow;
ps->StoreColors = pScreen->StoreColors; ps->StoreColors = pScreen->StoreColors;
pScreen->DestroyWindow = PictureDestroyWindow;
pScreen->CloseScreen = PictureCloseScreen;
pScreen->StoreColors = PictureStoreColors; pScreen->StoreColors = PictureStoreColors;
dixScreenHookWindowDestroy(pScreen, picture_window_destructor);
dixScreenHookClose(pScreen, PictureScreenClose);
if (!PictureSetDefaultFilters(pScreen)) { if (!PictureSetDefaultFilters(pScreen)) {
PictureResetFilters(pScreen); PictureResetFilters(pScreen);
SetPictureScreen(pScreen, 0); SetPictureScreen(pScreen, 0);

View File

@ -294,9 +294,6 @@ typedef struct _PictureScreen {
GlyphsProcPtr Glyphs; /* unused */ GlyphsProcPtr Glyphs; /* unused */
CompositeRectsProcPtr CompositeRects; CompositeRectsProcPtr CompositeRects;
DestroyWindowProcPtr DestroyWindow;
CloseScreenProcPtr CloseScreen;
StoreColorsProcPtr StoreColors; StoreColorsProcPtr StoreColors;
InitIndexedProcPtr InitIndexed; InitIndexedProcPtr InitIndexed;

View File

@ -119,7 +119,6 @@ typedef struct _CursorHideCountRec {
typedef struct _CursorScreen { typedef struct _CursorScreen {
DisplayCursorProcPtr DisplayCursor; DisplayCursorProcPtr DisplayCursor;
CloseScreenProcPtr CloseScreen;
CursorHideCountPtr pCursorHideCounts; CursorHideCountPtr pCursorHideCounts;
} CursorScreenRec, *CursorScreenPtr; } CursorScreenRec, *CursorScreenPtr;
@ -193,20 +192,15 @@ CursorDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
return ret; return ret;
} }
static Bool static void CursorScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
CursorCloseScreen(ScreenPtr pScreen)
{ {
CursorScreenPtr cs = GetCursorScreen(pScreen); CursorScreenPtr cs = GetCursorScreen(pScreen);
Bool ret;
_X_UNUSED CloseScreenProcPtr close_proc;
_X_UNUSED DisplayCursorProcPtr display_proc; _X_UNUSED DisplayCursorProcPtr display_proc;
Unwrap(cs, pScreen, CloseScreen, close_proc); dixScreenUnhookClose(pScreen, CursorScreenClose);
Unwrap(cs, pScreen, DisplayCursor, display_proc); Unwrap(cs, pScreen, DisplayCursor, display_proc);
deleteCursorHideCountsForScreen(pScreen); deleteCursorHideCountsForScreen(pScreen);
ret = (*pScreen->CloseScreen) (pScreen);
free(cs); free(cs);
return ret;
} }
#define CursorAllEvents (XFixesDisplayCursorNotifyMask) #define CursorAllEvents (XFixesDisplayCursorNotifyMask)
@ -1069,7 +1063,7 @@ XFixesCursorInit(void)
cs = (CursorScreenPtr) calloc(1, sizeof(CursorScreenRec)); cs = (CursorScreenPtr) calloc(1, sizeof(CursorScreenRec));
if (!cs) if (!cs)
return FALSE; return FALSE;
Wrap(cs, pScreen, CloseScreen, CursorCloseScreen); dixScreenHookClose(pScreen, CursorScreenClose);
Wrap(cs, pScreen, DisplayCursor, CursorDisplayCursor); Wrap(cs, pScreen, DisplayCursor, CursorDisplayCursor);
cs->pCursorHideCounts = NULL; cs->pCursorHideCounts = NULL;
SetCursorScreen(pScreen, cs); SetCursorScreen(pScreen, cs);