xwayland: Take border width into account

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 <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
This commit is contained in:
Olivier Fourdan 2019-12-12 13:50:16 +01:00
parent 1cb886bc2a
commit 46e5236bbe
2 changed files with 9 additions and 4 deletions

View File

@ -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++;

View File

@ -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);
}
}