Added patch to allow setting pixel format for desktop window.

This commit is contained in:
Sebastian Lackner
2015-06-04 00:21:47 +02:00
parent 9acb14c728
commit 002f664b68
5 changed files with 221 additions and 127 deletions

View File

@@ -0,0 +1,75 @@
From aced729294b868190d7c133a17e357f56e2c29d6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Wed, 3 Jun 2015 22:57:21 +0200
Subject: winex11.drv: Allow changing the opengl pixel format on the desktop
window.
This patch is not 100% correct because the old behavior was more similar to
windows. However, Direct3D supports using the desktop window to create a
context and since Wine translates Direct3D to OpenGL, using the desktop
window will fail because of this limitation. Unless someone comes up with
a more correct solution or finds an application that breaks because of this,
it seems to be a suitable workaround as it fixes multiple applications.
---
dlls/d3d9/tests/device.c | 16 ++++++++++++++++
dlls/winex11.drv/opengl.c | 5 ++++-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index cb4a6e8..7872b32 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -10152,6 +10152,21 @@ static void test_resource_priority(void)
DestroyWindow(window);
}
+static void test_desktop_window(void)
+{
+ IDirect3DDevice9 *device = NULL;
+ IDirect3D9 *d3d;
+
+ d3d = Direct3DCreate9(D3D_SDK_VERSION);
+ ok(!!d3d, "Failed to create a D3D object.\n");
+
+ device = create_device(d3d, GetDesktopWindow(), NULL);
+ ok(!!device, "Failed to created device on desktop window.\n");
+
+ if (device) IDirect3DDevice9_Release(device);
+ IDirect3D9_Release(d3d);
+}
+
START_TEST(device)
{
WNDCLASSA wc = {0};
@@ -10262,6 +10277,7 @@ START_TEST(device)
test_writeonly_resource();
test_lost_device();
test_resource_priority();
+ test_desktop_window();
UnregisterClassA("d3d9_test_wc", GetModuleHandleA(NULL));
}
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 7b8ba82..72445fb 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -1436,12 +1436,15 @@ static BOOL set_pixel_format(HDC hdc, int format, BOOL allow_change)
TRACE("(%p,%d)\n", hdc, format);
- if (!hwnd || hwnd == GetDesktopWindow())
+ if (!hwnd)
{
WARN( "not a valid window DC %p/%p\n", hdc, hwnd );
return FALSE;
}
+ if (hwnd == GetDesktopWindow())
+ FIXME("Using desktop window for OpenGL is not supported on windows\n");
+
fmt = get_pixel_format(gdi_display, format, FALSE /* Offscreen */);
if (!fmt)
{
--
2.4.2

View File

@@ -0,0 +1 @@
Fixes: Allow to set pixel format for desktop window