forked from mirror/openmw-tes3mp
Alternative fix strategy by checking for binding state
This commit is contained in:
parent
bbb7ceab43
commit
97caa1f8a4
3 changed files with 36 additions and 15 deletions
|
@ -558,36 +558,51 @@ namespace MWInput
|
|||
|
||||
void InputManager::keyReleased(const SDL_KeyboardEvent &arg )
|
||||
{
|
||||
mInputBinder->keyReleased (arg);
|
||||
|
||||
OIS::KeyCode kc = mInputManager->sdl2OISKeyCode(arg.keysym.sym);
|
||||
|
||||
MyGUI::InputManager::getInstance().injectKeyRelease(MyGUI::KeyCode::Enum(kc));
|
||||
setPlayerControlsEnabled(!MyGUI::InputManager::getInstance().injectKeyRelease(MyGUI::KeyCode::Enum(kc)));
|
||||
mInputBinder->keyReleased (arg);
|
||||
}
|
||||
|
||||
void InputManager::mousePressed( const SDL_MouseButtonEvent &arg, Uint8 id )
|
||||
{
|
||||
mInputBinder->mousePressed (arg, id);
|
||||
bool guiMode = false;
|
||||
|
||||
if (id != SDL_BUTTON_LEFT && id != SDL_BUTTON_RIGHT)
|
||||
return; // MyGUI has no use for these events
|
||||
|
||||
MyGUI::InputManager::getInstance().injectMousePress(mMouseX, mMouseY, sdlButtonToMyGUI(id));
|
||||
if (MyGUI::InputManager::getInstance ().getMouseFocusWidget () != 0)
|
||||
if (id == SDL_BUTTON_LEFT || id == SDL_BUTTON_RIGHT) // MyGUI has no use for these events
|
||||
{
|
||||
MyGUI::Button* b = MyGUI::InputManager::getInstance ().getMouseFocusWidget ()->castType<MyGUI::Button>(false);
|
||||
if (b && b->getEnabled())
|
||||
MyGUI::InputManager::getInstance().injectMousePress(mMouseX, mMouseY, sdlButtonToMyGUI(id));
|
||||
guiMode = guiMode && MWBase::Environment::get().getWindowManager()->isGuiMode();
|
||||
if (MyGUI::InputManager::getInstance ().getMouseFocusWidget () != 0)
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager ()->playSound ("Menu Click", 1.f, 1.f);
|
||||
MyGUI::Button* b = MyGUI::InputManager::getInstance ().getMouseFocusWidget ()->castType<MyGUI::Button>(false);
|
||||
if (b && b->getEnabled())
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager ()->playSound ("Menu Click", 1.f, 1.f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setPlayerControlsEnabled(!guiMode);
|
||||
mInputBinder->mousePressed (arg, id);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void InputManager::mouseReleased( const SDL_MouseButtonEvent &arg, Uint8 id )
|
||||
{
|
||||
mInputBinder->mouseReleased (arg, id);
|
||||
{
|
||||
|
||||
MyGUI::InputManager::getInstance().injectMouseRelease(mMouseX, mMouseY, sdlButtonToMyGUI(id));
|
||||
if(mInputBinder->detectingBindingState())
|
||||
{
|
||||
mInputBinder->mouseReleased (arg, id);
|
||||
} else {
|
||||
bool guiMode = MyGUI::InputManager::getInstance().injectMouseRelease(mMouseX, mMouseY, sdlButtonToMyGUI(id));
|
||||
guiMode = guiMode && MWBase::Environment::get().getWindowManager()->isGuiMode();
|
||||
|
||||
if(mInputBinder->detectingBindingState()) return; // don't allow same mouseup to bind as initiated bind
|
||||
|
||||
setPlayerControlsEnabled(!guiMode);
|
||||
mInputBinder->mouseReleased (arg, id);
|
||||
}
|
||||
}
|
||||
|
||||
void InputManager::mouseMoved(const SFO::MouseMotionEvent &arg )
|
||||
|
|
5
extern/oics/ICSInputControlSystem.cpp
vendored
5
extern/oics/ICSInputControlSystem.cpp
vendored
|
@ -796,6 +796,11 @@ namespace ICS
|
|||
mMouseAxisBindingInitialValues[0] = ICS_MOUSE_AXIS_BINDING_NULL_VALUE;
|
||||
}
|
||||
|
||||
bool InputControlSystem::detectingBindingState()
|
||||
{
|
||||
return mDetectingBindingControl != NULL;
|
||||
}
|
||||
|
||||
void InputControlSystem::cancelDetectingBindingState()
|
||||
{
|
||||
mDetectingBindingControl = NULL;
|
||||
|
|
1
extern/oics/ICSInputControlSystem.h
vendored
1
extern/oics/ICSInputControlSystem.h
vendored
|
@ -146,6 +146,7 @@ namespace ICS
|
|||
|
||||
void enableDetectingBindingState(Control* control, Control::ControlChangingDirection direction);
|
||||
void cancelDetectingBindingState();
|
||||
bool detectingBindingState();
|
||||
|
||||
bool save(std::string fileName = "");
|
||||
|
||||
|
|
Loading…
Reference in a new issue