Really fix problems with wxGLCanvas resizing under macOS 10.14.5

This is a better fix for the problem with NSOpenGLView having wrong size
after resizing the window under 10.14.5 (only): reset the context when
making the context current, to ensure that the up-to-date size is used.

See #18402.
This commit is contained in:
Daniel Kulp 2019-08-20 11:17:49 +02:00 committed by Vadim Zeitlin
parent c2e6b86786
commit 6974a6ceaa

View File

@ -33,6 +33,7 @@
#endif
#include "wx/osx/private.h"
#include "wx/osx/private/available.h"
WXGLContext WXGLCreateContext( WXGLPixelFormat pixelFormat, WXGLContext shareContext )
{
@ -199,6 +200,14 @@ bool wxGLContext::SetCurrent(const wxGLCanvas& win) const
[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];
}
return true;
}