DisplayConfig: Add an optional 'is_underscanning' monitor property

Add a 'is_underscanning' entry to the properties map, if the monitor
supports underscanning. The client should assume a monitor does not
support underscanning if no property was added.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
Jonas Ådahl 2017-01-23 17:59:43 +08:00
parent bc56971e18
commit 6b2a111428
4 changed files with 27 additions and 2 deletions

View File

@ -1209,6 +1209,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;
GList *k; GList *k;
current_mode = meta_monitor_get_current_mode (monitor); current_mode = meta_monitor_get_current_mode (monitor);
@ -1240,13 +1241,23 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
flags); flags);
} }
g_variant_builder_init (&properties_builder, G_VARIANT_TYPE ("a{sv}"));
if (meta_monitor_supports_underscanning (monitor))
{
gboolean is_underscanning = meta_monitor_is_underscanning (monitor);
g_variant_builder_add (&properties_builder, "{sv}",
"is_underscanning",
g_variant_new_boolean (is_underscanning));
}
g_variant_builder_add (&monitors_builder, MONITOR_FORMAT, g_variant_builder_add (&monitors_builder, MONITOR_FORMAT,
monitor_spec->connector, monitor_spec->connector,
monitor_spec->vendor, monitor_spec->vendor,
monitor_spec->product, monitor_spec->product,
monitor_spec->serial, monitor_spec->serial,
&modes_builder, &modes_builder,
NULL); &properties_builder);
} }
for (l = manager->logical_monitors; l; l = l->next) for (l = manager->logical_monitors; l; l = l->next)

View File

@ -186,6 +186,16 @@ meta_monitor_is_primary (MetaMonitor *monitor)
return output->is_primary; return output->is_primary;
} }
gboolean
meta_monitor_supports_underscanning (MetaMonitor *monitor)
{
MetaOutput *output;
output = meta_monitor_get_main_output (monitor);
return output->supports_underscanning;
}
gboolean gboolean
meta_monitor_is_underscanning (MetaMonitor *monitor) meta_monitor_is_underscanning (MetaMonitor *monitor)
{ {

View File

@ -91,6 +91,8 @@ MetaOutput * meta_monitor_get_main_output (MetaMonitor *monitor);
gboolean meta_monitor_is_primary (MetaMonitor *monitor); gboolean meta_monitor_is_primary (MetaMonitor *monitor);
gboolean meta_monitor_supports_underscanning (MetaMonitor *monitor);
gboolean meta_monitor_is_underscanning (MetaMonitor *monitor); gboolean meta_monitor_is_underscanning (MetaMonitor *monitor);
gboolean meta_monitor_is_laptop_panel (MetaMonitor *monitor); gboolean meta_monitor_is_laptop_panel (MetaMonitor *monitor);

View File

@ -313,6 +313,9 @@
* a{sv} properties: optional properties, including: * a{sv} properties: optional properties, including:
- "width_mm" (i): physical width of monitor in millimeters - "width_mm" (i): physical width of monitor in millimeters
- "height_mm" (i): physical height of monitor in millimeters - "height_mm" (i): physical height of monitor in millimeters
- "is_underscanning" (b): whether underscanning is enabled
(absence of this means underscanning
not being supported)
Possible mode flags: Possible mode flags:
1 : preferred mode 1 : preferred mode
@ -337,7 +340,6 @@
@max_screen_size represents the maximum size the screen may have, or 0x0 if no @max_screen_size represents the maximum size the screen may have, or 0x0 if no
such limit is known. such limit is known.
--> -->
<method name="GetCurrentState"> <method name="GetCurrentState">
<arg name="serial" direction="out" type="u" /> <arg name="serial" direction="out" type="u" />