mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 21:47:43 +00:00
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:
parent
fbae03b737
commit
72a3f69df7
19 changed files with 8 additions and 27 deletions
|
@ -16,7 +16,6 @@ int main(int argc, char** argv)
|
||||||
window_rect.center_within(GDesktop::the().rect());
|
window_rect.center_within(GDesktop::the().rect());
|
||||||
window->set_resizable(false);
|
window->set_resizable(false);
|
||||||
window->set_rect(window_rect);
|
window->set_rect(window_rect);
|
||||||
window->set_should_exit_event_loop_on_close(true);
|
|
||||||
|
|
||||||
auto* widget = new GWidget;
|
auto* widget = new GWidget;
|
||||||
window->set_main_widget(widget);
|
window->set_main_widget(widget);
|
||||||
|
|
|
@ -39,7 +39,6 @@ int main(int argc, char** argv)
|
||||||
auto* window = new GWindow;
|
auto* window = new GWindow;
|
||||||
window->set_title("File Manager");
|
window->set_title("File Manager");
|
||||||
window->set_rect(20, 200, 640, 480);
|
window->set_rect(20, 200, 640, 480);
|
||||||
window->set_should_exit_event_loop_on_close(true);
|
|
||||||
|
|
||||||
auto* widget = new GWidget;
|
auto* widget = new GWidget;
|
||||||
widget->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
widget->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
||||||
|
|
|
@ -29,7 +29,6 @@ int main(int argc, char** argv)
|
||||||
window->set_rect({ 50, 50, 390, 342 });
|
window->set_rect({ 50, 50, 390, 342 });
|
||||||
auto* font_editor = new FontEditorWidget(path, move(edited_font));
|
auto* font_editor = new FontEditorWidget(path, move(edited_font));
|
||||||
window->set_main_widget(font_editor);
|
window->set_main_widget(font_editor);
|
||||||
window->set_should_exit_event_loop_on_close(true);
|
|
||||||
window->show();
|
window->show();
|
||||||
window->set_icon_path("/res/icons/16x16/app-font-editor.png");
|
window->set_icon_path("/res/icons/16x16/app-font-editor.png");
|
||||||
return app.exec();
|
return app.exec();
|
||||||
|
|
|
@ -8,7 +8,6 @@ int main(int argc, char** argv)
|
||||||
GApplication app(argc, argv);
|
GApplication app(argc, argv);
|
||||||
|
|
||||||
IRCAppWindow app_window;
|
IRCAppWindow app_window;
|
||||||
app_window.set_should_exit_event_loop_on_close(true);
|
|
||||||
app_window.show();
|
app_window.show();
|
||||||
|
|
||||||
printf("Entering main loop...\n");
|
printf("Entering main loop...\n");
|
||||||
|
|
|
@ -30,7 +30,6 @@ int main(int argc, char** argv)
|
||||||
signal(SIGCHLD, handle_sigchld);
|
signal(SIGCHLD, handle_sigchld);
|
||||||
|
|
||||||
auto* launcher_window = make_launcher_window();
|
auto* launcher_window = make_launcher_window();
|
||||||
launcher_window->set_should_exit_event_loop_on_close(true);
|
|
||||||
launcher_window->show();
|
launcher_window->show();
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
|
|
|
@ -18,7 +18,6 @@ int main(int argc, char** argv)
|
||||||
auto* window = new GWindow;
|
auto* window = new GWindow;
|
||||||
window->set_title("PaintBrush");
|
window->set_title("PaintBrush");
|
||||||
window->set_rect(100, 100, 640, 480);
|
window->set_rect(100, 100, 640, 480);
|
||||||
window->set_should_exit_event_loop_on_close(true);
|
|
||||||
|
|
||||||
auto* horizontal_container = new GWidget(nullptr);
|
auto* horizontal_container = new GWidget(nullptr);
|
||||||
window->set_main_widget(horizontal_container);
|
window->set_main_widget(horizontal_container);
|
||||||
|
|
|
@ -16,7 +16,6 @@ int main(int argc, char** argv)
|
||||||
auto* window = new GWindow;
|
auto* window = new GWindow;
|
||||||
window->set_title("Piano");
|
window->set_title("Piano");
|
||||||
window->set_rect(100, 100, 512, 512);
|
window->set_rect(100, 100, 512, 512);
|
||||||
window->set_should_exit_event_loop_on_close(true);
|
|
||||||
|
|
||||||
auto* piano_widget = new PianoWidget;
|
auto* piano_widget = new PianoWidget;
|
||||||
window->set_main_widget(piano_widget);
|
window->set_main_widget(piano_widget);
|
||||||
|
|
|
@ -119,7 +119,7 @@ int main(int argc, char** argv)
|
||||||
process_context_menu->add_action(stop_action);
|
process_context_menu->add_action(stop_action);
|
||||||
process_context_menu->add_action(continue_action);
|
process_context_menu->add_action(continue_action);
|
||||||
process_table_view->on_context_menu_request = [&](const GModelIndex& index, const GContextMenuEvent& event) {
|
process_table_view->on_context_menu_request = [&](const GModelIndex& index, const GContextMenuEvent& event) {
|
||||||
(void) index;
|
(void)index;
|
||||||
process_context_menu->popup(event.screen_position());
|
process_context_menu->popup(event.screen_position());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ int main(int argc, char** argv)
|
||||||
window->set_title("Process Manager");
|
window->set_title("Process Manager");
|
||||||
window->set_rect(20, 200, 680, 400);
|
window->set_rect(20, 200, 680, 400);
|
||||||
window->set_main_widget(keeper);
|
window->set_main_widget(keeper);
|
||||||
window->set_should_exit_event_loop_on_close(true);
|
|
||||||
window->show();
|
window->show();
|
||||||
|
|
||||||
window->set_icon_path("/res/icons/16x16/app-process-manager.png");
|
window->set_icon_path("/res/icons/16x16/app-process-manager.png");
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "QSWidget.h"
|
#include "QSWidget.h"
|
||||||
|
#include <LibDraw/PNGLoader.h>
|
||||||
#include <LibGUI/GAction.h>
|
#include <LibGUI/GAction.h>
|
||||||
#include <LibGUI/GApplication.h>
|
#include <LibGUI/GApplication.h>
|
||||||
#include <LibGUI/GBoxLayout.h>
|
#include <LibGUI/GBoxLayout.h>
|
||||||
|
@ -6,7 +7,6 @@
|
||||||
#include <LibGUI/GMenu.h>
|
#include <LibGUI/GMenu.h>
|
||||||
#include <LibGUI/GMenuBar.h>
|
#include <LibGUI/GMenuBar.h>
|
||||||
#include <LibGUI/GWindow.h>
|
#include <LibGUI/GWindow.h>
|
||||||
#include <LibDraw/PNGLoader.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
|
@ -67,7 +67,6 @@ int main(int argc, char** argv)
|
||||||
widget->set_bitmap(*bitmap);
|
widget->set_bitmap(*bitmap);
|
||||||
window->set_main_widget(widget);
|
window->set_main_widget(widget);
|
||||||
|
|
||||||
window->set_should_exit_event_loop_on_close(true);
|
|
||||||
window->show();
|
window->show();
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
|
|
|
@ -15,7 +15,6 @@ TaskbarWindow::TaskbarWindow()
|
||||||
{
|
{
|
||||||
set_window_type(GWindowType::Taskbar);
|
set_window_type(GWindowType::Taskbar);
|
||||||
set_title("Taskbar");
|
set_title("Taskbar");
|
||||||
set_should_exit_event_loop_on_close(true);
|
|
||||||
|
|
||||||
on_screen_rect_change(GDesktop::the().rect());
|
on_screen_rect_change(GDesktop::the().rect());
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,6 @@ int main(int argc, char** argv)
|
||||||
window->set_title("Terminal");
|
window->set_title("Terminal");
|
||||||
window->set_background_color(Color::Black);
|
window->set_background_color(Color::Black);
|
||||||
window->set_double_buffering_enabled(false);
|
window->set_double_buffering_enabled(false);
|
||||||
window->set_should_exit_event_loop_on_close(true);
|
|
||||||
|
|
||||||
RefPtr<CConfigFile> config = CConfigFile::get_for_app("Terminal");
|
RefPtr<CConfigFile> config = CConfigFile::get_for_app("Terminal");
|
||||||
Terminal terminal(ptm_fd, config);
|
Terminal terminal(ptm_fd, config);
|
||||||
|
|
|
@ -7,7 +7,6 @@ int main(int argc, char** argv)
|
||||||
auto* window = new GWindow;
|
auto* window = new GWindow;
|
||||||
window->set_title("Text Editor");
|
window->set_title("Text Editor");
|
||||||
window->set_rect(20, 200, 640, 400);
|
window->set_rect(20, 200, 640, 400);
|
||||||
window->set_should_exit_event_loop_on_close(true);
|
|
||||||
|
|
||||||
auto* text_widget = new TextEditorWidget();
|
auto* text_widget = new TextEditorWidget();
|
||||||
window->set_main_widget(text_widget);
|
window->set_main_widget(text_widget);
|
||||||
|
@ -19,4 +18,4 @@ int main(int argc, char** argv)
|
||||||
window->set_icon_path("/res/icons/TextEditor16.png");
|
window->set_icon_path("/res/icons/TextEditor16.png");
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,12 +16,12 @@
|
||||||
* [ ] handle fire bitmap edges better
|
* [ ] handle fire bitmap edges better
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <LibDraw/GraphicsBitmap.h>
|
||||||
#include <LibGUI/GApplication.h>
|
#include <LibGUI/GApplication.h>
|
||||||
#include <LibGUI/GLabel.h>
|
#include <LibGUI/GLabel.h>
|
||||||
#include <LibGUI/GPainter.h>
|
#include <LibGUI/GPainter.h>
|
||||||
#include <LibGUI/GWidget.h>
|
#include <LibGUI/GWidget.h>
|
||||||
#include <LibGUI/GWindow.h>
|
#include <LibGUI/GWindow.h>
|
||||||
#include <LibDraw/GraphicsBitmap.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
@ -214,7 +214,6 @@ int main(int argc, char** argv)
|
||||||
GApplication app(argc, argv);
|
GApplication app(argc, argv);
|
||||||
|
|
||||||
auto* window = new GWindow;
|
auto* window = new GWindow;
|
||||||
window->set_should_exit_event_loop_on_close(true);
|
|
||||||
window->set_double_buffering_enabled(false);
|
window->set_double_buffering_enabled(false);
|
||||||
window->set_title("Fire");
|
window->set_title("Fire");
|
||||||
window->set_resizable(false);
|
window->set_resizable(false);
|
||||||
|
|
|
@ -60,7 +60,7 @@ int main(int argc, char** argv)
|
||||||
window->set_title(form1->name());
|
window->set_title(form1->name());
|
||||||
window->set_rect(120, 200, 640, 400);
|
window->set_rect(120, 200, 640, 400);
|
||||||
window->set_main_widget(form1);
|
window->set_main_widget(form1);
|
||||||
window->set_should_exit_event_loop_on_close(true);
|
|
||||||
window->show();
|
window->show();
|
||||||
|
|
||||||
auto* toolbox = make_toolbox_window();
|
auto* toolbox = make_toolbox_window();
|
||||||
|
|
|
@ -14,7 +14,6 @@ int main(int argc, char** argv)
|
||||||
GApplication app(argc, argv);
|
GApplication app(argc, argv);
|
||||||
|
|
||||||
auto* window = new GWindow;
|
auto* window = new GWindow;
|
||||||
window->set_should_exit_event_loop_on_close(true);
|
|
||||||
window->set_resizable(false);
|
window->set_resizable(false);
|
||||||
window->set_title("Minesweeper");
|
window->set_title("Minesweeper");
|
||||||
window->set_rect(100, 100, 139, 175);
|
window->set_rect(100, 100, 139, 175);
|
||||||
|
|
|
@ -12,7 +12,7 @@ int main(int argc, char** argv)
|
||||||
GApplication app(argc, argv);
|
GApplication app(argc, argv);
|
||||||
|
|
||||||
auto* window = new GWindow;
|
auto* window = new GWindow;
|
||||||
window->set_should_exit_event_loop_on_close(true);
|
|
||||||
window->set_double_buffering_enabled(false);
|
window->set_double_buffering_enabled(false);
|
||||||
window->set_title("Snake");
|
window->set_title("Snake");
|
||||||
window->set_rect(100, 100, 320, 320);
|
window->set_rect(100, 100, 320, 320);
|
||||||
|
|
|
@ -6,7 +6,7 @@ GDialog::GDialog(CObject* parent)
|
||||||
: GWindow(parent)
|
: GWindow(parent)
|
||||||
{
|
{
|
||||||
set_modal(true);
|
set_modal(true);
|
||||||
set_should_exit_event_loop_on_close(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GDialog::~GDialog()
|
GDialog::~GDialog()
|
||||||
|
|
|
@ -46,8 +46,6 @@ GWindow::~GWindow()
|
||||||
|
|
||||||
void GWindow::close()
|
void GWindow::close()
|
||||||
{
|
{
|
||||||
if (should_exit_event_loop_on_close())
|
|
||||||
GEventLoop::current().quit(0);
|
|
||||||
if (should_destroy_on_close())
|
if (should_destroy_on_close())
|
||||||
delete_later();
|
delete_later();
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,9 +104,6 @@ public:
|
||||||
GWidget* automatic_cursor_tracking_widget() { return m_automatic_cursor_tracking_widget.ptr(); }
|
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(); }
|
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(); }
|
GWidget* hovered_widget() { return m_hovered_widget.ptr(); }
|
||||||
const GWidget* hovered_widget() const { return m_hovered_widget.ptr(); }
|
const GWidget* hovered_widget() const { return m_hovered_widget.ptr(); }
|
||||||
void set_hovered_widget(GWidget*);
|
void set_hovered_widget(GWidget*);
|
||||||
|
@ -160,7 +157,6 @@ private:
|
||||||
Color m_background_color { Color::WarmGray };
|
Color m_background_color { Color::WarmGray };
|
||||||
GWindowType m_window_type { GWindowType::Normal };
|
GWindowType m_window_type { GWindowType::Normal };
|
||||||
bool m_is_active { false };
|
bool m_is_active { false };
|
||||||
bool m_should_exit_app_on_close { false };
|
|
||||||
bool m_destroy_on_close { true };
|
bool m_destroy_on_close { true };
|
||||||
bool m_has_alpha_channel { false };
|
bool m_has_alpha_channel { false };
|
||||||
bool m_double_buffering_enabled { true };
|
bool m_double_buffering_enabled { true };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue