Signal Handling and Fix for Closing

This commit is contained in:
pallaswept 2025-05-09 13:10:55 +00:00 committed by Adam Honse
parent ac13b614d6
commit 138d991cf2
2 changed files with 22 additions and 1 deletions

View file

@ -31,6 +31,10 @@ io_connect_t macUSPCIO_driver_connection;
#include "macutils.h"
#endif
#ifdef __linux__
#include <csignal>
#endif
using namespace std::chrono_literals;
/******************************************************************************************\
@ -168,6 +172,19 @@ void InstallWinRing0()
}
#endif
/******************************************************************************************\
* *
* Linux signal handler *
* *
\******************************************************************************************/
#ifdef __linux__
void sigHandler(int s)
{
std::signal(s, SIG_DFL);
qApp->quit();
}
#endif
/******************************************************************************************\
* *
* main *
@ -288,6 +305,10 @@ int main(int argc, char* argv[])
}
LOG_TRACE("[main] Ready to exec() the dialog");
#ifdef __linux__
std::signal(SIGINT, sigHandler);
std::signal(SIGTERM, sigHandler);
#endif
exitval = a.exec();
}
else

View file

@ -639,7 +639,7 @@ void OpenRGBDialog::closeEvent(QCloseEvent *event)
{
ResourceManager::get()->WaitForDeviceDetection();
if (IsMinimizeOnClose() && !this->isHidden())
if (IsMinimizeOnClose() && !this->isHidden() && event->spontaneous())
{
#ifdef __APPLE__
MacUtils::ToggleApplicationDocklessState(false);