[PATCH 5/5] winex11.drv: Allow OpenGL on minimized windows.
Henri Verbeet
hverbeet at codeweavers.com
Sun Apr 11 14:47:49 CDT 2010
---
dlls/opengl32/tests/opengl.c | 71 ++++++++++++++++++++++++++++++++++++++++++
dlls/winex11.drv/window.c | 12 +++---
2 files changed, 77 insertions(+), 6 deletions(-)
diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c
index b2d8e18..bcc8218 100644
--- a/dlls/opengl32/tests/opengl.c
+++ b/dlls/opengl32/tests/opengl.c
@@ -650,6 +650,76 @@ static void test_opengl3(HDC hdc)
}
}
+static void test_minimized(void)
+{
+ PIXELFORMATDESCRIPTOR pf_desc =
+ {
+ sizeof(PIXELFORMATDESCRIPTOR),
+ 1, /* version */
+ PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER,
+ PFD_TYPE_RGBA,
+ 24, /* 24-bit color depth */
+ 0, 0, 0, 0, 0, 0, /* color bits */
+ 0, /* alpha buffer */
+ 0, /* shift bit */
+ 0, /* accumulation buffer */
+ 0, 0, 0, 0, /* accum bits */
+ 32, /* z-buffer */
+ 0, /* stencil buffer */
+ 0, /* auxiliary buffer */
+ PFD_MAIN_PLANE, /* main layer */
+ 0, /* reserved */
+ 0, 0, 0 /* layer masks */
+ };
+ int pixel_format;
+ HWND window;
+ DWORD error;
+ LONG style;
+ HGLRC ctx;
+ BOOL ret;
+ HDC dc;
+
+ window = CreateWindowA("static", "opengl32_test",
+ WS_POPUP | WS_MINIMIZE, 0, 0, 640, 480, 0, 0, 0, 0);
+ ok(!!window, "Failed to create window, last error %#x.\n", GetLastError());
+
+ dc = GetDC(window);
+ ok(!!dc, "Failed to get DC.\n");
+
+ pixel_format = ChoosePixelFormat(dc, &pf_desc);
+ if (!pixel_format)
+ {
+ win_skip("Failed to find pixel format.\n");
+ ReleaseDC(window, dc);
+ DestroyWindow(window);
+ return;
+ }
+
+ ret = SetPixelFormat(dc, pixel_format, &pf_desc);
+ ok(ret, "Failed to set pixel format, last error %#x.\n", GetLastError());
+
+ style = GetWindowLongA(window, GWL_STYLE);
+ ok(style & WS_MINIMIZE, "Window should be minimized, got style %#x.\n", style);
+
+ ctx = wglCreateContext(dc);
+ ok(!!ctx, "Failed to create GL context, last error %#x.\n", GetLastError());
+
+ ret = wglMakeCurrent(dc, ctx);
+ ok(ret, "Failed to make context current, last error %#x.\n", GetLastError());
+
+ style = GetWindowLongA(window, GWL_STYLE);
+ ok(style & WS_MINIMIZE, "window should be minimized, got style %#x.\n", style);
+
+ ret = wglMakeCurrent(NULL, NULL);
+ ok(ret, "Failed to clear current context, last error %#x.\n", GetLastError());
+
+ ret = wglDeleteContext(ctx);
+ ok(ret, "Failed to delete GL context, last error %#x.\n", GetLastError());
+
+ ReleaseDC(window, dc);
+ DestroyWindow(window);
+}
+
START_TEST(opengl)
{
HWND hwnd;
@@ -704,6 +774,7 @@ START_TEST(opengl)
res = SetPixelFormat(hdc, iPixelFormat, &pfd);
ok(res, "SetPixelformat failed: %x\n", GetLastError());
+ test_minimized();
test_dc(hwnd, hdc);
hglrc = wglCreateContext(hdc);
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index ef197ca..a9a3769 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -1951,16 +1951,16 @@ void CDECL X11DRV_GetDC( HDC hdc, HWND hwnd, HWND top, const RECT *win_rect,
escape.pixmap = 0;
escape.gl_copy = FALSE;
- if (top == hwnd && data && IsIconic( hwnd ) && data->icon_window)
- {
- escape.drawable = data->icon_window;
- }
- else if (top == hwnd)
+ if (top == hwnd)
{
escape.fbconfig_id = data ? data->fbconfig_id : (XID)GetPropA( hwnd, fbconfig_id_prop );
/* GL draws to the client area even for window DCs */
escape.gl_drawable = data ? data->client_window : X11DRV_get_client_window( hwnd );
- if (flags & DCX_WINDOW)
+ if (data && IsIconic( hwnd ) && data->icon_window)
+ {
+ escape.drawable = data->icon_window;
+ }
+ else if (flags & DCX_WINDOW)
escape.drawable = data ? data->whole_window : X11DRV_get_whole_window( hwnd );
else
escape.drawable = escape.gl_drawable;
--
1.6.4.4
More information about the wine-patches
mailing list