monitor-manager/native: Emit privacy-screen-changed signal later

Make sure the monitor and output state is up to date when we emit the
privacy-monitor-changed signal, otherwise the signal emission code will
try to look up out of date state.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2119
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2280>
This commit is contained in:
Jonas Ådahl 2022-02-10 14:53:38 +01:00 committed by Marge Bot
parent 0f2ec1e8a7
commit 2a624dbd1e

View File

@ -507,6 +507,8 @@ on_kms_resources_changed (MetaKms *kms,
MetaKmsUpdateChanges changes, MetaKmsUpdateChanges changes,
MetaMonitorManager *manager) MetaMonitorManager *manager)
{ {
gboolean needs_emit_privacy_screen_change = FALSE;
g_assert (changes != META_KMS_UPDATE_CHANGE_NONE); g_assert (changes != META_KMS_UPDATE_CHANGE_NONE);
if (changes == META_KMS_UPDATE_CHANGE_GAMMA) if (changes == META_KMS_UPDATE_CHANGE_GAMMA)
@ -527,13 +529,17 @@ on_kms_resources_changed (MetaKms *kms,
META_PRIVACY_SCREEN_CHANGE_STATE_PENDING_HOTKEY; META_PRIVACY_SCREEN_CHANGE_STATE_PENDING_HOTKEY;
} }
meta_monitor_manager_maybe_emit_privacy_screen_change (manager); needs_emit_privacy_screen_change = TRUE;
if (changes == META_KMS_UPDATE_CHANGE_PRIVACY_SCREEN) if (changes == META_KMS_UPDATE_CHANGE_PRIVACY_SCREEN)
return; goto out;
} }
handle_hotplug_event (manager); handle_hotplug_event (manager);
out:
if (needs_emit_privacy_screen_change)
meta_monitor_manager_maybe_emit_privacy_screen_change (manager);
} }
static void static void