Commit 3255b214 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

winex11.drv: Allow OpenGL on minimized windows.

parent a4fad541
...@@ -650,6 +650,75 @@ static void test_opengl3(HDC hdc) ...@@ -650,6 +650,75 @@ 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;
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) START_TEST(opengl)
{ {
HWND hwnd; HWND hwnd;
...@@ -704,6 +773,7 @@ START_TEST(opengl) ...@@ -704,6 +773,7 @@ START_TEST(opengl)
res = SetPixelFormat(hdc, iPixelFormat, &pfd); res = SetPixelFormat(hdc, iPixelFormat, &pfd);
ok(res, "SetPixelformat failed: %x\n", GetLastError()); ok(res, "SetPixelformat failed: %x\n", GetLastError());
test_minimized();
test_dc(hwnd, hdc); test_dc(hwnd, hdc);
hglrc = wglCreateContext(hdc); hglrc = wglCreateContext(hdc);
......
...@@ -1951,16 +1951,16 @@ void CDECL X11DRV_GetDC( HDC hdc, HWND hwnd, HWND top, const RECT *win_rect, ...@@ -1951,16 +1951,16 @@ void CDECL X11DRV_GetDC( HDC hdc, HWND hwnd, HWND top, const RECT *win_rect,
escape.pixmap = 0; escape.pixmap = 0;
escape.gl_copy = FALSE; escape.gl_copy = FALSE;
if (top == hwnd && data && IsIconic( hwnd ) && data->icon_window) if (top == hwnd)
{
escape.drawable = data->icon_window;
}
else if (top == hwnd)
{ {
escape.fbconfig_id = data ? data->fbconfig_id : (XID)GetPropA( hwnd, fbconfig_id_prop ); escape.fbconfig_id = data ? data->fbconfig_id : (XID)GetPropA( hwnd, fbconfig_id_prop );
/* GL draws to the client area even for window DCs */ /* GL draws to the client area even for window DCs */
escape.gl_drawable = data ? data->client_window : X11DRV_get_client_window( hwnd ); 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 ); escape.drawable = data ? data->whole_window : X11DRV_get_whole_window( hwnd );
else else
escape.drawable = escape.gl_drawable; escape.drawable = escape.gl_drawable;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment