From: Chris Michael Date: Tue, 14 Feb 2017 16:31:57 +0000 (-0500) Subject: ecore-wl2: Fix setting input region on a window X-Git-Tag: upstream/1.20.0~2018 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=515c2d0374316239d0fee9fd24121ac987f447e4;p=platform%2Fupstream%2Fefl.git ecore-wl2: Fix setting input region on a window Previous code here would store incorrect values into the window->input rectangle. These values should be what is actually getting set in the wl_region. This code also fixes an issue when setting input region for transparent/alpha windows by clearing out any pending input region (wl_surface_set_input_region(surface, null)). Reviewed-By: Derek Foreman @fix Signed-off-by: Chris Michael --- diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c index d087014..385a685 100644 --- a/src/lib/ecore_wl2/ecore_wl2_window.c +++ b/src/lib/ecore_wl2/ecore_wl2_window.c @@ -941,42 +941,57 @@ ecore_wl2_window_input_region_set(Ecore_Wl2_Window *window, int x, int y, int w, EINA_SAFETY_ON_NULL_RETURN(window); - if ((window->input_rect.x == x) && (window->input_rect.y == y) && - (window->input_rect.w == w) && (window->input_rect.h == h)) - return; - - window->input_rect.x = x; - window->input_rect.y = y; - window->input_rect.w = w; - window->input_rect.h = h; - window->input_set = 1; - - if (window->type == ECORE_WL2_WINDOW_TYPE_DND) return; - if (!window->surface) return; //surface not created yet - - region = wl_compositor_create_region(window->display->wl.compositor); - if (!region) + if ((x == 0) && (y == 0) && (w == 0) && (h == 0)) { - ERR("Failed to create opaque region"); + if (window->surface) + wl_surface_set_input_region(window->surface, NULL); return; } switch (window->rotation) { case 0: - wl_region_add(region, x, y, w, h); - break; - case 180: - wl_region_add(region, x, x + y, w, h); + window->input_rect.x = x; + window->input_rect.y = y; + window->input_rect.w = w; + window->input_rect.h = h; break; case 90: - wl_region_add(region, y, x, h, w); + window->input_rect.x = y; + window->input_rect.y = x; + window->input_rect.w = h; + window->input_rect.h = w; + break; + case 180: + window->input_rect.x = x; + window->input_rect.y = x + y; + window->input_rect.w = w; + window->input_rect.h = h; break; case 270: - wl_region_add(region, x + y, x, h, w); + window->input_rect.x = x + y; + window->input_rect.y = x; + window->input_rect.w = h; + window->input_rect.h = w; + break; + default: break; } + window->input_set = EINA_TRUE; + + if (!window->surface) return; + if (window->type == ECORE_WL2_WINDOW_TYPE_DND) return; + + region = wl_compositor_create_region(window->display->wl.compositor); + if (!region) + { + ERR("Failed to create input region"); + return; + } + + wl_region_add(region, window->input_rect.x, window->input_rect.y, + window->input_rect.w, window->input_rect.h); wl_surface_set_input_region(window->surface, region); wl_region_destroy(region); }