From 481b09f489f95c0b2b575fec61a23ee5fbaf65c1 Mon Sep 17 00:00:00 2001 From: narzoul Date: Sat, 2 Jan 2021 16:14:58 +0100 Subject: [PATCH] Fixed clipping of desktop DC --- DDrawCompat/Gdi/Dc.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/DDrawCompat/Gdi/Dc.cpp b/DDrawCompat/Gdi/Dc.cpp index 1787424..30ddba6 100644 --- a/DDrawCompat/Gdi/Dc.cpp +++ b/DDrawCompat/Gdi/Dc.cpp @@ -203,11 +203,18 @@ namespace Gdi POINT origin = {}; GetDCOrgEx(origDc, &origin); - const HWND hwnd = CALL_ORIG_FUNC(WindowFromDC)(origDc); - if (hwnd && GetDesktopWindow() != hwnd) + HWND hwnd = CALL_ORIG_FUNC(WindowFromDC)(origDc); + if (hwnd) { - origin.x -= virtualScreenBounds.left; - origin.y -= virtualScreenBounds.top; + if (GetDesktopWindow() == hwnd) + { + hwnd = nullptr; + } + else + { + origin.x -= virtualScreenBounds.left; + origin.y -= virtualScreenBounds.top; + } } compatDc.refCount = 1;