The case was under macOS with a non-GL parent window mapped to a retina display
containing a GL subwindow and if the app did not call Fl::use_high_res_GL(1).
This new implementation does all screen drawing through the drawRect: method.
The benefit is that [[NSGraphicsContext currentContext] CGContext] provides
a system-built drawing context whose product ultimately appears on screen.
Feed-back from the fldigi FLTK application shows that this procedure is
measurably faster that the previous one when drawing a rapidly changing image.
The bug is that the app freezes for a few seconds before the yellow transient window is closed
if the close message is set from within a timer callback.
If the window to close returns NO to the canBecomeKeyWindow message, the bug does not occur.
Anyway it's good that canBecomeKeyWindow returns NO for a window with the OUTPUT flag.
This allows to support the tabbing/untabbing of windows with simpler, clearer code.
This commit also fixes the resizing of Fl_Overlay_Window that was broken in the
recent commit "Simpler implementation of Fl_Cocoa_Window_Driver::resize()"
c66caf5dce
The recent commit "Simpler implementation of Fl_Cocoa_Window_Driver::resize()"
c66caf5dce
did not take care of tabbing/untabbing of windows.
This is repaired here.
The new name follows FLTK naming rules and has the benefit of avoiding potential
collision with future macOS method names that follow a different naming rule.
macOS normally previews a dead key and then replaces the preview by the final text
after the second key is typed.
macOS ≥10.7 also opens an auxiliary window to help choosing among possible characters
after some keys (e.g., n, c, o, a) are pressed and maintained for a while.
The problem fixed here is that after an auxiliary window has been used,
dead keys are no longer previewed.
That problem emerged at some undetermined point before 10.14 and after 10.7.
With macOS 10.13 and 10.14 at least, recursivelySendToSubwindows:@selector(display)
is not necessary in the new procedure where the window icon is computed in
windowDidMiniaturize rather than in windowWillMiniaturize as was done before.
Test scenario:
- use 2-screen configuration, one retina, one non-retina as main screen
- put subwindow-containing window on retina
- miniaturize window
- close retina screen
- de-miniaturize window
The subwindow was wrong without this change.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13131 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
After experimenting with a modified cairo_test program that draws both with
cairo and with regular FLTK drawing functions to the same window, it seems
necessary to control for possible changes to the graphics context made by
cairo in Fl_Cocoa_Window_Driver::make_current() rather than in
cairo_create_surface().
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13119 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Thus, Fl_cocoa.mm is completely independent from code of libfltk_gl.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13104 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
The problem was visible with test/mandelbrot and with layer-backed views.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13100 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Part of the fix applies both to layer-backed and non layer-backed windows.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13090 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
The doc recommends to draw views with the displayLayer: method when the view manages itself
completely its own bitmap:
If your delegate implements the displayLayer: method, that implementation is responsible
for creating a bitmap and assigning it to the layer’s contents property.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13075 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
MacOS apps running under 10.14 AND linked with SDK 10.14 use a completely different way
to draw to the screen in comparison with the same app running under 10.13 or earlier:
all views are "layer-backed".
This commit makes FLTK apps running under 10.14 and linked with SDK 10.14 explicitly
use layers to draw to the screen.
FLTK apps remain downward compatible with earlier macOS versions.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13071 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
error: non-constant-expression cannot be narrowed from type 'int' to 'CGFloat'
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13070 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Window capture by initWithFocusedViewRect: does not work if the app is linked against 10.14 SDK
and run under 10.14. In that case, capture is performed instead by CGWindowListCreateImage().
Detection of whether the app was linked against 10.14 SDK is done by checking whether
the FLView possesses a CALayer.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13062 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
The regression was detected by "FLTK 1.4 on macOS: Trouble compiling my Application with Makefile"
in fltk.general.
The fix is to have unbundled apps initialize under MacOS 10.13 as under earlier OS,
thus the new initialization procedure introduced for 10.13 is for bundled apps only.
Tested OK on 10.13.6 and 10.14 public beta 10.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13050 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
The previous method int(x + 0.5) is incorrect when x < 0
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13046 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
The new procedure essentially resizes the window, as done on the X11+EWMH and Windows platforms.
This improves in particular the possibility to turn an Fl_Gl_Window fullscreen on and off.
MacOS ≥ 10.10 is required because the procedure isn't stable (random crashes during fast switches) with 10.9.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13045 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
FLTK now transforms that into \n as is expected under MacOS.
Older MS Office apps used \r as old MacOS software.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13014 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Also, define an FLTK event triggered when the scaling is changed and an option
to disable the transient window showing the new scaling factor.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13011 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This function is replaced by static Fl_Window_Driver* Fl_Window_Driver::(const Fl_Window *win).
The purpose is to have class Fl_Window_Driver outside from FLTK ABI.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12915 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
The new function names begin_job() and begin_page() better match end_job() and end_page() with which
they must be used by pair.
The old names start_job() and start_page() are maintained for API compatibility with FLTK 1.3.x
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12910 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Change Fl_Cocoa_Screen_Driver::read_win_rectangle() so it captures only
from the current window and ignores its subwindows, as do other Fl_Screen_Driver derived classes.
Remove Fl_Cocoa_Printer_Driver::print_window_part() that is no longer necessary.
Remove Fl_Printer::print_widget() and Fl_Printer::print_window_part() that
are no longer necessary.
Stop Fl_Widget_Surface::print_window_part() from being virtual because its platform-independent
implementation should suffice.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12894 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
These were introduced at r12647, that is, during development of the 1.4 API.
These functions provided windowless support only on the MacOS platform,
where this can be obtained without those functions.
Windowless support on other platforms would require changing the event
loop. There's no evidence from STR's there's a demand for windowless mode
on other platforms.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12680 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Because these functions are related to Fl_Screen_Driver::wait(double)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12652 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
The default handling of cmd-Q/Quit program under MacOS was to terminate the
program if all its windows are closed without returning from FLTK's event loop.
This was running against a strong design feature of FLTK that programs
should always complete their event loop and return from main() when cleanly
terminating.
In the new code for the MacOS platform, cmd-Q/Quit program no longer terminates
the program. Instead, the event loop is interrupted and a call to Fl::program_should_quit()
allows to detect that program termination has been requested, if necessary.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12647 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This second step replaces FL/x.H with FL/platform.H in all source files.
Dependencies have been adjusted as well.
This commit completes the replacement of FL/x.H with FL/platform.H.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12641 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
The modified statement uses the window height in graphics coordinates that has been truncated to
integer at window creation and resize.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12625 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This patch also improves by simplification the code of class Fl_Quartz_Image_Surface_Driver:
because, under the driver model, there's a separate graphics content for the display and for
each offscreen buffer, it's possible to reverse the drawing orientation (draw from top to bottom)
once at offscreen creation. It's thus no longer necessary to reverse orientation in
Fl_Quartz_Graphics_Driver::restore_clip() specifically for offscreen buffers.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12603 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
With this, most MacOS FLTK app can be scaled with command/+/-/0/ keystrokes.
A scaling problem remains, visible in test/cube, where the "Test" string is not positioned correctly.
GLUT apps can also be scaled (across platforms).
SVG images are re-rasterized after app scaling for optimal drawing.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12594 ea41ed52-d2ee-0310-a9c1-e6b18d33e121