devilhorns pushed a commit to branch master.

commit d7cbc84aa806d3bddb08105812051fbff3db8d75
Author: Chris Michael <[email protected]>
Date:   Tue May 21 10:46:04 2013 +0100

    Add function to get a Ecore_Wl_Window from a wl_surface.
    
    Signed-off-by: Chris Michael <[email protected]>
---
 src/lib/ecore_wayland/Ecore_Wayland.h   | 11 +++++++++++
 src/lib/ecore_wayland/ecore_wl_window.c | 24 +++++++++++++++++++++++-
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/src/lib/ecore_wayland/Ecore_Wayland.h 
b/src/lib/ecore_wayland/Ecore_Wayland.h
index 00a0cb5..b9f9315 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 33e195c..cc1a8df 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)

-- 

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may

Reply via email to