diff --git a/lib/platform/CMSWindowsSecondaryScreen.cpp b/lib/platform/CMSWindowsSecondaryScreen.cpp index 35b4e5d0..7e078763 100644 --- a/lib/platform/CMSWindowsSecondaryScreen.cpp +++ b/lib/platform/CMSWindowsSecondaryScreen.cpp @@ -637,6 +637,22 @@ static const UINT g_mapEF00[] = DWORD CMSWindowsSecondaryScreen::mapButton(ButtonID button, bool press) const { + // the system will swap the meaning of left/right for us if + // the user has configured a left-handed mouse but we don't + // want it to swap since we want the handedness of the + // server's mouse. so pre-swap for a left-handed mouse. + if (GetSystemMetrics(SM_SWAPBUTTON)) { + switch (button) { + case kButtonLeft: + button = kButtonRight; + break; + + case kButtonRight: + button = kButtonLeft; + break; + } + } + // map button id to button flag switch (button) { case kButtonLeft: diff --git a/lib/platform/CXWindowsSecondaryScreen.cpp b/lib/platform/CXWindowsSecondaryScreen.cpp index 801627e6..1e848887 100644 --- a/lib/platform/CXWindowsSecondaryScreen.cpp +++ b/lib/platform/CXWindowsSecondaryScreen.cpp @@ -450,7 +450,7 @@ CXWindowsSecondaryScreen::mapButton(ButtonID id) const return 0; } else { - return static_cast(id); + return static_cast(m_buttons[id - 1]); } }