xwayland: Recycle window buffers when setting pixmap

Right now, we would recycle the window buffers whenever the window the
window is resized.

This, however, is not sufficient to guarantee that the buffers are up
to date, since changing the window border width for example would not
trigger a `WindowResize` (the border being outside the window).

Make sure we recycle the buffers on `SetWindowPixmap` to ensure that
the buffers will be recycled whenever the pixmap size is changed.

Related: https://gitlab.freedesktop.org/xorg/xserver/issues/951
Suggested-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
This commit is contained in:
Olivier Fourdan 2019-12-13 11:10:03 +01:00
parent 71c3a97142
commit 1cb886bc2a

View File

@ -1025,7 +1025,10 @@ xwl_set_window_pixmap(WindowPtr window,
{ {
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;
PixmapPtr old_pixmap;
old_pixmap = (*screen->GetWindowPixmap) (window);
xwl_screen = xwl_screen_get(screen); xwl_screen = xwl_screen_get(screen);
screen->SetWindowPixmap = xwl_screen->SetWindowPixmap; screen->SetWindowPixmap = xwl_screen->SetWindowPixmap;
@ -1037,6 +1040,14 @@ xwl_set_window_pixmap(WindowPtr window,
return; return;
ensure_surface_for_window(window); ensure_surface_for_window(window);
if (old_pixmap->drawable.width == pixmap->drawable.width &&
old_pixmap->drawable.height == pixmap->drawable.height)
return;
xwl_window = xwl_window_get(window);
if (xwl_window)
xwl_window_buffers_recycle(xwl_window);
} }
static void static void
@ -1058,7 +1069,6 @@ xwl_resize_window(WindowPtr window,
screen->ResizeWindow = xwl_resize_window; screen->ResizeWindow = xwl_resize_window;
if (xwl_window) { if (xwl_window) {
xwl_window_buffers_recycle(xwl_window);
xwl_window->x = x; xwl_window->x = x;
xwl_window->y = y; xwl_window->y = y;
xwl_window->width = width; xwl_window->width = width;