ecore-wl2: Avoid resetting opaque & input regions if they match

Small patch to avoid setting the same opaque/input regions if they
already match what is being requested.

ref T5226

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2017-02-28 08:51:21 -05:00
parent 0e93f03636
commit f8f71d05cd
1 changed files with 42 additions and 32 deletions

View File

@ -877,6 +877,7 @@ EAPI void
ecore_wl2_window_opaque_region_set(Ecore_Wl2_Window *window, int x, int y, int w, int h)
{
struct wl_region *region;
int nx = 0, ny = 0, nw = 0, nh = 0;
EINA_SAFETY_ON_NULL_RETURN(window);
@ -890,33 +891,37 @@ ecore_wl2_window_opaque_region_set(Ecore_Wl2_Window *window, int x, int y, int w
switch (window->rotation)
{
case 0:
window->opaque.x = x;
window->opaque.y = y;
window->opaque.w = w;
window->opaque.h = h;
nx = x;
ny = y;
nw = w;
nh = h;
break;
case 90:
window->opaque.x = y;
window->opaque.y = x;
window->opaque.w = h;
window->opaque.h = w;
nx = y;
ny = x;
nw = h;
nh = w;
break;
case 180:
window->opaque.x = x;
window->opaque.y = x + y;
window->opaque.w = w;
window->opaque.h = h;
nx = x;
ny = x + y;
nw = w;
nh = h;
break;
case 270:
window->opaque.x = x + y;
window->opaque.y = x;
window->opaque.w = h;
window->opaque.h = w;
nx = x + y;
ny = x;
nw = h;
nh = w;
break;
default:
break;
}
if ((window->opaque.x == nx) && (window->opaque.y == ny) &&
(window->opaque.w == nw) && (window->opaque.h == nh))
return;
window->opaque_set = EINA_TRUE;
if (!window->surface) return;
@ -938,6 +943,7 @@ EAPI void
ecore_wl2_window_input_region_set(Ecore_Wl2_Window *window, int x, int y, int w, int h)
{
struct wl_region *region;
int nx = 0, ny = 0, nw = 0, nh = 0;
EINA_SAFETY_ON_NULL_RETURN(window);
@ -951,33 +957,37 @@ ecore_wl2_window_input_region_set(Ecore_Wl2_Window *window, int x, int y, int w,
switch (window->rotation)
{
case 0:
window->input_rect.x = x;
window->input_rect.y = y;
window->input_rect.w = w;
window->input_rect.h = h;
nx = x;
ny = y;
nw = w;
nh = h;
break;
case 90:
window->input_rect.x = y;
window->input_rect.y = x;
window->input_rect.w = h;
window->input_rect.h = w;
nx = y;
ny = x;
nw = h;
nh = 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;
nx = x;
ny = x + y;
nw = w;
nh = h;
break;
case 270:
window->input_rect.x = x + y;
window->input_rect.y = x;
window->input_rect.w = h;
window->input_rect.h = w;
nx = x + y;
ny = x;
nw = h;
nh = w;
break;
default:
break;
}
if ((window->input_rect.x == nx) && (window->input_rect.y == ny) &&
(window->input_rect.w == nw) && (window->input_rect.h == nh))
return;
window->input_set = EINA_TRUE;
if (!window->surface) return;