From f76d2a2bf8c35c0c313f05bbd6deda49dd344efc Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Thu, 27 Sep 2018 05:42:57 +0000 Subject: Support for macOS 10.14 Mojave: apps linked with SDK 10.14 did not draw anything in their windows. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13057 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_cocoa.mm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 835e278c9..fb8414de1 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -3223,13 +3223,17 @@ void Fl_Cocoa_Window_Driver::make_current() destroy_double_buffer(); changed_resolution(false); } - NSGraphicsContext *nsgc; + /*NSGraphicsContext *nsgc; #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 if (fl_mac_os_version >= 100400) nsgc = [fl_window graphicsContext]; // 10.4 else -#endif - nsgc = through_Fl_X_flush ? [NSGraphicsContext currentContext] : [NSGraphicsContext graphicsContextWithWindow:fl_window]; +#endif*/ + NSGraphicsContext *nsgc = through_Fl_X_flush ? [NSGraphicsContext currentContext] : [NSGraphicsContext graphicsContextWithWindow:fl_window]; + if (!nsgc) { // this occurs on 10.14 when through_Fl_X_flush==0 + [[fl_window contentView] lockFocus]; + nsgc = [NSGraphicsContext currentContext]; + } gc = (CGContextRef)[nsgc graphicsPort]; Fl_Graphics_Driver::default_driver().gc(gc); CGContextSaveGState(gc); // native context -- cgit v1.2.3