From 229b07a3b913d0f93425249cbdb8da3aeaaf3b5f Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Tue, 10 Jul 2012 16:13:26 +0000 Subject: [PATCH] Ecore_Evas: dpi_get() for Windows (XP and CE) SVN revision: 73537 --- legacy/ecore/src/lib/ecore_evas/ecore_evas_win32.c | 22 ++++++++++++++++++++-- legacy/ecore/src/lib/ecore_evas/ecore_evas_wince.c | 21 ++++++++++++++++++++- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas_win32.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_win32.c index 4fc7481..dde2e21 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_win32.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_win32.c @@ -1023,6 +1023,24 @@ _ecore_evas_win32_alpha_set(Ecore_Evas *ee, int alpha) } } +static void +_ecore_evas_win32_screen_dpi_get(const Ecore_Evas *ee, int *xdpi, int *ydpi) +{ + HDC dc; + + dc = GetDC(NULL); + if (!dc) + { + if (xdpi) *xdpi = 0; + if (ydpi) *ydpi = 0; + return; + } + + if (xdpi) *xdpi = GetDeviceCaps(dc, LOGPIXELSX); + if (ydpi) *ydpi = GetDeviceCaps(dc, LOGPIXELSY); + + ReleaseDC(NULL, dc); +} static Ecore_Evas_Engine_Func _ecore_win32_engine_func = { @@ -1082,8 +1100,8 @@ static Ecore_Evas_Engine_Func _ecore_win32_engine_func = NULL, NULL, // render - NULL, //screen_geometry_get - NULL // screen_dpi_get + NULL, // screen_geometry_get + _ecore_evas_win32_screen_dpi_get }; #endif /* BUILD_ECORE_EVAS_WIN32 */ diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas_wince.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_wince.c index 0976996..fe0054a 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_wince.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_wince.c @@ -724,6 +724,25 @@ _ecore_evas_wince_fullscreen_set(Ecore_Evas *ee, int on) } } +static void +_ecore_evas_wince_screen_dpi_get(const Ecore_Evas *ee, int *xdpi, int *ydpi) +{ + HDC dc; + + dc = GetDC(NULL); + if (!dc) + { + if (xdpi) *xdpi = 0; + if (ydpi) *ydpi = 0; + return; + } + + if (xdpi) *xdpi = GetDeviceCaps(dc, LOGPIXELSX); + if (ydpi) *ydpi = GetDeviceCaps(dc, LOGPIXELSY); + + ReleaseDC(NULL, dc); +} + static Ecore_Evas_Engine_Func _ecore_wince_engine_func = { _ecore_evas_wince_free, @@ -783,7 +802,7 @@ static Ecore_Evas_Engine_Func _ecore_wince_engine_func = NULL, // render NULL, // screen_geometry_get - NULL // screen_dpi_get + _ecore_evas_wince_screen_dpi_get }; /* API */ -- 2.7.4