diff options
Diffstat (limited to 'src/ui/util.h')
-rw-r--r-- | src/ui/util.h | 12 |
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 | ||
46 | enum 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. */ | ||
51 | iLocalDef void setPerPixel_MouseWheelEvent(SDL_MouseWheelEvent *ev, iBool set) { | ||
52 | iChangeFlags(ev->direction, perPixel_MouseWheelFlag, set); | ||
53 | } | ||
54 | iLocalDef 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 |