diff --git a/src/Window.cpp b/src/Window.cpp index 2f52cf7..db9a459 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -60,8 +60,9 @@ void Window::Init(const std::string& overideConfigLocation) void Window::Run() { Create(); - while (gtk_main_iteration()) + while (!bShouldQuit) { + gtk_main_iteration(); if (bHandleMonitorChanges) { // Flush the event loop @@ -185,7 +186,7 @@ void Window::Destroy() void Window::Close() { Destroy(); - gtk_main_quit(); + bShouldQuit = true; } void Window::UpdateMargin() diff --git a/src/Window.h b/src/Window.h index 0ce5d87..f9bf5e8 100644 --- a/src/Window.h +++ b/src/Window.h @@ -78,5 +78,6 @@ private: GdkMonitor* m_Monitor = nullptr; + bool bShouldQuit = false; bool bHandleMonitorChanges = false; };