[PATCH] winex11.drv: Recreate gl_drawable for top-level windows as non-top level when clipping for child windows is required

Micah N Gorrell mgorrell at codeweavers.com
Wed Apr 10 13:47:59 CDT 2019


On Wed, Apr 10, 2019 at 01:45:21PM -0500, Ken Thomases wrote:
> On Apr 9, 2019, at 2:40 PM, Micah N Gorrell <mgorrell at codeweavers.com> wrote:
> > 
> > Prevent creating a gl_drawable for a window as type DC_GL_WINDOW if the
> > window has children since DC_GL_WINDOW does not support clipping.
> > 
> > If a parent window is encountered of type DC_GL_WINDOW then recreate the
> > gl_drawable.
> > 
> > Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=15232
> > Signed-off-by: Micah N Gorrell <mgorrell at codeweavers.com>
> > ---
> > dlls/winex11.drv/opengl.c | 23 +++++++++++++++--------
> > dlls/winex11.drv/window.c | 13 ++++++++++++-
> > dlls/winex11.drv/x11drv.h |  2 +-
> > 3 files changed, 28 insertions(+), 10 deletions(-)
> > 
> > diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
> > index 13a1da32ea..0d4fb521c4 100644
> > --- a/dlls/winex11.drv/opengl.c
> > +++ b/dlls/winex11.drv/opengl.c
> > @@ -1328,7 +1328,7 @@ static GLXContext create_glxcontext(Display *display, struct wgl_context *contex
> > /***********************************************************************
> >  *              create_gl_drawable
> >  */
> > -static struct gl_drawable *create_gl_drawable( HWND hwnd, const struct wgl_pixel_format *format )
> > +static struct gl_drawable *create_gl_drawable( HWND hwnd, const struct wgl_pixel_format *format, BOOL have_child )
> > {
> >     struct gl_drawable *gl, *prev;
> >     XVisualInfo *visual = format->visual;
> > @@ -1349,7 +1349,7 @@ static struct gl_drawable *create_gl_drawable( HWND hwnd, const struct wgl_pixel
> >     gl->format = format;
> >     gl->ref = 1;
> > 
> > -    if (GetAncestor( hwnd, GA_PARENT ) == GetDesktopWindow())  /* top-level window */
> > +    if (!have_child && !GetWindow( hwnd, GW_CHILD ) && GetAncestor( hwnd, GA_PARENT ) == GetDesktopWindow())  /* childless top-level window */
> 
> The main issue I have is with the name "have_child".  It's too… definitive.  When it's passed as false (from X11DRV_WindowPosChanged()), that doesn't mean there definitely aren't children, just that we don't know definitively whether there are or aren't.  (If it were definitive, then the GetWindow(…, GW_CHILD) check wouldn't be needed.)
> 
> Perhaps "known_child"?
> 
> Otherwise, looks good to me.
> 
> -Ken
> 

Good point. You're absolutely right. When it is TRUE we know there is a child
but in many cases we don't know. I'll rename and send a new updated patch in a
moment.

-Micah




More information about the wine-devel mailing list