xwayland: Use ConfigNotify screen hook instead of ResizeWindow

Preparation for later commits, no functional change intended.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1300>
This commit is contained in:
Michel Dänzer 2024-02-15 18:08:16 +01:00 committed by Marge Bot
parent 3a0fc2684a
commit fa7b1c20c4
4 changed files with 21 additions and 15 deletions

View File

@ -1113,8 +1113,8 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
xwl_screen->ClipNotify = pScreen->ClipNotify; xwl_screen->ClipNotify = pScreen->ClipNotify;
pScreen->ClipNotify = xwl_clip_notify; pScreen->ClipNotify = xwl_clip_notify;
xwl_screen->ResizeWindow = pScreen->ResizeWindow; xwl_screen->ConfigNotify = pScreen->ConfigNotify;
pScreen->ResizeWindow = xwl_resize_window; pScreen->ConfigNotify = xwl_config_notify;
xwl_screen->MoveWindow = pScreen->MoveWindow; xwl_screen->MoveWindow = pScreen->MoveWindow;
pScreen->MoveWindow = xwl_move_window; pScreen->MoveWindow = xwl_move_window;

View File

@ -71,6 +71,7 @@ struct xwl_screen {
ClipNotifyProcPtr ClipNotify; ClipNotifyProcPtr ClipNotify;
CreateScreenResourcesProcPtr CreateScreenResources; CreateScreenResourcesProcPtr CreateScreenResources;
CloseScreenProcPtr CloseScreen; CloseScreenProcPtr CloseScreen;
ConfigNotifyProcPtr ConfigNotify;
CreateWindowProcPtr CreateWindow; CreateWindowProcPtr CreateWindow;
RealizeWindowProcPtr RealizeWindow; RealizeWindowProcPtr RealizeWindow;
UnrealizeWindowProcPtr UnrealizeWindow; UnrealizeWindowProcPtr UnrealizeWindow;
@ -79,7 +80,6 @@ struct xwl_screen {
SetWindowPixmapProcPtr SetWindowPixmap; SetWindowPixmapProcPtr SetWindowPixmap;
ChangeWindowAttributesProcPtr ChangeWindowAttributes; ChangeWindowAttributesProcPtr ChangeWindowAttributes;
ReparentWindowProcPtr ReparentWindow; ReparentWindowProcPtr ReparentWindow;
ResizeWindowProcPtr ResizeWindow;
MoveWindowProcPtr MoveWindow; MoveWindowProcPtr MoveWindow;
int (*GrabServer) (ClientPtr client); int (*GrabServer) (ClientPtr client);

View File

@ -1649,25 +1649,29 @@ xwl_clip_notify(WindowPtr window, int dx, int dy)
xwl_window_update_surface_window(xwl_window); xwl_window_update_surface_window(xwl_window);
} }
void int
xwl_resize_window(WindowPtr window, xwl_config_notify(WindowPtr window,
int x, int y, int x, int y,
unsigned int width, unsigned int height, int width, int height, int bw,
WindowPtr sib) WindowPtr sib)
{ {
ScreenPtr screen = window->drawable.pScreen; ScreenPtr screen = window->drawable.pScreen;
struct xwl_screen *xwl_screen; struct xwl_screen *xwl_screen;
struct xwl_window *xwl_window; struct xwl_window *xwl_window;
Bool size_changed;
int ret;
xwl_screen = xwl_screen_get(screen); xwl_screen = xwl_screen_get(screen);
xwl_window = xwl_window_from_window(window); xwl_window = xwl_window_from_window(window);
screen->ResizeWindow = xwl_screen->ResizeWindow; size_changed = width != window->drawable.width || height != window->drawable.height;
(*screen->ResizeWindow) (window, x, y, width, height, sib);
xwl_screen->ResizeWindow = screen->ResizeWindow;
screen->ResizeWindow = xwl_resize_window;
if (xwl_window) { screen->ConfigNotify = xwl_screen->ConfigNotify;
ret = screen->ConfigNotify(window, x, y, width, height, bw, sib);
xwl_screen->ConfigNotify = screen->ConfigNotify;
screen->ConfigNotify = xwl_config_notify;
if (size_changed && xwl_window) {
if (xwl_window_get(window) || xwl_window_is_toplevel(window)) if (xwl_window_get(window) || xwl_window_is_toplevel(window))
xwl_window_check_resolution_change_emulation(xwl_window); xwl_window_check_resolution_change_emulation(xwl_window);
if (window == screen->root) { if (window == screen->root) {
@ -1682,6 +1686,8 @@ xwl_resize_window(WindowPtr window,
xwl_window_check_fractional_scale_viewport(xwl_window, width, height); xwl_window_check_fractional_scale_viewport(xwl_window, width, height);
} }
} }
return ret;
} }
void void

View File

@ -129,10 +129,10 @@ Bool xwl_realize_window(WindowPtr window);
Bool xwl_unrealize_window(WindowPtr window); Bool xwl_unrealize_window(WindowPtr window);
Bool xwl_change_window_attributes(WindowPtr window, unsigned long mask); Bool xwl_change_window_attributes(WindowPtr window, unsigned long mask);
void xwl_clip_notify(WindowPtr window, int dx, int dy); void xwl_clip_notify(WindowPtr window, int dx, int dy);
void xwl_resize_window(WindowPtr window, int xwl_config_notify(WindowPtr window,
int x, int y, int x, int y,
unsigned int width, unsigned int height, int width, int height, int bw,
WindowPtr sib); WindowPtr sib);
void xwl_move_window(WindowPtr window, void xwl_move_window(WindowPtr window,
int x, int y, int x, int y,
WindowPtr next_sib, WindowPtr next_sib,