https://git.reactos.org/?p=reactos.git;a=commitdiff;h=34d5d1dbd43af0d51fa09cb4b7b1b5d830e18c6d

commit 34d5d1dbd43af0d51fa09cb4b7b1b5d830e18c6d
Author:     Doug Lyons <[email protected]>
AuthorDate: Thu Jul 15 12:04:46 2021 -0500
Commit:     GitHub <[email protected]>
CommitDate: Thu Jul 15 19:04:46 2021 +0200

    [DDRAW] ddraw.c ddraw7_FlipToGDISurface() to Wine-6.8 (#3827) CORE-15128
    
    
    fixes CORE-15128 "Fall 0.1.3, black controls all over the desktop after 
exiting the game"
    which regressed by 0.4.9-dev-155-g 9987f02917539e05268ba2ad11e62d24a3636972
    (the sync to Wine Staging 3.3)
    
    the patch on top of 0.4.15-dev-2923-g2210d23:
    KVM: https://reactos.org/testman/compare.php?ids=78290,78295 LGTM
    VBox: https://reactos.org/testman/compare.php?ids=78291,78294 LGTM
---
 dll/directx/wine/ddraw/ddraw.c | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/dll/directx/wine/ddraw/ddraw.c b/dll/directx/wine/ddraw/ddraw.c
index e5205c0d000..e5acf2caff5 100644
--- a/dll/directx/wine/ddraw/ddraw.c
+++ b/dll/directx/wine/ddraw/ddraw.c
@@ -2093,15 +2093,31 @@ static HRESULT WINAPI d3d1_Initialize(IDirect3D *iface, 
REFIID riid)
 static HRESULT WINAPI ddraw7_FlipToGDISurface(IDirectDraw7 *iface)
 {
     struct ddraw *ddraw = impl_from_IDirectDraw7(iface);
+    IDirectDrawSurface7 *gdi_surface;
+    struct ddraw_surface *gdi_impl;
+    HRESULT hr;
 
     TRACE("iface %p.\n", iface);
 
-    ddraw->flags |= DDRAW_GDI_FLIP;
+    wined3d_mutex_lock();
 
-    if (ddraw->primary)
-        ddraw_surface_update_frontbuffer(ddraw->primary, NULL, FALSE);
+    if (FAILED(hr = IDirectDraw7_GetGDISurface(iface, &gdi_surface)))
+    {
+        WARN("Failed to retrieve GDI surface, hr %#x.\n", hr);
+        wined3d_mutex_unlock();
+        return hr;
+    }
 
-    return DD_OK;
+    gdi_impl = impl_from_IDirectDrawSurface7(gdi_surface);
+    if (gdi_impl->surface_desc.ddsCaps.dwCaps & DDSCAPS_FRONTBUFFER)
+        hr = DD_OK;
+    else
+        hr = 
IDirectDrawSurface7_Flip(&ddraw->primary->IDirectDrawSurface7_iface, 
gdi_surface, DDFLIP_WAIT);
+    IDirectDrawSurface7_Release(gdi_surface);
+
+    wined3d_mutex_unlock();
+
+    return hr;
 }
 
 static HRESULT WINAPI ddraw4_FlipToGDISurface(IDirectDraw4 *iface)

Reply via email to