devilhorns pushed a commit to branch master.

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

commit 24aa08ede77175dfbbf12724609257e23c417b3e
Author: Chris Michael <cp.mich...@samsung.com>
Date:   Tue Oct 13 14:22:06 2015 -0400

    ecore-wl2: Add API function to get the DPI of a given output
    
    Signed-off-by: Chris Michael <cp.mich...@samsung.com>
---
 src/lib/ecore_wl2/Ecore_Wl2.h        | 15 +++++++++++++++
 src/lib/ecore_wl2/ecore_wl2_output.c | 14 ++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h
index dd1b402..d992696 100644
--- a/src/lib/ecore_wl2/Ecore_Wl2.h
+++ b/src/lib/ecore_wl2/Ecore_Wl2.h
@@ -711,6 +711,21 @@ EAPI void 
ecore_wl2_subsurface_sync_set(Ecore_Wl2_Subsurface *subsurface, Eina_B
  */
 EAPI void ecore_wl2_subsurface_opaque_region_set(Ecore_Wl2_Subsurface 
*subsurface, int x, int y, int w, int h);
 
+/**
+ * Return the DPI of a given output
+ *
+ * This is a simplistic call to get DPI. It does not account for differing
+ * DPI in the x and y axes nor does it account for multihead or xinerama and
+ * xrandr where different parts of the screen may have different DPI etc.
+ *
+ * @param output The output to get the DPI of
+ *
+ * @return the general screen DPI (dots/pixels per inch).
+ *
+ * @ingroup Ecore_Wl2_Output_Group
+ */
+EAPI int ecore_wl2_output_dpi_get(Ecore_Wl2_Output *output);
+
 /* # ifdef __cplusplus */
 /* } */
 /* # endif */
diff --git a/src/lib/ecore_wl2/ecore_wl2_output.c 
b/src/lib/ecore_wl2/ecore_wl2_output.c
index 75e3ef9..4e43f3f 100644
--- a/src/lib/ecore_wl2/ecore_wl2_output.c
+++ b/src/lib/ecore_wl2/ecore_wl2_output.c
@@ -94,3 +94,17 @@ _ecore_wl2_output_del(Ecore_Wl2_Output *output)
    free(output);
 }
 
+EAPI int
+ecore_wl2_output_dpi_get(Ecore_Wl2_Output *output)
+{
+   int w, mw;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(output, 75);
+
+   mw = output->mw;
+   if (mw <= 0) return 75;
+
+   w = output->geometry.w;
+
+   return (((w * 254) / mw) + 5) / 10;
+}

-- 


Reply via email to