[pkg-wine-party] [SCM] Debian Wine packaging branch, lenny, updated. wine-1.0.0-1-126-gccc5cbd

Alexandre Julliard julliard at winehq.org
Thu Oct 30 14:43:44 UTC 2008


The following commit has been merged in the lenny branch:
commit 8f82a3988d824af5d63937e94fa6b4bbafe36ec6
Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Jun 18 20:10:47 2008 +0200

    winex11: Check for matching pixel format in wglMakeCurrent.
    (cherry picked from commit 815baba090b79cab4a3ceff5fa248bda1f7c8e8c)

diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c
index 46ded06..e72d1a0 100644
--- a/dlls/opengl32/tests/opengl.c
+++ b/dlls/opengl32/tests/opengl.c
@@ -265,6 +265,33 @@ static void test_setpixelformat(HDC winhdc)
     }
 }
 
+static void test_makecurrent(HDC winhdc)
+{
+    BOOL ret;
+    HGLRC hglrc;
+    HDC hdc;
+
+    hdc = GetDC(0);
+    ok( hdc != 0, "GetDC(0) failed\n" );
+
+    hglrc = wglCreateContext(winhdc);
+    ok( hglrc != 0, "wglCreateContext failed\n" );
+
+    ret = wglMakeCurrent( winhdc, hglrc );
+    ok( ret, "wglMakeCurrent failed\n" );
+
+    ok( wglGetCurrentContext() == hglrc, "wrong context\n" );
+
+    SetLastError( 0xdeadbeef );
+    ret = wglMakeCurrent( hdc, hglrc );
+    ok( !ret, "wglMakeCurrent succeeded\n" );
+    ok( GetLastError() == ERROR_INVALID_PIXEL_FORMAT, "last error %u\n", GetLastError() );
+
+    ok( wglGetCurrentContext() == hglrc, "wrong context\n" );
+
+    ReleaseDC( 0, hdc );
+}
+
 static void test_colorbits(HDC hdc)
 {
     const int iAttribList[] = { WGL_COLOR_BITS_ARB, WGL_RED_BITS_ARB, WGL_GREEN_BITS_ARB,
@@ -437,6 +464,7 @@ START_TEST(opengl)
         ok(res, "wglMakeCurrent failed!\n");
         init_functions();
 
+        test_makecurrent(hdc);
         test_setpixelformat(hdc);
         test_colorbits(hdc);
         test_gdi_dbuf(hdc);
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 393c11a..b6e88ea 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -1754,6 +1754,7 @@ BOOL X11DRV_wglMakeCurrent(X11DRV_PDEVICE *physDev, HGLRC hglrc) {
     BOOL ret;
     HDC hdc = physDev->hdc;
     DWORD type = GetObjectType(hdc);
+    Wine_GLContext *ctx = (Wine_GLContext *) hglrc;
 
     TRACE("(%p,%p)\n", hdc, hglrc);
 
@@ -1766,8 +1767,12 @@ BOOL X11DRV_wglMakeCurrent(X11DRV_PDEVICE *physDev, HGLRC hglrc) {
     if (hglrc == NULL) {
         ret = pglXMakeCurrent(gdi_display, None, NULL);
         NtCurrentTeb()->glContext = NULL;
+    } else if (ctx->fmt->iPixelFormat != physDev->current_pf) {
+        WARN( "mismatched pixel format hdc %p %u ctx %p %u\n",
+              hdc, physDev->current_pf, ctx, ctx->fmt->iPixelFormat );
+        SetLastError( ERROR_INVALID_PIXEL_FORMAT );
+        ret = FALSE;
     } else {
-        Wine_GLContext *ctx = (Wine_GLContext *) hglrc;
         Drawable drawable = get_glxdrawable(physDev);
         if (ctx->ctx == NULL) {
             /* The describe lines below are for debugging purposes only */

-- 
Debian Wine packaging



More information about the pkg-wine-party mailing list