forked from mirror/openmw-tes3mp
MyGUI doesn't care for SDL's mouse button ordering, send it what it expects
This commit is contained in:
parent
00a2a5c358
commit
6b49b8ab47
2 changed files with 20 additions and 2 deletions
|
@ -450,7 +450,7 @@ namespace MWInput
|
|||
{
|
||||
mInputCtrl->mousePressed (arg, id);
|
||||
|
||||
MyGUI::InputManager::getInstance().injectMousePress(mMouseX, mMouseY, MyGUI::MouseButton::Enum(id));
|
||||
MyGUI::InputManager::getInstance().injectMousePress(mMouseX, mMouseY, sdlButtonToMyGUI(id));
|
||||
|
||||
if (MyGUI::InputManager::getInstance ().getMouseFocusWidget () != 0)
|
||||
{
|
||||
|
@ -468,7 +468,7 @@ namespace MWInput
|
|||
{
|
||||
mInputCtrl->mouseReleased (arg, id);
|
||||
|
||||
MyGUI::InputManager::getInstance().injectMouseRelease(mMouseX, mMouseY, MyGUI::MouseButton::Enum(id));
|
||||
MyGUI::InputManager::getInstance().injectMouseRelease(mMouseX, mMouseY, sdlButtonToMyGUI(id));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -905,4 +905,16 @@ namespace MWInput
|
|||
{
|
||||
loadKeyDefaults(true);
|
||||
}
|
||||
|
||||
MyGUI::MouseButton InputManager::sdlButtonToMyGUI(Uint8 button)
|
||||
{
|
||||
//The right button is the second button, according to MyGUI
|
||||
if(button == SDL_BUTTON_RIGHT)
|
||||
button = SDL_BUTTON_MIDDLE;
|
||||
else if(button == SDL_BUTTON_MIDDLE)
|
||||
button = SDL_BUTTON_RIGHT;
|
||||
|
||||
//MyGUI's buttons are 0 indexed
|
||||
return MyGUI::MouseButton::Enum(button - 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,11 @@ namespace ICS
|
|||
class InputControlSystem;
|
||||
}
|
||||
|
||||
namespace MyGUI
|
||||
{
|
||||
class MouseButton;
|
||||
}
|
||||
|
||||
#include <extern/oics/ICSChannelListener.h>
|
||||
#include <extern/oics/ICSInputControlSystem.h>
|
||||
#include <extern/oics/OISCompat.h>
|
||||
|
@ -149,6 +154,7 @@ namespace MWInput
|
|||
|
||||
private:
|
||||
void adjustMouseRegion(int width, int height);
|
||||
MyGUI::MouseButton sdlButtonToMyGUI(Uint8 button);
|
||||
|
||||
void resetIdleTime();
|
||||
void updateIdleTime(float dt);
|
||||
|
|
Loading…
Reference in a new issue