forked from enlightenment/efl
ecore-wl2: Add support for input region setting for an Ecore_Wl2_Window
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
parent
35710fa919
commit
d22b6c581c
|
@ -447,6 +447,9 @@ EAPI void ecore_wl2_window_transparent_set(Ecore_Wl2_Window *window, Eina_Bool t
|
|||
*/
|
||||
EAPI void ecore_wl2_window_opaque_region_set(Ecore_Wl2_Window *window, int x, int y, int w, int h);
|
||||
|
||||
/* TODO: doxy */
|
||||
EAPI void ecore_wl2_window_input_region_set(Ecore_Wl2_Window *window, int x, int y, int w, int h);
|
||||
|
||||
/* TODO: doxy */
|
||||
EAPI Eina_Bool ecore_wl2_window_maximized_get(Ecore_Wl2_Window *window);
|
||||
|
||||
|
|
|
@ -91,6 +91,7 @@ struct _Ecore_Wl2_Window
|
|||
|
||||
Eina_Rectangle geometry;
|
||||
Eina_Rectangle opaque;
|
||||
Eina_Rectangle input;
|
||||
|
||||
Ecore_Wl2_Window_Type type;
|
||||
|
||||
|
|
|
@ -620,6 +620,47 @@ ecore_wl2_window_opaque_region_set(Ecore_Wl2_Window *window, int x, int y, int w
|
|||
wl_region_destroy(region);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_input_region_set(Ecore_Wl2_Window *window, int x, int y, int w, int h)
|
||||
{
|
||||
struct wl_region *region;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
window->input.x = x;
|
||||
window->input.y = y;
|
||||
window->input.w = w;
|
||||
window->input.h = h;
|
||||
|
||||
if (window->type == ECORE_WL2_WINDOW_TYPE_DND) return;
|
||||
|
||||
region = wl_compositor_create_region(window->display->wl.compositor);
|
||||
if (!region)
|
||||
{
|
||||
ERR("Failed to create opaque region: %m");
|
||||
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);
|
||||
break;
|
||||
case 90:
|
||||
wl_region_add(region, y, x, h, w);
|
||||
break;
|
||||
case 270:
|
||||
wl_region_add(region, x + y, x, h, w);
|
||||
break;
|
||||
}
|
||||
|
||||
wl_surface_set_input_region(window->surface, region);
|
||||
wl_region_destroy(region);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_wl2_window_maximized_get(Ecore_Wl2_Window *window)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue