Add support of macOS 11.0 "Big Sur".

This commit is contained in:
ManoloFLTK
2020-08-10 07:31:50 +02:00
parent 0da41da713
commit e5b5189870
2 changed files with 12 additions and 14 deletions
+2 -1
View File
@@ -123,7 +123,8 @@ Changes in FLTK 1.4.0 Released: ??? ?? 2020
Other Improvements Other Improvements
- (add new items here) - (add new items here)
- Support for building for the arm64 architecture used by macOS 11.0 "Big Sur". - Added support for macOS 11.0 "Big Sur" and for building for
the arm64 architecture.
- Add optional argument to Fl_Printer::begin_job() to receive - Add optional argument to Fl_Printer::begin_job() to receive
a string describing the error when an error occurs. a string describing the error when an error occurs.
- Fix Windows-specific bug when the program tries to enlarge a - Fix Windows-specific bug when the program tries to enlarge a
+7 -10
View File
@@ -2183,9 +2183,10 @@ static FLTextInputContext* fltextinputcontext_instance = nil;
} }
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14
- (void)create_aux_bitmap:(CGContextRef)gc retina:(BOOL)r { - (void)create_aux_bitmap:(CGContextRef)gc retina:(BOOL)r {
aux_bitmap = CGBitmapContextCreate(NULL, CGBitmapContextGetWidth(gc), CGBitmapContextGetHeight(gc), int W = [self frame].size.width, H = [self frame].size.height;
CGBitmapContextGetBitsPerComponent(gc), CGBitmapContextGetBytesPerRow(gc), if (r) { W *= 2; H *= 2; }
CGBitmapContextGetColorSpace(gc), CGBitmapContextGetBitmapInfo(gc)); static CGColorSpaceRef cspace = CGColorSpaceCreateDeviceRGB();
aux_bitmap = CGBitmapContextCreate(NULL, W, H, 8, 4 * W, cspace, kCGImageAlphaPremultipliedFirst);
if (r) CGContextScaleCTM(aux_bitmap, 2, 2); if (r) CGContextScaleCTM(aux_bitmap, 2, 2);
} }
- (void)reset_aux_bitmap { - (void)reset_aux_bitmap {
@@ -2249,15 +2250,11 @@ static FLTextInputContext* fltextinputcontext_instance = nil;
if (window->damage()) d->Fl_Window_Driver::flush(); if (window->damage()) d->Fl_Window_Driver::flush();
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14
if (destination) { if (destination) {
if (CGBitmapContextGetBytesPerRow(aux_bitmap) == CGBitmapContextGetBytesPerRow(destination)) { // With macOS 11.0, bitmap context-specific functions such as CGBitmapContextGetWidth()
memcpy(CGBitmapContextGetData(destination), CGBitmapContextGetData(aux_bitmap), // can't be used with destination. Why?
CGBitmapContextGetHeight(aux_bitmap) * CGBitmapContextGetBytesPerRow(aux_bitmap));
} else {
// this condition (unchanged W and H but changed BytesPerRow) occurs with 10.15
CGImageRef img = CGBitmapContextCreateImage(aux_bitmap); CGImageRef img = CGBitmapContextCreateImage(aux_bitmap);
CGContextDrawImage(destination, [self frame], img); CGContextDrawImage(destination, [self frame], img);
CGImageRelease(img); CGImageRelease(img);
}
Fl_Cocoa_Window_Driver::q_release_context(); Fl_Cocoa_Window_Driver::q_release_context();
} }
#endif #endif
@@ -2305,7 +2302,7 @@ static FLTextInputContext* fltextinputcontext_instance = nil;
} }
- (void)resetCursorRects { - (void)resetCursorRects {
Fl_Window *w = [(FLWindow*)[self window] getFl_Window]; Fl_Window *w = [(FLWindow*)[self window] getFl_Window];
Fl_X *i = Fl_X::i(w); Fl_X *i = (w ? Fl_X::i(w) : NULL);
if (!i) return; // fix for STR #3128 if (!i) return; // fix for STR #3128
// We have to have at least one cursor rect for invalidateCursorRectsForView // We have to have at least one cursor rect for invalidateCursorRectsForView
// to work, hence the "else" clause. // to work, hence the "else" clause.