Alexandre Julliard : gdi32: Don' t return screen resolution on printer devices.

Alexandre Julliard julliard at winehq.org
Wed Sep 5 16:15:27 CDT 2018


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Sep  5 19:52:16 2018 +0200

gdi32: Don't return screen resolution on printer devices.

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

---

 dlls/gdi32/driver.c   | 4 ++--
 dlls/gdi32/tests/dc.c | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c
index 6580008..ce60d11 100644
--- a/dlls/gdi32/driver.c
+++ b/dlls/gdi32/driver.c
@@ -355,7 +355,7 @@ static INT nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap )
     case SCALINGFACTORY:  return 0;
     case VREFRESH:        return GetDeviceCaps( dev->hdc, TECHNOLOGY ) == DT_RASDISPLAY ? 1 : 0;
     case DESKTOPHORZRES:
-        if (pGetSystemMetrics)
+        if (GetDeviceCaps( dev->hdc, TECHNOLOGY ) == DT_RASDISPLAY && pGetSystemMetrics)
         {
             DPI_AWARENESS_CONTEXT context;
             UINT ret;
@@ -366,7 +366,7 @@ static INT nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap )
         }
         return GetDeviceCaps( dev->hdc, HORZRES );
     case DESKTOPVERTRES:
-        if (pGetSystemMetrics)
+        if (GetDeviceCaps( dev->hdc, TECHNOLOGY ) == DT_RASDISPLAY && pGetSystemMetrics)
         {
             DPI_AWARENESS_CONTEXT context;
             UINT ret;
diff --git a/dlls/gdi32/tests/dc.c b/dlls/gdi32/tests/dc.c
index 5ad3b31..5eec74a 100644
--- a/dlls/gdi32/tests/dc.c
+++ b/dlls/gdi32/tests/dc.c
@@ -471,6 +471,12 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale
         }
         else
         {
+            ok( GetDeviceCaps( ref_dc, DESKTOPHORZRES ) == GetDeviceCaps( ref_dc, HORZRES ),
+                "Got DESKTOPHORZRES %d on %s, expected %d\n",
+                GetDeviceCaps( ref_dc, DESKTOPHORZRES ), descr, GetDeviceCaps( ref_dc, HORZRES ));
+            ok( GetDeviceCaps( ref_dc, DESKTOPVERTRES ) == GetDeviceCaps( ref_dc, VERTRES ),
+                "Got DESKTOPVERTRES %d on %s, expected %d\n",
+                GetDeviceCaps( ref_dc, DESKTOPVERTRES ), descr, GetDeviceCaps( ref_dc, VERTRES ));
             SetRect( &ref_rect, 0, 0, GetDeviceCaps( ref_dc, DESKTOPHORZRES ),
                      GetDeviceCaps( ref_dc, DESKTOPVERTRES ) );
         }




More information about the wine-cvs mailing list