mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
monitor-manager: Let backend implementations handle inital config
How the initial configuration is done depends on the backend, so let them do it themself. https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
parent
0b4d80d74f
commit
ee0677a021
@ -169,6 +169,14 @@ meta_monitor_manager_dummy_read_current (MetaMonitorManager *manager)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_monitor_manager_dummy_ensure_initial_config (MetaMonitorManager *manager)
|
||||||
|
{
|
||||||
|
meta_monitor_manager_ensure_configured (manager);
|
||||||
|
|
||||||
|
meta_monitor_manager_update_logical_state_derived (manager);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_monitor_manager_dummy_apply_config (MetaMonitorManager *manager,
|
meta_monitor_manager_dummy_apply_config (MetaMonitorManager *manager,
|
||||||
MetaCrtcInfo **crtcs,
|
MetaCrtcInfo **crtcs,
|
||||||
@ -289,6 +297,7 @@ meta_monitor_manager_dummy_class_init (MetaMonitorManagerDummyClass *klass)
|
|||||||
MetaMonitorManagerClass *manager_class = META_MONITOR_MANAGER_CLASS (klass);
|
MetaMonitorManagerClass *manager_class = META_MONITOR_MANAGER_CLASS (klass);
|
||||||
|
|
||||||
manager_class->read_current = meta_monitor_manager_dummy_read_current;
|
manager_class->read_current = meta_monitor_manager_dummy_read_current;
|
||||||
|
manager_class->ensure_initial_config = meta_monitor_manager_dummy_ensure_initial_config;
|
||||||
manager_class->apply_configuration = meta_monitor_manager_dummy_apply_config;
|
manager_class->apply_configuration = meta_monitor_manager_dummy_apply_config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,6 +298,8 @@ struct _MetaMonitorManagerClass
|
|||||||
GBytes* (*read_edid) (MetaMonitorManager *,
|
GBytes* (*read_edid) (MetaMonitorManager *,
|
||||||
MetaOutput *);
|
MetaOutput *);
|
||||||
|
|
||||||
|
void (*ensure_initial_config) (MetaMonitorManager *);
|
||||||
|
|
||||||
void (*apply_configuration) (MetaMonitorManager *,
|
void (*apply_configuration) (MetaMonitorManager *,
|
||||||
MetaCrtcInfo **,
|
MetaCrtcInfo **,
|
||||||
unsigned int ,
|
unsigned int ,
|
||||||
@ -411,6 +413,10 @@ void meta_monitor_manager_tiled_monitor_added (MetaMonitorManager
|
|||||||
void meta_monitor_manager_tiled_monitor_removed (MetaMonitorManager *manager,
|
void meta_monitor_manager_tiled_monitor_removed (MetaMonitorManager *manager,
|
||||||
MetaMonitor *monitor);
|
MetaMonitor *monitor);
|
||||||
|
|
||||||
|
void meta_monitor_manager_ensure_configured (MetaMonitorManager *manager);
|
||||||
|
|
||||||
|
void meta_monitor_manager_update_logical_state_derived (MetaMonitorManager *manager);
|
||||||
|
|
||||||
void meta_monitor_manager_clear_output (MetaOutput *output);
|
void meta_monitor_manager_clear_output (MetaOutput *output);
|
||||||
void meta_monitor_manager_clear_mode (MetaCrtcMode *mode);
|
void meta_monitor_manager_clear_mode (MetaCrtcMode *mode);
|
||||||
void meta_monitor_manager_clear_crtc (MetaCrtc *crtc);
|
void meta_monitor_manager_clear_crtc (MetaCrtc *crtc);
|
||||||
|
@ -120,7 +120,7 @@ derive_monitor_position (MetaMonitor *monitor,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
make_logical_config (MetaMonitorManager *manager)
|
meta_monitor_manager_rebuild_logical_monitors_derived (MetaMonitorManager *manager)
|
||||||
{
|
{
|
||||||
GList *logical_monitors = NULL;
|
GList *logical_monitors = NULL;
|
||||||
GList *l;
|
GList *l;
|
||||||
@ -200,6 +200,12 @@ power_save_mode_changed (MetaMonitorManager *manager,
|
|||||||
manager->power_save_mode = mode;
|
manager->power_save_mode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_monitor_manager_ensure_initial_config (MetaMonitorManager *manager)
|
||||||
|
{
|
||||||
|
META_MONITOR_MANAGER_GET_CLASS (manager)->ensure_initial_config (manager);
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
meta_monitor_manager_has_hotplug_mode_update (MetaMonitorManager *manager)
|
meta_monitor_manager_has_hotplug_mode_update (MetaMonitorManager *manager)
|
||||||
{
|
{
|
||||||
@ -223,6 +229,12 @@ legacy_ensure_configured (MetaMonitorManager *manager)
|
|||||||
meta_monitor_config_make_default (manager->legacy_config, manager);
|
meta_monitor_config_make_default (manager->legacy_config, manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_monitor_manager_ensure_configured (MetaMonitorManager *manager)
|
||||||
|
{
|
||||||
|
legacy_ensure_configured (manager);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_monitor_manager_constructed (GObject *object)
|
meta_monitor_manager_constructed (GObject *object)
|
||||||
{
|
{
|
||||||
@ -237,19 +249,8 @@ meta_monitor_manager_constructed (GObject *object)
|
|||||||
|
|
||||||
meta_monitor_manager_read_current_state (manager);
|
meta_monitor_manager_read_current_state (manager);
|
||||||
|
|
||||||
legacy_ensure_configured (manager);
|
meta_monitor_manager_ensure_initial_config (manager);
|
||||||
|
|
||||||
/* Under XRandR, we don't rebuild our data structures until we see
|
|
||||||
the RRScreenNotify event, but at least at startup we want to have
|
|
||||||
the right configuration immediately.
|
|
||||||
|
|
||||||
The other backends keep the data structures always updated,
|
|
||||||
so this is not needed.
|
|
||||||
*/
|
|
||||||
if (META_IS_MONITOR_MANAGER_XRANDR (manager))
|
|
||||||
meta_monitor_manager_read_current_state (manager);
|
|
||||||
|
|
||||||
make_logical_config (manager);
|
|
||||||
initialize_dbus_interface (manager);
|
initialize_dbus_interface (manager);
|
||||||
|
|
||||||
manager->in_init = FALSE;
|
manager->in_init = FALSE;
|
||||||
@ -1533,6 +1534,15 @@ meta_monitor_manager_read_current_state (MetaMonitorManager *manager)
|
|||||||
meta_monitor_manager_free_crtc_array (old_crtcs, n_old_crtcs);
|
meta_monitor_manager_free_crtc_array (old_crtcs, n_old_crtcs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_monitor_manager_notify_monitors_changed (MetaMonitorManager *manager)
|
||||||
|
{
|
||||||
|
MetaBackend *backend = meta_get_backend ();
|
||||||
|
|
||||||
|
meta_backend_monitors_changed (backend);
|
||||||
|
g_signal_emit_by_name (manager, "monitors-changed");
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_monitor_manager_update_monitor_modes_derived (MetaMonitorManager *manager)
|
meta_monitor_manager_update_monitor_modes_derived (MetaMonitorManager *manager)
|
||||||
{
|
{
|
||||||
@ -1546,10 +1556,16 @@ meta_monitor_manager_update_monitor_modes_derived (MetaMonitorManager *manager)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_monitor_manager_update_logical_state_derived (MetaMonitorManager *manager)
|
||||||
|
{
|
||||||
|
meta_monitor_manager_rebuild_logical_monitors_derived (manager);
|
||||||
|
meta_monitor_manager_update_monitor_modes_derived (manager);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_monitor_manager_rebuild_derived (MetaMonitorManager *manager)
|
meta_monitor_manager_rebuild_derived (MetaMonitorManager *manager)
|
||||||
{
|
{
|
||||||
MetaBackend *backend = meta_get_backend ();
|
|
||||||
GList *old_logical_monitors;
|
GList *old_logical_monitors;
|
||||||
|
|
||||||
if (manager->in_init)
|
if (manager->in_init)
|
||||||
@ -1557,16 +1573,9 @@ meta_monitor_manager_rebuild_derived (MetaMonitorManager *manager)
|
|||||||
|
|
||||||
old_logical_monitors = manager->logical_monitors;
|
old_logical_monitors = manager->logical_monitors;
|
||||||
|
|
||||||
make_logical_config (manager);
|
meta_monitor_manager_update_logical_state_derived (manager);
|
||||||
meta_monitor_manager_update_monitor_modes_derived (manager);
|
|
||||||
|
|
||||||
/* Tell the backend about that the monitors changed before emitting the
|
meta_monitor_manager_notify_monitors_changed (manager);
|
||||||
* signal, so that the backend can prepare itself before all the signal
|
|
||||||
* consumers.
|
|
||||||
*/
|
|
||||||
meta_backend_monitors_changed (backend);
|
|
||||||
|
|
||||||
g_signal_emit_by_name (manager, "monitors-changed");
|
|
||||||
|
|
||||||
g_list_free_full (old_logical_monitors, g_object_unref);
|
g_list_free_full (old_logical_monitors, g_object_unref);
|
||||||
}
|
}
|
||||||
|
@ -1337,6 +1337,14 @@ set_underscan (MetaMonitorManagerKms *manager_kms,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_monitor_manager_kms_ensure_initial_config (MetaMonitorManager *manager)
|
||||||
|
{
|
||||||
|
meta_monitor_manager_ensure_configured (manager);
|
||||||
|
|
||||||
|
meta_monitor_manager_update_logical_state_derived (manager);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_monitor_manager_kms_apply_configuration (MetaMonitorManager *manager,
|
meta_monitor_manager_kms_apply_configuration (MetaMonitorManager *manager,
|
||||||
MetaCrtcInfo **crtcs,
|
MetaCrtcInfo **crtcs,
|
||||||
@ -1922,6 +1930,7 @@ meta_monitor_manager_kms_class_init (MetaMonitorManagerKmsClass *klass)
|
|||||||
|
|
||||||
manager_class->read_current = meta_monitor_manager_kms_read_current;
|
manager_class->read_current = meta_monitor_manager_kms_read_current;
|
||||||
manager_class->read_edid = meta_monitor_manager_kms_read_edid;
|
manager_class->read_edid = meta_monitor_manager_kms_read_edid;
|
||||||
|
manager_class->ensure_initial_config = meta_monitor_manager_kms_ensure_initial_config;
|
||||||
manager_class->apply_configuration = meta_monitor_manager_kms_apply_configuration;
|
manager_class->apply_configuration = meta_monitor_manager_kms_apply_configuration;
|
||||||
manager_class->set_power_save_mode = meta_monitor_manager_kms_set_power_save_mode;
|
manager_class->set_power_save_mode = meta_monitor_manager_kms_set_power_save_mode;
|
||||||
manager_class->get_crtc_gamma = meta_monitor_manager_kms_get_crtc_gamma;
|
manager_class->get_crtc_gamma = meta_monitor_manager_kms_get_crtc_gamma;
|
||||||
|
@ -1279,6 +1279,21 @@ meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager,
|
|||||||
XFlush (manager_xrandr->xdisplay);
|
XFlush (manager_xrandr->xdisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_monitor_manager_xrandr_ensure_initial_config (MetaMonitorManager *manager)
|
||||||
|
{
|
||||||
|
meta_monitor_manager_ensure_configured (manager);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Normally we don't rebuild our data structures until we see the
|
||||||
|
* RRScreenNotify event, but at least at startup we want to have the right
|
||||||
|
* configuration immediately.
|
||||||
|
*/
|
||||||
|
meta_monitor_manager_read_current_state (manager);
|
||||||
|
|
||||||
|
meta_monitor_manager_update_logical_state_derived (manager);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_monitor_manager_xrandr_change_backlight (MetaMonitorManager *manager,
|
meta_monitor_manager_xrandr_change_backlight (MetaMonitorManager *manager,
|
||||||
MetaOutput *output,
|
MetaOutput *output,
|
||||||
@ -1571,6 +1586,7 @@ meta_monitor_manager_xrandr_class_init (MetaMonitorManagerXrandrClass *klass)
|
|||||||
|
|
||||||
manager_class->read_current = meta_monitor_manager_xrandr_read_current;
|
manager_class->read_current = meta_monitor_manager_xrandr_read_current;
|
||||||
manager_class->read_edid = meta_monitor_manager_xrandr_read_edid;
|
manager_class->read_edid = meta_monitor_manager_xrandr_read_edid;
|
||||||
|
manager_class->ensure_initial_config = meta_monitor_manager_xrandr_ensure_initial_config;
|
||||||
manager_class->apply_configuration = meta_monitor_manager_xrandr_apply_configuration;
|
manager_class->apply_configuration = meta_monitor_manager_xrandr_apply_configuration;
|
||||||
manager_class->set_power_save_mode = meta_monitor_manager_xrandr_set_power_save_mode;
|
manager_class->set_power_save_mode = meta_monitor_manager_xrandr_set_power_save_mode;
|
||||||
manager_class->change_backlight = meta_monitor_manager_xrandr_change_backlight;
|
manager_class->change_backlight = meta_monitor_manager_xrandr_change_backlight;
|
||||||
|
@ -83,6 +83,14 @@ meta_monitor_manager_test_read_current (MetaMonitorManager *manager)
|
|||||||
manager->n_outputs = manager_test->test_setup->n_outputs;
|
manager->n_outputs = manager_test->test_setup->n_outputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_monitor_manager_test_ensure_initial_config (MetaMonitorManager *manager)
|
||||||
|
{
|
||||||
|
meta_monitor_manager_ensure_configured (manager);
|
||||||
|
|
||||||
|
meta_monitor_manager_update_logical_state_derived (manager);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_monitor_manager_test_apply_configuration (MetaMonitorManager *manager,
|
meta_monitor_manager_test_apply_configuration (MetaMonitorManager *manager,
|
||||||
MetaCrtcInfo **crtcs,
|
MetaCrtcInfo **crtcs,
|
||||||
@ -240,6 +248,7 @@ meta_monitor_manager_test_class_init (MetaMonitorManagerTestClass *klass)
|
|||||||
object_class->dispose = meta_monitor_manager_test_dispose;
|
object_class->dispose = meta_monitor_manager_test_dispose;
|
||||||
|
|
||||||
manager_class->read_current = meta_monitor_manager_test_read_current;
|
manager_class->read_current = meta_monitor_manager_test_read_current;
|
||||||
|
manager_class->ensure_initial_config = meta_monitor_manager_test_ensure_initial_config;
|
||||||
manager_class->apply_configuration = meta_monitor_manager_test_apply_configuration;
|
manager_class->apply_configuration = meta_monitor_manager_test_apply_configuration;
|
||||||
manager_class->tiled_monitor_added = meta_monitor_manager_test_tiled_monitor_added;
|
manager_class->tiled_monitor_added = meta_monitor_manager_test_tiled_monitor_added;
|
||||||
manager_class->tiled_monitor_removed = meta_monitor_manager_test_tiled_monitor_removed;
|
manager_class->tiled_monitor_removed = meta_monitor_manager_test_tiled_monitor_removed;
|
||||||
|
Loading…
Reference in New Issue
Block a user