- added m_swapbuttons CVAR for the Windows RawInput and DirectInput backends.

The problem I discovered is that these backends do not respect the GUI-side system setting for swapping the buttons, so this needs to be done in-application so that swapped buttons can behave the same in the menu and the game.
This commit is contained in:
Christoph Oelckers 2021-02-26 10:37:55 +01:00
parent 97de1f670b
commit feb3520ee9

View file

@ -380,9 +380,18 @@ void FMouse::WheelMoved(int axis, int wheelmove)
// //
//========================================================================== //==========================================================================
CVAR(Bool, m_swapbuttons, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
void FMouse::PostButtonEvent(int button, bool down) void FMouse::PostButtonEvent(int button, bool down)
{ {
event_t ev = { 0 }; event_t ev = { 0 };
// Neither RawInput nor DirectInput check the GUI setting for swapped mouse buttons so we have to do our own implementation...
if (m_swapbuttons && button < 2)
{
button = 1 - button;
}
int mask = 1 << button; int mask = 1 << button;
ev.data1 = KEY_MOUSE1 + button; ev.data1 = KEY_MOUSE1 + button;