From 378781dc88a3e5228f55573d47f1d2a0d0b6c948 Mon Sep 17 00:00:00 2001 From: lightmanLP <50497969+lightmanLP@users.noreply.github.com> Date: Wed, 18 Dec 2024 09:32:21 +0000 Subject: [PATCH] MouseCapture keybind --- src/graphic/Fast3D/Fast3dWindow.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/graphic/Fast3D/Fast3dWindow.cpp b/src/graphic/Fast3D/Fast3dWindow.cpp index 494a0e233..7f876eff2 100644 --- a/src/graphic/Fast3D/Fast3dWindow.cpp +++ b/src/graphic/Fast3D/Fast3dWindow.cpp @@ -270,6 +270,13 @@ bool Fast3dWindow::KeyUp(int32_t scancode) { Ship::Context::GetInstance()->GetWindow()->ToggleFullscreen(); } + if (scancode == Ship::Context::GetInstance()->GetConfig()->GetInt("Shortcuts.MouseCapture", Ship::KbScancode::LUS_KB_F2)) { + bool captureState = Ship::Context::GetInstance()->GetWindow()->IsMouseCaptured(); + if (captureState || !Ship::Context::GetInstance()->GetWindow()->GetGui()->GetMenuOrMenubarVisible()) { + Ship::Context::GetInstance()->GetWindow()->SetMouseCapture(!captureState); + } + } + Ship::Context::GetInstance()->GetWindow()->SetLastScancode(-1); return Ship::Context::GetInstance()->GetControlDeck()->ProcessKeyboardEvent( Ship::KbEventType::LUS_KB_EVENT_KEY_UP, static_cast(scancode));