monitor-manager: Clean up hot-plug paths slightly

Make the API used more shared and better named.

meta_monitor_manager_on_hotplug() was renamed
meta_monitor_manager_reconfigure(), and meta_monitor_manager_reload()
was introduced to combine reading the current state and reconfiguring.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1689>
This commit is contained in:
Jonas Ådahl 2021-01-25 21:10:53 +01:00 committed by Marge Bot
parent e48be709f8
commit 432682f305
5 changed files with 15 additions and 9 deletions

View File

@ -325,11 +325,12 @@ void meta_monitor_manager_confirm_configuration (MetaMonitorManag
gboolean meta_monitor_manager_has_hotplug_mode_update (MetaMonitorManager *manager);
META_EXPORT_TEST
void meta_monitor_manager_read_current_state (MetaMonitorManager *manager);
void meta_monitor_manager_reconfigure (MetaMonitorManager *manager);
META_EXPORT_TEST
void meta_monitor_manager_on_hotplug (MetaMonitorManager *manager);
void meta_monitor_manager_reload (MetaMonitorManager *manager);
gboolean meta_monitor_manager_get_monitor_matrix (MetaMonitorManager *manager,
MetaMonitor *monitor,

View File

@ -809,7 +809,7 @@ experimental_features_changed (MetaSettings *settings,
should_reconfigure = TRUE;
if (should_reconfigure)
meta_monitor_manager_on_hotplug (manager);
meta_monitor_manager_reconfigure (manager);
meta_settings_update_ui_scaling_factor (settings);
}
@ -3098,11 +3098,18 @@ meta_monitor_manager_rebuild_derived (MetaMonitorManager *manager,
}
void
meta_monitor_manager_on_hotplug (MetaMonitorManager *manager)
meta_monitor_manager_reconfigure (MetaMonitorManager *manager)
{
meta_monitor_manager_ensure_configured (manager);
}
void
meta_monitor_manager_reload (MetaMonitorManager *manager)
{
meta_monitor_manager_read_current_state (manager);
meta_monitor_manager_reconfigure (manager);
}
static gboolean
calculate_viewport_matrix (MetaMonitorManager *manager,
MetaLogicalMonitor *logical_monitor,

View File

@ -463,8 +463,7 @@ meta_monitor_manager_kms_set_crtc_gamma (MetaMonitorManager *manager,
static void
handle_hotplug_event (MetaMonitorManager *manager)
{
meta_monitor_manager_read_current_state (manager);
meta_monitor_manager_on_hotplug (manager);
meta_monitor_manager_reload (manager);
}
static void

View File

@ -1126,7 +1126,7 @@ meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xra
manager_xrandr->last_xrandr_set_timestamp);
if (is_hotplug)
{
meta_monitor_manager_on_hotplug (manager);
meta_monitor_manager_reconfigure (manager);
}
else
{

View File

@ -63,8 +63,7 @@ meta_monitor_manager_test_emulate_hotplug (MetaMonitorManagerTest *manager_test,
old_test_setup = manager_test->test_setup;
manager_test->test_setup = test_setup;
meta_monitor_manager_read_current_state (manager);
meta_monitor_manager_on_hotplug (manager);
meta_monitor_manager_reload (manager);
g_free (old_test_setup);
}