winex11: Don't reset OpenGL swap interval of window on SetParent().

This commit is contained in:
Ken Thomases 2014-03-21 00:18:58 -05:00 committed by Alexandre Julliard
parent 15612dd762
commit 6696e7d9e1
2 changed files with 17 additions and 7 deletions

View file

@ -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());

View file

@ -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)