[PATCH] compositor: make the input region of drag surfaces empty

2012-02-28 Thread Ander Conselvan de Oliveira
With the input region changes, drag surfaces were being picked and
receiving events which led to problems on the client side.
---
 src/compositor.c |   16 
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index b12c583..eabb34f 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -190,6 +190,15 @@ region_is_undefined(pixman_region32_t *region)
return region-data == undef_region_data;
 }
 
+static void
+empty_region(pixman_region32_t *region)
+{
+   if (!region_is_undefined(region))
+   pixman_region32_fini(region);
+
+   pixman_region32_init_rect(region, 0, 0, 0, 0);
+}
+
 WL_EXPORT struct weston_surface *
 weston_surface_create(struct weston_compositor *compositor)
 {
@@ -1895,6 +1904,7 @@ weston_input_update_drag_surface(struct wl_input_device 
*input_device,
surface_changed = 1;
 
if (!input_device-drag_surface || surface_changed) {
+   undef_region(device-drag_surface-input);
device-drag_surface = NULL;
if (!surface_changed)
return;
@@ -1913,8 +1923,14 @@ weston_input_update_drag_surface(struct wl_input_device 
*input_device,
wl_list_insert(weston_compositor_top(device-compositor),
   device-drag_surface-link);
weston_surface_assign_output(device-drag_surface);
+   empty_region(device-drag_surface-input);
}
 
+   /* the client may have attached a buffer with a different size to
+* the drag surface, causing the input region to be reset */
+   if (region_is_undefined(device-drag_surface-input))
+   empty_region(device-drag_surface-input);
+
if (!dx  !dy)
return;
 
-- 
1.7.4.1

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] compositor: make the input region of drag surfaces empty

2012-02-28 Thread Kristian Hoegsberg
On Tue, Feb 28, 2012 at 05:59:33PM +0200, Ander Conselvan de Oliveira wrote:
 With the input region changes, drag surfaces were being picked and
 receiving events which led to problems on the client side.
 ---
  src/compositor.c |   16 
  1 files changed, 16 insertions(+), 0 deletions(-)
 
 diff --git a/src/compositor.c b/src/compositor.c
 index b12c583..eabb34f 100644
 --- a/src/compositor.c
 +++ b/src/compositor.c
 @@ -190,6 +190,15 @@ region_is_undefined(pixman_region32_t *region)
   return region-data == undef_region_data;
  }
  
 +static void
 +empty_region(pixman_region32_t *region)
 +{
 + if (!region_is_undefined(region))
 + pixman_region32_fini(region);
 +
 + pixman_region32_init_rect(region, 0, 0, 0, 0);

Thanks, committed.  I changed the pixman_region32_init_rect above to
just pixman_region32_init, which initializes to the empty region.

Kristian

 +}
 +
  WL_EXPORT struct weston_surface *
  weston_surface_create(struct weston_compositor *compositor)
  {
 @@ -1895,6 +1904,7 @@ weston_input_update_drag_surface(struct wl_input_device 
 *input_device,
   surface_changed = 1;
  
   if (!input_device-drag_surface || surface_changed) {
 + undef_region(device-drag_surface-input);
   device-drag_surface = NULL;
   if (!surface_changed)
   return;
 @@ -1913,8 +1923,14 @@ weston_input_update_drag_surface(struct 
 wl_input_device *input_device,
   wl_list_insert(weston_compositor_top(device-compositor),
  device-drag_surface-link);
   weston_surface_assign_output(device-drag_surface);
 + empty_region(device-drag_surface-input);
   }
  
 + /* the client may have attached a buffer with a different size to
 +  * the drag surface, causing the input region to be reset */
 + if (region_is_undefined(device-drag_surface-input))
 + empty_region(device-drag_surface-input);
 +
   if (!dx  !dy)
   return;
  
 -- 
 1.7.4.1
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel