Commit de61da16 authored by Jonas Ådahl's avatar Jonas Ådahl

monitor-manager: Reconfigure when 'scale-monitor-framebuffer' is toggled

When the experimental feature 'scale-monitor-framebuffer' is enabled or
disabled, reconfigure the monitors.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
parent bdcb395b
......@@ -158,6 +158,8 @@ void meta_backend_monitors_changed (MetaBackend *backend);
gboolean meta_backend_is_experimental_feature_enabled (MetaBackend *backend,
MetaExperimentalFeature feature);
MetaExperimentalFeature meta_backend_get_experimental_features (MetaBackend *backend);
void meta_backend_override_experimental_features (MetaBackend *backend);
void meta_backend_enable_experimental_feature (MetaBackend *backend,
......
......@@ -479,14 +479,18 @@ mutter_settings_changed (GSettings *settings,
gchar *key,
MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
MetaExperimentalFeature old_experimental_features;
gboolean changed;
if (!g_str_equal (key, "experimental-features"))
return;
old_experimental_features = priv->experimental_features;
changed = update_experimental_features (backend);
if (changed)
g_signal_emit (backend, signals[EXPERIMENTAL_FEATURES_CHANGED], 0);
g_signal_emit (backend, signals[EXPERIMENTAL_FEATURES_CHANGED], 0,
(unsigned int) old_experimental_features);
}
gboolean
......@@ -557,7 +561,7 @@ meta_backend_class_init (MetaBackendClass *klass)
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
G_TYPE_NONE, 1, G_TYPE_UINT);
signals[UI_SCALING_FACTOR_CHANGED] =
g_signal_new ("ui-scaling-factor-changed",
G_TYPE_FROM_CLASS (object_class),
......
......@@ -520,25 +520,45 @@ done:
}
static void
experimental_features_changed (MetaBackend *backend,
MetaMonitorManager *manager)
experimental_features_changed (MetaBackend *backend,
MetaExperimentalFeature old_experimental_features,
MetaMonitorManager *manager)
{
MetaDBusDisplayConfig *skeleton = META_DBUS_DISPLAY_CONFIG (manager);
gboolean was_config_manager_enabled;
gboolean was_stage_views_scaled;
gboolean is_config_manager_enabled;
gboolean is_stage_views_scaled;
gboolean should_reconfigure = FALSE;
int ui_scaling_factor;
is_config_manager_enabled = meta_is_monitor_config_manager_enabled ();
was_config_manager_enabled =
meta_dbus_display_config_get_is_experimental_api_enabled (skeleton);
if (was_config_manager_enabled != is_config_manager_enabled)
{
meta_dbus_display_config_set_is_experimental_api_enabled (
skeleton, is_config_manager_enabled);
meta_dbus_display_config_set_is_experimental_api_enabled (
skeleton, is_config_manager_enabled);
meta_monitor_manager_on_hotplug (manager);
meta_backend_notify_ui_scaling_factor_changed (backend);
}
was_stage_views_scaled =
!!(old_experimental_features &
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER);
is_stage_views_scaled =
meta_backend_is_experimental_feature_enabled (
backend,
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER);
if (is_config_manager_enabled != was_config_manager_enabled ||
is_stage_views_scaled != was_stage_views_scaled)
should_reconfigure = TRUE;
ui_scaling_factor = meta_backend_get_ui_scaling_factor (backend);
if (should_reconfigure)
meta_monitor_manager_on_hotplug (manager);
if (ui_scaling_factor != meta_backend_get_ui_scaling_factor (backend))
meta_backend_notify_ui_scaling_factor_changed (backend);
}
static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment