mirror of
https://github.com/brl/mutter.git
synced 2025-06-14 01:09:30 +00:00
monitor-manager: Notify privacy screen changes on hotkey press
When privacy screen is changed and this happens on explicit user request (that is not a setting change) we should notify about this via an OSD. To perform this, we keep track of the reason that lead to a privacy screen change, and when we record it we try to notify the user about. When the hardware has not an explicit hotkey signal but we record a change we must still fallback to this case. Fixes: #2105 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1952>
This commit is contained in:

committed by
Marge Bot

parent
4e10324a80
commit
8cf3485ab0
@ -195,6 +195,12 @@ static void prefs_changed_callback (MetaPreference pref,
|
||||
static int mru_cmp (gconstpointer a,
|
||||
gconstpointer b);
|
||||
|
||||
static void
|
||||
meta_display_show_osd (MetaDisplay *display,
|
||||
gint monitor_idx,
|
||||
const gchar *icon_name,
|
||||
const gchar *message);
|
||||
|
||||
static void
|
||||
meta_display_get_property(GObject *object,
|
||||
guint prop_id,
|
||||
@ -655,6 +661,19 @@ on_ui_scaling_factor_changed (MetaSettings *settings,
|
||||
meta_display_reload_cursor (display);
|
||||
}
|
||||
|
||||
static void
|
||||
on_monitor_privacy_screen_changed (MetaDisplay *display,
|
||||
MetaLogicalMonitor *logical_monitor,
|
||||
gboolean enabled)
|
||||
{
|
||||
meta_display_show_osd (display,
|
||||
logical_monitor->number,
|
||||
enabled ? "screen-privacy-symbolic"
|
||||
: "screen-privacy-disabled-symbolic",
|
||||
enabled ? _("Privacy Screen Enabled")
|
||||
: _("Privacy Screen Disabled"));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_display_init_x11_display (MetaDisplay *display,
|
||||
GError **error)
|
||||
@ -863,6 +882,9 @@ meta_display_new (MetaContext *context,
|
||||
monitor_manager = meta_backend_get_monitor_manager (backend);
|
||||
g_signal_connect (monitor_manager, "monitors-changed-internal",
|
||||
G_CALLBACK (on_monitors_changed_internal), display);
|
||||
g_signal_connect_object (monitor_manager, "monitor-privacy-screen-changed",
|
||||
G_CALLBACK (on_monitor_privacy_screen_changed),
|
||||
display, G_CONNECT_SWAPPED);
|
||||
|
||||
display->pad_action_mapper = meta_pad_action_mapper_new (monitor_manager);
|
||||
|
||||
|
Reference in New Issue
Block a user