monitor-manager: Ensure monitors settings after backend has been updated
The monitors settings such as the privacy screen property is propagated to the monitors via kms updates, however during initialization and on monitors changes, we end up clearing the pending KMS updates because such settings are added to the queue before the backend has fully initialized the monitors, and this may lead to discarding all the pending updates, including the one we've just planned. To avoid this, move settings applications after we've both initialized the backend and notified it about changes. Also avoid to try set the settings during actual initialization, but delay that after post-init. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2372>
This commit is contained in:
parent
8ec8a26717
commit
c93e402a89
@ -70,6 +70,7 @@ typedef enum _MetaLogicalMonitorLayoutMode
|
||||
typedef enum
|
||||
{
|
||||
META_PRIVACY_SCREEN_CHANGE_STATE_NONE,
|
||||
META_PRIVACY_SCREEN_CHANGE_STATE_INIT,
|
||||
META_PRIVACY_SCREEN_CHANGE_STATE_PENDING_HOTKEY,
|
||||
META_PRIVACY_SCREEN_CHANGE_STATE_PENDING_SETTING,
|
||||
} MetaPrivacyScreenChangeState;
|
||||
|
@ -1080,21 +1080,25 @@ get_global_privacy_screen_state (MetaMonitorManager *manager)
|
||||
return global_state;
|
||||
}
|
||||
|
||||
static void
|
||||
apply_privacy_screen_settings (MetaMonitorManager *manager)
|
||||
static gboolean
|
||||
privacy_screen_needs_update (MetaMonitorManager *manager)
|
||||
{
|
||||
MetaSettings *settings = meta_backend_get_settings (manager->backend);
|
||||
MetaPrivacyScreenState privacy_screen_state =
|
||||
get_global_privacy_screen_state (manager);
|
||||
|
||||
if (privacy_screen_state == META_PRIVACY_SCREEN_UNAVAILABLE)
|
||||
return;
|
||||
return FALSE;
|
||||
|
||||
if (!!(privacy_screen_state & META_PRIVACY_SCREEN_ENABLED) ==
|
||||
meta_settings_is_privacy_screen_enabled (settings))
|
||||
return;
|
||||
return (!!(privacy_screen_state & META_PRIVACY_SCREEN_ENABLED) !=
|
||||
meta_settings_is_privacy_screen_enabled (settings));
|
||||
}
|
||||
|
||||
if (ensure_monitors_settings (manager))
|
||||
static void
|
||||
apply_privacy_screen_settings (MetaMonitorManager *manager)
|
||||
{
|
||||
if (privacy_screen_needs_update (manager) &&
|
||||
ensure_monitors_settings (manager))
|
||||
{
|
||||
manager->privacy_screen_change_state =
|
||||
META_PRIVACY_SCREEN_CHANGE_STATE_PENDING_SETTING;
|
||||
@ -1181,7 +1185,8 @@ meta_monitor_manager_setup (MetaMonitorManager *manager)
|
||||
|
||||
meta_monitor_manager_ensure_initial_config (manager);
|
||||
|
||||
apply_privacy_screen_settings (manager);
|
||||
if (privacy_screen_needs_update (manager))
|
||||
manager->privacy_screen_change_state = META_PRIVACY_SCREEN_CHANGE_STATE_INIT;
|
||||
|
||||
manager->in_init = FALSE;
|
||||
}
|
||||
@ -1506,7 +1511,8 @@ meta_monitor_manager_maybe_emit_privacy_screen_change (MetaMonitorManager *manag
|
||||
{
|
||||
MetaPrivacyScreenChangeState reason = manager->privacy_screen_change_state;
|
||||
|
||||
if (reason == META_PRIVACY_SCREEN_CHANGE_STATE_NONE)
|
||||
if (reason == META_PRIVACY_SCREEN_CHANGE_STATE_NONE ||
|
||||
reason == META_PRIVACY_SCREEN_CHANGE_STATE_INIT)
|
||||
return;
|
||||
|
||||
if (reason == META_PRIVACY_SCREEN_CHANGE_STATE_PENDING_HOTKEY)
|
||||
@ -3561,10 +3567,10 @@ meta_monitor_manager_rebuild (MetaMonitorManager *manager,
|
||||
|
||||
meta_monitor_manager_update_logical_state (manager, config);
|
||||
|
||||
ensure_monitors_settings (manager);
|
||||
|
||||
meta_monitor_manager_notify_monitors_changed (manager);
|
||||
|
||||
ensure_monitors_settings (manager);
|
||||
|
||||
g_list_free_full (old_logical_monitors, g_object_unref);
|
||||
}
|
||||
|
||||
@ -3840,6 +3846,15 @@ meta_monitor_manager_post_init (MetaMonitorManager *manager)
|
||||
ClutterBackend *clutter_backend;
|
||||
ClutterSeat *seat;
|
||||
|
||||
if (manager->privacy_screen_change_state ==
|
||||
META_PRIVACY_SCREEN_CHANGE_STATE_INIT)
|
||||
{
|
||||
manager->privacy_screen_change_state =
|
||||
META_PRIVACY_SCREEN_CHANGE_STATE_NONE;
|
||||
}
|
||||
|
||||
apply_privacy_screen_settings (manager);
|
||||
|
||||
clutter_backend = meta_backend_get_clutter_backend (manager->backend);
|
||||
seat = clutter_backend_get_default_seat (clutter_backend);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user