From 4b15dd2bcac74f973bc068ac68986ec513e63731 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 17 Feb 2019 09:58:35 +0100 Subject: [PATCH] LibGUI: Rename GEventLoop::exit() and GApplication::exit() to quit(). These functions don't exit immediately, but rather on the next iteration of the event loop. Since exit() is already used by the standard library, let's call it quit() instead. That way, saying exit() means the same thing here as anywhere else. --- Applications/About/main.cpp | 2 +- Applications/FileManager/main.cpp | 2 +- Applications/Terminal/Terminal.cpp | 4 ++-- Applications/Terminal/main.cpp | 2 +- LibGUI/GApplication.cpp | 4 ++-- LibGUI/GApplication.h | 2 +- LibGUI/GEventLoop.cpp | 6 +++--- LibGUI/GEventLoop.h | 2 +- LibGUI/GWindow.cpp | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Applications/About/main.cpp b/Applications/About/main.cpp index ead9a03808..bd405bd719 100644 --- a/Applications/About/main.cpp +++ b/Applications/About/main.cpp @@ -39,7 +39,7 @@ int main(int argc, char** argv) quit_button->set_caption("Okay"); quit_button->set_relative_rect(80, 100, widget->width() - 160, 20); quit_button->on_click = [] (GButton&) { - GApplication::the().exit(0); + GApplication::the().quit(0); }; window->show(); diff --git a/Applications/FileManager/main.cpp b/Applications/FileManager/main.cpp index 3027abb23f..ea0560c2d6 100644 --- a/Applications/FileManager/main.cpp +++ b/Applications/FileManager/main.cpp @@ -19,7 +19,7 @@ int main(int argc, char** argv) auto app_menu = make("FileManager"); app_menu->add_action(make("Quit", String(), [] (const GAction&) { - GApplication::the().exit(0); + GApplication::the().quit(0); return; })); menubar->add_menu(move(app_menu)); diff --git a/Applications/Terminal/Terminal.cpp b/Applications/Terminal/Terminal.cpp index 97b6ea5e6f..70721af153 100644 --- a/Applications/Terminal/Terminal.cpp +++ b/Applications/Terminal/Terminal.cpp @@ -27,12 +27,12 @@ Terminal::Terminal(int ptm_fd) if (nread < 0) { dbgprintf("Terminal read error: %s\n", strerror(errno)); perror("read(ptm)"); - GApplication::the().exit(1); + GApplication::the().quit(1); return; } if (nread == 0) { dbgprintf("Terminal: EOF on master pty, closing.\n"); - GApplication::the().exit(0); + GApplication::the().quit(0); return; } for (ssize_t i = 0; i < nread; ++i) diff --git a/Applications/Terminal/main.cpp b/Applications/Terminal/main.cpp index 780c1b32fa..f1dc759dc8 100644 --- a/Applications/Terminal/main.cpp +++ b/Applications/Terminal/main.cpp @@ -98,7 +98,7 @@ int main(int argc, char** argv) auto app_menu = make("Terminal"); app_menu->add_action(make("Quit", String(), [] (const GAction&) { dbgprintf("Terminal: Quit menu activated!\n"); - GApplication::the().exit(0); + GApplication::the().quit(0); return; })); menubar->add_menu(move(app_menu)); diff --git a/LibGUI/GApplication.cpp b/LibGUI/GApplication.cpp index a5d520c5a6..f212bbf202 100644 --- a/LibGUI/GApplication.cpp +++ b/LibGUI/GApplication.cpp @@ -26,9 +26,9 @@ int GApplication::exec() return m_event_loop->exec(); } -void GApplication::exit(int exit_code) +void GApplication::quit(int exit_code) { - m_event_loop->exit(exit_code); + m_event_loop->quit(exit_code); } void GApplication::set_menubar(OwnPtr&& menubar) diff --git a/LibGUI/GApplication.h b/LibGUI/GApplication.h index 0a139b2cd2..723eeec3e4 100644 --- a/LibGUI/GApplication.h +++ b/LibGUI/GApplication.h @@ -12,7 +12,7 @@ public: ~GApplication(); int exec(); - void exit(int); + void quit(int); void set_menubar(OwnPtr&&); diff --git a/LibGUI/GEventLoop.cpp b/LibGUI/GEventLoop.cpp index d13dfa4c88..6120007231 100644 --- a/LibGUI/GEventLoop.cpp +++ b/LibGUI/GEventLoop.cpp @@ -66,7 +66,7 @@ GEventLoop& GEventLoop::main() return *s_mainGEventLoop; } -void GEventLoop::exit(int code) +void GEventLoop::quit(int code) { m_exit_requested = true; m_exit_code = code; @@ -257,7 +257,7 @@ void GEventLoop::wait_for_event() if (event.type == WSAPI_ServerMessage::Error) { dbgprintf("GEventLoop got error message from server\n"); dbgprintf(" - error message: %s\n", String(event.text, event.text_length).characters()); - exit(1); + quit(1); return; } @@ -307,7 +307,7 @@ bool GEventLoop::drain_messages_from_server() ssize_t nread = read(m_event_fd, &message, sizeof(WSAPI_ServerMessage)); if (nread < 0) { perror("read"); - exit(1); + quit(1); return false; } if (nread == 0) diff --git a/LibGUI/GEventLoop.h b/LibGUI/GEventLoop.h index 1918e732cf..f2c436898d 100644 --- a/LibGUI/GEventLoop.h +++ b/LibGUI/GEventLoop.h @@ -32,7 +32,7 @@ public: void register_notifier(Badge, GNotifier&); void unregister_notifier(Badge, GNotifier&); - void exit(int); + void quit(int); bool post_message_to_server(const WSAPI_ClientMessage&); bool wait_for_specific_event(WSAPI_ServerMessage::Type, WSAPI_ServerMessage&); diff --git a/LibGUI/GWindow.cpp b/LibGUI/GWindow.cpp index c3e74186b9..49771bc8d9 100644 --- a/LibGUI/GWindow.cpp +++ b/LibGUI/GWindow.cpp @@ -46,7 +46,7 @@ void GWindow::close() // FIXME: If we exit the event loop, we're never gonna deal with the delete_later request! // This will become relevant once we support nested event loops. if (should_exit_app_on_close()) - GEventLoop::main().exit(0); + GEventLoop::main().quit(0); delete_later(); }