From 7a1f498626f4a618f7e79e6ab79023a5576436b2 Mon Sep 17 00:00:00 2001 From: raster Date: Wed, 24 Sep 2008 10:18:26 +0000 Subject: [PATCH] add simple dpi get call git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@36205 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/ecore_x/Ecore_X.h | 1 + src/lib/ecore_x/xlib/ecore_x.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/lib/ecore_x/Ecore_X.h b/src/lib/ecore_x/Ecore_X.h index 669666a..84aecae 100644 --- a/src/lib/ecore_x/Ecore_X.h +++ b/src/lib/ecore_x/Ecore_X.h @@ -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); diff --git a/src/lib/ecore_x/xlib/ecore_x.c b/src/lib/ecore_x/xlib/ecore_x.c index 6d96fa6..4ca3bf2 100644 --- a/src/lib/ecore_x/xlib/ecore_x.c +++ b/src/lib/ecore_x/xlib/ecore_x.c @@ -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__) { -- 2.7.4