mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-22 10:57:08 +00:00
input: mark mouse and touch position update in mp_cmd
This makes it possible to distinguish these dummy commands for position update notification from other commands.
This commit is contained in:
@@ -113,6 +113,7 @@ typedef struct mp_cmd {
|
|||||||
bool is_mouse_button : 1;
|
bool is_mouse_button : 1;
|
||||||
bool repeated : 1;
|
bool repeated : 1;
|
||||||
bool mouse_move : 1;
|
bool mouse_move : 1;
|
||||||
|
bool notify_event : 1;
|
||||||
bool canceled : 1;
|
bool canceled : 1;
|
||||||
bool coalesce : 1;
|
bool coalesce : 1;
|
||||||
int mouse_x, mouse_y;
|
int mouse_x, mouse_y;
|
||||||
|
|||||||
@@ -775,6 +775,8 @@ static void feed_key(struct input_ctx *ictx, int code, double scale,
|
|||||||
mp_cmd_t *cmd = get_cmd_from_keys(ictx, (bstr){0}, code);
|
mp_cmd_t *cmd = get_cmd_from_keys(ictx, (bstr){0}, code);
|
||||||
if (!cmd) // queue dummy cmd so that mouse-pos can notify observers
|
if (!cmd) // queue dummy cmd so that mouse-pos can notify observers
|
||||||
cmd = mp_input_parse_cmd(ictx, bstr0("ignore"), "<internal>");
|
cmd = mp_input_parse_cmd(ictx, bstr0("ignore"), "<internal>");
|
||||||
|
if (cmd)
|
||||||
|
cmd->notify_event = true;
|
||||||
queue_cmd(ictx, cmd);
|
queue_cmd(ictx, cmd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -921,6 +923,7 @@ static void set_mouse_pos(struct input_ctx *ictx, int x, int y, bool quiet)
|
|||||||
|
|
||||||
if (cmd) {
|
if (cmd) {
|
||||||
cmd->mouse_move = true;
|
cmd->mouse_move = true;
|
||||||
|
cmd->notify_event = true;
|
||||||
cmd->mouse_x = x;
|
cmd->mouse_x = x;
|
||||||
cmd->mouse_y = y;
|
cmd->mouse_y = y;
|
||||||
if (should_drop_cmd(ictx, cmd)) {
|
if (should_drop_cmd(ictx, cmd)) {
|
||||||
@@ -981,6 +984,8 @@ static void notify_touch_update(struct input_ctx *ictx)
|
|||||||
{
|
{
|
||||||
// queue dummy cmd so that touch-pos can notify observers
|
// queue dummy cmd so that touch-pos can notify observers
|
||||||
mp_cmd_t *cmd = mp_input_parse_cmd(ictx, bstr0("ignore"), "<internal>");
|
mp_cmd_t *cmd = mp_input_parse_cmd(ictx, bstr0("ignore"), "<internal>");
|
||||||
|
if (cmd)
|
||||||
|
cmd->notify_event = true;
|
||||||
queue_cmd(ictx, cmd);
|
queue_cmd(ictx, cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user