monitor-manager: Add supported scales to D-Bus API

Let the configuring client know what scales are supported by the
display server.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
Jonas Ådahl 2017-01-26 17:15:52 +08:00
parent 9e8ee491e6
commit 9003a42df3
2 changed files with 29 additions and 0 deletions

View File

@ -288,6 +288,17 @@ meta_monitor_manager_calculate_monitor_mode_scale (MetaMonitorManager *manager,
monitor_mode);
}
static void
meta_monitor_manager_get_supported_scales (MetaMonitorManager *manager,
float **scales,
int *n_scales)
{
MetaMonitorManagerClass *manager_class =
META_MONITOR_MANAGER_GET_CLASS (manager);
manager_class->get_supported_scales (manager, scales, n_scales);
}
static void
meta_monitor_manager_ensure_initial_config (MetaMonitorManager *manager)
{
@ -1194,8 +1205,12 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
MetaMonitorManager *manager = META_MONITOR_MANAGER (skeleton);
GVariantBuilder monitors_builder;
GVariantBuilder logical_monitors_builder;
GVariantBuilder supported_scales_builder;
GVariantBuilder max_screen_size_builder;
GList *l;
float *supported_scales;
int n_supported_scales;
int i;
g_variant_builder_init (&monitors_builder,
G_VARIANT_TYPE (MONITORS_FORMAT));
@ -1294,6 +1309,13 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
NULL);
}
g_variant_builder_init (&supported_scales_builder, G_VARIANT_TYPE ("ad"));
meta_monitor_manager_get_supported_scales (manager,
&supported_scales,
&n_supported_scales);
for (i = 0; i < n_supported_scales; i++)
g_variant_builder_add (&supported_scales_builder, "d", supported_scales[i]);
g_variant_builder_init (&max_screen_size_builder,
G_VARIANT_TYPE ("(ii)"));
g_variant_builder_add (&max_screen_size_builder, "i",
@ -1307,6 +1329,7 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
manager->serial,
g_variant_builder_end (&monitors_builder),
g_variant_builder_end (&logical_monitors_builder),
g_variant_builder_end (&supported_scales_builder),
g_variant_builder_end (&max_screen_size_builder));
return TRUE;

View File

@ -296,6 +296,7 @@
@serial: configuration serial
@monitors: available monitors
@logical_monitors: current logical monitor configuration
@supported_scales: scaling factors supported by the display server
@max_screen_size: the maximum screen size
@monitors represent connected physical monitors
@ -340,11 +341,16 @@
@max_screen_size represents the maximum size the screen may have, or 0x0 if no
such limit is known.
@supported_scales is an ordered list of floating point numbers representing
scale factors of logical monitors supported by the display server.
-->
<method name="GetCurrentState">
<arg name="serial" direction="out" type="u" />
<arg name="monitors" direction="out" type="a((ssss)a(iiddu)a{sv})" />
<arg name="logical_monitors" direction="out" type="a(iiiia(ssss)dba{sv})" />
<arg name="supported_scales" direction="out" type="ad" />
<arg name="max_screen_size" direction="out" type="(ii)" />
</method>
</interface>