From 6696e7d9e1b59c22b8842803670ed917ebb2a3d4 Mon Sep 17 00:00:00 2001 From: Ken Thomases Date: Fri, 21 Mar 2014 00:18:58 -0500 Subject: [PATCH] winex11: Don't reset OpenGL swap interval of window on SetParent(). --- dlls/opengl32/tests/opengl.c | 16 +++++++++++++--- dlls/winex11.drv/opengl.c | 8 ++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c index 4303d1ca56f..7384cb41312 100644 --- a/dlls/opengl32/tests/opengl.c +++ b/dlls/opengl32/tests/opengl.c @@ -1509,7 +1509,7 @@ static void test_swap_control(HDC oldhdc) 0, 0, 0 /* layer masks */ }; int pixel_format; - HWND window1, window2; + HWND window1, window2, old_parent; HGLRC ctx1, ctx2, oldctx; BOOL ret; HDC dc1, dc2; @@ -1550,7 +1550,7 @@ static void test_swap_control(HDC oldhdc) ok(ret, "Failed to set swap interval to 0, last error %#x.\n", GetLastError()); interval = pwglGetSwapIntervalEXT(); - ok(interval == 0, "Expected default swap interval 0, got %d\n", interval); + ok(interval == 0, "Expected swap interval 0, got %d\n", interval); /* Check what interval we get on a second context on the same drawable.*/ ctx2 = wglCreateContext(dc1); @@ -1582,7 +1582,17 @@ static void test_swap_control(HDC oldhdc) * is not global or shared among contexts. */ interval = pwglGetSwapIntervalEXT(); - ok(interval == 1, "Expected swap interval 1, got %d\n", interval); + ok(interval == 1, "Expected default swap interval 1, got %d\n", interval); + + /* Test if setting the parent of a window resets the swap interval. */ + ret = wglMakeCurrent(dc1, ctx1); + ok(ret, "Failed to make context current, last error %#x.\n", GetLastError()); + + old_parent = SetParent(window1, window2); + ok(!!old_parent, "Failed to make window1 a child of window2, last error %#x.\n", GetLastError()); + + interval = pwglGetSwapIntervalEXT(); + ok(interval == 0, "Expected swap interval 0, got %d\n", interval); ret = wglDeleteContext(ctx1); ok(ret, "Failed to delete GL context, last error %#x.\n", GetLastError()); diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index d06565aa943..759e51f20ec 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1253,10 +1253,6 @@ static void free_gl_drawable( struct gl_drawable *gl ) static BOOL create_gl_drawable( HWND hwnd, HWND parent, struct gl_drawable *gl ) { gl->drawable = 0; - /* Default GLX and WGL swap interval is 1, but in case of glXSwapIntervalSGI - * there is no way to query it, so we have to store it here. - */ - gl->swap_interval = 1; if (GetAncestor( hwnd, GA_PARENT ) == GetDesktopWindow()) /* top-level window */ { @@ -1331,6 +1327,10 @@ static BOOL set_win_format( HWND hwnd, const struct wgl_pixel_format *format ) struct gl_drawable *gl, *prev; gl = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*gl) ); + /* Default GLX and WGL swap interval is 1, but in case of glXSwapIntervalSGI + * there is no way to query it, so we have to store it here. + */ + gl->swap_interval = 1; gl->format = format; gl->visual = pglXGetVisualFromFBConfig( gdi_display, format->fbconfig ); if (!gl->visual) -- 2.11.4.GIT