Commit f950f41b authored by Alexandre Julliard's avatar Alexandre Julliard

Revert "winex11: Refuse to set the pixel format for HWND_MESSAGE windows."

This reverts commit 53806917. Tests show that this is allowed.
parent 2a43bb22
...@@ -1110,6 +1110,84 @@ static void test_window_dc(void) ...@@ -1110,6 +1110,84 @@ static void test_window_dc(void)
DestroyWindow(window); DestroyWindow(window);
} }
static void test_message_window(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;
RECT vp, r;
HGLRC ctx;
BOOL ret;
HDC dc;
GLenum glerr;
window = CreateWindowA("static", "opengl32_test",
WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, HWND_MESSAGE, 0, 0, 0);
if (!window)
{
win_skip( "HWND_MESSAGE not supported\n" );
return;
}
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());
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());
GetClientRect(window, &r);
glGetIntegerv(GL_VIEWPORT, (GLint *)&vp);
ok(EqualRect(&r, &vp), "Viewport not equal to client rect.\n");
glClear(GL_COLOR_BUFFER_BIT);
glFinish();
glerr = glGetError();
ok(glerr == GL_NO_ERROR, "Failed glClear, error %#x.\n", glerr);
ret = SwapBuffers(dc);
ok(ret, "Failed SwapBuffers, error %#x.\n", GetLastError());
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);
}
static void test_destroy(HDC oldhdc) static void test_destroy(HDC oldhdc)
{ {
PIXELFORMATDESCRIPTOR pf_desc = PIXELFORMATDESCRIPTOR pf_desc =
...@@ -1458,6 +1536,7 @@ START_TEST(opengl) ...@@ -1458,6 +1536,7 @@ START_TEST(opengl)
test_bitmap_rendering( FALSE ); test_bitmap_rendering( FALSE );
test_minimized(); test_minimized();
test_window_dc(); test_window_dc();
test_message_window();
test_dc(hwnd, hdc); test_dc(hwnd, hdc);
hglrc = wglCreateContext(hdc); hglrc = wglCreateContext(hdc);
......
...@@ -1170,9 +1170,9 @@ static BOOL create_gl_drawable( HWND hwnd, HWND parent, struct gl_drawable *gl ) ...@@ -1170,9 +1170,9 @@ static BOOL create_gl_drawable( HWND hwnd, HWND parent, struct gl_drawable *gl )
gl->drawable = 0; gl->drawable = 0;
if (parent == GetDesktopWindow()) /* top-level window */ if (GetAncestor( hwnd, GA_PARENT ) == GetDesktopWindow()) /* top-level window */
{ {
Window xparent = X11DRV_get_whole_window( hwnd ); Window parent = X11DRV_get_whole_window( hwnd );
gl->type = DC_GL_WINDOW; gl->type = DC_GL_WINDOW;
gl->colormap = XCreateColormap( gdi_display, root_window, gl->visual->visual, gl->colormap = XCreateColormap( gdi_display, root_window, gl->visual->visual,
...@@ -1185,8 +1185,8 @@ static BOOL create_gl_drawable( HWND hwnd, HWND parent, struct gl_drawable *gl ) ...@@ -1185,8 +1185,8 @@ static BOOL create_gl_drawable( HWND hwnd, HWND parent, struct gl_drawable *gl )
attrib.backing_store = NotUseful; attrib.backing_store = NotUseful;
/* put the initial rect outside of the window, it will be moved into place by SetWindowPos */ /* put the initial rect outside of the window, it will be moved into place by SetWindowPos */
OffsetRect( &gl->rect, gl->rect.right, gl->rect.bottom ); OffsetRect( &gl->rect, gl->rect.right, gl->rect.bottom );
if (xparent) if (parent)
gl->drawable = XCreateWindow( gdi_display, xparent, gl->rect.left, gl->rect.top, gl->drawable = XCreateWindow( gdi_display, parent, gl->rect.left, gl->rect.top,
gl->rect.right - gl->rect.left, gl->rect.bottom - gl->rect.top, gl->rect.right - gl->rect.left, gl->rect.bottom - gl->rect.top,
0, default_visual.depth, InputOutput, gl->visual->visual, 0, default_visual.depth, InputOutput, gl->visual->visual,
CWBitGravity | CWWinGravity | CWBackingStore | CWColormap, CWBitGravity | CWWinGravity | CWBackingStore | CWColormap,
...@@ -1196,10 +1196,6 @@ static BOOL create_gl_drawable( HWND hwnd, HWND parent, struct gl_drawable *gl ) ...@@ -1196,10 +1196,6 @@ static BOOL create_gl_drawable( HWND hwnd, HWND parent, struct gl_drawable *gl )
else else
XFreeColormap( gdi_display, gl->colormap ); XFreeColormap( gdi_display, gl->colormap );
} }
else if (!GetAncestor( parent, GA_PARENT ))
{
FIXME( "can't set format of HWND_MESSAGE window %p\n", hwnd );
}
#ifdef SONAME_LIBXCOMPOSITE #ifdef SONAME_LIBXCOMPOSITE
else if(usexcomposite) else if(usexcomposite)
{ {
......
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