diff --git a/src/lib/ecore_wayland/Ecore_Wayland.h b/src/lib/ecore_wayland/Ecore_Wayland.h index 00a0cb53ba..b9f9315401 100644 --- a/src/lib/ecore_wayland/Ecore_Wayland.h +++ b/src/lib/ecore_wayland/Ecore_Wayland.h @@ -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 diff --git a/src/lib/ecore_wayland/ecore_wl_window.c b/src/lib/ecore_wayland/ecore_wl_window.c index 33e195c150..cc1a8df46a 100644 --- a/src/lib/ecore_wayland/ecore_wl_window.c +++ b/src/lib/ecore_wayland/ecore_wl_window.c @@ -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)