add simple dpi get call
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 24 Sep 2008 10:18:26 +0000 (10:18 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 24 Sep 2008 10:18:26 +0000 (10:18 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@36205 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/ecore_x/Ecore_X.h
src/lib/ecore_x/xlib/ecore_x.c

index 669666a..84aecae 100644 (file)
@@ -1029,6 +1029,7 @@ EAPI void             ecore_x_flush(void);
 EAPI void             ecore_x_sync(void);
 EAPI void             ecore_x_killall(Ecore_X_Window root);
 EAPI void             ecore_x_kill(Ecore_X_Window win);
+EAPI int              ecore_x_dpi_get(void);
 
 EAPI Ecore_X_Time     ecore_x_current_time_get(void);
 
index 6d96fa6..4ca3bf2 100644 (file)
@@ -605,6 +605,24 @@ ecore_x_current_time_get(void)
    return _ecore_x_event_last_time;
 }
 
+/**
+ * Return the screen DPI
+ *
+ * This is a simplistic call to get DPI. It does not account for differing
+ * DPI in the x amd y axes nor does it accoutn for multihead or xinerama and
+ * xrander where different parts of the screen may have differen DPI etc.
+ *
+ * @return the general screen DPI (dots/pixels per inch).
+ */
+EAPI int
+ecore_x_dpi_get(void)
+{
+   Screen *s;
+   
+   s = DefaultScreenOfDisplay(_ecore_x_disp);
+   return (s->width / (s->mwidth * 254)) / 10;
+}
+
 static int
 _ecore_x_fd_handler(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
 {