Commit 98ef6d0d authored by Carlos Garnacho's avatar Carlos Garnacho

wayland: Ensure pointer constraint region consistency

Changes in games between fullscreen and windowed modes may trigger
chaotic situations where the buffer and the frame size temporarily
disagree, producing rectangles with negative width/height. This is
usually followed by other updates that bring the pointer constraint
up to date.

This makes cairo panic and return an "error" empty region, which breaks
deeper down when using the region rectangles to apply the pointer

If we hit this situation, ignore the frame rectangle, and just go with
the buffer rectangle.

Part-of: <!1655>
parent d439501f
Pipeline #246167 passed with stages
in 19 minutes and 20 seconds
...@@ -624,12 +624,15 @@ meta_wayland_pointer_constraint_calculate_effective_region (MetaWaylandPointerCo ...@@ -624,12 +624,15 @@ meta_wayland_pointer_constraint_calculate_effective_region (MetaWaylandPointerCo
frame->right_width); frame->right_width);
actual_height = window->buffer_rect.height - (frame->child_y + actual_height = window->buffer_rect.height - (frame->child_y +
frame->bottom_height); frame->bottom_height);
cairo_region_intersect_rectangle (region, &(cairo_rectangle_int_t) { if (actual_width > 0 && actual_height > 0)
.x = frame->child_x, {
.y = frame->child_y, cairo_region_intersect_rectangle (region, &(cairo_rectangle_int_t) {
.width = actual_width, .x = frame->child_x,
.height = actual_height .y = frame->child_y,
}); .width = actual_width,
.height = actual_height
} }
return region; return region;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment