Ecore_Evas: dpi_get() for Windows (XP and CE)
authorcaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 10 Jul 2012 16:13:26 +0000 (16:13 +0000)
committercaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 10 Jul 2012 16:13:26 +0000 (16:13 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@73537 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/ecore_evas/ecore_evas_win32.c
src/lib/ecore_evas/ecore_evas_wince.c

index 4fc7481..dde2e21 100644 (file)
@@ -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 */
index 0976996..fe0054a 100644 (file)
@@ -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 */