Please ignore the patch in my previous mail. I created the new patch
attached here, and it fixes this bug for me.

The patch reverts commit 0cb79db12ac7c48477518dcff269ccc5d6b745e0,
which was reported in the upstream discussion[1] to introduce the bug.
Unfortunately, the reverted commit was intended to fix another bug[2],
so it might be that, by reverting the commit, the other bug[2] may be
re-introduced. Luckily, I am not affected by that other bug, so I am
much better off with this patch.

The other bug was open for more than 10 years, so apparently, it was
never a high priority for the developers. I'd say that the other bug,
which may be re-introduced by this patch, is a pretty minor one.

It may be of interest that the latest version of the Wine source code
(version 7.0+) does not seem to contain code from commit
0cb79db12ac7c48477518dcff269ccc5d6b745e0. 

[1] https://bugs.winehq.org/show_bug.cgi?id=49649
[2] https://bugs.winehq.org/show_bug.cgi?id=15232

From: Corné Plooy <cornware...@ultimatestunts.nl>
Subject: Revert commit 0cb79db12ac7c48477518dcff269ccc5d6b745e0

Bug: https://bugs.winehq.org/show_bug.cgi?id=49649
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1002023
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -1305,7 +1305,7 @@
 /***********************************************************************
  *              create_gl_drawable
  */
-static struct gl_drawable *create_gl_drawable( HWND hwnd, const struct wgl_pixel_format *format, BOOL known_child )
+static struct gl_drawable *create_gl_drawable( HWND hwnd, const struct wgl_pixel_format *format )
 {
     struct gl_drawable *gl, *prev;
     XVisualInfo *visual = format->visual;
@@ -1326,7 +1326,7 @@
     gl->format = format;
     gl->ref = 1;
 
-    if (!known_child && !GetWindow( hwnd, GW_CHILD ) && GetAncestor( hwnd, GA_PARENT ) == GetDesktopWindow())  /* childless top-level window */
+    if (GetAncestor( hwnd, GA_PARENT ) == GetDesktopWindow())  /* top-level window */
     {
         gl->type = DC_GL_WINDOW;
         gl->window = create_client_window( hwnd, visual );
@@ -1389,7 +1389,7 @@
 
     if (!format->visual) return FALSE;
 
-    if (!(gl = create_gl_drawable( hwnd, format, FALSE ))) return FALSE;
+    if (!(gl = create_gl_drawable( hwnd, format ))) return FALSE;
 
     TRACE( "created GL drawable %lx for win %p %s\n",
            gl->drawable, hwnd, debugstr_fbconfig( format->fbconfig ));
@@ -1448,7 +1448,7 @@
 /***********************************************************************
  *              sync_gl_drawable
  */
-void sync_gl_drawable( HWND hwnd, BOOL known_child )
+void sync_gl_drawable( HWND hwnd )
 {
     struct gl_drawable *old, *new;
 
@@ -1456,11 +1456,8 @@
 
     switch (old->type)
     {
-    case DC_GL_WINDOW:
-        if (!known_child) break; /* Still a childless top-level window */
-        /* fall through */
     case DC_GL_PIXMAP_WIN:
-        if (!(new = create_gl_drawable( hwnd, old->format, known_child ))) break;
+        if (!(new = create_gl_drawable( hwnd, old->format ))) break;
         mark_drawable_dirty( old, new );
         XFlush( gdi_display );
         TRACE( "Recreated GL drawable %lx to replace %lx\n", new->drawable, old->drawable );
@@ -1497,7 +1494,7 @@
         return;
     }
 
-    if ((new = create_gl_drawable( hwnd, old->format, FALSE )))
+    if ((new = create_gl_drawable( hwnd, old->format )))
     {
         mark_drawable_dirty( old, new );
         release_gl_drawable( new );
@@ -3284,10 +3281,9 @@
         }
         pglXSwapBuffers(gdi_display, gl->drawable);
         break;
-    case DC_GL_WINDOW:
     case DC_GL_CHILD_WIN:
         if (ctx) sync_context( ctx );
-        if (gl->type == DC_GL_CHILD_WIN) escape.gl_drawable = gl->window;
+        escape.gl_drawable = gl->window;
         /* fall through */
     default:
         if (escape.gl_drawable && pglXSwapBuffersMscOML)
@@ -3343,7 +3339,7 @@
     return NULL;
 }
 
-void sync_gl_drawable( HWND hwnd, BOOL known_child )
+void sync_gl_drawable( HWND hwnd )
 {
 }
 
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -1906,11 +1906,6 @@
 
     if (GetWindowThreadProcessId( hwnd, NULL ) != GetCurrentThreadId()) return NULL;
 
-    /* Recreate the parent gl_drawable now that we know there are child windows
-     * that will need clipping support.
-     */
-    sync_gl_drawable( parent, TRUE );
-
     display = thread_init_display();
     init_clip_window();  /* make sure the clip window is initialized in this thread */
 
@@ -2243,12 +2238,6 @@
 done:
     release_win_data( data );
     set_gl_drawable_parent( hwnd, parent );
-
-    /* Recreate the parent gl_drawable now that we know there are child windows
-     * that will need clipping support.
-     */
-    sync_gl_drawable( parent, TRUE );
-
     fetch_icon_data( hwnd, 0, 0 );
 }
 
@@ -2412,7 +2401,7 @@
                               data->client_rect.bottom - data->client_rect.top !=
                               old_client_rect.bottom - old_client_rect.top));
         release_win_data( data );
-        if (needs_resize) sync_gl_drawable( hwnd, FALSE );
+        if (needs_resize) sync_gl_drawable( hwnd );
         return;
     }
 
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -588,7 +588,7 @@
 extern Window X11DRV_get_whole_window( HWND hwnd ) DECLSPEC_HIDDEN;
 extern XIC X11DRV_get_ic( HWND hwnd ) DECLSPEC_HIDDEN;
 
-extern void sync_gl_drawable( HWND hwnd, BOOL known_child ) DECLSPEC_HIDDEN;
+extern void sync_gl_drawable( HWND hwnd ) DECLSPEC_HIDDEN;
 extern void set_gl_drawable_parent( HWND hwnd, HWND parent ) DECLSPEC_HIDDEN;
 extern void destroy_gl_drawable( HWND hwnd ) DECLSPEC_HIDDEN;
 extern void wine_vk_surface_destroy( HWND hwnd ) DECLSPEC_HIDDEN;

Reply via email to