Fix output computation when width and height are unspecified

* output.c (XLUpdateSurfaceOutputs): Calculate width and height
before checking if the surface is in the output region.
This commit is contained in:
hujianwei 2022-10-21 03:29:15 +00:00
parent a866c4068a
commit 584ea0ac4d

View file

@ -781,17 +781,17 @@ XLUpdateSurfaceOutputs (Surface *surface, int x, int y, int width,
int n, i;
struct wl_resource *resource;
if (BoxContains (pixman_region32_extents (&surface->output_region),
x, y, width, height))
/* The surface didn't move past the output region. */
return;
if (width == -1)
width = ViewWidth (surface->view);
if (height == -1)
height = ViewHeight (surface->view);
if (BoxContains (pixman_region32_extents (&surface->output_region),
x, y, width, height))
/* The surface didn't move past the output region. */
return;
/* TODO: store the number of outputs somewhere instead of hardcoding
256. */
n = ComputeSurfaceOutputs (x, y, width, height,