diff --git a/gdk/macos/gdkmacosglcontext.c b/gdk/macos/gdkmacosglcontext.c index d3c70e6f5b..e3d72e54d9 100644 --- a/gdk/macos/gdkmacosglcontext.c +++ b/gdk/macos/gdkmacosglcontext.c @@ -21,6 +21,7 @@ #include "gdkmacosglcontext-private.h" #include "gdkmacossurface-private.h" +#include "gdkmacostoplevelsurface-private.h" #include "gdkinternals.h" #include "gdkintl.h" @@ -174,7 +175,6 @@ gdk_macos_gl_context_real_realize (GdkGLContext *context, GdkGLContext *shared_data; GdkGLContext *existing; GLint sync_to_framerate = 1; - GLint opaque = 0; GLint validate = 0; int major, minor; @@ -225,7 +225,6 @@ gdk_macos_gl_context_real_realize (GdkGLContext *context, } [gl_context setValues:&sync_to_framerate forParameter:NSOpenGLCPSwapInterval]; - [gl_context setValues:&opaque forParameter:NSOpenGLCPSurfaceOpacity]; [gl_context setValues:&validate forParameter:NSOpenGLContextParameterStateValidation]; self->dummy_window = [[NSWindow alloc] initWithContentRect:NSZeroRect @@ -280,6 +279,9 @@ gdk_macos_gl_context_begin_frame (GdkDrawContext *context, if (self->needs_resize) { + GdkSurface *surface = gdk_draw_context_get_surface (context); + GLint opaque; + self->needs_resize = FALSE; if (self->dummy_view != NULL) @@ -291,6 +293,16 @@ gdk_macos_gl_context_begin_frame (GdkDrawContext *context, [self->dummy_view setFrame:frame]; } + /* Possibly update our opaque setting depending on a resize. We can + * rely on getting a resize if decoarated is changed, so this reduces + * how much we adjust the parameter. + */ + if (GDK_IS_MACOS_TOPLEVEL_SURFACE (surface)) + opaque = GDK_MACOS_TOPLEVEL_SURFACE (surface)->decorated; + else + opaque = FALSE; + [self->gl_context setValues:&opaque forParameter:NSOpenGLCPSurfaceOpacity]; + [self->gl_context update]; } diff --git a/gdk/macos/gdkmacostoplevelsurface-private.h b/gdk/macos/gdkmacostoplevelsurface-private.h index d7866601e5..8d3ec15b02 100644 --- a/gdk/macos/gdkmacostoplevelsurface-private.h +++ b/gdk/macos/gdkmacostoplevelsurface-private.h @@ -24,13 +24,24 @@ G_BEGIN_DECLS -typedef struct _GdkMacosToplevelSurface GdkMacosToplevelSurface; -typedef struct _GdkMacosToplevelSurfaceClass GdkMacosToplevelSurfaceClass; - #define GDK_TYPE_MACOS_TOPLEVEL_SURFACE (_gdk_macos_toplevel_surface_get_type()) #define GDK_MACOS_TOPLEVEL_SURFACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_MACOS_TOPLEVEL_SURFACE, GdkMacosToplevelSurface)) #define GDK_IS_MACOS_TOPLEVEL_SURFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MACOS_TOPLEVEL_SURFACE)) +typedef struct _GdkMacosToplevelSurface GdkMacosToplevelSurface; +typedef struct _GdkMacosToplevelSurfaceClass GdkMacosToplevelSurfaceClass; + +struct _GdkMacosToplevelSurface +{ + GdkMacosSurface parent_instance; + guint decorated : 1; +}; + +struct _GdkMacosToplevelSurfaceClass +{ + GdkMacosSurfaceClass parent_instance; +}; + GType _gdk_macos_toplevel_surface_get_type (void); GdkMacosSurface *_gdk_macos_toplevel_surface_new (GdkMacosDisplay *display, GdkSurface *parent, diff --git a/gdk/macos/gdkmacostoplevelsurface.c b/gdk/macos/gdkmacostoplevelsurface.c index 2615957b2c..a9a6488419 100644 --- a/gdk/macos/gdkmacostoplevelsurface.c +++ b/gdk/macos/gdkmacostoplevelsurface.c @@ -29,17 +29,6 @@ #include "gdkmacostoplevelsurface-private.h" #include "gdkmacosutils-private.h" -struct _GdkMacosToplevelSurface -{ - GdkMacosSurface parent_instance; - guint decorated : 1; -}; - -struct _GdkMacosToplevelSurfaceClass -{ - GdkMacosSurfaceClass parent_instance; -}; - static void _gdk_macos_toplevel_surface_fullscreen (GdkMacosToplevelSurface *self) {