summaryrefslogtreecommitdiff
path: root/plugins/xsettings/msd-xsettings-manager.c
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2018-01-25 20:05:18 -0500
committerMartin Wimpress <[email protected]>2018-01-26 01:05:18 +0000
commiteaad50f7624c8946e57ca075f8b7e383b1715bcc (patch)
treedec5148045765ee369fbec58e19bee094d46b869 /plugins/xsettings/msd-xsettings-manager.c
parent6ce8e3732215cc813597496001fa23b37f3d5bf3 (diff)
downloadmate-settings-daemon-eaad50f7624c8946e57ca075f8b7e383b1715bcc.tar.bz2
mate-settings-daemon-eaad50f7624c8946e57ca075f8b7e383b1715bcc.tar.xz
Add support for HiDPI displays (#208)
* Support font size and mouse cursor auto-scaling for HiDPI displays * Fix where DPI is getting scaled * Remove ceil for scaled DPI
Diffstat (limited to 'plugins/xsettings/msd-xsettings-manager.c')
-rw-r--r--plugins/xsettings/msd-xsettings-manager.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/xsettings/msd-xsettings-manager.c b/plugins/xsettings/msd-xsettings-manager.c
index 8016abb..9105088 100644
--- a/plugins/xsettings/msd-xsettings-manager.c
+++ b/plugins/xsettings/msd-xsettings-manager.c
@@ -232,6 +232,7 @@ get_dpi_from_x_server (void)
{
GdkScreen *screen;
double dpi;
+ gint scale;
screen = gdk_screen_get_default ();
if (screen != NULL) {
@@ -254,6 +255,11 @@ get_dpi_from_x_server (void)
dpi = DPI_FALLBACK;
}
+
+ scale = gdk_window_get_scale_factor (gdk_screen_get_root_window (screen));
+ if (scale)
+ dpi = dpi * scale;
+
return dpi;
}
@@ -301,24 +307,28 @@ xft_settings_get (MateXSettingsManager *manager,
MateXftSettings *settings)
{
GSettings *mouse_gsettings;
+ GdkScreen *screen;
char *antialiasing;
char *hinting;
char *rgba_order;
double dpi;
+ gint scale;
mouse_gsettings = g_hash_table_lookup (manager->priv->gsettings, MOUSE_SCHEMA);
+ screen = gdk_screen_get_default();
antialiasing = g_settings_get_string (manager->priv->gsettings_font, FONT_ANTIALIASING_KEY);
hinting = g_settings_get_string (manager->priv->gsettings_font, FONT_HINTING_KEY);
rgba_order = g_settings_get_string (manager->priv->gsettings_font, FONT_RGBA_ORDER_KEY);
dpi = get_dpi_from_gsettings_or_x_server (manager->priv->gsettings_font);
+ scale = gdk_window_get_scale_factor (gdk_screen_get_root_window (screen));
settings->antialias = TRUE;
settings->hinting = TRUE;
settings->hintstyle = "hintslight";
settings->dpi = dpi * 1024; /* Xft wants 1/1024ths of an inch */
settings->cursor_theme = g_settings_get_string (mouse_gsettings, CURSOR_THEME_KEY);
- settings->cursor_size = g_settings_get_int (mouse_gsettings, CURSOR_SIZE_KEY);
+ settings->cursor_size = scale * g_settings_get_int (mouse_gsettings, CURSOR_SIZE_KEY);
settings->rgba = "rgb";
if (rgba_order) {