Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-03-06 09:24:12 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-03-06 09:31:28 +0300
commit5be0e3430d13341feddee739997130239daf71d5 (patch)
treeb8af4c1d47d40425d0703883f8efdc0c297e37ea /source/blender/windowmanager/intern/wm_keymap.c
parent73ef27f15611ccb254816e199f8c74103b3d5172 (diff)
GHOST/Keymap: support for detecting repeat events
- Keymap items now have 'repeat' boolean which can be set to make keymap items respond to key repeat events or not. - Support for X11 & WIN32 (not macOS currently). This allows for the possibility to perform actions while a key is held and finish the action upon release. Thanks to @Severin for review and WIN32 support.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_keymap.c')
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 68a12fa4272..bbe685b56cb 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -180,7 +180,9 @@ static bool wm_keymap_item_equals(wmKeyMapItem *a, wmKeyMapItem *b)
{
return (wm_keymap_item_equals_result(a, b) && a->type == b->type && a->val == b->val &&
a->shift == b->shift && a->ctrl == b->ctrl && a->alt == b->alt && a->oskey == b->oskey &&
- a->keymodifier == b->keymodifier && a->maptype == b->maptype);
+ a->keymodifier == b->keymodifier && a->maptype == b->maptype &&
+ ((ISKEYBOARD(a->type) == 0) ||
+ (a->flag & KMI_REPEAT_IGNORE) == (b->flag & KMI_REPEAT_IGNORE)));
}
/* properties can be NULL, otherwise the arg passed is used and ownership is given to the kmi */
@@ -2012,6 +2014,7 @@ void WM_keymap_item_restore_to_default(bContext *C, wmKeyMap *keymap, wmKeyMapIt
kmi->oskey = orig->oskey;
kmi->keymodifier = orig->keymodifier;
kmi->maptype = orig->maptype;
+ kmi->flag = (kmi->flag & ~KMI_REPEAT_IGNORE) | (orig->flag & KMI_REPEAT_IGNORE);
WM_keyconfig_update_tag(keymap, kmi);
}