|
|
commit e5b518987007fe2f83394e6d1ba4d8f642b68676
Author: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Mon Aug 10 07:31:50 2020 +0200
Commit: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Mon Aug 10 07:31:50 2020 +0200
Add support of macOS 11.0 "Big Sur".
CHANGES.txt | 3 ++-
src/Fl_cocoa.mm | 23 ++++++++++-------------
2 files changed, 12 insertions(+), 14 deletions(-)
diff --git CHANGES.txt CHANGES.txt
index b4f3070..97f0a28 100644
--- CHANGES.txt
+++ CHANGES.txt
@@ -123,7 +123,8 @@ Changes in FLTK 1.4.0 Released: ??? ?? 2020
Other Improvements
- (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
a string describing the error when an error occurs.
- Fix Windows-specific bug when the program tries to enlarge a
diff --git src/Fl_cocoa.mm src/Fl_cocoa.mm
index 50c658e..ddc30e5 100644
--- src/Fl_cocoa.mm
+++ src/Fl_cocoa.mm
@@ -2183,9 +2183,10 @@ static FLTextInputContext* fltextinputcontext_instance = nil;
}
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14
- (void)create_aux_bitmap:(CGContextRef)gc retina:(BOOL)r {
- aux_bitmap = CGBitmapContextCreate(NULL, CGBitmapContextGetWidth(gc), CGBitmapContextGetHeight(gc),
- CGBitmapContextGetBitsPerComponent(gc), CGBitmapContextGetBytesPerRow(gc),
- CGBitmapContextGetColorSpace(gc), CGBitmapContextGetBitmapInfo(gc));
+ int W = [self frame].size.width, H = [self frame].size.height;
+ if (r) { W *= 2; H *= 2; }
+ static CGColorSpaceRef cspace = CGColorSpaceCreateDeviceRGB();
+ aux_bitmap = CGBitmapContextCreate(NULL, W, H, 8, 4 * W, cspace, kCGImageAlphaPremultipliedFirst);
if (r) CGContextScaleCTM(aux_bitmap, 2, 2);
}
- (void)reset_aux_bitmap {
@@ -2249,15 +2250,11 @@ static FLTextInputContext* fltextinputcontext_instance = nil;
if (window->damage()) d->Fl_Window_Driver::flush();
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14
if (destination) {
- if (CGBitmapContextGetBytesPerRow(aux_bitmap) == CGBitmapContextGetBytesPerRow(destination)) {
- memcpy(CGBitmapContextGetData(destination), CGBitmapContextGetData(aux_bitmap),
- 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);
- CGContextDrawImage(destination, [self frame], img);
- CGImageRelease(img);
- }
+ // With macOS 11.0, bitmap context-specific functions such as CGBitmapContextGetWidth()
+ // can't be used with destination. Why?
+ CGImageRef img = CGBitmapContextCreateImage(aux_bitmap);
+ CGContextDrawImage(destination, [self frame], img);
+ CGImageRelease(img);
Fl_Cocoa_Window_Driver::q_release_context();
}
#endif
@@ -2305,7 +2302,7 @@ static FLTextInputContext* fltextinputcontext_instance = nil;
}
- (void)resetCursorRects {
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
// We have to have at least one cursor rect for invalidateCursorRectsForView
// to work, hence the "else" clause.
[ Direct Link to Message ] | |
|
| |