diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-07-26 16:13:59 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-07-26 16:13:59 +0200 |
commit | d7ff2c5b86546fb7d7bebde7afeb03b6f67199e4 (patch) | |
tree | a5db213d6411ae1fefaac429cb73045825bf2ad6 /Libraries | |
parent | 7da5a04131eadf71300ba960518e45f09b760b0a (diff) | |
download | serenity-d7ff2c5b86546fb7d7bebde7afeb03b6f67199e4.zip |
LibGUI: GDialog should close its nested event loop on window close.
Make GWindow::close() so we can override it in GDialog and quit from the
internal event loop when the window manager tells us to close ourselves.
The dialog will return GDialog::ExecCancel in these situations.
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibGUI/GDialog.cpp | 7 | ||||
-rw-r--r-- | Libraries/LibGUI/GDialog.h | 2 | ||||
-rw-r--r-- | Libraries/LibGUI/GWindow.h | 2 |
3 files changed, 10 insertions, 1 deletions
diff --git a/Libraries/LibGUI/GDialog.cpp b/Libraries/LibGUI/GDialog.cpp index 7438e41b2e..eaa3359f39 100644 --- a/Libraries/LibGUI/GDialog.cpp +++ b/Libraries/LibGUI/GDialog.cpp @@ -40,3 +40,10 @@ void GDialog::done(int result) dbgprintf("%s: quit event loop with result %d\n", class_name(), result); m_event_loop->quit(result); } + +void GDialog::close() +{ + GWindow::close(); + m_event_loop->quit(ExecCancel); +} + diff --git a/Libraries/LibGUI/GDialog.h b/Libraries/LibGUI/GDialog.h index a0e9a2cb46..6b3bbb7f04 100644 --- a/Libraries/LibGUI/GDialog.h +++ b/Libraries/LibGUI/GDialog.h @@ -19,6 +19,8 @@ public: int result() const { return m_result; } void done(int result); + virtual void close() override; + protected: explicit GDialog(CObject* parent); diff --git a/Libraries/LibGUI/GWindow.h b/Libraries/LibGUI/GWindow.h index e8b50ed13a..a0ec5f8542 100644 --- a/Libraries/LibGUI/GWindow.h +++ b/Libraries/LibGUI/GWindow.h @@ -82,7 +82,7 @@ public: void show(); void hide(); - void close(); + virtual void close(); void move_to_front(); void start_wm_resize(); |