From b822e9efe8f35e1683665332cf21f941be89404e Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Thu, 22 Aug 2019 19:03:18 +0200 Subject: [PATCH] running OpenGL fix only when really needed (second attempt) --- src/osx/cocoa/glcanvas.mm | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/osx/cocoa/glcanvas.mm b/src/osx/cocoa/glcanvas.mm index 3bb102e8a1..94051a7fd7 100644 --- a/src/osx/cocoa/glcanvas.mm +++ b/src/osx/cocoa/glcanvas.mm @@ -199,24 +199,25 @@ bool wxGLContext::SetCurrent(const wxGLCanvas& win) const [m_glContext update]; [m_glContext makeCurrentContext]; - - // At least under macOS 10.14.5 we need to do this in order to update the - // context with the new size information after the window is resized. -// if ( WX_IS_MACOS_AVAILABLE_FULL(10, 14, 5) ) - { - NSOpenGLView *v = (NSOpenGLView *)win.GetHandle(); - [v setOpenGLContext: m_glContext]; - } - + // the missing redraw upon resize problem only happens when linked against 10.14 +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14 // At least under macOS 10.14.5 we need to do this in order to update the // context with the new size information after the window is resized. if ( WX_IS_MACOS_AVAILABLE_FULL(10, 14, 5) ) { - NSOpenGLView *v = (NSOpenGLView *)win.GetHandle(); - [v setOpenGLContext: m_glContext]; + if ( WX_IS_MACOS_AVAILABLE(10, 15) ) + { + // no workaround needed under 10.15 anymore + } + else + { + NSOpenGLView *v = (NSOpenGLView *)win.GetHandle(); + [v setOpenGLContext: m_glContext]; + } } - +#endif + return true; }