forked from enlightenment/efl
ecore-wl2: Add API function to set window opaque region
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
parent
795627ab51
commit
35cbc0d737
|
@ -378,6 +378,22 @@ EAPI Eina_Bool ecore_wl2_window_alpha_get(Ecore_Wl2_Window *window);
|
||||||
/* TODO: doxy */
|
/* TODO: doxy */
|
||||||
EAPI void ecore_wl2_window_alpha_set(Ecore_Wl2_Window *window, Eina_Bool alpha);
|
EAPI void ecore_wl2_window_alpha_set(Ecore_Wl2_Window *window, Eina_Bool alpha);
|
||||||
|
|
||||||
|
/* TODO: doxy */
|
||||||
|
EAPI void ecore_wl2_window_transparent_set(Ecore_Wl2_Window *window, Eina_Bool transparent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the opaque region of the Ecore_Wl2_Window
|
||||||
|
*
|
||||||
|
* @param win The window
|
||||||
|
* @param x The left point of the region.
|
||||||
|
* @param y The top point of the region.
|
||||||
|
* @param w The width of the region.
|
||||||
|
* @param h The height of the region.
|
||||||
|
*
|
||||||
|
* @ingroup Ecore_Wl2_Window_Group
|
||||||
|
*/
|
||||||
|
EAPI void ecore_wl2_window_opaque_region_set(Ecore_Wl2_Window *window, int x, int y, int w, int h);
|
||||||
|
|
||||||
/* # ifdef __cplusplus */
|
/* # ifdef __cplusplus */
|
||||||
/* } */
|
/* } */
|
||||||
/* # endif */
|
/* # endif */
|
||||||
|
|
|
@ -78,7 +78,7 @@ struct _Ecore_Wl2_Window
|
||||||
|
|
||||||
Ecore_Wl2_Window *parent;
|
Ecore_Wl2_Window *parent;
|
||||||
|
|
||||||
int id;
|
int id, rotation;
|
||||||
const char *title;
|
const char *title;
|
||||||
const char *class;
|
const char *class;
|
||||||
|
|
||||||
|
@ -89,6 +89,7 @@ struct _Ecore_Wl2_Window
|
||||||
struct wl_callback *anim_cb;
|
struct wl_callback *anim_cb;
|
||||||
|
|
||||||
Eina_Rectangle geometry;
|
Eina_Rectangle geometry;
|
||||||
|
Eina_Rectangle opaque;
|
||||||
|
|
||||||
Ecore_Wl2_Window_Type type;
|
Ecore_Wl2_Window_Type type;
|
||||||
|
|
||||||
|
|
|
@ -507,8 +507,55 @@ ecore_wl2_window_alpha_set(Ecore_Wl2_Window *window, Eina_Bool alpha)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||||
|
|
||||||
if (win->alpha == alpha) return;
|
if (window->alpha == alpha) return;
|
||||||
|
|
||||||
win->alpha = alpha;
|
window->alpha = alpha;
|
||||||
/* TODO: set opaque region */
|
|
||||||
|
if (!window->alpha)
|
||||||
|
ecore_wl2_window_opaque_region_set(window, window->opaque.x,
|
||||||
|
window->opaque.y, window->opaque.w,
|
||||||
|
window->opaque.h);
|
||||||
|
else
|
||||||
|
ecore_wl2_window_opaque_region_set(window, 0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
ecore_wl2_window_opaque_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->opaque.x = x;
|
||||||
|
window->opaque.y = y;
|
||||||
|
window->opaque.w = w;
|
||||||
|
window->opaque.h = h;
|
||||||
|
|
||||||
|
/* TODO: transparent or alpha check ? */
|
||||||
|
|
||||||
|
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_opaque_region(window->surface, region);
|
||||||
|
wl_region_destroy(region);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue