[mutter/gnome-3-22] wayland/pointer-constraints: Don't include window frame in region



commit f9d1bb4e6c68264b9d14231772eddef28bc48ce3
Author: Jonas Ådahl <jadahl gmail com>
Date:   Fri Sep 23 10:51:56 2016 +0800

    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

 src/wayland/meta-wayland-pointer-constraints.c |   22 ++++++++++++++++++++++
 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 68395b5..aa89aa0 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;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]