Add function to get a Ecore_Wl_Window from a wl_surface.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2013-05-21 10:46:04 +01:00
parent f13a35909b
commit d7cbc84aa8
2 changed files with 34 additions and 1 deletions

View File

@ -652,6 +652,17 @@ EAPI struct wl_surface *ecore_wl_window_surface_create(Ecore_Wl_Window *win);
EAPI void ecore_wl_window_alpha_set(Ecore_Wl_Window *win, Eina_Bool alpha);
EAPI Eina_Bool ecore_wl_window_alpha_get(Ecore_Wl_Window *win);
/**
* Returns the Ecore_Wl_Window from a wl_surface
*
* @param surface The surface for which to find the Ecore_Wl_Window from
* @return the Ecore_Wl_Window associated with this surface
*
* @ingroup Ecore_Wl_Window_Group
* @since 1.8
*/
EAPI Ecore_Wl_Window *ecore_wl_window_surface_find(struct wl_surface *surface);
#ifdef __cplusplus
}
#endif

View File

@ -253,7 +253,6 @@ ecore_wl_window_surface_create(Ecore_Wl_Window *win)
if (win->surface) return NULL;
win->surface = wl_compositor_create_surface(_ecore_wl_disp->wl.compositor);
wl_surface_set_user_data(win->surface, win);
return win->surface;
}
@ -466,6 +465,7 @@ EAPI void
ecore_wl_window_update_size(Ecore_Wl_Window *win, int w, int h)
{
struct wl_region *opaque = NULL;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!win) return;
@ -581,6 +581,28 @@ ecore_wl_window_parent_set(Ecore_Wl_Window *win, Ecore_Wl_Window *parent)
win->parent = parent;
}
EAPI Ecore_Wl_Window *
ecore_wl_window_surface_find(struct wl_surface *surface)
{
Eina_Iterator *itr;
Ecore_Wl_Window *win = NULL;
void *data;
itr = eina_hash_iterator_data_new(_windows);
while (eina_iterator_next(itr, &data))
{
if (((Ecore_Wl_Window *)data)->surface == surface)
{
win = data;
break;
}
}
eina_iterator_free(itr);
return win;
}
/* local functions */
static void
_ecore_wl_window_cb_ping(void *data EINA_UNUSED, struct wl_shell_surface *shell_surface, unsigned int serial)