diff options
author | Emmanuele Bassi <ebassi@gmail.com> | 2020-12-02 01:14:30 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gmail.com> | 2020-12-02 01:14:30 +0000 |
commit | 770e848953af9aea230b636c979756a7db4a2bc8 (patch) | |
tree | 873112da7e021d21c448ea5f22401d2773f73978 | |
parent | 617d12fd77a0627ece7816123878b04e4dd87cad (diff) | |
parent | 9e1dd15e3191b0b876ee13426f737a4d5ab14e2c (diff) | |
download | gtk+-770e848953af9aea230b636c979756a7db4a2bc8.tar.gz |
Merge branch 'wip/chergert/gdk-macos-for-master' into 'master'
macos: various macos improvements for GTK 4
See merge request GNOME/gtk!2902
-rw-r--r-- | gdk/macos/gdkmacosglcontext.c | 19 | ||||
-rw-r--r-- | gdk/macos/gdkmacostoplevelsurface.c | 2 | ||||
-rw-r--r-- | gsk/gskrenderer.c | 3 |
3 files changed, 20 insertions, 4 deletions
diff --git a/gdk/macos/gdkmacosglcontext.c b/gdk/macos/gdkmacosglcontext.c index 06829b9184..00ddfefcde 100644 --- a/gdk/macos/gdkmacosglcontext.c +++ b/gdk/macos/gdkmacosglcontext.c @@ -447,15 +447,28 @@ _gdk_macos_gl_context_new (GdkMacosSurface *surface, gboolean _gdk_macos_gl_context_make_current (GdkMacosGLContext *self) { + NSOpenGLContext *current; + g_return_val_if_fail (GDK_IS_MACOS_GL_CONTEXT (self), FALSE); - if (self->gl_context != nil) + if (self->gl_context == NULL) + return FALSE; + + current = [NSOpenGLContext currentContext]; + + if (self->gl_context != current) { + /* The OpenGL mac programming guide suggests that glFlush() is called + * before switching current contexts to ensure that the drawing commands + * are submitted. + */ + if (current != NULL) + glFlush (); + [self->gl_context makeCurrentContext]; - return TRUE; } - return FALSE; + return TRUE; } G_GNUC_END_IGNORE_DEPRECATIONS diff --git a/gdk/macos/gdkmacostoplevelsurface.c b/gdk/macos/gdkmacostoplevelsurface.c index a9a6488419..05d88ba94f 100644 --- a/gdk/macos/gdkmacostoplevelsurface.c +++ b/gdk/macos/gdkmacostoplevelsurface.c @@ -174,6 +174,8 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel, } else { + [nswindow setAnimationBehavior:NSWindowAnimationBehaviorDocumentWindow]; + if (!self->decorated && !GDK_MACOS_SURFACE (self)->did_initial_present && GDK_SURFACE (self)->x == 0 && diff --git a/gsk/gskrenderer.c b/gsk/gskrenderer.c index dbbfd28f35..716eef1c22 100644 --- a/gsk/gskrenderer.c +++ b/gsk/gskrenderer.c @@ -567,8 +567,9 @@ get_renderer_for_backend (GdkSurface *surface) return GSK_TYPE_BROADWAY_RENDERER; #endif #ifdef GDK_WINDOWING_MACOS + /* Use Cairo until GL renderer is working */ if (GDK_IS_MACOS_SURFACE (surface)) - return GSK_TYPE_GL_RENDERER; + return GSK_TYPE_CAIRO_RENDERER; #endif #ifdef GDK_WINDOWING_WIN32 if (GDK_IS_WIN32_SURFACE (surface)) |