LibGUI: Get rid of GWindow::should_exit_event_loop_on_close().

This behavior and API was extremely counter-intuitive since our default
behavior was for applications to never exit after you close all of their
windows.

Now that we exit the event loop by default when the very last GWindow is
deleted, we don't have to worry about this.
This commit is contained in:
Andreas Kling 2019-07-23 18:20:00 +02:00
parent fbae03b737
commit 72a3f69df7
19 changed files with 8 additions and 27 deletions

View file

@ -16,7 +16,6 @@ int main(int argc, char** argv)
window_rect.center_within(GDesktop::the().rect());
window->set_resizable(false);
window->set_rect(window_rect);
window->set_should_exit_event_loop_on_close(true);
auto* widget = new GWidget;
window->set_main_widget(widget);

View file

@ -39,7 +39,6 @@ int main(int argc, char** argv)
auto* window = new GWindow;
window->set_title("File Manager");
window->set_rect(20, 200, 640, 480);
window->set_should_exit_event_loop_on_close(true);
auto* widget = new GWidget;
widget->set_layout(make<GBoxLayout>(Orientation::Vertical));

View file

@ -29,7 +29,6 @@ int main(int argc, char** argv)
window->set_rect({ 50, 50, 390, 342 });
auto* font_editor = new FontEditorWidget(path, move(edited_font));
window->set_main_widget(font_editor);
window->set_should_exit_event_loop_on_close(true);
window->show();
window->set_icon_path("/res/icons/16x16/app-font-editor.png");
return app.exec();

View file

@ -8,7 +8,6 @@ int main(int argc, char** argv)
GApplication app(argc, argv);
IRCAppWindow app_window;
app_window.set_should_exit_event_loop_on_close(true);
app_window.show();
printf("Entering main loop...\n");

View file

@ -30,7 +30,6 @@ int main(int argc, char** argv)
signal(SIGCHLD, handle_sigchld);
auto* launcher_window = make_launcher_window();
launcher_window->set_should_exit_event_loop_on_close(true);
launcher_window->show();
return app.exec();

View file

@ -18,7 +18,6 @@ int main(int argc, char** argv)
auto* window = new GWindow;
window->set_title("PaintBrush");
window->set_rect(100, 100, 640, 480);
window->set_should_exit_event_loop_on_close(true);
auto* horizontal_container = new GWidget(nullptr);
window->set_main_widget(horizontal_container);

View file

@ -16,7 +16,6 @@ int main(int argc, char** argv)
auto* window = new GWindow;
window->set_title("Piano");
window->set_rect(100, 100, 512, 512);
window->set_should_exit_event_loop_on_close(true);
auto* piano_widget = new PianoWidget;
window->set_main_widget(piano_widget);

View file

@ -153,7 +153,7 @@ int main(int argc, char** argv)
window->set_title("Process Manager");
window->set_rect(20, 200, 680, 400);
window->set_main_widget(keeper);
window->set_should_exit_event_loop_on_close(true);
window->show();
window->set_icon_path("/res/icons/16x16/app-process-manager.png");

View file

@ -1,4 +1,5 @@
#include "QSWidget.h"
#include <LibDraw/PNGLoader.h>
#include <LibGUI/GAction.h>
#include <LibGUI/GApplication.h>
#include <LibGUI/GBoxLayout.h>
@ -6,7 +7,6 @@
#include <LibGUI/GMenu.h>
#include <LibGUI/GMenuBar.h>
#include <LibGUI/GWindow.h>
#include <LibDraw/PNGLoader.h>
#include <stdio.h>
int main(int argc, char** argv)
@ -67,7 +67,6 @@ int main(int argc, char** argv)
widget->set_bitmap(*bitmap);
window->set_main_widget(widget);
window->set_should_exit_event_loop_on_close(true);
window->show();
return app.exec();

View file

@ -15,7 +15,6 @@ TaskbarWindow::TaskbarWindow()
{
set_window_type(GWindowType::Taskbar);
set_title("Taskbar");
set_should_exit_event_loop_on_close(true);
on_screen_rect_change(GDesktop::the().rect());

View file

@ -146,7 +146,6 @@ int main(int argc, char** argv)
window->set_title("Terminal");
window->set_background_color(Color::Black);
window->set_double_buffering_enabled(false);
window->set_should_exit_event_loop_on_close(true);
RefPtr<CConfigFile> config = CConfigFile::get_for_app("Terminal");
Terminal terminal(ptm_fd, config);

View file

@ -7,7 +7,6 @@ int main(int argc, char** argv)
auto* window = new GWindow;
window->set_title("Text Editor");
window->set_rect(20, 200, 640, 400);
window->set_should_exit_event_loop_on_close(true);
auto* text_widget = new TextEditorWidget();
window->set_main_widget(text_widget);

View file

@ -16,12 +16,12 @@
* [ ] handle fire bitmap edges better
*/
#include <LibDraw/GraphicsBitmap.h>
#include <LibGUI/GApplication.h>
#include <LibGUI/GLabel.h>
#include <LibGUI/GPainter.h>
#include <LibGUI/GWidget.h>
#include <LibGUI/GWindow.h>
#include <LibDraw/GraphicsBitmap.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
@ -214,7 +214,6 @@ int main(int argc, char** argv)
GApplication app(argc, argv);
auto* window = new GWindow;
window->set_should_exit_event_loop_on_close(true);
window->set_double_buffering_enabled(false);
window->set_title("Fire");
window->set_resizable(false);

View file

@ -60,7 +60,7 @@ int main(int argc, char** argv)
window->set_title(form1->name());
window->set_rect(120, 200, 640, 400);
window->set_main_widget(form1);
window->set_should_exit_event_loop_on_close(true);
window->show();
auto* toolbox = make_toolbox_window();

View file

@ -14,7 +14,6 @@ int main(int argc, char** argv)
GApplication app(argc, argv);
auto* window = new GWindow;
window->set_should_exit_event_loop_on_close(true);
window->set_resizable(false);
window->set_title("Minesweeper");
window->set_rect(100, 100, 139, 175);

View file

@ -12,7 +12,7 @@ int main(int argc, char** argv)
GApplication app(argc, argv);
auto* window = new GWindow;
window->set_should_exit_event_loop_on_close(true);
window->set_double_buffering_enabled(false);
window->set_title("Snake");
window->set_rect(100, 100, 320, 320);

View file

@ -6,7 +6,7 @@ GDialog::GDialog(CObject* parent)
: GWindow(parent)
{
set_modal(true);
set_should_exit_event_loop_on_close(true);
}
GDialog::~GDialog()

View file

@ -46,8 +46,6 @@ GWindow::~GWindow()
void GWindow::close()
{
if (should_exit_event_loop_on_close())
GEventLoop::current().quit(0);
if (should_destroy_on_close())
delete_later();
}

View file

@ -104,9 +104,6 @@ public:
GWidget* automatic_cursor_tracking_widget() { return m_automatic_cursor_tracking_widget.ptr(); }
const GWidget* automatic_cursor_tracking_widget() const { return m_automatic_cursor_tracking_widget.ptr(); }
bool should_exit_event_loop_on_close() const { return m_should_exit_app_on_close; }
void set_should_exit_event_loop_on_close(bool b) { m_should_exit_app_on_close = b; }
GWidget* hovered_widget() { return m_hovered_widget.ptr(); }
const GWidget* hovered_widget() const { return m_hovered_widget.ptr(); }
void set_hovered_widget(GWidget*);
@ -160,7 +157,6 @@ private:
Color m_background_color { Color::WarmGray };
GWindowType m_window_type { GWindowType::Normal };
bool m_is_active { false };
bool m_should_exit_app_on_close { false };
bool m_destroy_on_close { true };
bool m_has_alpha_channel { false };
bool m_double_buffering_enabled { true };