devilhorns pushed a commit to branch master.

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

commit 2a973da77beac1b4efc662ca80522ba08c1677d6
Author: Chris Michael <cp.mich...@samsung.com>
Date:   Thu Sep 10 13:21:02 2015 -0400

    ecore-wl2: Add function to find a window based on surface
    
    Signed-off-by: Chris Michael <cp.mich...@samsung.com>
---
 src/lib/ecore_wl2/ecore_wl2_display.c | 17 +++++++++++++++++
 src/lib/ecore_wl2/ecore_wl2_private.h |  5 +++++
 src/lib/ecore_wl2/ecore_wl2_window.c  | 10 ++++++++++
 3 files changed, 32 insertions(+)

diff --git a/src/lib/ecore_wl2/ecore_wl2_display.c 
b/src/lib/ecore_wl2/ecore_wl2_display.c
index 8fea4fc..97867a8 100644
--- a/src/lib/ecore_wl2/ecore_wl2_display.c
+++ b/src/lib/ecore_wl2/ecore_wl2_display.c
@@ -234,6 +234,23 @@ _ecore_wl2_display_cleanup(Ecore_Wl2_Display *ewd)
    eina_hash_free(ewd->globals);
 }
 
+Ecore_Wl2_Window *
+_ecore_wl2_display_window_surface_find(Ecore_Wl2_Display *display, struct 
wl_surface *wl_surface)
+{
+   Ecore_Wl2_Window *window;
+
+   if ((!display) || (!wl_surface)) return NULL;
+
+   EINA_INLIST_FOREACH(display->windows, window)
+     {
+        if ((window->surface) &&
+            (window->surface == wl_surface))
+          return window;
+     }
+
+   return NULL;
+}
+
 EAPI Ecore_Wl2_Display *
 ecore_wl2_display_create(const char *name)
 {
diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h 
b/src/lib/ecore_wl2/ecore_wl2_private.h
index 6555cdf..3c87cae 100644
--- a/src/lib/ecore_wl2/ecore_wl2_private.h
+++ b/src/lib/ecore_wl2/ecore_wl2_private.h
@@ -60,6 +60,7 @@ struct _Ecore_Wl2_Display
 
    Eina_Hash *globals;
 
+   Eina_Inlist *windows;
    Eina_Inlist *outputs;
    Eina_Inlist *inputs;
 
@@ -68,6 +69,8 @@ struct _Ecore_Wl2_Display
 
 struct _Ecore_Wl2_Window
 {
+   EINA_INLIST;
+
    Ecore_Wl2_Display *display;
 
    Ecore_Wl2_Window *parent;
@@ -183,6 +186,8 @@ struct _Ecore_Wl2_Input
      } repeat;
 };
 
+Ecore_Wl2_Window *_ecore_wl2_display_window_surface_find(Ecore_Wl2_Display 
*display, struct wl_surface *wl_surface);
+
 void _ecore_wl2_output_add(Ecore_Wl2_Display *display, unsigned int id);
 void _ecore_wl2_output_del(Ecore_Wl2_Output *output);
 
diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c 
b/src/lib/ecore_wl2/ecore_wl2_window.c
index 03991c2..12c63f3 100644
--- a/src/lib/ecore_wl2/ecore_wl2_window.c
+++ b/src/lib/ecore_wl2/ecore_wl2_window.c
@@ -187,6 +187,9 @@ ecore_wl2_window_new(Ecore_Wl2_Display *display, 
Ecore_Wl2_Window *parent, int x
 
    win->type = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
 
+   display->windows =
+     eina_inlist_append(display->windows, EINA_INLIST_GET(win));
+
    return win;
 }
 
@@ -286,8 +289,12 @@ ecore_wl2_window_hide(Ecore_Wl2_Window *window)
 EAPI void
 ecore_wl2_window_free(Ecore_Wl2_Window *window)
 {
+   Ecore_Wl2_Display *display;
+
    EINA_SAFETY_ON_NULL_RETURN(window);
 
+   display = window->display;
+
    /* TODO: reset input pointer and keyboard focus */
    /* TODO: delete window anim callback */
    /* TODO: destroy subsurfaces */
@@ -297,6 +304,9 @@ ecore_wl2_window_free(Ecore_Wl2_Window *window)
    if (window->title) eina_stringshare_del(window->title);
    if (window->class) eina_stringshare_del(window->class);
 
+   display->windows =
+     eina_inlist_remove(display->windows, EINA_INLIST_GET(window));
+
    free(window);
 }
 

-- 


Reply via email to