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>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-09-20 20:30:33 +02:00
parent aecb404ffc
commit b59a5e85c4
4 changed files with 7 additions and 17 deletions

View File

@ -84,7 +84,6 @@ typedef struct _RootlessScreenRec {
CloseScreenProcPtr CloseScreen;
CreateWindowProcPtr CreateWindow;
DestroyWindowProcPtr DestroyWindow;
RealizeWindowProcPtr RealizeWindow;
UnrealizeWindowProcPtr UnrealizeWindow;
MoveWindowProcPtr MoveWindow;

View File

@ -649,6 +649,8 @@ RootlessWrap(ScreenPtr pScreen)
{
RootlessScreenRec *s = SCREENREC(pScreen);
dixScreenHookWindowDestroy(pScreen, RootlessWindowDestroy);
#define WRAP(a) \
if (pScreen->a) { \
s->a = pScreen->a; \
@ -666,7 +668,6 @@ RootlessWrap(ScreenPtr pScreen)
WRAP(GetImage);
WRAP(SourceValidate);
WRAP(CreateWindow);
WRAP(DestroyWindow);
WRAP(RealizeWindow);
WRAP(UnrealizeWindow);
WRAP(MoveWindow);

View File

@ -189,24 +189,14 @@ 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

View File

@ -37,7 +37,7 @@
#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);