Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 9a6e552

Browse files
committed
Disable keyboard and actually disable mouse movement processing when out of focus
1 parent 4856501 commit 9a6e552

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Managers/UInputMan.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,9 @@ namespace RTE {
766766
break;
767767
}
768768
case SDL_MOUSEMOTION:
769+
if (m_DisableMouseMoving) {
770+
break;
771+
}
769772
m_RawMouseMovement += Vector(static_cast<float>(inputEvent.motion.xrel), static_cast<float>(inputEvent.motion.yrel));
770773
m_AbsoluteMousePos.SetXY(static_cast<float>(inputEvent.motion.x * g_WindowMan.GetResMultiplier()), static_cast<float>(inputEvent.motion.y * g_WindowMan.GetResMultiplier()));
771774
if (g_WindowMan.FullyCoversAllDisplays()) {

Managers/WindowMan.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,8 @@ namespace RTE {
511511

512512
void WindowMan::DisplaySwitchIn(SDL_Window *windowThatShouldTakeInputFocus) const {
513513
g_UInputMan.DisableMouseMoving(false);
514+
g_UInputMan.DisableKeys(false);
515+
514516
if (!m_MultiDisplayWindows.empty()) {
515517
for (const auto &window : m_MultiDisplayWindows) {
516518
SDL_RaiseWindow(window.get());
@@ -526,6 +528,7 @@ namespace RTE {
526528

527529
void WindowMan::DisplaySwitchOut() const {
528530
g_UInputMan.DisableMouseMoving(true);
531+
g_UInputMan.DisableKeys(true);
529532
}
530533

531534
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)