summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2020-12-23 18:58:48 +0100
committerCarlos Garnacho <carlosg@gnome.org>2020-12-23 20:00:34 +0100
commitdd02e8209c9bbe1f0bb7d00fc3f7a8859d13c1bf (patch)
tree556af3a974f5f0ccf9b4c7bc2c17c92b2eba70cd
parent17afb88a0cb606a02d4015e9accebd56fabbacd8 (diff)
downloadmutter-wip/carlosg/invalid-constraint-region.tar.gz
wayland: Ensure pointer constraint region consistencywip/carlosg/invalid-constraint-region
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 constraint. If we hit this situation, ignore the frame rectangle, and just go with the buffer rectangle.
-rw-r--r--src/wayland/meta-wayland-pointer-constraints.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/wayland/meta-wayland-pointer-constraints.c b/src/wayland/meta-wayland-pointer-constraints.c
index d7033e3ef..f5ed5b9a5 100644
--- a/src/wayland/meta-wayland-pointer-constraints.c
+++ b/src/wayland/meta-wayland-pointer-constraints.c
@@ -624,12 +624,15 @@ meta_wayland_pointer_constraint_calculate_effective_region (MetaWaylandPointerCo
frame->right_width);
actual_height = window->buffer_rect.height - (frame->child_y +
frame->bottom_height);
- cairo_region_intersect_rectangle (region, &(cairo_rectangle_int_t) {
- .x = frame->child_x,
- .y = frame->child_y,
- .width = actual_width,
- .height = actual_height
- });
+ if (actual_width > 1 && actual_height > 1)
+ {
+ cairo_region_intersect_rectangle (region, &(cairo_rectangle_int_t) {
+ .x = frame->child_x,
+ .y = frame->child_y,
+ .width = actual_width,
+ .height = actual_height
+ });
+ }
}
return region;