winex11.drv: Make wglMakeCurrent return the correct error when the drawable is invalid.

This commit is contained in:
Matteo Bruni 2011-03-17 22:49:23 +01:00 committed by Alexandre Julliard
parent 77679c4e9c
commit 716df1c2d2
2 changed files with 9 additions and 3 deletions

View File

@ -956,7 +956,7 @@ static void test_destroy(HDC oldhdc)
SetLastError(0xdeadbeef);
ret = wglMakeCurrent(dc, ctx);
err = GetLastError();
todo_wine ok(!ret && err == ERROR_INVALID_HANDLE,
ok(!ret && err == ERROR_INVALID_HANDLE,
"Unexpected behavior when making context current, ret %d, last error %#x.\n", ret, err);
ok(wglGetCurrentContext() == ctx, "Wrong current context.\n");
@ -977,7 +977,7 @@ static void test_destroy(HDC oldhdc)
SetLastError(0xdeadbeef);
ret = wglMakeCurrent(dc, ctx);
err = GetLastError();
todo_wine ok(!ret && err == ERROR_INVALID_HANDLE,
ok(!ret && err == ERROR_INVALID_HANDLE,
"Unexpected behavior when making context current, ret %d, last error %#x.\n", ret, err);
ok(wglGetCurrentContext() == NULL, "Wrong current context.\n");
@ -989,7 +989,7 @@ static void test_destroy(HDC oldhdc)
SetLastError(0xdeadbeef);
ret = wglMakeCurrent(dc, ctx);
err = GetLastError();
todo_wine ok(!ret && err == ERROR_INVALID_HANDLE,
ok(!ret && err == ERROR_INVALID_HANDLE,
"Unexpected behavior when making context current, ret %d, last error %#x.\n", ret, err);
ok(wglGetCurrentContext() == oldctx, "Wrong current context.\n");

View File

@ -1896,6 +1896,12 @@ BOOL CDECL X11DRV_wglMakeCurrent(X11DRV_PDEVICE *physDev, HGLRC hglrc) {
ret = pglXMakeCurrent(gdi_display, None, NULL);
NtCurrentTeb()->glContext = NULL;
}
else if (!physDev->current_pf)
{
WARN("Trying to use an invalid drawable\n");
SetLastError(ERROR_INVALID_HANDLE);
ret = FALSE;
}
else if (ctx->fmt->iPixelFormat != physDev->current_pf)
{
WARN( "mismatched pixel format hdc %p %u ctx %p %u\n",