Commit Graph

637 Commits

Author SHA1 Message Date
ManoloFLTK
38b8dfaaea Remove [FLViewLayer dealloc] method.
The Apple doc recommends not to release resources in an object's dealloc method.
The job is now done in the [FLWindow close] method.
2019-01-04 17:06:10 +01:00
ManoloFLTK
06fdfaf822 Restore possibility to compile with SDK 10.7 or earlier. 2019-01-04 16:52:26 +01:00
Manolo Gouy
26bb0e5a83 Under macOS 10.14, Fl_Cocoa_Window_Driver::flush() draws to the bitmap and does [view setNeedsDisplay:YES] 2018-12-30 10:59:53 +01:00
ManoloFLTK
0240158d4c macOS: creation of window with subwindow in iconized form - continued.
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.
2018-12-09 10:45:17 +01:00
ManoloFLTK
433f9b8ccb macOS Mojave: fix window with subwindow created in iconized form - continued
Some more changes needed to keep support of MacOS < 10.5
2018-12-08 19:38:15 +01:00
ManoloFLTK
b4c3fec029 macOS Mojave: fix window with subwindow created in iconized form. 2018-12-08 16:31:18 +01:00
Manolo Gouy
ed87d98c24 macOS comment only: refer to OS 10.14.2 gone public now. 2018-12-07 16:59:00 +01:00
ManoloFLTK
3bcb1256bb New static member function: Fl_Device_Plugin *Fl_Device_Plugin::opengl_plugin() 2018-12-05 11:04:58 +01:00
ManoloFLTK
549d3555a1 Comment only: to try push with git 2018-12-02 19:20:44 +01:00
Manolo Gouy
f53c7fd128 macOS: rewrite opengl_plugin_device() to use less memory.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13143 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-11-30 09:29:08 +00:00
Manolo Gouy
b511f6a7a4 Use the Fl_Gl_Device_Plugin mechanism to simplify the construction of a layer-backed GL window.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13140 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-11-29 17:50:55 +00:00
Manolo Gouy
d8c4447c84 MacOS: slightly simpler implementation of Fl_Cocoa_Window_Driver::wait_for_expose().
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13133 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-11-26 09:21:40 +00:00
Manolo Gouy
3be39b03b4 MacOS: further support of scenarios mixing miniaturize/deminiaturize/change screen configurations.
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
2018-11-23 09:47:08 +00:00
Manolo Gouy
97c0c6a024 MacOS: fix redraw of subwindow when display resolutions before miniaturize and after deminiaturize differ.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13129 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-11-22 11:55:04 +00:00
Manolo Gouy
7e5b04cab5 macOS: remove two useless statements for layer-backed OpenGL windows.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13128 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-11-21 11:55:04 +00:00
Manolo Gouy
3e6d8903d4 Minor reorder of operations performed when layered window is 1st drawn.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13127 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-11-20 16:52:35 +00:00
Manolo Gouy
95aa03d86d macOS: reorganize the code running when windows are moved between retina and non-retina displays.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13126 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-11-20 12:51:03 +00:00
Manolo Gouy
de797c7101 MacOS: introduce classes FLViewLayer and FLGLViewLayer to handle layer-backed views.
Both new classes are derived from FLView.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13124 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-11-16 11:58:39 +00:00
Manolo Gouy
015d460c49 MacOS: simpler implementation of extra code necessary at first display of layer-backed GL windows
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13123 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-11-16 09:11:54 +00:00
Manolo Gouy
d312284099 Account for property graphicsPort of NSGraphicsContext being deprecated in 10.14
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13121 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-11-10 09:00:45 +00:00
Manolo Gouy
43b511b784 Fix macOS 10.14 Mojave support of the FLTK-cairo interface.
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
2018-11-09 14:35:55 +00:00
Manolo Gouy
8a04aeb146 MacOS Mojave and gl_start(): fix for 10.14 but not 10.14.1
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13108 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-11-02 09:27:04 +00:00
Manolo Gouy
6a201d7070 Add useful cast
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13106 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-11-01 20:33:35 +00:00
Manolo Gouy
3a2439e31c MacOS Mojave: restore use of gl_start()/gl_finish()
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13105 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-11-01 14:34:22 +00:00
Manolo Gouy
6c8115ee9b Remove use of Fl_Gl_Window_Driver.H in file src/Fl_cocoa.mm
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
2018-10-31 12:45:51 +00:00
Manolo Gouy
22bcc7b4ca Remove all dependency to libfltk_gl from Fl_cocoa.mm.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13103 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-10-31 09:05:26 +00:00
Manolo Gouy
9e20113757 Fix issue when moving window between retina/non-retina screens while window is under progressive redraw.
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
2018-10-30 08:12:03 +00:00
Manolo Gouy
c146ba344c Removed temporary comment.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13096 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-10-29 17:20:31 +00:00
Manolo Gouy
71d7a9db79 Fix handling of layer-backed sub GL window moved between retina and non-retina screens.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13093 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-10-29 17:09:37 +00:00
Manolo Gouy
61eb23a9ea Fix handling of GL window moved between retina and non-retina screens.
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
2018-10-29 15:30:44 +00:00
Manolo Gouy
185934b9b0 Fix handling of layer-backed GL window moved between retina and non retina screens.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13089 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-10-29 10:14:09 +00:00
Manolo Gouy
2106f867b6 Fixed first drawing of a layer-backed OpenGL window.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13087 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-10-28 16:22:05 +00:00
Manolo Gouy
d666a6f234 MacOS Mojave 10.14 support: fix creation of several OpenGL windows.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13086 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-10-28 14:20:44 +00:00
Manolo Gouy
50f90a6970 Fix suppport of tabbed windows.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13085 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-10-28 02:35:02 +00:00
Manolo Gouy
318a756a60 Stop using viewFrameDidChangeNotification and implement drawRect:(NSRect) for FLViewGL.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13084 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-10-26 07:47:47 +00:00
Manolo Gouy
ab51dfc636 Support GL windows on retina display when app does not set Fl::use_high_res_GL(1)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13078 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-10-20 22:09:28 +00:00
Manolo Gouy
e32b7e1fca Fix resize of layer-backed, top-level GL windows: no more blank window.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13076 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-10-20 07:42:15 +00:00
Manolo Gouy
1741a6c128 Minor improvement of macOS 10.14 mojave support: draw window views with the displayLayer: method
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
2018-10-20 07:24:27 +00:00
Manolo Gouy
dd8e60a956 Add support for macOS 10.14 Mojave.
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
2018-10-19 05:17:24 +00:00
Manolo Gouy
7331900ef8 Remove compilation error when using clang 8:
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
2018-10-18 19:33:09 +00:00
Manolo Gouy
506b60a3f9 MacOS 10.14 Mojave: fix support of window capture - continued.
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
2018-10-05 10:47:16 +00:00
Manolo Gouy
61c01d9f9a MacOS 10.14 Mojave: fix support of window capture that 10.14 broke.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13060 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-10-04 07:54:18 +00:00
Manolo Gouy
08910b74ac macOS: check for non-nil image before using it as miniaturized window icon.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13058 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-09-30 13:46:13 +00:00
Manolo Gouy
f76d2a2bf8 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
2018-09-27 05:42:57 +00:00
Manolo Gouy
673d95b99c MacOS: fix is_bundled() function for case when [NSBundle mainBundle] is nil.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13055 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-09-22 07:24:57 +00:00
Manolo Gouy
3131757e9c MacOS: fix regression in OS 10.13 where an unbundled app had its system menu bar unresponsive.
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
2018-09-16 10:17:23 +00:00
Manolo Gouy
07f18a5190 MacOS: Fix rounding to nearest int for negative screen coordinates.
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
2018-09-12 15:12:11 +00:00
Manolo Gouy
b0e0e0912c MacOS ≥ 10.10: Fl_Window::fullscreen() and fullscreen_off() no longer call Fl_Window::hide() + Fl_Window::show()
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
2018-09-12 12:46:09 +00:00
Manolo Gouy
ee3fbb849e MacOS: fix creation of fullscreen GL window
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13039 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-09-03 15:47:48 +00:00
Manolo Gouy
f50e9170dc MacOS: slightly simplify [FLAppDelegate applicationDidChangeScreenParameters:]
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13033 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-08-29 16:42:41 +00:00