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
This commit is contained in:
Jonas Ådahl 2016-09-23 10:51:56 +08:00
parent 6cc8450f8e
commit 6480a7ee4a

View File

@ -41,6 +41,7 @@
#include "backends/meta-backend-private.h" #include "backends/meta-backend-private.h"
#include "backends/native/meta-backend-native.h" #include "backends/native/meta-backend-native.h"
#include "backends/meta-pointer-constraint.h" #include "backends/meta-pointer-constraint.h"
#include "core/frame.h"
#include "pointer-constraints-unstable-v1-server-protocol.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) meta_wayland_pointer_constraint_calculate_effective_region (MetaWaylandPointerConstraint *constraint)
{ {
cairo_region_t *region; cairo_region_t *region;
MetaWindow *window;
region = meta_wayland_surface_calculate_input_region (constraint->surface); region = meta_wayland_surface_calculate_input_region (constraint->surface);
if (constraint->region) if (constraint->region)
cairo_region_intersect (region, 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; return region;
} }