wayland-outputs: Respect the scaling-factor override

This allows someone to explicitly set a scaling factor that overrides
the computed scale for all outputs.
This commit is contained in:
Jasper St. Pierre 2015-02-22 10:40:14 -08:00
parent 94b111cf6c
commit adccbc9b7b

View File

@ -99,6 +99,18 @@ out:
return scale; return scale;
} }
static GSettings *desktop_settings;
static int
get_output_scale (MetaOutput *output)
{
int scale = g_settings_get_uint (desktop_settings, "scaling-factor");
if (scale > 0)
return scale;
else
return compute_scale (output);
}
static void static void
bind_output (struct wl_client *client, bind_output (struct wl_client *client,
void *data, void *data,
@ -146,7 +158,7 @@ bind_output (struct wl_client *client,
(int)output->crtc->current_mode->height, (int)output->crtc->current_mode->height,
(int)output->crtc->current_mode->refresh_rate); (int)output->crtc->current_mode->refresh_rate);
output->scale = compute_scale (output); output->scale = get_output_scale (output);
if (version >= WL_OUTPUT_SCALE_SINCE_VERSION) if (version >= WL_OUTPUT_SCALE_SINCE_VERSION)
wl_output_send_scale (resource, output->scale); wl_output_send_scale (resource, output->scale);
@ -283,6 +295,8 @@ meta_wayland_outputs_init (MetaWaylandCompositor *compositor)
{ {
MetaMonitorManager *monitors; MetaMonitorManager *monitors;
desktop_settings = g_settings_new ("org.gnome.desktop.interface");
monitors = meta_monitor_manager_get (); monitors = meta_monitor_manager_get ();
g_signal_connect (monitors, "monitors-changed", g_signal_connect (monitors, "monitors-changed",
G_CALLBACK (on_monitors_changed), compositor); G_CALLBACK (on_monitors_changed), compositor);