diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2020-01-10 18:54:17 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2020-01-21 14:22:24 +0300 |
commit | ca4e8b423e81f2a72cd5409d1c2c0450e12afc78 (patch) | |
tree | f6bcd8f872cb0e9845ef1efc7973ee62ca7d5713 /source/blender/windowmanager/WM_types.h | |
parent | f10d190240a135f4e26058eb49a787f9178ceb71 (diff) |
Cleanup: simplify wmEvent tablet data storage and naming
Removing meaningless distinction between NULL pointer and EVT_TABLET_NONE,
and initialize pressure and tilt to 1.0 and 0.0 respectively when no tablet
is used.
Diffstat (limited to 'source/blender/windowmanager/WM_types.h')
-rw-r--r-- | source/blender/windowmanager/WM_types.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index e9e4b7c6d12..531459298c5 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -505,6 +505,19 @@ typedef struct wmGesture { /* ************** wmEvent ************************ */ +typedef struct wmTabletData { + /** 0=EVT_TABLET_NONE, 1=EVT_TABLET_STYLUS, 2=EVT_TABLET_ERASER. */ + int active; + /** range 0.0 (not touching) to 1.0 (full pressure). */ + float pressure; + /** range 0.0 (upright) to 1.0 (tilted fully against the tablet surface). */ + float x_tilt; + /** as above. */ + float y_tilt; + /** Interpret mouse motion as absolute as typical for tablets. */ + char is_motion_absolute; +} wmTabletData; + /** * Each event should have full modifier state. * event comes from event manager and from keymap. @@ -546,10 +559,9 @@ typedef struct wmEvent { /** Set in case a #KM_PRESS went by unhandled. */ char check_click; char check_drag; - char is_motion_absolute; /** Tablet info, only use when the tablet is active. */ - const struct wmTabletData *tablet_data; + wmTabletData tablet; /* custom data */ /** Custom data type, stylus, 6dof, see wm_event_types.h */ @@ -577,18 +589,6 @@ bool WM_event_cursor_click_drag_threshold_met(const wmEvent *event); */ #define WM_EVENT_CURSOR_MOTION_THRESHOLD ((float)U.move_threshold * U.dpi_fac) -/* ************** custom wmEvent data ************** */ -typedef struct wmTabletData { - /** 0=EVT_TABLET_NONE, 1=EVT_TABLET_STYLUS, 2=EVT_TABLET_ERASER. */ - int Active; - /** range 0.0 (not touching) to 1.0 (full pressure). */ - float Pressure; - /** range 0.0 (upright) to 1.0 (tilted fully against the tablet surface). */ - float Xtilt; - /** as above. */ - float Ytilt; -} wmTabletData; - /** Motion progress, for modal handlers. */ typedef enum { P_NOT_STARTED, |