From 46e5236bbe0ca90f1c2a480c54d3f729d4930dfb Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Thu, 12 Dec 2019 13:50:16 +0100 Subject: [PATCH] xwayland: Take border width into account MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Damage coordinates are relative to the drawable, (0,0) being the top left corner inside the border. Therefore, when applying damages or accumulating damages between window buffers, we need to take the window border width into account as well, otherwise the updates might be only partial or misplaced. Related: https://gitlab.freedesktop.org/xorg/xserver/issues/951 Signed-off-by: Olivier Fourdan Reviewed-by: Michel Dänzer --- hw/xwayland/xwayland-window-buffers.c | 6 ++++-- hw/xwayland/xwayland.c | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/hw/xwayland/xwayland-window-buffers.c b/hw/xwayland/xwayland-window-buffers.c index 62999091d..22fef3ffd 100644 --- a/hw/xwayland/xwayland-window-buffers.c +++ b/hw/xwayland/xwayland-window-buffers.c @@ -286,8 +286,10 @@ xwl_window_buffers_get_pixmap(struct xwl_window *xwl_window, while (nBox--) { if (!copy_pixmap_area(window_pixmap, xwl_window_buffer->pixmap, - pBox->x1, pBox->y1, - pBox->x2 - pBox->x1, pBox->y2 - pBox->y1)) + pBox->x1 + xwl_window->window->borderWidth, + pBox->y1 + xwl_window->window->borderWidth, + pBox->x2 - pBox->x1, + pBox->y2 - pBox->y1)) return window_pixmap; pBox++; diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c index 54a1fdac0..686b259df 100644 --- a/hw/xwayland/xwayland.c +++ b/hw/xwayland/xwayland.c @@ -1163,13 +1163,16 @@ xwl_window_post_damage(struct xwl_window *xwl_window) */ if (RegionNumRects(region) > 256) { box = RegionExtents(region); - xwl_surface_damage(xwl_screen, xwl_window->surface, box->x1, box->y1, + xwl_surface_damage(xwl_screen, xwl_window->surface, + box->x1 + xwl_window->window->borderWidth, + box->y1 + xwl_window->window->borderWidth, box->x2 - box->x1, box->y2 - box->y1); } else { box = RegionRects(region); for (i = 0; i < RegionNumRects(region); i++, box++) { xwl_surface_damage(xwl_screen, xwl_window->surface, - box->x1, box->y1, + box->x1 + xwl_window->window->borderWidth, + box->y1 + xwl_window->window->borderWidth, box->x2 - box->x1, box->y2 - box->y1); } }