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-25 19:49:25 +02:00
parent f315b2b07d
commit 2bd54bb790

View File

@ -28,6 +28,8 @@
#include <dix-config.h>
#include "dix/screen_hooks_priv.h"
#include "randrstr_priv.h"
#include "extinit_priv.h"
@ -81,14 +83,13 @@ RRClientCallback(CallbackListPtr *list, void *closure, void *data)
}
}
static Bool
RRCloseScreen(ScreenPtr pScreen)
static void RRCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
rrScrPriv(pScreen);
int j;
RRLeasePtr lease, next;
unwrap(pScrPriv, pScreen, CloseScreen);
dixScreenUnhookClose(pScreen, RRCloseScreen);
xorg_list_for_each_entry_safe(lease, next, &pScrPriv->leases, list)
RRTerminateLease(lease);
@ -106,7 +107,6 @@ RRCloseScreen(ScreenPtr pScreen)
free(pScrPriv->outputs);
free(pScrPriv);
RRNScreens -= 1; /* ok, one fewer screen with RandR running */
return (*pScreen->CloseScreen) (pScreen);
}
static void
@ -337,7 +337,7 @@ RRScreenInit(ScreenPtr pScreen)
pScrPriv->lastSetTime = currentTime;
pScrPriv->lastConfigTime = currentTime;
wrap(pScrPriv, pScreen, CloseScreen, RRCloseScreen);
dixScreenHookClose(pScreen, RRCloseScreen);
pScreen->ConstrainCursorHarder = RRConstrainCursorHarder;
pScreen->ReplaceScanoutPixmap = RRReplaceScanoutPixmap;