devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=e36b1930bf04694fb67dd7e741dbcb5231bf5e58

commit e36b1930bf04694fb67dd7e741dbcb5231bf5e58
Author: Christopher Michael <[email protected]>
Date:   Tue Nov 19 09:37:11 2019 -0500

    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
---
 src/lib/ecore_wl2/Ecore_Wl2.h        | 10 ++++++++++
 src/lib/ecore_wl2/ecore_wl2_window.c | 15 +++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h
index 04dd80a79f..6f8f9dcd54 100644
--- a/src/lib/ecore_wl2/Ecore_Wl2.h
+++ b/src/lib/ecore_wl2/Ecore_Wl2.h
@@ -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
diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c 
b/src/lib/ecore_wl2/ecore_wl2_window.c
index 6ba894b02f..d31dcafeb0 100644
--- a/src/lib/ecore_wl2/ecore_wl2_window.c
+++ b/src/lib/ecore_wl2/ecore_wl2_window.c
@@ -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;
+}

-- 


Reply via email to