From 6ca68635e8cef8407e91bc9542edf196ef708210 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 17 Dec 2021 10:43:11 -0500 Subject: Make button numbers consistent across platforms There's no universal consensus on how buttons are numbered. Left, right, middle as 0, 1, 2 seems to be the most common convention on modern vaguely similar libraries, so I've gone with that. The switch to zero-based indices will obviously break all current client code. Particularly since now is the time to finish any breaking changes before a stable release, I think that is better than only changing the middle and right numbers, which would likely go unnoticed. --- src/win.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/win.c') diff --git a/src/win.c b/src/win.c index eb1d0d1..c7a95d5 100644 --- a/src/win.c +++ b/src/win.c @@ -680,22 +680,22 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam) view->impl->mouseTracked = false; break; case WM_LBUTTONDOWN: - initMouseEvent(&event, view, 1, true, lParam); + initMouseEvent(&event, view, 0, true, lParam); break; case WM_MBUTTONDOWN: initMouseEvent(&event, view, 2, true, lParam); break; case WM_RBUTTONDOWN: - initMouseEvent(&event, view, 3, true, lParam); + initMouseEvent(&event, view, 1, true, lParam); break; case WM_LBUTTONUP: - initMouseEvent(&event, view, 1, false, lParam); + initMouseEvent(&event, view, 0, false, lParam); break; case WM_MBUTTONUP: initMouseEvent(&event, view, 2, false, lParam); break; case WM_RBUTTONUP: - initMouseEvent(&event, view, 3, false, lParam); + initMouseEvent(&event, view, 1, false, lParam); break; case WM_MOUSEWHEEL: initScrollEvent(&event, view, lParam); -- cgit v1.2.1