1
0
Fork 0

monitor-manager: Expose the privacy screen state on DBus current state

Expose each monitor state as two booleans, not to expose the whole flags

Related-to: GNOME/gnome-control-center#909
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1952>
This commit is contained in:
Marco Trevisan (Treviño) 2021-03-22 01:20:00 +01:00 committed by Marge Bot
parent f96a167aea
commit fd1f6094c9
2 changed files with 20 additions and 0 deletions

View file

@ -336,6 +336,12 @@
laptop panel (absence of this means it is
not built in)
- "display-name" (s): a human readable display name of the monitor
- "privacy-screen-state" (bb): the state of the privacy screen
(absence of this means it is not being
supported) first value indicates whether
it's enabled and second value whether it's
hardware locked (and so can't be changed
via gsettings)
Possible mode flags:
1 : preferred mode

View file

@ -1802,6 +1802,7 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
MetaMonitorSpec *monitor_spec = meta_monitor_get_spec (monitor);
MetaMonitorMode *current_mode;
MetaMonitorMode *preferred_mode;
MetaPrivacyScreenState privacy_screen_state;
GVariantBuilder modes_builder;
GVariantBuilder monitor_properties_builder;
GList *k;
@ -1901,6 +1902,19 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
"display-name",
g_variant_new_string (display_name));
privacy_screen_state = meta_monitor_get_privacy_screen_state (monitor);
if (privacy_screen_state != META_PRIVACY_SCREEN_UNAVAILABLE)
{
GVariant *state;
state = g_variant_new ("(bb)",
!!(privacy_screen_state & META_PRIVACY_SCREEN_ENABLED),
!!(privacy_screen_state & META_PRIVACY_SCREEN_LOCKED));
g_variant_builder_add (&monitor_properties_builder, "{sv}",
"privacy-screen-state", state);
}
g_variant_builder_add (&monitors_builder, MONITOR_FORMAT,
monitor_spec->connector,
monitor_spec->vendor,