DisplayConfig: Add 'properties' to GetCurrentState

Adds compositor wide DisplayConfig properties bag, and add a
"supports-mirroring" property.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
Jonas Ådahl 2017-02-07 16:03:43 +08:00
parent d050fdb17f
commit ea4438284f
2 changed files with 35 additions and 5 deletions

View File

@ -299,6 +299,15 @@ meta_monitor_manager_get_supported_scales (MetaMonitorManager *manager,
manager_class->get_supported_scales (manager, scales, n_scales); manager_class->get_supported_scales (manager, scales, n_scales);
} }
static MetaMonitorManagerCapability
meta_monitor_manager_get_capabilities (MetaMonitorManager *manager)
{
MetaMonitorManagerClass *manager_class =
META_MONITOR_MANAGER_GET_CLASS (manager);
return manager_class->get_capabilities (manager);
}
static void static void
meta_monitor_manager_ensure_initial_config (MetaMonitorManager *manager) meta_monitor_manager_ensure_initial_config (MetaMonitorManager *manager)
{ {
@ -1207,10 +1216,12 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
GVariantBuilder logical_monitors_builder; GVariantBuilder logical_monitors_builder;
GVariantBuilder supported_scales_builder; GVariantBuilder supported_scales_builder;
GVariantBuilder max_screen_size_builder; GVariantBuilder max_screen_size_builder;
GVariantBuilder properties_builder;
GList *l; GList *l;
float *supported_scales; float *supported_scales;
int n_supported_scales; int n_supported_scales;
int i; int i;
MetaMonitorManagerCapability capabilities;
g_variant_builder_init (&monitors_builder, g_variant_builder_init (&monitors_builder,
G_VARIANT_TYPE (MONITORS_FORMAT)); G_VARIANT_TYPE (MONITORS_FORMAT));
@ -1224,7 +1235,7 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
MetaMonitorMode *current_mode; MetaMonitorMode *current_mode;
MetaMonitorMode *preferred_mode; MetaMonitorMode *preferred_mode;
GVariantBuilder modes_builder; GVariantBuilder modes_builder;
GVariantBuilder properties_builder; GVariantBuilder monitor_properties_builder;
GList *k; GList *k;
current_mode = meta_monitor_get_current_mode (monitor); current_mode = meta_monitor_get_current_mode (monitor);
@ -1256,12 +1267,13 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
flags); flags);
} }
g_variant_builder_init (&properties_builder, G_VARIANT_TYPE ("a{sv}")); g_variant_builder_init (&monitor_properties_builder,
G_VARIANT_TYPE ("a{sv}"));
if (meta_monitor_supports_underscanning (monitor)) if (meta_monitor_supports_underscanning (monitor))
{ {
gboolean is_underscanning = meta_monitor_is_underscanning (monitor); gboolean is_underscanning = meta_monitor_is_underscanning (monitor);
g_variant_builder_add (&properties_builder, "{sv}", g_variant_builder_add (&monitor_properties_builder, "{sv}",
"is_underscanning", "is_underscanning",
g_variant_new_boolean (is_underscanning)); g_variant_new_boolean (is_underscanning));
} }
@ -1272,7 +1284,7 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
monitor_spec->product, monitor_spec->product,
monitor_spec->serial, monitor_spec->serial,
&modes_builder, &modes_builder,
&properties_builder); &monitor_properties_builder);
} }
for (l = manager->logical_monitors; l; l = l->next) for (l = manager->logical_monitors; l; l = l->next)
@ -1323,6 +1335,15 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
g_variant_builder_add (&max_screen_size_builder, "i", g_variant_builder_add (&max_screen_size_builder, "i",
manager->max_screen_height); manager->max_screen_height);
g_variant_builder_init (&properties_builder, G_VARIANT_TYPE ("a{sv}"));
capabilities = meta_monitor_manager_get_capabilities (manager);
if ((capabilities & META_MONITOR_MANAGER_CAPABILITY_MIRRORING) == 0)
{
g_variant_builder_add (&properties_builder, "{sv}",
"supports-mirroring",
g_variant_new_boolean (FALSE));
}
meta_dbus_display_config_complete_get_current_state ( meta_dbus_display_config_complete_get_current_state (
skeleton, skeleton,
invocation, invocation,
@ -1330,7 +1351,8 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
g_variant_builder_end (&monitors_builder), g_variant_builder_end (&monitors_builder),
g_variant_builder_end (&logical_monitors_builder), g_variant_builder_end (&logical_monitors_builder),
g_variant_builder_end (&supported_scales_builder), g_variant_builder_end (&supported_scales_builder),
g_variant_builder_end (&max_screen_size_builder)); g_variant_builder_end (&max_screen_size_builder),
g_variant_builder_end (&properties_builder));
return TRUE; return TRUE;
} }

View File

@ -298,6 +298,7 @@
@logical_monitors: current logical monitor configuration @logical_monitors: current logical monitor configuration
@supported_scales: scaling factors supported by the display server @supported_scales: scaling factors supported by the display server
@max_screen_size: the maximum screen size @max_screen_size: the maximum screen size
@properties: display configuration properties
@monitors represent connected physical monitors @monitors represent connected physical monitors
@ -345,6 +346,12 @@
@supported_scales is an ordered list of floating point numbers representing @supported_scales is an ordered list of floating point numbers representing
scale factors of logical monitors supported by the display server. scale factors of logical monitors supported by the display server.
Possible @properties are:
* "supports-mirroring" (b): FALSE if mirroring not supported; TRUE or not
present if mirroring is supported.
--> -->
<method name="GetCurrentState"> <method name="GetCurrentState">
<arg name="serial" direction="out" type="u" /> <arg name="serial" direction="out" type="u" />
@ -352,6 +359,7 @@
<arg name="logical_monitors" direction="out" type="a(iiiia(ssss)dba{sv})" /> <arg name="logical_monitors" direction="out" type="a(iiiia(ssss)dba{sv})" />
<arg name="supported_scales" direction="out" type="ad" /> <arg name="supported_scales" direction="out" type="ad" />
<arg name="max_screen_size" direction="out" type="(ii)" /> <arg name="max_screen_size" direction="out" type="(ii)" />
<arg name="properties" direction="out" type="a{sv}" />
</method> </method>
</interface> </interface>
</node> </node>