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
This commit is contained in:
Manolo Gouy 2018-02-20 09:08:38 +00:00
parent 78183fb45b
commit 06b925964d
8 changed files with 12 additions and 55 deletions

View File

@ -22,12 +22,13 @@ Changes in FLTK 1.4.0 Released: ??? ?? 2017
hardware support is present (a backup mechanism is available in absence hardware support is present (a backup mechanism is available in absence
of this support). Thus, all text drawable in Fl_Window's can be drawn of this support). Thus, all text drawable in Fl_Window's can be drawn
in Fl_GL_Window's (STR#3450). in Fl_GL_Window's (STR#3450).
- New member functions FL::run_also_windowless(),
and FL::wait_also_windowless(double secnds) to run the event
loop even without any mapped window if the platform supports it.
- New member functions Fl::program_should_quit(void), - New member functions Fl::program_should_quit(void),
and Fl::program_should_quit(int) to support detection by the library and Fl::program_should_quit(int) to support detection by the library
of a request to terminate cleanly the program. of a request to terminate cleanly the program.
- MacOS platform: the processing of the application menu's "Quit" item
has been changed. With FLTK 1.3.x, the application terminated when all
windows were closed even before Fl::run() of Fl::wait() could return.
With FLTK 1.4, Fl::run() returns so the app follows its normal termination path.
- MacOS platform: Added support for rescaling the GUI of any app at run-time - MacOS platform: Added support for rescaling the GUI of any app at run-time
using the command/+/-/0/ keystrokes. using the command/+/-/0/ keystrokes.
- MSWindows platform: Added optional support for rescaling the GUI of any app - MSWindows platform: Added optional support for rescaling the GUI of any app

View File

@ -414,8 +414,6 @@ public:
static int check(); static int check();
static int ready(); static int ready();
static int run(); static int run();
static int run_also_windowless();
static int wait_also_windowless(double delay = 1e20);
/** Returns non-zero when a request for program termination was received and accepted. /** Returns non-zero when a request for program termination was received and accepted.
On the MacOS platform, the "Quit xxx" item of the application menu is such a request, On the MacOS platform, the "Quit xxx" item of the application menu is such a request,
that is considered accepted when all windows are closed. On other platforms, this function that is considered accepted when all windows are closed. On other platforms, this function

View File

@ -178,9 +178,6 @@ public:
/* Number of pixels per drawing unit for the display. /* Number of pixels per drawing unit for the display.
The default implementation may be enough. */ The default implementation may be enough. */
virtual float retina_factor() { return 1; } virtual float retina_factor() { return 1; }
// The default implementation of the next 2 functions may be enough.
virtual int run_also_windowless();
virtual int wait_also_windowless(double delay);
}; };

View File

@ -738,15 +738,12 @@ Apple "Quit" Event
\par \par
When the user presses Cmd-Q or requests a termination of the When the user presses Cmd-Q or requests a termination of the
application, FLTK reacts sending an \c FL_CLOSE event to all open application, FLTK sends an \c FL_CLOSE event to all open
windows. If any window remains open, the termination request aborts. windows. If any window remains open, the termination request aborts.
If all windows close, the application's event loop terminates, If all windows close, the application's event loop terminates,
that is, Fl::run() returns. The application can then follow that is, Fl::run() returns. The application can then follow
FLTK's normal termination path executing cleanup code that may be programmed FLTK's normal termination path executing cleanup code that may be programmed
after termination of the event loop, and returning from main(). after termination of the event loop, and returning from main().
Function Fl::run_also_windowless() can be used instead of Fl::run() to keep
the event loop running also after all windows are closed, a feature the MacOS platform supports.
This function also returns after a successful Cmd-Q.
Function Fl::program_should_quit() allows to detect whether the event loop Function Fl::program_should_quit() allows to detect whether the event loop
terminated because of a program termination request. terminated because of a program termination request.

View File

@ -516,6 +516,13 @@ double Fl::wait(double time_to_wait) {
(supposedly it would return non-zero on any errors, but FLTK calls (supposedly it would return non-zero on any errors, but FLTK calls
exit directly for these). A normal program will end main() exit directly for these). A normal program will end main()
with return Fl::run();. with return Fl::run();.
\note Fl::run() and Fl::wait() (but not Fl::wait(double)) both
return when all FLTK windows are closed. Therefore, a MacOS FLTK
application possessing Fl_Sys_Menu_Bar items able to create new windows
and expected to keep running without any open window cannot use
these two functions. One solution is to run the event loop as follows:
\code while (!Fl::program_should_quit()) Fl::wait(1e20); \endcode
*/ */
int Fl::run() { int Fl::run() {
while (Fl_X::first) wait(FOREVER); while (Fl_X::first) wait(FOREVER);
@ -588,26 +595,6 @@ int Fl::ready()
return screen_driver()->ready(); return screen_driver()->ready();
} }
/** Run the event loop even without any mapped window if the platform supports it.
Identical to Fl::run() for platforms that don't support running windowless.
The MacOS platform supports it.
\return zero indicates the event loop has been terminated.
\version 1.4.0
*/
int Fl::run_also_windowless() {
return Fl::screen_driver()->run_also_windowless();
}
/** Wait for \p delay seconds or until an event occurs, even without any mapped window if the platform supports it.
Identical to Fl::wait(delay) for platforms that don't support running windowless.
The MacOS platform supports it.
\return non zero indicates the event loop should be terminated
\version 1.4.0
*/
int Fl::wait_also_windowless(double delay) {
return Fl::screen_driver()->wait_also_windowless(delay);
}
int Fl::program_should_quit_ = 0; int Fl::program_should_quit_ = 0;
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////

View File

@ -483,15 +483,6 @@ int Fl_Screen_Driver::parse_color(const char* p, uchar& r, uchar& g, uchar& b)
return 1; return 1;
} }
int Fl_Screen_Driver::run_also_windowless() {
return Fl::run();
}
int Fl_Screen_Driver::wait_also_windowless(double delay) {
Fl::wait(delay);
return Fl::first_window() != NULL;
}
// //
// End of "$Id$". // End of "$Id$".
// //

View File

@ -1719,18 +1719,6 @@ static void drain_dropped_files_list() {
free(fname); free(fname);
} }
int Fl_Cocoa_Screen_Driver::run_also_windowless() {
while (!Fl::program_should_quit()) {
Fl::wait(1e20);
}
return 0;
}
int Fl_Cocoa_Screen_Driver::wait_also_windowless(double delay) {
if (!Fl::program_should_quit()) Fl::wait(delay);
return !Fl::program_should_quit();
}
/* /*
* Install an open documents event handler... * Install an open documents event handler...
*/ */

View File

@ -101,8 +101,6 @@ public:
virtual float scale(int n) {return scale_;} virtual float scale(int n) {return scale_;}
virtual void scale(int n, float f) { scale_ = f;} virtual void scale(int n, float f) { scale_ = f;}
virtual Fl_RGB_Image *read_win_rectangle(int X, int Y, int w, int h); virtual Fl_RGB_Image *read_win_rectangle(int X, int Y, int w, int h);
virtual int run_also_windowless();
virtual int wait_also_windowless(double delay);
private: private:
float scale_; float scale_;
}; };