1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-07 06:37:46 +00:00

input: be stricter about rejecting mouse input with --no-input-cursor

Apparently this switch means all mouse input should be strictly
rejected. Some VO backends (such as X11) explicitly disable all mouse
events if this option is set, but others don't. So check them in
input.c, which increases consistency.
This commit is contained in:
wm4 2014-07-27 22:00:55 +02:00
parent 4c533fbb16
commit 58255e0e2b
2 changed files with 5 additions and 0 deletions

View File

@ -692,6 +692,8 @@ static void mp_input_feed_key(struct input_ctx *ictx, int code, double scale)
release_down_cmd(ictx, false);
return;
}
if (!ictx->opts->enable_mouse_movements && MP_KEY_IS_MOUSE(unmod))
return;
if (unmod == MP_KEY_MOUSE_LEAVE) {
update_mouse_section(ictx);
struct mp_cmd *cmd = get_cmd_from_keys(ictx, NULL, code);

View File

@ -222,6 +222,9 @@
(MP_KEY_IS_MOUSE_BTN_SINGLE(code) || MP_KEY_IS_MOUSE_BTN_DBL(code) || \
(code) == MP_KEY_MOUSE_MOVE)
#define MP_KEY_IS_MOUSE(code) \
(MP_KEY_DEPENDS_ON_MOUSE_POS(code) || (code) == MP_KEY_MOUSE_LEAVE)
// 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.
// This is a fixed part of the keycode, not a modifier than can change.