summaryrefslogtreecommitdiff
path: root/src/ui/util.h
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-03-07 10:24:58 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-03-07 10:25:42 +0200
commit892094fa91f064e24d9017d84228f6c781add428 (patch)
tree45c21fa52f4742578947339f810e56036b306216 /src/ui/util.h
parent237ea3e1a66b792c2258eebd39e7771002c5584b (diff)
Processing per-pixel scroll events
Do platform-specific processing of scroll events up front so widgets can support both types of scrolls everywhere. IssueID #166
Diffstat (limited to 'src/ui/util.h')
-rw-r--r--src/ui/util.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ui/util.h b/src/ui/util.h
index 122cbb97..7a66ebb3 100644
--- a/src/ui/util.h
+++ b/src/ui/util.h
@@ -43,6 +43,18 @@ iLocalDef iBool isMetricsChange_UserEvent(const SDL_Event *d) {
43 return isCommand_UserEvent(d, "metrics.changed"); 43 return isCommand_UserEvent(d, "metrics.changed");
44} 44}
45 45
46enum iMouseWheelFlag {
47 perPixel_MouseWheelFlag = iBit(9), /* e.g., trackpad or finger scroll; applied to `direction` */
48};
49
50/* Note: A future version of SDL may support per-pixel scrolling, but 2.0.x doesn't. */
51iLocalDef void setPerPixel_MouseWheelEvent(SDL_MouseWheelEvent *ev, iBool set) {
52 iChangeFlags(ev->direction, perPixel_MouseWheelFlag, set);
53}
54iLocalDef iBool isPerPixel_MouseWheelEvent(const SDL_MouseWheelEvent *ev) {
55 return (ev->direction & perPixel_MouseWheelFlag) != 0;
56}
57
46#if defined (iPlatformApple) 58#if defined (iPlatformApple)
47# define KMOD_PRIMARY KMOD_GUI 59# define KMOD_PRIMARY KMOD_GUI
48# define KMOD_SECONDARY KMOD_CTRL 60# define KMOD_SECONDARY KMOD_CTRL