Restore support of OpenGL on retina without Fl::use_high_res_GL(1)

Apparently the default value of the wantsBestResolutionOpenGLSurface
property changed with macOS Catalina 10.15
This commit is contained in:
ManoloFLTK 2019-10-26 08:47:25 +02:00
parent 4f8e692f30
commit d1e346a7d2

View File

@ -2857,11 +2857,11 @@ NSOpenGLContext* Fl_Cocoa_Window_Driver::create_GLcontext_for_window(NSOpenGLPix
NSOpenGLContext *context = [[NSOpenGLContext alloc] initWithFormat:pixelformat shareContext:shared_ctx];
if (context) {
FLView *view = (FLView*)[fl_xid(window) contentView];
if (fl_mac_os_version >= 100700 && Fl::use_high_res_GL()) {
if (fl_mac_os_version >= 100700) {
//replaces [view setWantsBestResolutionOpenGLSurface:YES] without compiler warning
typedef void (*bestResolutionIMP)(id, SEL, BOOL);
static bestResolutionIMP addr = (bestResolutionIMP)[NSView instanceMethodForSelector:@selector(setWantsBestResolutionOpenGLSurface:)];
addr(view, @selector(setWantsBestResolutionOpenGLSurface:), YES);
addr(view, @selector(setWantsBestResolutionOpenGLSurface:), Fl::use_high_res_GL() != 0);
}
[context setView:view];
}