mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-10-27 14:30:25 +00:00
1 parent
97240cd5f2
commit
29294553bb
3 files changed
+28
-9
No files matched your search
@@ -116,6 +116,11 @@ SdlInputHandler::SdlInputHandler(StreamingPreferences& prefs, int streamWidth, i
|
|||||||
m_SpecialKeyCombos[KeyComboQuitAndExit].scanCode = SDL_SCANCODE_E;
|
m_SpecialKeyCombos[KeyComboQuitAndExit].scanCode = SDL_SCANCODE_E;
|
||||||
m_SpecialKeyCombos[KeyComboQuitAndExit].enabled = true;
|
m_SpecialKeyCombos[KeyComboQuitAndExit].enabled = true;
|
||||||
|
|
||||||
|
m_SpecialKeyCombos[KeyComboToggleKeyboardGrab].keyCombo = KeyComboToggleKeyboardGrab;
|
||||||
|
m_SpecialKeyCombos[KeyComboToggleKeyboardGrab].keyCode = SDLK_k;
|
||||||
|
m_SpecialKeyCombos[KeyComboToggleKeyboardGrab].scanCode = SDL_SCANCODE_K;
|
||||||
|
m_SpecialKeyCombos[KeyComboToggleKeyboardGrab].enabled = QGuiApplication::platformName() != "eglfs";
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
@@ -319,16 +324,14 @@ bool SdlInputHandler::isCaptureActive()
|
|||||||
|
|
||||||
void SdlInputHandler::updateKeyboardGrabState()
|
void SdlInputHandler::updateKeyboardGrabState()
|
||||||
{
|
{
|
||||||
if (m_CaptureSystemKeysMode == StreamingPreferences::CSK_OFF) {
|
bool shouldGrab = m_CaptureSystemKeysMode != StreamingPreferences::CSK_OFF && isCaptureActive();
|
||||||
return;
|
if (shouldGrab) {
|
||||||
}
|
Uint32 windowFlags = SDL_GetWindowFlags(m_Window);
|
||||||
|
if (m_CaptureSystemKeysMode == StreamingPreferences::CSK_FULLSCREEN &&
|
||||||
bool shouldGrab = isCaptureActive();
|
|
||||||
Uint32 windowFlags = SDL_GetWindowFlags(m_Window);
|
|
||||||
if (m_CaptureSystemKeysMode == StreamingPreferences::CSK_FULLSCREEN &&
|
|
||||||
!(windowFlags & SDL_WINDOW_FULLSCREEN)) {
|
!(windowFlags & SDL_WINDOW_FULLSCREEN)) {
|
||||||
// Ungrab if it's fullscreen only and we left fullscreen
|
// Ungrab if it's fullscreen only and we left fullscreen
|
||||||
shouldGrab = false;
|
shouldGrab = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't close the window on Alt+F4 when keyboard grab is enabled
|
// Don't close the window on Alt+F4 when keyboard grab is enabled
|
||||||
|
|||||||
@@ -167,6 +167,7 @@ private:
|
|||||||
KeyComboPasteText,
|
KeyComboPasteText,
|
||||||
KeyComboTogglePointerRegionLock,
|
KeyComboTogglePointerRegionLock,
|
||||||
KeyComboQuitAndExit,
|
KeyComboQuitAndExit,
|
||||||
|
KeyComboToggleKeyboardGrab,
|
||||||
KeyComboMax
|
KeyComboMax
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -153,6 +153,21 @@ void SdlInputHandler::performSpecialKeyCombo(KeyCombo combo)
|
|||||||
SDL_PushEvent(&quitExitEvent);
|
SDL_PushEvent(&quitExitEvent);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case KeyComboToggleKeyboardGrab:
|
||||||
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Detected keyboard grab toggle combo");
|
||||||
|
|
||||||
|
// Toggle the system key capture mode
|
||||||
|
if (isSystemKeyCaptureActive()) {
|
||||||
|
m_CaptureSystemKeysMode = StreamingPreferences::CSK_OFF;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_CaptureSystemKeysMode = StreamingPreferences::CSK_ALWAYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateKeyboardGrabState();
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user