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

View File

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

View File

@ -141,9 +141,7 @@ static void WriteSwappedVideoNotifyEvent(xvEvent *, xvEvent *);
static void WriteSwappedPortNotifyEvent(xvEvent *, xvEvent *);
static Bool CreateResourceTypes(void);
static Bool XvCloseScreen(ScreenPtr);
static Bool XvDestroyPixmap(PixmapPtr);
static Bool XvDestroyWindow(WindowPtr);
static void XvScreenClose(CallbackListPtr *pcbl, ScreenPtr, void *arg);
static void XvResetProc(ExtensionEntry *);
static int XvdiDestroyGrab(void *, XID);
static int XvdiDestroyEncoding(void *, XID);
@ -152,6 +150,7 @@ static int XvdiDestroyPortNotify(void *, XID);
static int XvdiDestroyVideoNotifyList(void *, XID);
static int XvdiDestroyPort(void *, XID);
static int XvdiSendVideoNotify(XvPortPtr, DrawablePtr, int);
static void XvStopAdaptors(DrawablePtr pDrawable);
/*
** 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
XvScreenInit(ScreenPtr pScreen)
{
@ -290,34 +299,26 @@ XvScreenInit(ScreenPtr pScreen)
dixSetPrivate(&pScreen->devPrivates, XvScreenKey, pxvs);
pxvs->DestroyPixmap = pScreen->DestroyPixmap;
pxvs->DestroyWindow = pScreen->DestroyWindow;
pxvs->CloseScreen = pScreen->CloseScreen;
pScreen->DestroyPixmap = XvDestroyPixmap;
pScreen->DestroyWindow = XvDestroyWindow;
pScreen->CloseScreen = XvCloseScreen;
dixScreenHookWindowDestroy(pScreen, XvWindowDestroy);
dixScreenHookClose(pScreen, XvScreenClose);
dixScreenHookPixmapDestroy(pScreen, XvPixmapDestroy);
return Success;
}
static Bool
XvCloseScreen(ScreenPtr pScreen)
static void XvScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
XvScreenPtr pxvs;
pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
pScreen->DestroyPixmap = pxvs->DestroyPixmap;
pScreen->DestroyWindow = pxvs->DestroyWindow;
pScreen->CloseScreen = pxvs->CloseScreen;
dixScreenUnhookWindowDestroy(pScreen, XvWindowDestroy);
dixScreenUnhookClose(pScreen, XvScreenClose);
dixScreenUnhookPixmapDestroy(pScreen, XvPixmapDestroy);
free(pxvs);
dixSetPrivate(&pScreen->devPrivates, XvScreenKey, NULL);
return (*pScreen->CloseScreen) (pScreen);
}
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
XvdiDestroyPort(void *pPort, XID id)
{

View File

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

View File

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

View File

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

View File

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

View File

@ -81,12 +81,6 @@ DbeStubScreen(DbeScreenPrivPtr pDbeScreenPriv, int *nStubbedScreens)
/* Stub DIX. */
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. */
pDbeScreenPriv->GetVisualInfo = NULL;
pDbeScreenPriv->AllocBackBufferName = NULL;
@ -1201,7 +1195,9 @@ DbeWindowPrivDelete(void *pDbeWinPriv, XID id)
return Success;
} /* DbeWindowPrivDelete() */
static void miDbeWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin);
/******************************************************************************
*
* DBE DIX Procedure: DbeResetProc
@ -1225,55 +1221,30 @@ DbeResetProc(ExtensionEntry * extEntry)
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
if (pDbeScreenPriv) {
/* Unwrap DestroyWindow, which was wrapped in DbeExtensionInit(). */
pScreen->DestroyWindow = pDbeScreenPriv->DestroyWindow;
pScreen->PositionWindow = pDbeScreenPriv->PositionWindow;
dixScreenUnhookWindowDestroy(pScreen, miDbeWindowDestroy);
dixScreenUnhookWindowPosition(pScreen, miDbeWindowPosition);
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)
{
DbeScreenPrivPtr pDbeScreenPriv;
DbeWindowPrivPtr pDbeWindowPriv;
ScreenPtr pScreen;
Bool ret;
/*
**************************************************************************
** 1. Unwrap the member routine.
**************************************************************************
/**
* @brief window destroy callback
*
* Called by DIX when window is being destroyed.
*
*/
pScreen = pWin->drawable.pScreen;
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
pScreen->DestroyWindow = pDbeScreenPriv->DestroyWindow;
static void miDbeWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin)
{
/*
**************************************************************************
** 2. Do any work necessary before the member routine is called.
**
** Call the window priv delete function for all buffer IDs associated
** with this window.
**************************************************************************
*/
if ((pDbeWindowPriv = DBE_WINDOW_PRIV(pWin))) {
while (pDbeWindowPriv) {
DbeWindowPrivPtr pDbeWindowPriv;
while ((pDbeWindowPriv = DBE_WINDOW_PRIV(pWin))) {
/* *DbeWinPrivDelete() will free the window private and set it to
* NULL if there are no more buffer IDs associated with this
* window.
@ -1283,36 +1254,6 @@ DbeDestroyWindow(WindowPtr 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
@ -1395,12 +1336,10 @@ DbeExtensionInit(void)
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
if (ddxInitSuccess) {
/* Wrap DestroyWindow. The DDX initialization function
* already wrapped PositionWindow for us.
/* Hook in our window destructor. The DDX initialization function
* already added WindowPosition hook for us.
*/
pDbeScreenPriv->DestroyWindow = pScreen->DestroyWindow;
pScreen->DestroyWindow = DbeDestroyWindow;
dixScreenHookWindowDestroy(pScreen, miDbeWindowDestroy);
}
else {
/* DDX initialization failed. Stub the screen. */

View File

@ -169,13 +169,6 @@ typedef struct _DbeWindowPrivRec {
*/
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 */
Bool (*SetupBackgroundPainter) (WindowPtr /*pWin */ ,
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
* miDbeWinPrivDelete() can be called by FreeResource(). They are:
*
* - A DBE window is destroyed, in which case the DbeDestroyWindow()
* wrapper is invoked. The wrapper calls FreeResource() for all DBE
* buffer IDs.
* - A DBE window is destroyed, in which case the DbeWindowDestroy()
* callback is invoked. It calls FreeResource() for all DBE buffer IDs.
*
* - miDbeAllocBackBufferName() calls FreeResource() to clean up resources
* 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() is called for all DBE buffer IDs.
*
@ -432,22 +431,20 @@ miDbeWinPrivDelete(DbeWindowPrivPtr pDbeWindowPriv, XID bufId)
if (pDbeWindowPriv->pBackBuffer)
dixDestroyPixmap(pDbeWindowPriv->pBackBuffer, 0);
} /* miDbeWinPrivDelete() */
/******************************************************************************
*
* DBE MI Procedure: miDbePositionWindow
* DBE MI Procedure: miDbeWindowPosition
*
* 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.
*
*****************************************************************************/
static Bool
miDbePositionWindow(WindowPtr pWin, int x, int y)
void miDbeWindowPosition(CallbackListPtr *pcbl, ScreenPtr pScreen, XorgScreenWindowPositionParamRec *param)
{
ScreenPtr pScreen;
DbeScreenPrivPtr pDbeScreenPriv;
DbeWindowPrivPtr pDbeWindowPriv;
int width, height;
@ -460,43 +457,9 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
Bool clear;
GCPtr pGC;
xRectangle clearRect;
Bool ret;
/*
**************************************************************************
** 1. Unwrap the member routine.
**************************************************************************
*/
pScreen = pWin->drawable.pScreen;
WindowPtr pWin = param->window;
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))) {
return ret;
}
if (!(pDbeWindowPriv = DBE_WINDOW_PRIV(pWin)))
return;
if (pDbeWindowPriv->width == pWin->drawable.width &&
pDbeWindowPriv->height == pWin->drawable.height) {
return ret;
}
pDbeWindowPriv->height == pWin->drawable.height)
return;
width = pWin->drawable.width;
height = pWin->drawable.height;
@ -595,7 +556,7 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
}
FreeScratchGC(pGC);
return FALSE;
return;
}
else {
@ -645,11 +606,8 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
FreeScratchGC(pGC);
}
}
return ret;
} /* miDbePositionWindow() */
/******************************************************************************
*
* DBE MI Procedure: miDbeInit
@ -663,9 +621,7 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
Bool
miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv)
{
/* Wrap functions. */
pDbeScreenPriv->PositionWindow = pScreen->PositionWindow;
pScreen->PositionWindow = miDbePositionWindow;
dixScreenHookWindowPosition(pScreen, miDbeWindowPosition);
/* Initialize the per-screen DBE function pointers. */
pDbeScreenPriv->GetVisualInfo = miDbeGetVisualInfo;

View File

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

View File

@ -10,4 +10,15 @@
void InitCallbackManager(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 */

View File

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

View File

@ -255,4 +255,59 @@ extern Bool enableBackingStore;
/* in generated BuiltInAtoms.c */
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 */

View File

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

View File

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

View File

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

View File

@ -27,7 +27,9 @@ srcs_dix = [
'region.c',
'registry.c',
'resource.c',
'screen_hooks.c',
'selection.c',
'screen.c',
'swaprep.c',
'swapreq.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))
return; /* XXX */
(*pScreen->PositionWindow) (pWin, 0, 0);
dixScreenRaiseWindowPosition(pWin, 0, 0);
pWin->cursorIsNone = FALSE;
pWin->optional->cursor = RefCursor(rootCursor);
@ -928,7 +929,7 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
return NullWindow;
}
/* 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))
RecalculateDeliverableEvents(pWin);
@ -998,8 +999,6 @@ DisposeWindowOptional(WindowPtr pWin)
static void
FreeWindowResources(WindowPtr pWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
DeleteWindowFromAnySaveSet(pWin);
DeleteWindowFromAnySelections(pWin);
DeleteWindowFromAnyEvents(pWin, TRUE);
@ -1019,8 +1018,9 @@ FreeWindowResources(WindowPtr pWin)
dixDestroyPixmap(pWin->background.pixmap, 0);
DeleteAllWindowProperties(pWin);
/* We SHOULD check for an error value here XXX */
(*pScreen->DestroyWindow) (pWin);
dixScreenRaiseWindowDestroy(pWin);
DisposeWindowOptional(pWin);
}
@ -1849,12 +1849,9 @@ GravityTranslate(int x, int y, int oldx, int oldy,
void
ResizeChildrenWinSize(WindowPtr pWin, int dx, int dy, int dw, int dh)
{
ScreenPtr pScreen;
WindowPtr pSib, pChild;
Bool resized = (dw || dh);
pScreen = pWin->drawable.pScreen;
for (pSib = pWin->firstChild; pSib; pSib = pSib->nextSib) {
if (resized && (pSib->winGravity > NorthWestGravity)) {
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;
SetWinSize(pSib);
SetBorderSize(pSib);
(*pScreen->PositionWindow) (pSib, pSib->drawable.x, pSib->drawable.y);
dixScreenRaiseWindowPosition(pSib, pSib->drawable.x, pSib->drawable.y);
if ((pChild = pSib->firstChild)) {
while (1) {
@ -1889,7 +1887,7 @@ ResizeChildrenWinSize(WindowPtr pWin, int dx, int dy, int dw, int dh)
pChild->origin.y;
SetWinSize(pChild);
SetBorderSize(pChild);
(*pScreen->PositionWindow) (pChild,
dixScreenRaiseWindowPosition(pChild,
pChild->drawable.x,
pChild->drawable.y);
if (pChild->firstChild) {
@ -2585,7 +2583,8 @@ ReparentWindow(WindowPtr pWin, WindowPtr pParent,
if (pScreen->ReparentWindow)
(*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);
CheckWindowOptionalNeed(pWin);

View File

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

View File

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

View File

@ -740,6 +740,11 @@ exaCloseScreen(ScreenPtr pScreen)
ExaScreenPriv(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)
exaGlyphsFini(pScreen);
@ -753,8 +758,6 @@ exaCloseScreen(ScreenPtr pScreen)
unwrap(pExaScr, pScreen, GetSpans);
if (pExaScr->SavedCreatePixmap)
unwrap(pExaScr, pScreen, CreatePixmap);
if (pExaScr->SavedDestroyPixmap)
unwrap(pExaScr, pScreen, DestroyPixmap);
if (pExaScr->SavedModifyPixmapHeader)
unwrap(pExaScr, pScreen, ModifyPixmapHeader);
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_MIXED_PIXMAPS) {
dixScreenHookPixmapDestroy(pScreen, exaPixmapDestroy_mixed);
wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_mixed);
wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_mixed);
wrap(pExaScr, pScreen, ModifyPixmapHeader,
exaModifyPixmapHeader_mixed);
wrap(pExaScr, pScreen, SharePixmapBacking, exaSharePixmapBacking_mixed);
@ -969,8 +973,9 @@ exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo)
pExaScr->prepare_access_reg = exaPrepareAccessReg_mixed;
}
else {
dixScreenHookPixmapDestroy(pScreen, exaPixmapDestroy_driver);
wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_driver);
wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_driver);
wrap(pExaScr, pScreen, ModifyPixmapHeader,
exaModifyPixmapHeader_driver);
pExaScr->do_migration = NULL;
@ -981,8 +986,9 @@ exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo)
}
}
else {
dixScreenHookPixmapDestroy(pScreen, exaPixmapDestroy_classic);
wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_classic);
wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_classic);
wrap(pExaScr, pScreen, ModifyPixmapHeader,
exaModifyPixmapHeader_classic);
pExaScr->do_migration = exaDoMigration_classic;

View File

@ -206,18 +206,11 @@ exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height,
return ret;
}
Bool
exaDestroyPixmap_classic(PixmapPtr pPixmap)
void exaPixmapDestroy_classic(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ExaScreenPriv(pScreen);
Bool ret = TRUE;
if (pPixmap->refcnt == 1) {
ExaPixmapPriv(pPixmap);
if (!pExaPixmap) // we're called on an error path
goto out;
return;
exaDestroyPixmap(pPixmap);
@ -235,15 +228,6 @@ exaDestroyPixmap_classic(PixmapPtr pPixmap)
RegionUninit(&pExaPixmap->validFB);
}
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
exaPixmapHasGpuCopy_classic(PixmapPtr pPixmap)
{

View File

@ -185,18 +185,13 @@ exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height,
return ret;
}
Bool
exaDestroyPixmap_driver(PixmapPtr pPixmap)
void exaPixmapDestroy_driver(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ExaScreenPriv(pScreen);
Bool ret = TRUE;
if (pPixmap->refcnt == 1) {
ExaPixmapPriv(pPixmap);
if (!pExaPixmap) // we're called on an error path
goto out;
return;
exaDestroyPixmap(pPixmap);
@ -205,15 +200,6 @@ exaDestroyPixmap_driver(PixmapPtr pPixmap)
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
exaPixmapHasGpuCopy_driver(PixmapPtr pPixmap)
{

View File

@ -239,18 +239,13 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
return ret;
}
Bool
exaDestroyPixmap_mixed(PixmapPtr pPixmap)
void exaPixmapDestroy_mixed(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ExaScreenPriv(pScreen);
Bool ret = TRUE;
if (pPixmap->refcnt == 1) {
ExaPixmapPriv(pPixmap);
if (!pExaPixmap)
goto out; // we're called on an error path
if (!pExaPixmap) // we're called on an error path
return;
exaDestroyPixmap(pPixmap);
@ -268,15 +263,6 @@ exaDestroyPixmap_mixed(PixmapPtr pPixmap)
}
}
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
exaPixmapHasGpuCopy_mixed(PixmapPtr pPixmap)
{

View File

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

View File

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

View File

@ -604,6 +604,11 @@ glamor_setup_formats(ScreenPtr screen)
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. */
Bool
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;
screen->CloseScreen = glamor_close_screen;
glamor_priv->saved_procs.destroy_pixmap = screen->DestroyPixmap;
screen->DestroyPixmap = glamor_destroy_pixmap;
dixScreenHookPixmapDestroy(screen, glamor_pixmap_destroy);
/* If we are using egl screen, call egl screen init to
* register correct close screen function. */
@ -879,7 +883,7 @@ glamor_init(ScreenPtr screen, unsigned int flags)
fail:
/* Restore default CloseScreen and DestroyPixmap handlers */
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_priv);
@ -913,9 +917,10 @@ glamor_close_screen(ScreenPtr screen)
glamor_set_glvnd_vendor(screen, NULL);
screen->CloseScreen = glamor_priv->saved_procs.close_screen;
dixScreenUnhookPixmapDestroy(screen, glamor_pixmap_destroy);
screen->CreateGC = glamor_priv->saved_procs.create_gc;
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->ChangeWindowAttributes =
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 */
CloseScreenProcPtr saved_close_screen;
DestroyPixmapProcPtr saved_destroy_pixmap;
xf86FreeScreenProc *saved_free_screen;
};
@ -756,17 +755,13 @@ glamor_egl_get_driver_name(ScreenPtr screen)
return NULL;
}
static Bool
glamor_egl_destroy_pixmap(PixmapPtr pixmap)
static void glamor_egl_pixmap_destroy(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pixmap)
{
ScreenPtr screen = pixmap->drawable.pScreen;
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
struct glamor_egl_screen_private *glamor_egl =
glamor_egl_get_screen_private(scrn);
Bool ret = TRUE;
if (pixmap->refcnt == 1) {
struct glamor_pixmap_private *pixmap_priv =
glamor_get_pixmap_private(pixmap);
@ -774,15 +769,6 @@ glamor_egl_destroy_pixmap(PixmapPtr pixmap)
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
glamor_egl_exchange_buffers(PixmapPtr front, PixmapPtr back)
{
@ -822,6 +808,7 @@ glamor_egl_close_screen(ScreenPtr screen)
eglDestroyImageKHR(glamor_egl->display, pixmap_priv->image);
pixmap_priv->image = NULL;
dixScreenUnhookPixmapDestroy(screen, glamor_egl_pixmap_destroy);
screen->CloseScreen = glamor_egl->saved_close_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;
screen->CloseScreen = glamor_egl_close_screen;
glamor_egl->saved_destroy_pixmap = screen->DestroyPixmap;
screen->DestroyPixmap = glamor_egl_destroy_pixmap;
dixScreenHookPixmapDestroy(screen, glamor_egl_pixmap_destroy);
glamor_ctx->ctx = glamor_egl->context;
glamor_ctx->display = glamor_egl->display;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -634,7 +634,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
return TRUE;
}
static Bool DRIDestroyWindow(WindowPtr pWin);
static void DRIWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin);
Bool
DRIFinishScreenInit(ScreenPtr pScreen)
@ -648,8 +648,7 @@ DRIFinishScreenInit(ScreenPtr pScreen)
pScreen->WindowExposures = pDRIInfo->wrap.WindowExposures;
}
pDRIPriv->DestroyWindow = pScreen->DestroyWindow;
pScreen->DestroyWindow = DRIDestroyWindow;
dixScreenHookWindowDestroy(pScreen, DRIWindowDestroy);
pDRIPriv->xf86_crtc_notify = xf86_wrap_crtc_notify(pScreen,
dri_crtc_notify);
@ -696,11 +695,8 @@ DRICloseScreen(ScreenPtr pScreen)
pScreen->WindowExposures = pDRIPriv->wrap.WindowExposures;
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);
if (pDRIInfo->wrap.CopyWindow) {
@ -1922,29 +1918,9 @@ DRITreeTraversal(WindowPtr pWin, void *data)
return WT_WALKCHILDREN;
}
static Bool
DRIDestroyWindow(WindowPtr pWin)
static void DRIWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
Bool retval = TRUE;
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

View File

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

View File

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

View File

@ -74,7 +74,6 @@ struct xwl_screen {
ConfigNotifyProcPtr ConfigNotify;
RealizeWindowProcPtr RealizeWindow;
UnrealizeWindowProcPtr UnrealizeWindow;
DestroyWindowProcPtr DestroyWindow;
XYToWindowProcPtr XYToWindow;
SetWindowPixmapProcPtr SetWindowPixmap;
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);
}
Bool
xwl_destroy_window(WindowPtr window)
void
xwl_window_destroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr window)
{
ScreenPtr screen = window->drawable.pScreen;
struct xwl_screen *xwl_screen = xwl_screen_get(screen);
struct xwl_screen *xwl_screen = xwl_screen_get(pScreen);
struct xwl_window *xwl_window = xwl_window_get(window);
Bool ret;
if (xwl_screen->present)
xwl_present_cleanup(window);
if (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

View File

@ -146,7 +146,7 @@ void xwl_move_window(WindowPtr window,
int x, int y,
WindowPtr next_sib,
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_create_frame_callback(struct xwl_window *xwl_window);
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,
XID glxDrawId, __GLXconfig * conf);
static Bool glxWinRealizeWindow(WindowPtr pWin);
static Bool glxWinUnrealizeWindow(WindowPtr pWin);
static void glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg,
RegionPtr prgnSrc);
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
fbConfigsDump(screen->base.numFBConfigs, screen->base.fbconfigs, &rejects);
/* Wrap RealizeWindow, UnrealizeWindow and CopyWindow on this screen */
screen->RealizeWindow = pScreen->RealizeWindow;
pScreen->RealizeWindow = glxWinRealizeWindow;
screen->UnrealizeWindow = pScreen->UnrealizeWindow;
pScreen->UnrealizeWindow = glxWinUnrealizeWindow;
/* Wrap CopyWindow on this screen */
screen->CopyWindow = pScreen->CopyWindow;
pScreen->CopyWindow = glxWinCopyWindow;
@ -730,23 +724,6 @@ glxWinScreenProbe(ScreenPtr pScreen)
* 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
glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
@ -778,22 +755,6 @@ glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -57,6 +57,8 @@ SOFTWARE.
#include "privates.h"
#include <X11/extensions/randr.h>
#include "dix_screen_hooks.h"
typedef struct _PixmapFormat {
unsigned char depth;
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
entry, and Wrap occurs at the bottom of each function, just
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 {
int myNum; /* index of this instance in Screens[] */
ATOM id;
@ -658,6 +669,22 @@ typedef struct _Screen {
ReplaceScanoutPixmapProcPtr ReplaceScanoutPixmap;
XYToWindowProcPtr XYToWindow;
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;
static inline RegionPtr

View File

@ -214,4 +214,10 @@
/* 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_ */

View File

@ -50,6 +50,7 @@ SOFTWARE.
#include <X11/extensions/shapeconst.h>
#include "dix/cursor_priv.h"
#include "dix/dix_priv.h"
#include "dix/input_priv.h"
#include "mi/mi_priv.h"
@ -276,7 +277,7 @@ miMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pNextSib, VTKind kind)
SetWinSize(pWin);
SetBorderSize(pWin);
(*pScreen->PositionWindow) (pWin, x, y);
dixScreenRaiseWindowPosition(pWin, x, y);
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);
/* let the hardware adjust background and border pixmaps, if any */
(*pScreen->PositionWindow) (pWin, x, y);
dixScreenRaiseWindowPosition(pWin, x, y);
pFirstChange = MoveWindowInStack(pWin, pSib);

View File

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

View File

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

View File

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

View File

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

View File

@ -189,26 +189,16 @@ RootlessDestroyFrame(WindowPtr pWin, RootlessWindowPtr winRec)
}
/*
* RootlessDestroyWindow
* Destroy the physical window associated with the given window.
* @brief window destructor: remove physical window associated with given window
*/
Bool
RootlessDestroyWindow(WindowPtr pWin)
void
RootlessWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin)
{
RootlessWindowRec *winRec = WINREC(pWin);
Bool result;
if (winRec != NULL) {
if (winRec != NULL)
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
RootlessGetShape(WindowPtr pWin, RegionPtr pShape)
{
@ -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
* in RootlessMoveWindow. (x, y) are *inside* position. After this,
* mi and fb are expecting the pixmap to be at the new location.
*/
Bool
RootlessPositionWindow(WindowPtr pWin, int x, int y)
void RootlessWindowPosition(CallbackListPtr *pcbl, ScreenPtr pScreen, XorgScreenWindowPositionParamRec *param)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
WindowPtr pWin = param->window;
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->is_drawing) {
@ -334,16 +324,11 @@ RootlessPositionWindow(WindowPtr pWin, int x, int y)
int bw = wBorderWidth(pWin);
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");
return result;
}
/*

View File

@ -37,12 +37,12 @@
#include "rootlessCommon.h"
Bool RootlessCreateWindow(WindowPtr pWin);
Bool RootlessDestroyWindow(WindowPtr pWin);
void RootlessWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin, void *arg);
void RootlessSetShape(WindowPtr pWin, int kind);
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 RootlessUnrealizeWindow(WindowPtr pWin);
void RootlessRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib);

View File

@ -165,7 +165,6 @@ struct present_screen_priv {
ScreenPtr pScreen;
CloseScreenProcPtr CloseScreen;
ConfigNotifyProcPtr ConfigNotify;
DestroyWindowProcPtr DestroyWindow;
ClipNotifyProcPtr ClipNotify;
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
*/
static Bool
present_destroy_window(WindowPtr window)
static void
present_destroy_window(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr window)
{
Bool ret;
ScreenPtr screen = window->drawable.pScreen;
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
present_window_priv_ptr window_priv = present_window_priv(window);
@ -112,13 +111,6 @@ present_destroy_window(WindowPtr window)
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;
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, ClipNotify, present_clip_notify);

View File

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

View File

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

View File

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

View File

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