Add quit-app-and-exit shortcut Ctrl+Alt+Shift+E

Add a shortcut to quit the current app and exit Moonlight entirely.
This commit is contained in:
James Poje 2025-03-20 01:13:04 -04:00 committed by Cameron Gutman
commit 9c9bfd8428
5 changed files with 36 additions and 1 deletions

View file

@ -577,6 +577,7 @@ Session::Session(NvComputer* computer, NvApp& app, StreamingPreferences *prefere
m_InputHandler(nullptr),
m_MouseEmulationRefCount(0),
m_FlushingWindowEventsRef(0),
m_ShouldExitAfterQuit(false),
m_AsyncConnectionSuccess(false),
m_PortTestResults(0),
m_OpusDecoder(nullptr),
@ -1251,7 +1252,8 @@ private:
// Only quit the running app if our session terminated gracefully
bool shouldQuit =
!m_Session->m_UnexpectedTermination &&
m_Session->m_Preferences->quitAppAfter;
(m_Session->m_Preferences->quitAppAfter ||
m_Session->m_ShouldExitAfterQuit);
// Notify the UI
if (shouldQuit) {
@ -1280,6 +1282,11 @@ private:
} catch (const QtNetworkReplyException&) {
}
// Exit the entire program if requested
if (m_Session->m_ShouldExitAfterQuit) {
QCoreApplication::instance()->quit();
}
// Session is finished now
emit m_Session->sessionFinished(m_Session->m_PortTestResults);
}
@ -1698,6 +1705,11 @@ void Session::flushWindowEvents()
SDL_PushEvent(&flushEvent);
}
void Session::setShouldExitAfterQuit()
{
m_ShouldExitAfterQuit = true;
}
class ExecThread : public QThread
{
public: