From 58afd21c7312c1d9225bded5fc1b6549b331b707 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Wed, 2 Dec 2015 14:22:52 +0000 Subject: Mac OS: send the setWantsBestResolutionOpenGLSurface:YES message in Fl_X::create_GLcontext_for_window() where it is directly relevant. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10947 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_cocoa.mm | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 02b8e7ce1..f29e96e67 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -2824,7 +2824,16 @@ NSOpenGLContext* Fl_X::create_GLcontext_for_window(NSOpenGLPixelFormat *pixelfor NSOpenGLContext *shared_ctx, Fl_Window *window) { NSOpenGLContext *context = [[NSOpenGLContext alloc] initWithFormat:pixelformat shareContext:shared_ctx]; - if (context) [context setView:[fl_xid(window) contentView]]; + if (context) { + NSView *view = [fl_xid(window) contentView]; + if (fl_mac_os_version >= 100700 && Fl::use_high_res_GL()) { + //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); + } + [context setView:view]; + } return context; } @@ -3031,12 +3040,6 @@ void Fl_X::make(Fl_Window* w) Fl_X::first = x; } FLView *myview = [[FLView alloc] initWithFrame:crect]; - if (w->as_gl_window() && fl_mac_os_version >= 100700 && Fl::use_high_res_GL()) { - //replaces [myview setWantsBestResolutionOpenGLSurface:YES] without compiler warning - typedef void (*bestResolutionIMP)(id, SEL, BOOL); - static bestResolutionIMP addr = (bestResolutionIMP)[NSView instanceMethodForSelector:@selector(setWantsBestResolutionOpenGLSurface:)]; - addr(myview, @selector(setWantsBestResolutionOpenGLSurface:), YES); - } [cw setContentView:myview]; [myview release]; [cw setLevel:winlevel]; -- cgit v1.2.3