ecore-wl2: Add API to find a window by given surface

This patch adds a convenience function to find a window by a given
wl_surface.

@feature
This commit is contained in:
Christopher Michael 2019-11-19 09:37:11 -05:00
parent 8195368929
commit e36b1930bf
2 changed files with 25 additions and 0 deletions

View File

@ -1360,6 +1360,16 @@ EAPI void ecore_wl2_window_floating_mode_set(Ecore_Wl2_Window *window, Eina_Bool
*/
EAPI Eina_Bool ecore_wl2_window_floating_mode_get(Ecore_Wl2_Window *window);
/**
* Finds a window by surface
*
* @param surface The surface to find the window of
*
* @ingroup Ecore_Wl2_Window_Group
* @since 1.24
*/
EAPI Ecore_Wl2_Window *ecore_wl2_window_surface_find(struct wl_surface *surface);
/**
* @defgroup Ecore_Wl2_Input_Group Wayland Library Input Functions
* @ingroup Ecore_Wl2_Group

View File

@ -1748,3 +1748,18 @@ ecore_wl2_window_type_get(Ecore_Wl2_Window *window)
EINA_SAFETY_ON_NULL_RETURN_VAL(window, ECORE_WL2_WINDOW_TYPE_NONE);
return window->type;
}
EAPI Ecore_Wl2_Window *
ecore_wl2_window_surface_find(struct wl_surface *surface)
{
Ecore_Wl2_Display *ewd;
Ecore_Wl2_Window *win;
EINA_SAFETY_ON_NULL_RETURN_VAL(surface, NULL);
ewd = ecore_wl2_connected_display_get(NULL);
EINA_SAFETY_ON_NULL_RETURN_VAL(ewd, NULL);
win = ecore_wl2_display_window_find_by_surface(ewd, surface);
return win;
}