mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-18 14:40:56 +00:00
feat: disable text input when window gains focus
This commit is contained in:
committed by
Cameron Gutman
parent
200cab9d17
commit
fb9a164111
@@ -301,6 +301,15 @@ void SdlInputHandler::notifyFocusLost()
|
|||||||
// Raise all keys that are currently pressed. If we don't do this, certain keys
|
// Raise all keys that are currently pressed. If we don't do this, certain keys
|
||||||
// used in shortcuts that cause focus loss (such as Alt+Tab) may get stuck down.
|
// used in shortcuts that cause focus loss (such as Alt+Tab) may get stuck down.
|
||||||
raiseAllKeys();
|
raiseAllKeys();
|
||||||
|
|
||||||
|
// Re-enable text input when window loses focus
|
||||||
|
SDL_StartTextInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SdlInputHandler::notifyFocusGained()
|
||||||
|
{
|
||||||
|
// Disable text input when window gains focus to prevent IME popup interference
|
||||||
|
SDL_StopTextInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SdlInputHandler::isCaptureActive()
|
bool SdlInputHandler::isCaptureActive()
|
||||||
|
|||||||
@@ -138,6 +138,8 @@ public:
|
|||||||
|
|
||||||
void notifyFocusLost();
|
void notifyFocusLost();
|
||||||
|
|
||||||
|
void notifyFocusGained();
|
||||||
|
|
||||||
bool isCaptureActive();
|
bool isCaptureActive();
|
||||||
|
|
||||||
bool isSystemKeyCaptureActive();
|
bool isSystemKeyCaptureActive();
|
||||||
|
|||||||
@@ -2108,6 +2108,7 @@ void Session::execInternal()
|
|||||||
if (m_Preferences->muteOnFocusLoss) {
|
if (m_Preferences->muteOnFocusLoss) {
|
||||||
m_AudioMuted = false;
|
m_AudioMuted = false;
|
||||||
}
|
}
|
||||||
|
m_InputHandler->notifyFocusGained();
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_LEAVE:
|
case SDL_WINDOWEVENT_LEAVE:
|
||||||
m_InputHandler->notifyMouseLeave();
|
m_InputHandler->notifyMouseLeave();
|
||||||
@@ -2420,4 +2421,3 @@ DispatchDeferredCleanup:
|
|||||||
// reference.
|
// reference.
|
||||||
QThreadPool::globalInstance()->start(new DeferredSessionCleanupTask(this));
|
QThreadPool::globalInstance()->start(new DeferredSessionCleanupTask(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user