input: add MP_TOUCH_RELEASE_ALL

Release all touch points. Used by some VOs like Wayland touch cancel
event.
This commit is contained in:
nanahi 2024-04-27 02:39:52 -04:00 committed by Kacper Michajłow
parent 77809faea1
commit 89aa10de24
2 changed files with 7 additions and 0 deletions

View File

@ -735,6 +735,11 @@ static void feed_key(struct input_ctx *ictx, int code, double scale,
release_down_cmd(ictx, false);
return;
}
if (code == MP_TOUCH_RELEASE_ALL) {
MP_TRACE(ictx, "release all touch\n");
ictx->num_touch_points = 0;
return;
}
if (!opts->enable_mouse_movements && MP_KEY_IS_MOUSE(unmod) && !force_mouse)
return;
if (unmod == MP_KEY_MOUSE_LEAVE || unmod == MP_KEY_MOUSE_ENTER) {

View File

@ -216,6 +216,8 @@
#define MP_KEY_ANY_UNICODE (MP_KEY_INTERN+5)
// For mp_input_put_key(): release all keys that are down.
#define MP_INPUT_RELEASE_ALL (MP_KEY_INTERN+6)
// For mp_input_put_key(): release all touch points.
#define MP_TOUCH_RELEASE_ALL (MP_KEY_INTERN+7)
// 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.