1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-19 21:41:33 +00:00

Enable Lua mouse engine handlers while in UI

This commit is contained in:
uramer 2024-02-11 23:49:26 +01:00
parent f4fed4ca5f
commit 63a1bbb88d
2 changed files with 7 additions and 7 deletions

View file

@ -119,10 +119,11 @@ namespace MWInput
mBindingsManager->setPlayerControlsEnabled(!guiMode); mBindingsManager->setPlayerControlsEnabled(!guiMode);
mBindingsManager->mouseReleased(arg, id); mBindingsManager->mouseReleased(arg, id);
}
MWBase::Environment::get().getLuaManager()->inputEvent( MWBase::Environment::get().getLuaManager()->inputEvent(
{ MWBase::LuaManager::InputEvent::MouseButtonReleased, arg.button }); { MWBase::LuaManager::InputEvent::MouseButtonReleased, arg.button });
} }
}
void MouseManager::mouseWheelMoved(const SDL_MouseWheelEvent& arg) void MouseManager::mouseWheelMoved(const SDL_MouseWheelEvent& arg)
{ {
@ -130,11 +131,11 @@ namespace MWInput
if (mBindingsManager->isDetectingBindingState() || !input->controlsDisabled()) if (mBindingsManager->isDetectingBindingState() || !input->controlsDisabled())
{ {
mBindingsManager->mouseWheelMoved(arg); mBindingsManager->mouseWheelMoved(arg);
MWBase::Environment::get().getLuaManager()->inputEvent({ MWBase::LuaManager::InputEvent::MouseWheel,
MWBase::LuaManager::InputEvent::WheelChange{ arg.x, arg.y } });
} }
input->setJoystickLastUsed(false); input->setJoystickLastUsed(false);
MWBase::Environment::get().getLuaManager()->inputEvent({ MWBase::LuaManager::InputEvent::MouseWheel,
MWBase::LuaManager::InputEvent::WheelChange{ arg.x, arg.y } });
} }
void MouseManager::mousePressed(const SDL_MouseButtonEvent& arg, Uint8 id) void MouseManager::mousePressed(const SDL_MouseButtonEvent& arg, Uint8 id)
@ -170,10 +171,10 @@ namespace MWInput
if ((!settingsWindow || !settingsWindow->isVisible()) && !input->controlsDisabled()) if ((!settingsWindow || !settingsWindow->isVisible()) && !input->controlsDisabled())
{ {
mBindingsManager->mousePressed(arg, id); mBindingsManager->mousePressed(arg, id);
}
MWBase::Environment::get().getLuaManager()->inputEvent( MWBase::Environment::get().getLuaManager()->inputEvent(
{ MWBase::LuaManager::InputEvent::MouseButtonPressed, arg.button }); { MWBase::LuaManager::InputEvent::MouseButtonPressed, arg.button });
} }
}
void MouseManager::updateCursorMode() void MouseManager::updateCursorMode()
{ {

View file

@ -181,7 +181,6 @@ return {
onKeyPress = function(key) onKeyPress = function(key)
bindButton(key.code ~= input.KEY.Escape and 'keyboard' or nil, key.code) bindButton(key.code ~= input.KEY.Escape and 'keyboard' or nil, key.code)
end, end,
-- TODO: currently never triggers, because mouse events are disabled while inside settings
onMouseButtonPress = function(button) onMouseButtonPress = function(button)
bindButton('mouse', button) bindButton('mouse', button)
end, end,