summaryrefslogtreecommitdiff
path: root/plugins/xsettings
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/xsettings')
-rw-r--r--plugins/xsettings/fontconfig-monitor.c3
-rw-r--r--plugins/xsettings/fontconfig-monitor.h1
-rw-r--r--plugins/xsettings/msd-xsettings-manager.c35
-rw-r--r--plugins/xsettings/msd-xsettings-manager.h1
-rw-r--r--plugins/xsettings/msd-xsettings-plugin.c1
-rw-r--r--plugins/xsettings/msd-xsettings-plugin.h1
-rw-r--r--plugins/xsettings/xsettings-common.c1
-rw-r--r--plugins/xsettings/xsettings-common.h1
-rw-r--r--plugins/xsettings/xsettings-manager.c7
-rw-r--r--plugins/xsettings/xsettings-manager.h9
10 files changed, 37 insertions, 23 deletions
diff --git a/plugins/xsettings/fontconfig-monitor.c b/plugins/xsettings/fontconfig-monitor.c
index ed4a5a9..a87fc0b 100644
--- a/plugins/xsettings/fontconfig-monitor.c
+++ b/plugins/xsettings/fontconfig-monitor.c
@@ -1,6 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2008 Red Hat, Inc.
+ * Copyright (C) 2012-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -73,7 +74,6 @@ monitor_files (GPtrArray *monitors,
FcStrListDone (list);
}
-
struct _fontconfig_monitor_handle {
GPtrArray *monitors;
@@ -143,7 +143,6 @@ stuff_changed (GFileMonitor *monitor G_GNUC_UNUSED,
handle->timeout = g_timeout_add_seconds (TIMEOUT_SECONDS, update, data);
}
-
fontconfig_monitor_handle_t *
fontconfig_monitor_start (GFunc notify_callback,
gpointer notify_data)
diff --git a/plugins/xsettings/fontconfig-monitor.h b/plugins/xsettings/fontconfig-monitor.h
index 22163e6..9afe3d3 100644
--- a/plugins/xsettings/fontconfig-monitor.h
+++ b/plugins/xsettings/fontconfig-monitor.h
@@ -1,6 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2008 Red Hat, Inc.
+ * Copyright (C) 2012-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/plugins/xsettings/msd-xsettings-manager.c b/plugins/xsettings/msd-xsettings-manager.c
index 33dd16d..c8199da 100644
--- a/plugins/xsettings/msd-xsettings-manager.c
+++ b/plugins/xsettings/msd-xsettings-manager.c
@@ -2,6 +2,7 @@
*
* Copyright (C) 2007 Rodrigo Moya
* Copyright (C) 2007 William Jon McCann <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -75,12 +76,17 @@
#define DPI_HIGH_REASONABLE_VALUE 500
/* The minimum resolution at which we turn on a window-scale of 2 */
-#define HIDPI_LIMIT (DPI_FALLBACK * 2)
+/* Set this to 90% of 2x DPI_FALLBACK, to catch QHD laptop screens */
+/* that are just below the 2x DPI_FALLBACK mark */
+#define HIDPI_LIMIT (DPI_FALLBACK * 2 * 90 / 100)
/* The minimum screen height at which we turn on a window-scale of 2;
* below this there just isn't enough vertical real estate for GNOME
* apps to work, and it's better to just be tiny */
-#define HIDPI_MIN_HEIGHT 1500
+#define HIDPI_MIN_HEIGHT 1440
+
+#define GPOINTER_TO_BOOLEAN(i) ((gboolean) ((GPOINTER_TO_INT(i) == 2) ? TRUE : FALSE))
+#define GBOOLEAN_TO_POINTER(i) (GINT_TO_POINTER ((i) ? 2 : 1))
typedef struct _TranslationEntry TranslationEntry;
typedef void (* TranslationFunc) (MateXSettingsManager *manager,
@@ -505,19 +511,19 @@ update_user_env_variable (const gchar *variable,
}
static gboolean
-delayed_toggle_bg_draw (gboolean value)
+delayed_toggle_bg_draw (gpointer value)
{
GSettings *settings;
settings = g_settings_new ("org.mate.background");
- g_settings_set_boolean (settings, "show-desktop-icons", value);
+ g_settings_set_boolean (settings, "show-desktop-icons", GPOINTER_TO_BOOLEAN (value));
g_object_unref (settings);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void
-scale_change_workarounds (MateXSettingsManager *manager, int new_scale)
+scale_change_workarounds (MateXSettingsManager *manager, int new_scale, int unscaled_dpi)
{
if (manager->priv->window_scale == new_scale)
return;
@@ -531,8 +537,11 @@ scale_change_workarounds (MateXSettingsManager *manager, int new_scale)
gsettings = g_hash_table_lookup (manager->priv->gsettings, INTERFACE_SCHEMA);
/* If enabled, set env variables to properly scale QT applications */
if (g_settings_get_boolean (gsettings, SCALING_FACTOR_QT_KEY)) {
- if (!update_user_env_variable ("QT_AUTO_SCREEN_SCALE_FACTOR", "0", &error)) {
- g_warning ("There was a problem when setting QT_AUTO_SCREEN_SCALE_FACTOR=0: %s", error->message);
+ char dpibuf[G_ASCII_DTOSTR_BUF_SIZE];
+ g_snprintf (dpibuf, sizeof (dpibuf), "%d", (int) (unscaled_dpi / 1024.0 + 0.5));
+
+ if (!update_user_env_variable ("QT_FONT_DPI", dpibuf, &error)) {
+ g_warning ("There was a problem when setting QT_FONT_DPI=%s: %s", dpibuf, error->message);
g_clear_error (&error);
}
if (!update_user_env_variable ("QT_SCALE_FACTOR", new_scale == 2 ? "2" : "1", &error)) {
@@ -574,8 +583,8 @@ scale_change_workarounds (MateXSettingsManager *manager, int new_scale)
desktop_settings = g_settings_new ("org.mate.background");
if (g_settings_get_boolean (desktop_settings, "show-desktop-icons")) {
/* Delay the toggle to allow enough time for the desktop to redraw */
- g_timeout_add_seconds (1, (GSourceFunc) delayed_toggle_bg_draw, (gpointer) FALSE);
- g_timeout_add_seconds (2, (GSourceFunc) delayed_toggle_bg_draw, (gpointer) TRUE);
+ g_timeout_add_seconds (1, delayed_toggle_bg_draw, GBOOLEAN_TO_POINTER (FALSE));
+ g_timeout_add_seconds (2, delayed_toggle_bg_draw, GBOOLEAN_TO_POINTER (TRUE));
}
g_object_unref (desktop_settings);
}
@@ -607,7 +616,7 @@ xft_settings_set_xsettings (MateXSettingsManager *manager,
}
mate_settings_profile_end (NULL);
- scale_change_workarounds (manager, settings->window_scale);
+ scale_change_workarounds (manager, settings->window_scale, settings->dpi);
}
static void
@@ -657,8 +666,8 @@ xft_settings_set_xresources (MateXftSettings *settings)
g_debug("xft_settings_set_xresources: orig res '%s'", add_string->str);
- update_property (add_string, "Xft.dpi",
- g_ascii_dtostr (dpibuf, sizeof (dpibuf), (double) settings->dpi / 1024.0));
+ g_snprintf (dpibuf, sizeof (dpibuf), "%d", (int) (settings->scaled_dpi / 1024.0 + 0.5));
+ update_property (add_string, "Xft.dpi", dpibuf);
update_property (add_string, "Xft.antialias",
settings->antialias ? "1" : "0");
update_property (add_string, "Xft.hinting",
diff --git a/plugins/xsettings/msd-xsettings-manager.h b/plugins/xsettings/msd-xsettings-manager.h
index 86eb32c..908982a 100644
--- a/plugins/xsettings/msd-xsettings-manager.h
+++ b/plugins/xsettings/msd-xsettings-manager.h
@@ -1,6 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2007 William Jon McCann <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/plugins/xsettings/msd-xsettings-plugin.c b/plugins/xsettings/msd-xsettings-plugin.c
index f8fede1..3a636dd 100644
--- a/plugins/xsettings/msd-xsettings-plugin.c
+++ b/plugins/xsettings/msd-xsettings-plugin.c
@@ -1,6 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2007 William Jon McCann <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/plugins/xsettings/msd-xsettings-plugin.h b/plugins/xsettings/msd-xsettings-plugin.h
index 37d4e15..76df96a 100644
--- a/plugins/xsettings/msd-xsettings-plugin.h
+++ b/plugins/xsettings/msd-xsettings-plugin.h
@@ -1,6 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2007 William Jon McCann <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/plugins/xsettings/xsettings-common.c b/plugins/xsettings/xsettings-common.c
index 8e3e04c..8e1b7e6 100644
--- a/plugins/xsettings/xsettings-common.c
+++ b/plugins/xsettings/xsettings-common.c
@@ -1,5 +1,6 @@
/*
* Copyright © 2001 Red Hat, Inc.
+ * Copyright (C) 2012-2021 MATE Developers
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
diff --git a/plugins/xsettings/xsettings-common.h b/plugins/xsettings/xsettings-common.h
index caf0e59..2165b04 100644
--- a/plugins/xsettings/xsettings-common.h
+++ b/plugins/xsettings/xsettings-common.h
@@ -1,5 +1,6 @@
/*
* Copyright © 2001 Red Hat, Inc.
+ * Copyright (C) 2012-2021 MATE Developers
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
diff --git a/plugins/xsettings/xsettings-manager.c b/plugins/xsettings/xsettings-manager.c
index 3d933d5..8bf4187 100644
--- a/plugins/xsettings/xsettings-manager.c
+++ b/plugins/xsettings/xsettings-manager.c
@@ -1,5 +1,6 @@
/*
* Copyright © 2001 Red Hat, Inc.
+ * Copyright (C) 2012-2021 MATE Developers
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@ -282,9 +283,9 @@ xsettings_manager_set_string (XSettingsManager *manager,
}
XSettingsResult
-xsettings_manager_set_color (XSettingsManager *manager,
- const char *name,
- XSettingsColor *value)
+xsettings_manager_set_color (XSettingsManager *manager,
+ const char *name,
+ const XSettingsColor *value)
{
XSettingsSetting setting;
diff --git a/plugins/xsettings/xsettings-manager.h b/plugins/xsettings/xsettings-manager.h
index 40681ae..55f674b 100644
--- a/plugins/xsettings/xsettings-manager.h
+++ b/plugins/xsettings/xsettings-manager.h
@@ -1,5 +1,6 @@
/*
* Copyright © 2001 Red Hat, Inc.
+ * Copyright (C) 2012-2021 MATE Developers
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@ -57,13 +58,11 @@ XSettingsResult xsettings_manager_set_int (XSettingsManager *manager,
XSettingsResult xsettings_manager_set_string (XSettingsManager *manager,
const char *name,
const char *value);
-XSettingsResult xsettings_manager_set_color (XSettingsManager *manager,
- const char *name,
- XSettingsColor *value);
+XSettingsResult xsettings_manager_set_color (XSettingsManager *manager,
+ const char *name,
+ const XSettingsColor *value);
XSettingsResult xsettings_manager_notify (XSettingsManager *manager);
-
-
#ifdef __cplusplus
}
#endif /* __cplusplus */