From 2986daf84e7c9a7ebb08d130e9b75ad5eb5ad915 Mon Sep 17 00:00:00 2001 From: chrg6 Date: Sun, 8 Nov 2026 09:14:33 -0500 Subject: [PATCH] Follow Windows' switched mouse buttons for the mouse bindings. GetAsyncKeyState reads the physical buttons, so with "switch primary and secondary buttons" on, a left-handed player's primary button targeted and the secondary attacked, the other way round from the window's own clicks. mouse_l and mouse_r now mean the primary and secondary buttons. Co-Authored-By: Claude Opus 5.5 --- runtime/input_win.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/runtime/input_win.c b/runtime/input_win.c index a6aa1e8d..5d0e8046 100644 --- a/runtime/input_win.c +++ b/runtime/input_win.c @@ -31,8 +31,10 @@ static int key_vk(int key) { case KEY_DOWN: return VK_DOWN; case KEY_LEFT: return VK_LEFT; case KEY_RIGHT: return VK_RIGHT; - case KEY_MOUSE_L: return VK_LBUTTON; - case KEY_MOUSE_R: return VK_RBUTTON; + // GetAsyncKeyState reads the physical buttons: with Windows' "switch primary and secondary buttons" on, the + // primary (left) button is the physical right one, as the window's own WM_LBUTTONDOWN has it + case KEY_MOUSE_L: return GetSystemMetrics(SM_SWAPBUTTON) ? VK_RBUTTON : VK_LBUTTON; + case KEY_MOUSE_R: return GetSystemMetrics(SM_SWAPBUTTON) ? VK_LBUTTON : VK_RBUTTON; case KEY_MOUSE_M: return VK_MBUTTON; case KEY_MOUSE_X1: return VK_XBUTTON1; case KEY_MOUSE_X2: return VK_XBUTTON2;