Alexandre Julliard : gdi32: Fall back to GetSystemMetrics() for the virtual desktop size.

Alexandre Julliard julliard at winehq.org
Wed Aug 22 16:12:29 CDT 2018


Module: wine
Branch: master
Commit: d0579649c1fb725b2bc1d15b7dbee866ffb44ebf
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d0579649c1fb725b2bc1d15b7dbee866ffb44ebf

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Aug 22 12:56:53 2018 +0200

gdi32: Fall back to GetSystemMetrics() for the virtual desktop size.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdi32/driver.c | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c
index 4a5058e..6580008 100644
--- a/dlls/gdi32/driver.c
+++ b/dlls/gdi32/driver.c
@@ -63,6 +63,7 @@ static CRITICAL_SECTION driver_section = { &critsect_debug, -1, 0, 0, 0, 0 };
 
 static typeof(GetDesktopWindow) *pGetDesktopWindow;
 static typeof(GetSystemMetrics) *pGetSystemMetrics;
+static typeof(SetThreadDpiAwarenessContext) *pSetThreadDpiAwarenessContext;
 
 /**********************************************************************
  *	     create_driver
@@ -182,6 +183,7 @@ void CDECL __wine_set_display_driver( HMODULE module )
 
     user32 = LoadLibraryA( "user32.dll" );
     pGetSystemMetrics = (void *)GetProcAddress( user32, "GetSystemMetrics" );
+    pSetThreadDpiAwarenessContext = (void *)GetProcAddress( user32, "SetThreadDpiAwarenessContext" );
 }
 
 
@@ -352,8 +354,28 @@ static INT nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap )
     case SCALINGFACTORX:  return 0;
     case SCALINGFACTORY:  return 0;
     case VREFRESH:        return GetDeviceCaps( dev->hdc, TECHNOLOGY ) == DT_RASDISPLAY ? 1 : 0;
-    case DESKTOPVERTRES:  return GetDeviceCaps( dev->hdc, VERTRES );
-    case DESKTOPHORZRES:  return GetDeviceCaps( dev->hdc, HORZRES );
+    case DESKTOPHORZRES:
+        if (pGetSystemMetrics)
+        {
+            DPI_AWARENESS_CONTEXT context;
+            UINT ret;
+            context = pSetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE );
+            ret = pGetSystemMetrics( SM_CXVIRTUALSCREEN );
+            pSetThreadDpiAwarenessContext( context );
+            return ret;
+        }
+        return GetDeviceCaps( dev->hdc, HORZRES );
+    case DESKTOPVERTRES:
+        if (pGetSystemMetrics)
+        {
+            DPI_AWARENESS_CONTEXT context;
+            UINT ret;
+            context = pSetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE );
+            ret = pGetSystemMetrics( SM_CYVIRTUALSCREEN );
+            pSetThreadDpiAwarenessContext( context );
+            return ret;
+        }
+        return GetDeviceCaps( dev->hdc, VERTRES );
     case BLTALIGNMENT:    return 0;
     case SHADEBLENDCAPS:  return 0;
     case COLORMGMTCAPS:   return 0;




More information about the wine-cvs mailing list