summaryrefslogtreecommitdiffstats
path: root/input/keycodes.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-02-18 21:09:35 +0100
committerwm4 <wm4@nowhere>2015-02-18 21:12:57 +0100
commit69e6e7b17cd56c2c8cffabe7230557836b92f0d0 (patch)
tree889e19385e72e1f4803a0b1ea4ae0142afed45f3 /input/keycodes.h
parentaa9804987788a0cc239403d13698cc685146122c (diff)
downloadmpv-69e6e7b17cd56c2c8cffabe7230557836b92f0d0.tar.bz2
mpv-69e6e7b17cd56c2c8cffabe7230557836b92f0d0.tar.xz
input: minor cleanup
Add MP_KEY_MOUSE_ENTER to the ignored input if the user has disabled mouse input. Remove one instance of code duplication, and add a MP_KEY_IS_MOUSE_MOVE macro to summarize events that are caused by moving the mouse.
Diffstat (limited to 'input/keycodes.h')
-rw-r--r--input/keycodes.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/input/keycodes.h b/input/keycodes.h
index 7b5027691d..7df93af6f4 100644
--- a/input/keycodes.h
+++ b/input/keycodes.h
@@ -224,13 +224,19 @@
#define MP_KEY_MOUSE_LEAVE ((MP_KEY_INTERN+2)|MP_NO_REPEAT_KEY)
#define MP_KEY_MOUSE_ENTER ((MP_KEY_INTERN+3)|MP_NO_REPEAT_KEY)
+#define MP_KEY_IS_MOUSE_CLICK(code) \
+ (MP_KEY_IS_MOUSE_BTN_SINGLE(code) || MP_KEY_IS_MOUSE_BTN_DBL(code))
+#define MP_KEY_IS_MOUSE_MOVE(code) \
+ ((code) == MP_KEY_MOUSE_MOVE || (code) == MP_KEY_MOUSE_ENTER || \
+ (code) == MP_KEY_MOUSE_LEAVE)
+
+// Whether to dispatch the key binding by current mouse position.
#define MP_KEY_DEPENDS_ON_MOUSE_POS(code) \
- (MP_KEY_IS_MOUSE_BTN_SINGLE(code) || MP_KEY_IS_MOUSE_BTN_DBL(code) || \
- (code) == MP_KEY_MOUSE_MOVE)
+ (MP_KEY_IS_MOUSE_CLICK(code) || (code) == MP_KEY_MOUSE_MOVE)
#define MP_KEY_IS_MOUSE(code) \
- (MP_KEY_DEPENDS_ON_MOUSE_POS(code) || (code) == MP_KEY_MOUSE_LEAVE)
+ (MP_KEY_IS_MOUSE_CLICK(code) || MP_KEY_IS_MOUSE_MOVE(code))
// Emit a command even on key-up (normally key-up is ignored). This means by
// default they binding will be triggered on key-up instead of key-down.