From 90fbbd74ccd24e4a9e36303e32ca54c8e1cb87f0 Mon Sep 17 00:00:00 2001 From: Ander Conselvan de Oliveira Date: Tue, 28 Feb 2012 17:59:33 +0200 Subject: [PATCH] compositor: make the input region of drag surfaces empty 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 file changed, 16 insertions(+) diff --git a/src/compositor.c b/src/compositor.c index a95837e7..74c40da5 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(region); +} + WL_EXPORT struct weston_surface * weston_surface_create(struct weston_compositor *compositor) { @@ -1910,6 +1919,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; @@ -1928,8 +1938,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;