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>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-09-23 17:26:05 +02:00
parent 0a50759af4
commit 6967c0033c
4 changed files with 6 additions and 21 deletions

View File

@ -40,6 +40,7 @@
#include "dix/dix_priv.h"
#include "dix/input_priv.h"
#include "dix/property_priv.h"
#include "dix/screen_hooks_priv.h"
#include "os/client_priv.h"
#include "os/osdep.h"
#include "os/xserver_poll.h"
@ -1136,8 +1137,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

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