command: notify-property command

Since VOCTRL is not suitable for frequent data query
(see 477a0f8318 for details),
it's not suitable to be used by the VO clipboard backend.
Instead, since the VO does the clipboard monitoring by itself,
it can notify the player when the clipboard is updated.

This adds an internal notify-property command so that VOs
can notify player when the clipboard is updated, so that clipboard
monitoring works.
This commit is contained in:
nanahi
2024-11-22 03:27:50 -05:00
committed by Kacper Michajłow
parent 625900687e
commit 593d437dae

View File

@@ -6887,6 +6887,14 @@ static void cmd_flush_status_line(void *p)
mp_msg_flush_status_line(mpctx->log, cmd->args[0].v.b);
}
static void cmd_notify_property(void *p)
{
struct mp_cmd_ctx *cmd = p;
struct MPContext *mpctx = cmd->mpctx;
mp_notify_property(mpctx, cmd->args[0].v.s);
}
/* This array defines all known commands.
* The first field the command name used in libmpv and input.conf.
* The second field is the handler function (see mp_cmd_def.handler and
@@ -7365,6 +7373,8 @@ const struct mp_cmd_def mp_cmds[] = {
{ "flush-status-line", cmd_flush_status_line, { {"clear", OPT_BOOL(v.b)} } },
{ "notify-property", cmd_notify_property, { {"property", OPT_STRING(v.s)} } },
{0}
};