diff --git a/data/dbus-interfaces/org.gnome.Mutter.DisplayConfig.xml b/data/dbus-interfaces/org.gnome.Mutter.DisplayConfig.xml index fec38a34a..c5d97d554 100644 --- a/data/dbus-interfaces/org.gnome.Mutter.DisplayConfig.xml +++ b/data/dbus-interfaces/org.gnome.Mutter.DisplayConfig.xml @@ -393,11 +393,16 @@ Variable Refresh Rate is active (absence of this means unknown) - "is-for-lease" (b): whether the monitor is for lease or not + - "supported-color-modes" (au): list of supported color modes Possible mode flags: 1 : preferred mode 2 : current mode + Available color modes: + 0 : default + 1 : BT.2100 + @logical_monitors represent current logical monitor configuration diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c index abe1db664..c8700c66f 100644 --- a/src/backends/meta-monitor-manager.c +++ b/src/backends/meta-monitor-manager.c @@ -2002,6 +2002,23 @@ request_persistent_confirmation (MetaMonitorManager *manager) #define LOGICAL_MONITOR_FORMAT "(iidub" LOGICAL_MONITOR_MONITORS_FORMAT "a{sv})" #define LOGICAL_MONITORS_FORMAT "a" LOGICAL_MONITOR_FORMAT +static GVariant * +generate_color_modes_variant (MetaMonitor *monitor) +{ + GVariantBuilder builder; + GList *l; + + g_variant_builder_init (&builder, G_VARIANT_TYPE ("au")); + for (l = meta_monitor_get_supported_color_modes (monitor); l; l = l->next) + { + MetaColorMode color_mode = GPOINTER_TO_INT (l->data); + + g_variant_builder_add (&builder, "u", color_mode); + } + + return g_variant_builder_end (&builder); +} + static gboolean meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton, GDBusMethodInvocation *invocation, @@ -2159,6 +2176,10 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton, "is-for-lease", g_variant_new_boolean (is_for_lease)); + g_variant_builder_add (&monitor_properties_builder, "{sv}", + "supported-color-modes", + generate_color_modes_variant (monitor)); + g_variant_builder_add (&monitors_builder, MONITOR_FORMAT, monitor_spec->connector, monitor_spec->vendor, diff --git a/src/tests/gdctl/show-properties b/src/tests/gdctl/show-properties index d8c7aa03d..d341a6e77 100644 --- a/src/tests/gdctl/show-properties +++ b/src/tests/gdctl/show-properties @@ -12,10 +12,11 @@ Monitors: │ │ └──Properties: (2) │ │ ├──is-current ⇒ yes │ │ └──is-preferred ⇒ yes -│ └──Properties: (3) +│ └──Properties: (4) │ ├──is-builtin ⇒ no │ ├──display-name ⇒ MetaProduct's Inc. 14" -│ └──is-for-lease ⇒ no +│ ├──is-for-lease ⇒ no +│ └──supported-color-modes ⇒ [0] └──Monitor DP-2 (MetaProduct's Inc. 13") ├──Vendor: MetaProduct's Inc. ├──Product: MetaMonitor @@ -29,10 +30,11 @@ Monitors: │ └──Properties: (2) │ ├──is-current ⇒ yes │ └──is-preferred ⇒ yes - └──Properties: (3) + └──Properties: (4) ├──is-builtin ⇒ no ├──display-name ⇒ MetaProduct's Inc. 13" - └──is-for-lease ⇒ no + ├──is-for-lease ⇒ no + └──supported-color-modes ⇒ [0] Logical monitors: ├──Logical monitor #1 diff --git a/src/tests/gdctl/show-verbose b/src/tests/gdctl/show-verbose index c88a0a8e3..344f54a56 100644 --- a/src/tests/gdctl/show-verbose +++ b/src/tests/gdctl/show-verbose @@ -30,10 +30,11 @@ Monitors: │ │ ├──Preferred scale: 1.0 │ │ ├──Supported scales: [1.0, 1.25, 1.5, 1.7475727796554565] │ │ └──Properties: (0) -│ └──Properties: (3) +│ └──Properties: (4) │ ├──is-builtin ⇒ no │ ├──display-name ⇒ MetaProduct's Inc. 14" -│ └──is-for-lease ⇒ no +│ ├──is-for-lease ⇒ no +│ └──supported-color-modes ⇒ [0] └──Monitor DP-2 (MetaProduct's Inc. 13") ├──Vendor: MetaProduct's Inc. ├──Product: MetaMonitor @@ -65,10 +66,11 @@ Monitors: │ ├──Preferred scale: 1.0 │ ├──Supported scales: [1.0] │ └──Properties: (0) - └──Properties: (3) + └──Properties: (4) ├──is-builtin ⇒ no ├──display-name ⇒ MetaProduct's Inc. 13" - └──is-for-lease ⇒ no + ├──is-for-lease ⇒ no + └──supported-color-modes ⇒ [0] Logical monitors: ├──Logical monitor #1