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:
Marco Trevisan (Treviño)
2021-08-02 18:22:46 +02:00
committed by Marge Bot
parent 4e10324a80
commit 8cf3485ab0
6 changed files with 135 additions and 4 deletions

View File

@ -35,6 +35,7 @@
#include "backends/meta-viewport-info.h"
#include "core/util-private.h"
#include "meta/display.h"
#include "meta/meta-enum-types.h"
#include "meta/meta-monitor-manager.h"
#define META_MONITOR_MANAGER_MIN_SCREEN_WIDTH 640
@ -62,6 +63,14 @@ typedef enum _MetaLogicalMonitorLayoutMode
META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL = 2
} MetaLogicalMonitorLayoutMode;
/* The source the privacy screen change has been triggered */
typedef enum
{
META_PRIVACY_SCREEN_CHANGE_STATE_NONE,
META_PRIVACY_SCREEN_CHANGE_STATE_PENDING_HOTKEY,
META_PRIVACY_SCREEN_CHANGE_STATE_PENDING_SETTING,
} MetaPrivacyScreenChangeState;
/*
* MetaCrtcAssignment:
*
@ -149,6 +158,8 @@ struct _MetaMonitorManager
GnomePnpIds *pnp_ids;
MetaMonitorSwitchConfigType current_switch_config;
MetaPrivacyScreenChangeState privacy_screen_change_state;
};
/**
@ -440,4 +451,6 @@ MetaViewportInfo * meta_monitor_manager_get_viewports (MetaMonitorManager *manag
GList * meta_monitor_manager_get_virtual_monitors (MetaMonitorManager *manager);
void meta_monitor_manager_maybe_emit_privacy_screen_change (MetaMonitorManager *manager);
#endif /* META_MONITOR_MANAGER_PRIVATE_H */