From f4db6b8479e52476f3ee35d9f6153e251b498462 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 23 Sep 2016 20:49:08 +0200 Subject: command: make most options observable The property observation mechanism turns properties into integer IDs for fast comparison. This means if two properties get the same ID, they will receive the same notifications. Use this to make properties under options/ receive notifications. The option-property bridge marks top-level properties with the same name as the options. This still might not work in cases the C code sets values on options structs directly. --- player/command.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index afc556e3eb..eae3f7116e 100644 --- a/player/command.c +++ b/player/command.c @@ -4032,6 +4032,12 @@ static bool match_property(const char *a, const char *b) { if (strcmp(a, "*") == 0) return true; + // Give options and properties the same ID each, so change notifications + // work both way. + if (strncmp(a, "options/", 8) == 0) + a += 8; + if (strncmp(b, "options/", 8) == 0) + b += 8; int len_a = prefix_len(a); int len_b = prefix_len(b); return strncmp(a, b, MPMIN(len_a, len_b)) == 0; -- cgit v1.2.3