summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2016-09-23 10:51:56 +0800
committerJonas Ådahl <jadahl@gmail.com>2016-10-19 17:20:14 +0800
commitf9d1bb4e6c68264b9d14231772eddef28bc48ce3 (patch)
treef8cc271921cd7033819e910d4ca90d3a36e57f96
parent1da239c83c4ed2e3a554a750819fa28e9e2f05e4 (diff)
downloadmutter-f9d1bb4e6c68264b9d14231772eddef28bc48ce3.tar.gz
wayland/pointer-constraints: Don't include window frame in region
When Xwayland confines, the surface dimensions will include the server side window manager decorations. We don't want the decorations to be included in the constraint region so intersect the calculated input region with the parts of the buffer rect that is not part of the window frame. https://bugzilla.gnome.org/show_bug.cgi?id=771859
-rw-r--r--src/wayland/meta-wayland-pointer-constraints.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/wayland/meta-wayland-pointer-constraints.c b/src/wayland/meta-wayland-pointer-constraints.c
index 68395b540..aa89aa0c2 100644
--- a/src/wayland/meta-wayland-pointer-constraints.c
+++ b/src/wayland/meta-wayland-pointer-constraints.c
@@ -41,6 +41,7 @@
#include "backends/meta-backend-private.h"
#include "backends/native/meta-backend-native.h"
#include "backends/meta-pointer-constraint.h"
+#include "core/frame.h"
#include "pointer-constraints-unstable-v1-server-protocol.h"
@@ -603,11 +604,32 @@ cairo_region_t *
meta_wayland_pointer_constraint_calculate_effective_region (MetaWaylandPointerConstraint *constraint)
{
cairo_region_t *region;
+ MetaWindow *window;
region = meta_wayland_surface_calculate_input_region (constraint->surface);
if (constraint->region)
cairo_region_intersect (region, constraint->region);
+ window = constraint->surface->window;
+ if (window && window->frame)
+ {
+ MetaFrame *frame = window->frame;
+ int actual_width, actual_height;
+
+ g_assert (meta_xwayland_is_xwayland_surface (constraint->surface));
+
+ actual_width = window->buffer_rect.width - (frame->child_x +
+ 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
+ });
+ }
+
return region;
}