aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-05-27 18:42:32 -0400
committerDavid Robillard <d@drobilla.net>2021-05-27 18:42:32 -0400
commit0fd60a2bc50c624ff119e8d7d28057d646955541 (patch)
treeb4311608dc5ed7940fa8fc440d4d5ce6387c6c4c /src
parente6183b3dbe6b83d642cad1dfb296083ce8c53360 (diff)
downloadpugl-0fd60a2bc50c624ff119e8d7d28057d646955541.tar.gz
pugl-0fd60a2bc50c624ff119e8d7d28057d646955541.tar.bz2
pugl-0fd60a2bc50c624ff119e8d7d28057d646955541.zip
Avoid confusing fallthrough structure
Diffstat (limited to 'src')
-rw-r--r--src/x11.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/x11.c b/src/x11.c
index c95edff..b115b21 100644
--- a/src/x11.c
+++ b/src/x11.c
@@ -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;