Commit Graph

598 Commits

Author SHA1 Message Date
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
Manolo Gouy
1b25d1d3a0 Support recent MS Office apps that use \r\n as end of line in pasteboard.
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
2018-08-10 15:44:39 +00:00
Manolo Gouy
cd399d9898 Support for GUI scaling: add API to get/set the scaling factor value.
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
2018-08-08 20:08:10 +00:00
Manolo Gouy
305e5dd21e Try dummy commit
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12990 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-07-02 15:21:57 +00:00
Manolo Gouy
7483651aaa Avoid giving same name (s) to 2 variables.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12988 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-06-30 05:57:21 +00:00
Manolo Gouy
3199e3331b Move Fl_Gl_Window_Driver.H from FL/ to src/
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12977 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-06-26 14:23:51 +00:00
Manolo Gouy
26cb08badb Move Fl_Screen_Driver.H from FL/ to src/
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12975 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-06-26 14:04:09 +00:00
Manolo Gouy
7ebe8e21b0 Move Fl_Window_Driver.H from FL/ to src/
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12974 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-06-26 13:43:18 +00:00
Matthias Melcher
a9fd08ff5a Doxygen: created Group to document drivers, disabled by default
Uncomment `ENABLED_SECTIONS += DriverDev` in documentation/Doxyfile.in
to enable driver documentation.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12968 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-06-23 16:47:40 +00:00
Manolo Gouy
af3625eb20 MacOS: use direct access to member variable in member function.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12929 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-05-23 16:43:43 +00:00
Manolo Gouy
2576f57384 MacOS: account for GUI rescaling in support of text input methods.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12927 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-05-23 16:19:37 +00:00
Manolo Gouy
10640df785 MacOS: move some code from file Fl_cocoa.mm to file Fl_Darwin_System_Driver.cxx - continued
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12919 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-05-12 17:03:26 +00:00
Manolo Gouy
aba87e8bb0 MacOS: move some code from file Fl_cocoa.mm to file Fl_Darwin_System_Driver.cxx
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12918 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-05-12 17:01:33 +00:00
Manolo Gouy
4c45bec127 MacOS: move some code from file Fl_cocoa.mm to file Fl_Cocoa_Window_Driver.cxx
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12917 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-05-12 16:59:03 +00:00
Manolo Gouy
6fd216d759 MacOS: move timer-related code from file Fl_cocoa.mm to file Fl_Cocoa_Screen_Driver.cxx
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12916 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-05-12 16:44:31 +00:00
Manolo Gouy
8b7f7c78b2 Remove public member function Fl_Window_Driver *Fl_Window::driver() so class Fl_Window_Driver is not in FLTK public API.
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
2018-05-12 09:36:36 +00:00
Manolo Gouy
2b7aac129b Rename Fl_Paged_Device::start_job() to begin_job() and Fl_Paged_Device::start_page() to begin_page().
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
2018-05-09 14:16:35 +00:00
Manolo Gouy
ccae86b291 Remove useless #include <FL/Fl_Shared_Image.H> following usage of the new Fl_Image::scale() member function.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12903 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-05-06 10:20:45 +00:00
Manolo Gouy
5c16dcb65b Simplify Fl_XXX_Window_Driver::capture_titlebar_and_borders() using Fl_Image::scale().
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12902 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-05-06 07:14:13 +00:00
Manolo Gouy
20ccb6b7f2 Shorten the list of virtual member functions used to support Fl_Widget_Surface derived classes.
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
2018-05-04 15:11:47 +00:00
Manolo Gouy
d4eeb75ac6 MacOS: improve fl_overlay_rect() when GUI scale factor = 1.7
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12893 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-05-04 08:25:45 +00:00
Manolo Gouy
31848b8565 MacOS: correct handling of window tabbing/untabbing together with GUI rescaling.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12681 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-02-20 12:09:32 +00:00
Manolo Gouy
06b925964d Remove Fl::run_also_windowless() and FL::wait_also_windowless() from planned public FLTK 1.4 API.
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
2018-02-20 09:08:38 +00:00
Manolo Gouy
a401c6c038 Fix Fl_Cocoa_Window_Driver::size_range() to make it support GUI rescaling.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12674 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-02-18 08:04:57 +00:00
Manolo Gouy
5bf7e5ece7 Fix Fl_Cocoa_Screen_Driver::screen_work_area() when the GUI is scaled - continued.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12670 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-02-16 17:12:23 +00:00
Manolo Gouy
38b924e12b Fix Fl_Cocoa_Screen_Driver::screen_work_area() when the GUI is scaled.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12669 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-02-16 17:10:06 +00:00
Manolo Gouy
0012debf37 After r.12653, it is also necessary to remove Fl_Cocoa_Window_Driver::bitmap_from_window_rect()
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12657 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-02-09 17:26:20 +00:00
Manolo Gouy
b78b2f7f5f Move xxx_also_windowless member functions from Fl_System_Driver to Fl_Screen_Driver.
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
2018-02-08 12:47:40 +00:00
Manolo Gouy
425ab2e8bc Add support for detection and processing of clean program termination request.
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
2018-02-06 17:26:11 +00:00
Albrecht Schlosser
42d8aba117 Replace FL/x.H with FL/platform.H - step 2 (STR #3435).
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
2018-01-31 21:17:17 +00:00
Manolo Gouy
46d8ef2c1d MacOS: More accurate coordinate computation in rect_to_NSBitmapImageRep() when GUI is rescaled.
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
2018-01-07 18:16:52 +00:00
Manolo Gouy
c6045962db Continue support for GUI rescaling under MacOS: fix test/resize() application - continued
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12607 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-12-27 07:48:52 +00:00
Manolo Gouy
d6a0e4a010 Continue support for GUI rescaling under MacOS: fix test/resize() application
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12606 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-12-27 07:46:50 +00:00
Manolo Gouy
8ee87d15e3 Continue support for GUI rescaling under MacOS: fix Fl_Cocoa_Window_Driver::capture_titlebar_and_borders()
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12604 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-12-24 07:20:25 +00:00
Manolo Gouy
e1893334fd Continue support for GUI rescaling under MacOS: fix Fl_Overlay_Window.
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
2017-12-23 06:34:42 +00:00
Manolo Gouy
c44382e973 Scaling capability under MacOS platform: fix capture of scaled window.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12602 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-12-19 14:14:42 +00:00
Manolo Gouy
d361de4d0d STR#3437 : Support display of windows in tabbed form as in MacOS 10.12 Sierra
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12596 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-12-18 15:19:15 +00:00
Manolo Gouy
3f9f4debbb STR#3444: Add MacOS support for application rescaling (not quite complete)
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
2017-12-18 08:52:55 +00:00
Manolo Gouy
eb763ae432 Further simpler code to initialise the MacOS-specific implementation of Fl_Sys_Menu_Bar_Driver
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12586 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-12-07 16:10:21 +00:00
Manolo Gouy
2da4cf8b9f Simpler code to initialise the MacOS-specific implementation of Fl_Sys_Menu_Bar_Driver
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12585 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-12-07 15:35:07 +00:00