summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2023-11-30 15:02:15 +0100
committerMatthias Melcher <github@matthiasm.com>2023-11-30 15:02:21 +0100
commit2025481f8c19fd73a611e517a0c91c15d7ed390a (patch)
treea6ae01c2e3cb4b4f0b2f5441f5a7441aa8fde0f8
parenta1a3a3109078d5920985066858d6747844d560c4 (diff)
FLUID: Add dialog box when processes are still runing when user tries to quit.
-rw-r--r--fluid/fluid.cxx5
-rw-r--r--fluid/shell_command.cxx8
-rw-r--r--fluid/shell_command.h1
3 files changed, 13 insertions, 1 deletions
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: