From 66c1e80b997fc71d877617ab15f076dcd3f00b6b Mon Sep 17 00:00:00 2001 From: Jaidyn Ann Date: Sun, 21 Mar 2021 12:28:33 -0500 Subject: [PATCH] Minimize window instead of close; Pogger as background app --- src/App.cpp | 6 ++++++ src/MainWindow.cpp | 8 ++++++++ src/MainWindow.h | 1 + src/Pogger.rdef | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/App.cpp b/src/App.cpp index 5818589..72b879e 100644 --- a/src/App.cpp +++ b/src/App.cpp @@ -84,6 +84,12 @@ App::MessageReceived(BMessage* msg) fMainWindow->PostMessage(msg); break; } + case B_SILENT_RELAUNCH: + { + if (fMainWindow->IsMinimized() == true) + fMainWindow->Minimize(false); + break; + } default: { BApplication::MessageReceived(msg); diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index fcdd7e6..6422f13 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -85,6 +85,14 @@ MainWindow::MessageReceived(BMessage *msg) } +bool +MainWindow::QuitRequested() +{ + Minimize(true); + return false; +} + + void MainWindow::_InitInterface() { diff --git a/src/MainWindow.h b/src/MainWindow.h index 2113b29..52fcd29 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -18,6 +18,7 @@ public: ~MainWindow(); void MessageReceived(BMessage*); + bool QuitRequested(); private: void _InitInterface(); diff --git a/src/Pogger.rdef b/src/Pogger.rdef index b1af86b..198b0bb 100644 --- a/src/Pogger.rdef +++ b/src/Pogger.rdef @@ -5,7 +5,7 @@ resource app_signature "application/x-vnd.Pogger"; -resource app_flags B_SINGLE_LAUNCH; +resource app_flags B_SINGLE_LAUNCH | B_BACKGROUND_APP; resource app_version { major = 0,