@ -3310,7 +3313,10 @@ void Fl_Cocoa_Window_Driver::resize(int X, int Y, int W, int H) {
@@ -3310,7 +3313,10 @@ void Fl_Cocoa_Window_Driver::resize(int X, int Y, int W, int H) {
if (NSEqualRects(r, [xid frame])) {
pWindow->Fl_Group::resize(X, Y, W, H); // runs rarely, e.g. with scaled down test/tabs
if (pWindow->parent()) starting_moved_window = pWindow;
@ -3328,33 +3334,36 @@ void Fl_Cocoa_Window_Driver::resize(int X, int Y, int W, int H) {
@@ -3328,33 +3334,36 @@ void Fl_Cocoa_Window_Driver::resize(int X, int Y, int W, int H) {
This can be called in 3 different instances:
1) When a window is created or resized.
Before 10.14: The system sends the drawRect: message to the window's view after having prepared the current
graphics context to draw to this view. Processing of drawRect: sets variable through_drawRect
to YES and calls Fl_Cocoa_Window_Driver::flush() that sets through_Fl_X_flush
to YES and calls Fl_Window::flush().
After 10.14: The system sends the displayLayer: message to the window's view.
Variable through_Fl_X_flush is set to YES and Fl_Window_Driver::flush() is called
which calls Fl_Window::flush().
Fl_Window::flush() calls Fl_Window::make_current() that
uses the window's graphics context. The window's draw() function is then executed.
Before 10.14: macOS sends the drawRect: message to the window view after having prepared the
current graphics context to draw to this view. Variable through_drawRect is set
to YES and calls Fl_Window_Driver::flush().
After 10.14: macOS sends the displayLayer: message to the window view. If the layer bitmap
does not exist, variable through_Fl_X_flush is set to YES and Fl_Window_Driver::flush() is called.
Fl_Window_Driver::flush() calls Fl_Window::flush() that calls Fl_Window::make_current() that
uses the graphics context of the window or the layer. The window's draw() function is then executed.
After 10.14: the displayLayer method sets the layer's contents to the layer's bitmap.
2) At each round of the FLTK event loop.
Fl::flush() is called, that calls Fl_Cocoa_Window_Driver::flush() on each window that needs drawing.
Fl_Cocoa_Window_Driver::flush() [Before 10.14: locks the focus to the
view and] calls Fl_Window_Driver::flush() that calls Fl_Window::make_current()
and proceeds as in 1).
Fl_Cocoa_Window_Driver::flush() sets through_Fl_X_Flush to YES and marks the view as
needing display.
Before 10.14: the view is sent the displayIfNeededIgnoringOpacity message which makes
the OS send the view the drawRect: message. The program proceeds next as in 1) above.
After 10.14: Fl_Window_Driver::flush() is called which draws to the layer bitmap, and
the layered view is sent the displayLayer: message at the next event loop.
3) An FLTK application can call Fl_Window::make_current() at any time before it draws to a window.
This occurs for instance in the idle callback function of the mandelbrot test program. Variable
through_Fl_X_flush is NO. Under Mac OS 10.4 and higher, the window's graphics context is obtained.
Under Mac OS 10.3 a new graphics context adequate for the window is created.
Subsequent drawing requests go to this window. CAUTION: it's not possible to call Fl::wait(),
Fl::check() nor Fl::ready() while in the draw() function of a widget. Use an idle callback instead.
This occurs for instance in the idle callback function of the mandelbrot test program. Variables
through_Fl_X_flush and through_drawRect equal NO. The graphics context of the window
or the layer is obtained.
Before 10.14: Subsequent drawing requests go to the window.
After 10.14: The layered view is marked as needing display. It's sent the display message
at the next event loop.
CAUTION: it's not possible to call Fl::wait(), Fl::check() nor Fl::ready() while in the draw()
function of a widget. Use an idle callback instead.
*/
void Fl_Cocoa_Window_Driver::make_current()
{
if (make_current_counts > 1 && !views_use_CA) return;