From 3b269ac0a04b7575a8ab1a6665d75fc0d0e8589e Mon Sep 17 00:00:00 2001 From: torque Date: Mon, 16 Feb 2015 21:50:57 -0800 Subject: input: add MOUSE_ENTER keybinding. Signed-off-by: wm4 --- input/input.c | 9 ++++++++- input/keycodes.c | 1 + input/keycodes.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) (limited to 'input') diff --git a/input/input.c b/input/input.c index ecf897a9c2..55344be779 100644 --- a/input/input.c +++ b/input/input.c @@ -463,8 +463,11 @@ 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) + if (code == MP_KEY_MOUSE_MOVE || code == MP_KEY_MOUSE_LEAVE || + code == MP_KEY_MOUSE_ENTER) + { 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); @@ -635,6 +638,10 @@ static void mp_input_feed_key(struct input_ctx *ictx, int code, double scale) update_mouse_section(ictx); mp_input_queue_cmd(ictx, get_cmd_from_keys(ictx, NULL, code)); return; + } else if (unmod == MP_KEY_MOUSE_ENTER) { + update_mouse_section(ictx); + mp_input_queue_cmd(ictx, get_cmd_from_keys(ictx, NULL, code)); + return; } double now = mp_time_sec(); // ignore system-doubleclick if we generate these events ourselves diff --git a/input/keycodes.c b/input/keycodes.c index e448a9bd31..012fd006ce 100644 --- a/input/keycodes.c +++ b/input/keycodes.c @@ -205,6 +205,7 @@ static const struct key_name key_names[] = { { MP_KEY_CLOSE_WIN, "CLOSE_WIN" }, { MP_KEY_MOUSE_MOVE, "MOUSE_MOVE" }, { MP_KEY_MOUSE_LEAVE, "MOUSE_LEAVE" }, + { MP_KEY_MOUSE_ENTER, "MOUSE_ENTER" }, { 0, NULL } }; diff --git a/input/keycodes.h b/input/keycodes.h index 3922cfca6e..7b5027691d 100644 --- a/input/keycodes.h +++ b/input/keycodes.h @@ -222,6 +222,7 @@ // Generated by input.c (VOs use mp_input_set_mouse_pos()) #define MP_KEY_MOUSE_MOVE ((MP_KEY_INTERN+1)|MP_NO_REPEAT_KEY) #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_DEPENDS_ON_MOUSE_POS(code) \ -- cgit v1.2.3