devilhorns pushed a commit to branch master.

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

commit 70a345005b13bd25460e33d038bccb2a459f1725
Author: Chris Michael <cp.mich...@samsung.com>
Date:   Wed Jun 7 10:46:44 2017 -0400

    ecore-wl2: Add API function to find an output for given window
    
    Small patch which adds an API function that can be used to find the
    output where a given window resides.
    
    @feature
    
    Signed-off-by: Chris Michael <cp.mich...@samsung.com>
---
 src/lib/ecore_wl2/Ecore_Wl2.h        | 12 +++++++++++
 src/lib/ecore_wl2/ecore_wl2_window.c | 41 ++++++++++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+)

diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h
index 516c9bcae9..6647b855a4 100644
--- a/src/lib/ecore_wl2/Ecore_Wl2.h
+++ b/src/lib/ecore_wl2/Ecore_Wl2.h
@@ -947,6 +947,18 @@ EAPI void ecore_wl2_window_iconified_set(Ecore_Wl2_Window 
*window, Eina_Bool ico
 EAPI void ecore_wl2_window_type_set(Ecore_Wl2_Window *window, 
Ecore_Wl2_Window_Type type);
 
 /**
+ * Find the output that a given window is on
+ *
+ * @param window The window to find the output for
+ *
+ * @return An Ecore_Wl2_Output if found, or NULL otherwise
+ *
+ * @ingroup Ecore_Wl2_Window_Group
+ * @since 1.20
+ */
+EAPI Ecore_Wl2_Output *ecore_wl2_window_output_find(Ecore_Wl2_Window *window);
+
+/**
  * @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 70f3e80da8..672a69b065 100644
--- a/src/lib/ecore_wl2/ecore_wl2_window.c
+++ b/src/lib/ecore_wl2/ecore_wl2_window.c
@@ -1164,3 +1164,44 @@ ecore_wl2_window_activated_get(const Ecore_Wl2_Window 
*window)
    EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
    return window->focused;
 }
+
+EAPI Ecore_Wl2_Output *
+ecore_wl2_window_output_find(Ecore_Wl2_Window *window)
+{
+   Ecore_Wl2_Output *out;
+   Eina_Inlist *tmp;
+   int x = 0, y = 0;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL);
+
+   x = window->geometry.x;
+   y = window->geometry.y;
+
+   EINA_INLIST_FOREACH_SAFE(window->display->outputs, tmp, out)
+     {
+        int ox, oy, ow, oh;
+
+        ox = out->geometry.x;
+        oy = out->geometry.y;
+
+        switch (out->transform)
+          {
+           case WL_OUTPUT_TRANSFORM_90:
+           case WL_OUTPUT_TRANSFORM_270:
+           case WL_OUTPUT_TRANSFORM_FLIPPED_90:
+           case WL_OUTPUT_TRANSFORM_FLIPPED_270:
+             ow = out->geometry.h;
+             oh = out->geometry.w;
+             break;
+           default:
+             ow = out->geometry.w;
+             oh = out->geometry.h;
+             break;
+          }
+
+        if (((x >= ox) && (x < ow)) && ((y >= oy) && (y < oh)))
+          return out;
+     }
+
+   return NULL;
+}

-- 


Reply via email to