From 4bff15278e83616e4da6be9d36ed05c0c949545b Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Thu, 5 Jan 2023 15:20:05 +0100 Subject: [PATCH] Adding Fl::hide_all_windows() --- FL/Fl.H | 1 + src/Fl.cxx | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/FL/Fl.H b/FL/Fl.H index 6f51181a4..589d52109 100644 --- a/FL/Fl.H +++ b/FL/Fl.H @@ -453,6 +453,7 @@ public: \version 1.4.0 */ static void program_should_quit(int should_i) { program_should_quit_ = should_i; } + static void hide_all_windows(); static Fl_Widget* readqueue(); diff --git a/src/Fl.cxx b/src/Fl.cxx index e7ba9f04d..53fb7fff1 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -668,6 +668,17 @@ int Fl::ready() return system_driver()->ready(); } +/** Hide all visible window to make FLTK leav Fl::run(). + Fl:run() will run as long as there are visible windows. Call hide_all_windows() + will hide all windows, effectively terminating the Fl::run() loop. + \see Fl::run() + */ +void Fl::hide_all_windows() { + while (Fl::first_window()) { + Fl::first_window()->hide(); + } +} + int Fl::program_should_quit_ = 0; ////////////////////////////////////////////////////////////////