diff options
author | David Robillard <d@drobilla.net> | 2021-05-27 18:42:32 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-05-27 18:42:32 -0400 |
commit | 0fd60a2bc50c624ff119e8d7d28057d646955541 (patch) | |
tree | b4311608dc5ed7940fa8fc440d4d5ce6387c6c4c | |
parent | e6183b3dbe6b83d642cad1dfb296083ce8c53360 (diff) | |
download | pugl-0fd60a2bc50c624ff119e8d7d28057d646955541.tar.gz pugl-0fd60a2bc50c624ff119e8d7d28057d646955541.tar.bz2 pugl-0fd60a2bc50c624ff119e8d7d28057d646955541.zip |
Avoid confusing fallthrough structure
-rw-r--r-- | src/x11.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -689,7 +689,9 @@ translateEvent(PuglView* const view, XEvent xevent) } break; case ButtonPress: - if (xevent.xbutton.button >= 4 && xevent.xbutton.button <= 7) { + case ButtonRelease: + if (xevent.type == ButtonPress && xevent.xbutton.button >= 4 && + xevent.xbutton.button <= 7) { event.type = PUGL_SCROLL; event.scroll.time = (double)xevent.xbutton.time / 1e3; event.scroll.x = xevent.xbutton.x; @@ -717,11 +719,7 @@ translateEvent(PuglView* const view, XEvent xevent) event.scroll.direction = PUGL_SCROLL_RIGHT; break; } - // fallthru - } - // fallthru - case ButtonRelease: - if (xevent.xbutton.button < 4 || xevent.xbutton.button > 7) { + } else if (xevent.xbutton.button < 4 || xevent.xbutton.button > 7) { event.button.type = ((xevent.type == ButtonPress) ? PUGL_BUTTON_PRESS : PUGL_BUTTON_RELEASE); event.button.time = (double)xevent.xbutton.time / 1e3; |