diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mac.m | 4 | ||||
-rw-r--r-- | src/win.c | 8 | ||||
-rw-r--r-- | src/x11.c | 9 |
3 files changed, 14 insertions, 7 deletions
@@ -448,7 +448,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type) rloc.x, [[NSScreen mainScreen] frame].size.height - rloc.y, getModifiers(event), - (uint32_t)[event buttonNumber] + 1, + (uint32_t)[event buttonNumber], }; PuglEvent pressEvent; @@ -469,7 +469,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type) rloc.x, [[NSScreen mainScreen] frame].size.height - rloc.y, getModifiers(event), - (uint32_t)[event buttonNumber] + 1, + (uint32_t)[event buttonNumber], }; PuglEvent releaseEvent; @@ -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); @@ -741,7 +741,14 @@ translateEvent(PuglView* const view, XEvent xevent) event.button.xRoot = xevent.xbutton.x_root; event.button.yRoot = xevent.xbutton.y_root; event.button.state = translateModifiers(xevent.xbutton.state); - event.button.button = xevent.xbutton.button; + event.button.button = xevent.xbutton.button - 1; + if (event.button.button == 1) { + event.button.button = 2; + } else if (event.button.button == 2) { + event.button.button = 1; + } else if (event.button.button >= 7) { + event.button.button -= 4; + } } break; case KeyPress: |