From 06b925964d7f2c493415670d413dd682920cf7ad Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Tue, 20 Feb 2018 09:08:38 +0000 Subject: 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 --- src/Fl.cxx | 27 +++++++-------------------- src/Fl_Screen_Driver.cxx | 9 --------- src/Fl_cocoa.mm | 12 ------------ src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H | 2 -- 4 files changed, 7 insertions(+), 43 deletions(-) (limited to 'src') diff --git a/src/Fl.cxx b/src/Fl.cxx index 0e1f63fc7..25b6b696f 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -516,6 +516,13 @@ double Fl::wait(double time_to_wait) { (supposedly it would return non-zero on any errors, but FLTK calls exit directly for these). A normal program will end main() 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() { while (Fl_X::first) wait(FOREVER); @@ -588,26 +595,6 @@ int Fl::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; //////////////////////////////////////////////////////////////// diff --git a/src/Fl_Screen_Driver.cxx b/src/Fl_Screen_Driver.cxx index 2dffcd7a5..9891721a7 100644 --- a/src/Fl_Screen_Driver.cxx +++ b/src/Fl_Screen_Driver.cxx @@ -483,15 +483,6 @@ int Fl_Screen_Driver::parse_color(const char* p, uchar& r, uchar& g, uchar& b) 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$". // diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index e83f8af4c..12e9a7bd9 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -1719,18 +1719,6 @@ static void drain_dropped_files_list() { 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... */ diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H index 077416823..16cd246d3 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H +++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H @@ -101,8 +101,6 @@ public: virtual float scale(int n) {return scale_;} 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 int run_also_windowless(); - virtual int wait_also_windowless(double delay); private: float scale_; }; -- cgit v1.2.3