derekf pushed a commit to branch master.

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

commit 8abac6da65a1bfd5883383bb72de1215ff555b8f
Author: Derek Foreman <der...@osg.samsung.com>
Date:   Tue Jan 30 14:52:55 2018 -0600

    ecore_wl2: Track outputs a surface is present on
    
    Keep a list of Ecore_Wl2_Output * a surface is present on.
---
 src/lib/ecore_wl2/ecore_wl2_private.h |  2 ++
 src/lib/ecore_wl2/ecore_wl2_window.c  | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h 
b/src/lib/ecore_wl2/ecore_wl2_private.h
index ec7b767691..107bc6360b 100644
--- a/src/lib/ecore_wl2/ecore_wl2_private.h
+++ b/src/lib/ecore_wl2/ecore_wl2_private.h
@@ -224,6 +224,8 @@ struct _Ecore_Wl2_Window
    Eina_List *supported_aux_hints;
    Eina_List *frame_callbacks;
 
+   Eina_List *outputs;
+
    Ecore_Wl2_Window_Configure_State set_config;
    Ecore_Wl2_Window_Configure_State req_config;
    Ecore_Wl2_Window_Configure_State def_config;
diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c 
b/src/lib/ecore_wl2/ecore_wl2_window.c
index 8ee6e84c21..0e93170876 100644
--- a/src/lib/ecore_wl2/ecore_wl2_window.c
+++ b/src/lib/ecore_wl2/ecore_wl2_window.c
@@ -422,6 +422,39 @@ _ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window 
*window)
      }
 }
 
+static void
+_surface_enter(void *data, struct wl_surface *surf EINA_UNUSED, struct 
wl_output *op)
+{
+   Ecore_Wl2_Window *win;
+   Ecore_Wl2_Output *output;
+
+   win = data;
+
+   output = _ecore_wl2_output_find(win->display, op);
+   EINA_SAFETY_ON_NULL_RETURN(output);
+
+   win->outputs = eina_list_append(win->outputs, output);
+}
+
+static void
+_surface_leave(void *data, struct wl_surface *surf EINA_UNUSED, struct 
wl_output *op)
+{
+   Ecore_Wl2_Window *win;
+   Ecore_Wl2_Output *output;
+
+   win = data;
+   output = _ecore_wl2_output_find(win->display, op);
+   EINA_SAFETY_ON_NULL_RETURN(output);
+
+   win->outputs = eina_list_remove(win->outputs, output);
+}
+
+static const struct wl_surface_listener _surface_listener =
+{
+   _surface_enter,
+   _surface_leave,
+};
+
 void
 _ecore_wl2_window_surface_create(Ecore_Wl2_Window *window)
 {
@@ -440,6 +473,8 @@ _ecore_wl2_window_surface_create(Ecore_Wl2_Window *window)
 
         window->surface_id =
           wl_proxy_get_id((struct wl_proxy *)window->surface);
+
+        wl_surface_add_listener(window->surface, &_surface_listener, window);
         if (window->display->wl.efl_aux_hints)
           {
              
efl_aux_hints_get_supported_aux_hints(window->display->wl.efl_aux_hints, 
window->surface);

-- 


Reply via email to