diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2015-04-03 17:21:22 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2015-04-03 17:21:22 +0300 |
commit | 53a3850a8a05249942a0c4a16060e9491456af02 (patch) | |
tree | 39d46eeeba6e5570fadf0778942f2c6f56591526 /source/blender/windowmanager/WM_types.h | |
parent | b444887054297d83c560e860219a5c598d390935 (diff) |
Sticky Keys backend
Design task: T42339
Differential Revision: D840
Initial implementation proposal: T41867
Short description:
With this we can distinguish between holding and tabbing a key. Useful
is this if we want to assign to operators to a single shortcut. If two
operators are assigned to one shortcut, we call this a sticky key.
More info is accessible through the design task and the diff.
A few people that were involved with this:
* Sean Olson for stressing me with this burden ;) - It is his enthusiasm
that pushed me forward to get this done
* Campbell and Antony for the code and design review
* Ton for the design review
* All the other people that gave feedback on the patch and helped to
make this possible
A big "Thank You" for you all!
Diffstat (limited to 'source/blender/windowmanager/WM_types.h')
-rw-r--r-- | source/blender/windowmanager/WM_types.h | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index e716cd6b779..366d3218176 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -180,9 +180,11 @@ enum { #define KM_NOTHING 0 #define KM_PRESS 1 #define KM_RELEASE 2 -#define KM_CLICK 3 -#define KM_DBL_CLICK 4 +/* clicktype */ +#define KM_CLICK 3 /* clicked key (click_time <= U.click_timeout) */ +#define KM_DBL_CLICK 4 /* double click - keep at 4 to avoid breakage with older key configs */ +#define KM_HOLD 5 /* held key (click_time > U.click_timeout) */ /* ************** UI Handler ***************** */ @@ -427,7 +429,9 @@ typedef struct wmEvent { short type; /* event code itself (short, is also in keymap) */ short val; /* press, release, scrollvalue */ + short click_type; /* click, hold or double click */ int x, y; /* mouse pointer position, screen coord */ + double click_time; /* the time since keypress started */ int mval[2]; /* region mouse position, name convention pre 2.5 :) */ char utf8_buf[6]; /* from, ghost if utf8 is enabled for the platform, * BLI_str_utf8_size() must _always_ be valid, check @@ -435,20 +439,19 @@ typedef struct wmEvent { char ascii; /* from ghost, fallback if utf8 isn't set */ char pad; - /* previous state, used for double click and the 'click' */ + bool is_key_pressed; /* is a (non-modifier) key is pressed? (keyboard, mouse, NDOF, ...) */ + + /* previous state, used for clicktype */ short prevtype; short prevval; int prevx, prevy; - double prevclicktime; + double prevclick_time; int prevclickx, prevclicky; /* modifier states */ short shift, ctrl, alt, oskey; /* oskey is apple or windowskey, value denotes order of pressed */ short keymodifier; /* rawkey modifier */ - /* set in case a KM_PRESS went by unhandled */ - short check_click; - /* keymap item, set by handler (weak?) */ const char *keymap_idname; |