From 2025481f8c19fd73a611e517a0c91c15d7ed390a Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Thu, 30 Nov 2023 15:02:15 +0100 Subject: FLUID: Add dialog box when processes are still runing when user tries to quit. --- fluid/fluid.cxx | 5 +++++ fluid/shell_command.cxx | 8 +++++++- fluid/shell_command.h | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) (limited to 'fluid') diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx index 96138234c..42406606c 100644 --- a/fluid/fluid.cxx +++ b/fluid/fluid.cxx @@ -813,6 +813,11 @@ void revert_cb(Fl_Widget *,void *) { If the design was modified, a dialog will ask for confirmation. */ void exit_cb(Fl_Widget *,void *) { + if (shell_command_running()) { + fl_alert("Previous shell command still running!"); + return; + } + flush_text_widgets(); // verify user intention diff --git a/fluid/shell_command.cxx b/fluid/shell_command.cxx index b2fe85373..1af872ae0 100644 --- a/fluid/shell_command.cxx +++ b/fluid/shell_command.cxx @@ -105,7 +105,12 @@ static Fl_String fltk_config_cmd; static Fl_Process s_proc; - +/** + See if shell command is running (public) + */ +bool shell_command_running() { + return s_proc.desc() ? true : false; +} /** Reads an entry from the group. A default value must be @@ -285,6 +290,7 @@ void Fl_Process::clean_close(HANDLE& h) { #endif + /** Prepare FLUID for running a shell command according to the command flags. diff --git a/fluid/shell_command.h b/fluid/shell_command.h index 84de3630a..353874dfd 100644 --- a/fluid/shell_command.h +++ b/fluid/shell_command.h @@ -43,6 +43,7 @@ char preferences_get(Fl_Preferences &prefs, const char *key, Fl_String &value, c char preferences_set(Fl_Preferences &prefs, const char *key, const Fl_String &value); void run_shell_command(const Fl_String &cmd, int flags); +bool shell_command_running(void); class Fl_Process { public: -- cgit v1.2.3