summaryrefslogtreecommitdiffstats
path: root/input/input.c
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/input.c
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/input.c')
-rw-r--r--input/input.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/input/input.c b/input/input.c
index 55344be779..018a76fd43 100644
--- a/input/input.c
+++ b/input/input.c
@@ -463,11 +463,8 @@ static mp_cmd_t *get_cmd_from_keys(struct input_ctx *ictx, char *force_section,
if (code == MP_KEY_CLOSE_WIN)
return mp_input_parse_cmd_strv(ictx->log, (const char*[]){"quit", 0});
int msgl = MSGL_WARN;
- if (code == MP_KEY_MOUSE_MOVE || code == MP_KEY_MOUSE_LEAVE ||
- code == MP_KEY_MOUSE_ENTER)
- {
+ if (MP_KEY_IS_MOUSE_MOVE(code))
msgl = MSGL_DEBUG;
- }
char *key_buf = mp_input_get_key_combo_name(&code, 1);
MP_MSG(ictx, msgl, "No bind found for key '%s'.\n", key_buf);
talloc_free(key_buf);
@@ -634,11 +631,7 @@ static void mp_input_feed_key(struct input_ctx *ictx, int code, double scale)
}
if (!opts->enable_mouse_movements && MP_KEY_IS_MOUSE(unmod))
return;
- if (unmod == MP_KEY_MOUSE_LEAVE) {
- update_mouse_section(ictx);
- mp_input_queue_cmd(ictx, get_cmd_from_keys(ictx, NULL, code));
- return;
- } else if (unmod == MP_KEY_MOUSE_ENTER) {
+ if (unmod == MP_KEY_MOUSE_LEAVE || unmod == MP_KEY_MOUSE_ENTER) {
update_mouse_section(ictx);
mp_input_queue_cmd(ictx, get_cmd_from_keys(ictx, NULL, code));
return;