From d6022f33d64df9c0226db49bef68197473bfc598 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 8 Apr 2014 21:24:14 +0200 Subject: command: property set commands should send property change notifications Some of these property implementations already send notifications on their own, but most don't. This takes care of them. Of course this still doesn't handle all propertry changes - this is impossible without special-casing each property that can change on its own. --- player/command.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'player') diff --git a/player/command.c b/player/command.c index 127ef1e42d..9921a055f5 100644 --- a/player/command.c +++ b/player/command.c @@ -2301,10 +2301,30 @@ const struct m_option *mp_get_property_list(void) return mp_properties; } +static bool is_property_set(int action, void *val) +{ + switch (action) { + case M_PROPERTY_SET: + case M_PROPERTY_SWITCH: + case M_PROPERTY_SET_STRING: + case M_PROPERTY_SET_NODE: + return true; + case M_PROPERTY_KEY_ACTION: { + struct m_property_action_arg *key = val; + return is_property_set(key->action, key->arg); + } + default: + return false; + } +} + int mp_property_do(const char *name, int action, void *val, struct MPContext *ctx) { - return m_property_do(ctx->log, mp_properties, name, action, val, ctx); + int r = m_property_do(ctx->log, mp_properties, name, action, val, ctx); + if (r == M_PROPERTY_OK && is_property_set(action, val)) + mp_notify_property(ctx, (char *)name); + return r; } char *mp_property_expand_string(struct MPContext *mpctx, const char *str) -- cgit v1.2.3