xfree86: randr: 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>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-04-29 10:53:37 +02:00
parent 623171ce3f
commit b0f1bc92e5

View File

@ -28,6 +28,7 @@
#include <X11/X.h>
#include "dix/input_priv.h"
#include "dix/screen_hooks_priv.h"
#include "os.h"
#include "globals.h"
@ -40,7 +41,6 @@
#include "inputstr.h"
typedef struct _xf86RandRInfo {
CloseScreenProcPtr CloseScreen;
int virtualX;
int virtualY;
int mmWidth;
@ -341,19 +341,22 @@ xf86RandRSetConfig(ScreenPtr pScreen,
/*
* Reset size back to original
*/
static Bool
xf86RandRCloseScreen(ScreenPtr pScreen)
static void xf86RandRCloseScreen(CallbackListPtr *pcbl,
ScreenPtr pScreen, void *unused)
{
ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
if (!scrp)
return;
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
scrp->virtualX = pScreen->width = randrp->virtualX;
scrp->virtualY = pScreen->height = randrp->virtualY;
scrp->currentMode = scrp->modes;
pScreen->CloseScreen = randrp->CloseScreen;
dixScreenUnhookClose(pScreen, xf86RandRCloseScreen);
free(randrp);
dixSetPrivate(&pScreen->devPrivates, xf86RandRKey, NULL);
return (*pScreen->CloseScreen) (pScreen);
}
Rotation
@ -438,8 +441,7 @@ xf86RandRInit(ScreenPtr pScreen)
randrp->mmWidth = pScreen->mmWidth;
randrp->mmHeight = pScreen->mmHeight;
randrp->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = xf86RandRCloseScreen;
dixScreenHookClose(pScreen, xf86RandRCloseScreen);
randrp->rotation = RR_Rotate_0;