mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-01 07:15:27 +00:00
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:
parent
29b1304337
commit
9c9bfd8428
@ -111,6 +111,11 @@ SdlInputHandler::SdlInputHandler(StreamingPreferences& prefs, int streamWidth, i
|
|||||||
m_SpecialKeyCombos[KeyComboTogglePointerRegionLock].scanCode = SDL_SCANCODE_L;
|
m_SpecialKeyCombos[KeyComboTogglePointerRegionLock].scanCode = SDL_SCANCODE_L;
|
||||||
m_SpecialKeyCombos[KeyComboTogglePointerRegionLock].enabled = true;
|
m_SpecialKeyCombos[KeyComboTogglePointerRegionLock].enabled = true;
|
||||||
|
|
||||||
|
m_SpecialKeyCombos[KeyComboQuitAndExit].keyCombo = KeyComboQuitAndExit;
|
||||||
|
m_SpecialKeyCombos[KeyComboQuitAndExit].keyCode = SDLK_e;
|
||||||
|
m_SpecialKeyCombos[KeyComboQuitAndExit].scanCode = SDL_SCANCODE_E;
|
||||||
|
m_SpecialKeyCombos[KeyComboQuitAndExit].enabled = true;
|
||||||
|
|
||||||
m_OldIgnoreDevices = SDL_GetHint(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES);
|
m_OldIgnoreDevices = SDL_GetHint(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES);
|
||||||
m_OldIgnoreDevicesExcept = SDL_GetHint(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT);
|
m_OldIgnoreDevicesExcept = SDL_GetHint(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT);
|
||||||
|
|
||||||
|
@ -164,6 +164,7 @@ private:
|
|||||||
KeyComboToggleMinimize,
|
KeyComboToggleMinimize,
|
||||||
KeyComboPasteText,
|
KeyComboPasteText,
|
||||||
KeyComboTogglePointerRegionLock,
|
KeyComboTogglePointerRegionLock,
|
||||||
|
KeyComboQuitAndExit,
|
||||||
KeyComboMax
|
KeyComboMax
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -139,6 +139,20 @@ void SdlInputHandler::performSpecialKeyCombo(KeyCombo combo)
|
|||||||
updatePointerRegionLock();
|
updatePointerRegionLock();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case KeyComboQuitAndExit:
|
||||||
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Detected quitAndExit key combo");
|
||||||
|
|
||||||
|
// Indicate that we want to exit afterwards
|
||||||
|
Session::get()->setShouldExitAfterQuit();
|
||||||
|
|
||||||
|
// Push a quit event to the main loop
|
||||||
|
SDL_Event quitExitEvent;
|
||||||
|
quitExitEvent.type = SDL_QUIT;
|
||||||
|
quitExitEvent.quit.timestamp = SDL_GetTicks();
|
||||||
|
SDL_PushEvent(&quitExitEvent);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
@ -577,6 +577,7 @@ Session::Session(NvComputer* computer, NvApp& app, StreamingPreferences *prefere
|
|||||||
m_InputHandler(nullptr),
|
m_InputHandler(nullptr),
|
||||||
m_MouseEmulationRefCount(0),
|
m_MouseEmulationRefCount(0),
|
||||||
m_FlushingWindowEventsRef(0),
|
m_FlushingWindowEventsRef(0),
|
||||||
|
m_ShouldExitAfterQuit(false),
|
||||||
m_AsyncConnectionSuccess(false),
|
m_AsyncConnectionSuccess(false),
|
||||||
m_PortTestResults(0),
|
m_PortTestResults(0),
|
||||||
m_OpusDecoder(nullptr),
|
m_OpusDecoder(nullptr),
|
||||||
@ -1251,7 +1252,8 @@ private:
|
|||||||
// Only quit the running app if our session terminated gracefully
|
// Only quit the running app if our session terminated gracefully
|
||||||
bool shouldQuit =
|
bool shouldQuit =
|
||||||
!m_Session->m_UnexpectedTermination &&
|
!m_Session->m_UnexpectedTermination &&
|
||||||
m_Session->m_Preferences->quitAppAfter;
|
(m_Session->m_Preferences->quitAppAfter ||
|
||||||
|
m_Session->m_ShouldExitAfterQuit);
|
||||||
|
|
||||||
// Notify the UI
|
// Notify the UI
|
||||||
if (shouldQuit) {
|
if (shouldQuit) {
|
||||||
@ -1280,6 +1282,11 @@ private:
|
|||||||
} catch (const QtNetworkReplyException&) {
|
} catch (const QtNetworkReplyException&) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Exit the entire program if requested
|
||||||
|
if (m_Session->m_ShouldExitAfterQuit) {
|
||||||
|
QCoreApplication::instance()->quit();
|
||||||
|
}
|
||||||
|
|
||||||
// Session is finished now
|
// Session is finished now
|
||||||
emit m_Session->sessionFinished(m_Session->m_PortTestResults);
|
emit m_Session->sessionFinished(m_Session->m_PortTestResults);
|
||||||
}
|
}
|
||||||
@ -1698,6 +1705,11 @@ void Session::flushWindowEvents()
|
|||||||
SDL_PushEvent(&flushEvent);
|
SDL_PushEvent(&flushEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Session::setShouldExitAfterQuit()
|
||||||
|
{
|
||||||
|
m_ShouldExitAfterQuit = true;
|
||||||
|
}
|
||||||
|
|
||||||
class ExecThread : public QThread
|
class ExecThread : public QThread
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -124,6 +124,8 @@ public:
|
|||||||
|
|
||||||
void flushWindowEvents();
|
void flushWindowEvents();
|
||||||
|
|
||||||
|
void setShouldExitAfterQuit();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void stageStarting(QString stage);
|
void stageStarting(QString stage);
|
||||||
|
|
||||||
@ -264,6 +266,7 @@ private:
|
|||||||
int m_MouseEmulationRefCount;
|
int m_MouseEmulationRefCount;
|
||||||
int m_FlushingWindowEventsRef;
|
int m_FlushingWindowEventsRef;
|
||||||
QList<QString> m_LaunchWarnings;
|
QList<QString> m_LaunchWarnings;
|
||||||
|
bool m_ShouldExitAfterQuit;
|
||||||
|
|
||||||
bool m_AsyncConnectionSuccess;
|
bool m_AsyncConnectionSuccess;
|
||||||
int m_PortTestResults;
|
int m_PortTestResults;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user