Skip to content

Commit

Permalink
Make setting QT_SCALE_FACTOR optional.
Browse files Browse the repository at this point in the history
When enabling org.mate.interface window-scaling-factor-qt-sync (default), m-s-d will attempt to set QT_SCALE_FACTOR during the init phase.
When disabled, the user can then choose to control this env var elsewhere.
  • Loading branch information
vkareh authored and raveit65 committed May 31, 2018
1 parent 4efc6a4 commit bbbc909
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions plugins/xsettings/msd-xsettings-manager.c
Expand Up @@ -54,6 +54,7 @@
#define CURSOR_THEME_KEY "cursor-theme" #define CURSOR_THEME_KEY "cursor-theme"
#define CURSOR_SIZE_KEY "cursor-size" #define CURSOR_SIZE_KEY "cursor-size"
#define SCALING_FACTOR_KEY "window-scaling-factor" #define SCALING_FACTOR_KEY "window-scaling-factor"
#define SCALING_FACTOR_QT_KEY "window-scaling-factor-qt-sync"


#define FONT_RENDER_SCHEMA "org.mate.font-rendering" #define FONT_RENDER_SCHEMA "org.mate.font-rendering"
#define FONT_ANTIALIASING_KEY "antialiasing" #define FONT_ANTIALIASING_KEY "antialiasing"
Expand Down Expand Up @@ -525,14 +526,18 @@ scale_change_workarounds (MateXSettingsManager *manager, int new_scale)
/* This is only useful during the Initialization phase, so we guard against /* This is only useful during the Initialization phase, so we guard against
* unnecessarily attempting to set it later. */ * unnecessarily attempting to set it later. */
if (!manager->priv->window_scale) { if (!manager->priv->window_scale) {
/* Set env variables to properly scale QT applications */ GSettings *gsettings;
if (!update_user_env_variable ("QT_AUTO_SCREEN_SCALE_FACTOR", "0", &error)) { gsettings = g_hash_table_lookup (manager->priv->gsettings, INTERFACE_SCHEMA);
g_warning ("There was a problem when setting QT_AUTO_SCREEN_SCALE_FACTOR=0: %s", error->message); /* If enabled, set env variables to properly scale QT applications */
g_clear_error (&error); if (g_settings_get_boolean (gsettings, SCALING_FACTOR_QT_KEY)) {
} if (!update_user_env_variable ("QT_AUTO_SCREEN_SCALE_FACTOR", "0", &error)) {
if (!update_user_env_variable ("QT_SCALE_FACTOR", new_scale == 2 ? "2" : "1", &error)) { g_warning ("There was a problem when setting QT_AUTO_SCREEN_SCALE_FACTOR=0: %s", error->message);
g_warning ("There was a problem when setting QT_SCALE_FACTOR=%d: %s", new_scale, error->message); g_clear_error (&error);
g_clear_error (&error); }
if (!update_user_env_variable ("QT_SCALE_FACTOR", new_scale == 2 ? "2" : "1", &error)) {
g_warning ("There was a problem when setting QT_SCALE_FACTOR=%d: %s", new_scale, error->message);
g_clear_error (&error);
}
} }
} else { } else {
/* Restart marco */ /* Restart marco */
Expand Down

0 comments on commit bbbc909

Please sign in to comment.