Commit Graph

575 Commits

Author SHA1 Message Date
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
Manolo Gouy
24a5fa7632 MacOS: support running fl_open_display() in static initializer.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12583 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-12-06 07:38:05 +00:00
Manolo Gouy
8612fea277 Make Fl_Sys_Menu_Bar class usable in static initializers.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12579 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-12-04 17:39:19 +00:00
Manolo Gouy
6586b77975 Restore possibility to run fl_open_display() within a static initializer.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12578 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-12-03 15:46:12 +00:00
Manolo Gouy
a8fe10cf88 MacOS: use rounded bottom corners when drawing windows
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12574 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-11-30 16:14:13 +00:00
Manolo Gouy
00eef649ca MacOS: complete commit at r.12559 that contained a typo.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12560 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-11-13 14:47:49 +00:00
Manolo Gouy
b171a28de4 MacOS: make -[FLWindowDelegate windowShouldClose:] more robust by testing for NULL pointer.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12559 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-11-13 14:43:58 +00:00
Manolo Gouy
cfdc38f760 MacOS: improve drawing of rounded corners of window titlebar
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12557 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-11-12 08:00:21 +00:00
Manolo Gouy
10143bc50a Test commit
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12555 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-11-11 10:54:52 +00:00
Manolo Gouy
9646c04b54 Test commit
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12554 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-11-11 09:46:58 +00:00
Manolo Gouy
6a7008684f Test commit
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12553 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-11-11 09:45:16 +00:00
Manolo Gouy
5ac0d892c1 Test commit
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12552 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-11-11 09:44:09 +00:00
Manolo Gouy
ee929944ce Minor reformatting
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12551 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-11-11 09:04:26 +00:00
Manolo Gouy
7356d4ef21 Make a comment more detailed
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12550 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-11-11 09:01:51 +00:00
Manolo Gouy
ff1e508e5d MacOS: improve drawing of the rounded corners of window titlebars.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12548 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-11-09 15:27:26 +00:00
Manolo Gouy
9aaf6df90c MacOS: fix capture of window titlebar under MacOS 10.13 "High Sierra"
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12547 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-11-07 17:01:20 +00:00
Manolo Gouy
31e3d3758e MacOS: replace deprecated message by its recommended successor.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12527 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-10-25 11:34:03 +00:00
Manolo Gouy
554ab20b80 MacOS: replace [[NSRunningApplication currentApplication] isActive] requiring 10.6 by [NSApp isActive]
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12523 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-10-22 06:35:03 +00:00
Manolo Gouy
cf13e6c2cd MacOS: improve handling of dropped files at launch time for MacOS 10.13
Because opening a file can call the event loop and thus access the list of dropped files,
 it's necessary to remove the object from the list before opening the file.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12522 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-10-22 06:29:04 +00:00
Manolo Gouy
dba6b85b4d Mac OS 10.13 "High Sierra": restore possibility to run app from a command line and find it activated.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12514 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-10-18 14:53:05 +00:00
Manolo Gouy
4ec7403f12 MacOS: make sure all files dropped to the app at launch time are open when Fl_Window->wait_for_expose() is used.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12512 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-10-18 12:35:03 +00:00
Manolo Gouy
a92b628774 MacOS: slightly simpler implementation of Fl_Cocoa_Window_Driver::wait_for_expose().
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12510 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-10-18 04:24:51 +00:00
Manolo Gouy
fae02f2b4d Mac OS: complete changes needed for 10.13 "High Sierra" regarding how FLTK applications start.
With MacOS 10.13 "High Sierra", it was necessary to change what happens at application start time.
The new procedure is:
fl_open_display() calls [NSApp run], and during this call:
     the main event loop is started;
     the app delegate receives an openFile: message for each file dropped on the app icon. Each
           such filename is memorised in an NSMutableArray called dropped_files_list;
     the app delegate receives applicationDidFinishLaunching and stops the main event loop
           (this seems to occur unpredictably after the first openFile: message or after all of them).
When the FLTK event loop begins, it checks whether dropped_files_list is empty. If it is not,
   the first element of this list is a filename which is opened and is removed from dropped_files_list.

This new setup allows to turn resizable windows fullscreen and back as expected under MacOS,
and to support launching apps while dropping file(s) on its icon.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12508 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-10-17 09:01:28 +00:00
Manolo Gouy
507e39fd19 MacOS 10.13: fix problem with window made fullscreen by clicking on green window button - continued.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12503 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-10-15 17:36:58 +00:00