Add e_pixmap API for testing if a pixmap is a native surface

DMAbuf for wayland will complicate determining whether a pixmap can use
a native surface or not, so we add an API here to check this.

Note that this doesn't take compositor capabilities into account - for
example, X pixmaps need GL enabled to use native surfaces.  This is
already tested elsewhere.
This commit is contained in:
Derek Foreman 2016-04-29 11:16:49 -05:00
parent 91d16899b1
commit 1774b59923
2 changed files with 17 additions and 0 deletions

View File

@ -667,6 +667,22 @@ e_pixmap_parent_window_get(E_Pixmap *cp)
return cp->parent;
}
E_API Eina_Bool
e_pixmap_is_pixels(E_Pixmap *cp)
{
switch (cp->type)
{
case E_PIXMAP_TYPE_X:
return EINA_FALSE;
case E_PIXMAP_TYPE_WL:
if (!cp->buffer) return EINA_TRUE;
if (cp->buffer->shm_buffer) return EINA_TRUE;
return EINA_FALSE;
default:
return EINA_TRUE;
}
}
E_API Eina_Bool
e_pixmap_native_surface_init(E_Pixmap *cp, Evas_Native_Surface *ns)
{

View File

@ -38,6 +38,7 @@ E_API E_Pixmap *e_pixmap_find(E_Pixmap_Type type, ...);
E_API E_Client *e_pixmap_find_client(E_Pixmap_Type type, ...);
E_API int64_t e_pixmap_window_get(E_Pixmap *cp);
E_API Ecore_Window e_pixmap_parent_window_get(E_Pixmap *cp);
E_API Eina_Bool e_pixmap_is_pixels(E_Pixmap *cp);
E_API Eina_Bool e_pixmap_native_surface_init(E_Pixmap *cp, Evas_Native_Surface *ns);
E_API void e_pixmap_image_clear(E_Pixmap *cp, Eina_Bool cache);
E_API Eina_Bool e_pixmap_image_refresh(E_Pixmap *cp);