[PATCH 1/5] wined3d: Use a backup device context for swapchains created on the desktop window.

Zebediah Figura zfigura at codeweavers.com
Wed Jun 19 19:07:42 CDT 2019


From: Zebediah Figura <z.figura12 at gmail.com>

This patch was written by "naur".
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=18490

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/wined3d/context.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 6a7aafc96251..bd8a324fc57d 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1961,10 +1961,16 @@ HRESULT wined3d_context_gl_init(struct wined3d_context_gl *context_gl, struct wi
 
     context_gl->tid = GetCurrentThreadId();
     context_gl->window = context->swapchain->win_handle;
-    if (!(context_gl->dc = GetDCEx(context_gl->window, 0, DCX_USESTYLE | DCX_CACHE)))
+    if (context_gl->window == GetDesktopWindow())
     {
+        TRACE("Swapchain is created on the desktop window, trying backup device context.\n");
+        context_gl->dc = NULL;
+    }
+    else if (!(context_gl->dc = GetDCEx(context_gl->window, 0, DCX_USESTYLE | DCX_CACHE)))
         WARN("Failed to retrieve device context, trying swapchain backup.\n");
 
+    if (!context_gl->dc)
+    {
         if (!(context_gl->dc = swapchain_get_backup_dc(context->swapchain)))
         {
             ERR("Failed to retrieve a device context.\n");
-- 
2.20.1




More information about the wine-devel mailing list