summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2020-08-27 00:11:39 +0200
committerCarlos Garnacho <carlosg@gnome.org>2021-01-12 00:04:26 +0100
commit8c4bca1d2d1a641ccb1a8111b1bc90806d7c144e (patch)
treeb7f0e79c6b1a2be5664cf82825ebab46868c5c1b
parent58f7e05f5ade806a23ed8328e2bf9d465962469e (diff)
downloadgnome-settings-daemon-8c4bca1d2d1a641ccb1a8111b1bc90806d7c144e.tar.gz
xsettings: Use font aa/hinting/rgba-order settings from gsettings-desktop-schemas
Move these settings there, as they are more universal than gnome-settings-daemon.
-rw-r--r--data/org.gnome.settings-daemon.plugins.xsettings.gschema.xml.in32
-rw-r--r--meson.build2
-rw-r--r--plugins/xsettings/gsd-xsettings-manager.c66
-rw-r--r--plugins/xsettings/meson.build2
4 files changed, 63 insertions, 39 deletions
diff --git a/data/org.gnome.settings-daemon.plugins.xsettings.gschema.xml.in b/data/org.gnome.settings-daemon.plugins.xsettings.gschema.xml.in
index ce45ac67..45382f74 100644
--- a/data/org.gnome.settings-daemon.plugins.xsettings.gschema.xml.in
+++ b/data/org.gnome.settings-daemon.plugins.xsettings.gschema.xml.in
@@ -1,21 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
<schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.settings-daemon.plugins.xsettings" path="/org/gnome/settings-daemon/plugins/xsettings/">
- <key name="antialiasing" enum="org.gnome.settings-daemon.GsdFontAntialiasingMode">
- <default>'grayscale'</default>
- <summary>Antialiasing</summary>
- <description>The type of antialiasing to use when rendering fonts. Possible values are: “none” for no antialiasing, “grayscale” for standard grayscale antialiasing, and “rgba” for subpixel antialiasing (LCD screens only).</description>
- </key>
- <key name="hinting" enum="org.gnome.settings-daemon.GsdFontHinting">
- <default>'slight'</default>
- <summary>Hinting</summary>
- <description>The type of hinting to use when rendering fonts. Possible values are: “none” for no hinting and “slight” for fitting only to the Y-axis like Microsoft’s ClearType, DirectWrite and Adobe’s proprietary font rendering engine. Ignores native hinting within the font, generates hints algorithmically. Used on Ubuntu by default. Recommended. The meaning of “medium” and “full” depends on the font format (.ttf, .otf, .pfa/.pfb) and the installed version of FreeType. They usually try to fit glyphs to both the X and the Y axis (except for .otf: Y-only). This can lead to distortion and/or inconsistent rendering depending on the quality of the font, the font format and the state of FreeType’s font engines.</description>
- </key>
- <key name="rgba-order" enum="org.gnome.settings-daemon.GsdFontRgbaOrder">
- <default>'rgb'</default>
- <summary>RGBA order</summary>
- <description>The order of subpixel elements on an LCD screen; only used when antialiasing is set to “rgba”. Possible values are: “rgb” for red on left (most common), “bgr” for blue on left, “vrgb” for red on top, “vbgr” for red on bottom.</description>
- </key>
<key name="disabled-gtk-modules" type="as">
<default>[]</default>
<summary>List of explicitly disabled GTK+ modules</summary>
@@ -32,4 +17,21 @@
<description>This dictionary maps XSETTINGS names to overrides values. The values must be either strings, signed int32s or (in the case of colors), 4-tuples of uint16 (red, green, blue, alpha; 65535 is fully opaque).</description>
</key>
</schema>
+ <schema id="org.gnome.settings-daemon.plugins.xsettings.deprecated">
+ <key name="antialiasing" enum="org.gnome.settings-daemon.GsdFontAntialiasingMode">
+ <default>'grayscale'</default>
+ <summary>Antialiasing</summary>
+ <description>The type of antialiasing to use when rendering fonts. Possible values are: “none” for no antialiasing, “grayscale” for standard grayscale antialiasing, and “rgba” for subpixel antialiasing (LCD screens only).</description>
+ </key>
+ <key name="hinting" enum="org.gnome.settings-daemon.GsdFontHinting">
+ <default>'slight'</default>
+ <summary>Hinting</summary>
+ <description>The type of hinting to use when rendering fonts. Possible values are: “none” for no hinting and “slight” for fitting only to the Y-axis like Microsoft’s ClearType, DirectWrite and Adobe’s proprietary font rendering engine. Ignores native hinting within the font, generates hints algorithmically. Used on Ubuntu by default. Recommended. The meaning of “medium” and “full” depends on the font format (.ttf, .otf, .pfa/.pfb) and the installed version of FreeType. They usually try to fit glyphs to both the X and the Y axis (except for .otf: Y-only). This can lead to distortion and/or inconsistent rendering depending on the quality of the font, the font format and the state of FreeType’s font engines.</description>
+ </key>
+ <key name="rgba-order" enum="org.gnome.settings-daemon.GsdFontRgbaOrder">
+ <default>'rgb'</default>
+ <summary>RGBA order</summary>
+ <description>The order of subpixel elements on an LCD screen; only used when antialiasing is set to “rgba”. Possible values are: “rgb” for red on left (most common), “bgr” for blue on left, “vrgb” for red on top, “vbgr” for red on bottom.</description>
+ </key>
+ </schema>
</schemalist>
diff --git a/meson.build b/meson.build
index 41378a5d..bee1ff7e 100644
--- a/meson.build
+++ b/meson.build
@@ -94,7 +94,7 @@ geocode_glib_dep = dependency('geocode-glib-1.0', version: '>= 3.10.0')
gio_dep = dependency('gio-2.0', version: '>= 2.53.0')
gio_unix_dep = dependency('gio-unix-2.0')
gnome_desktop_dep = dependency('gnome-desktop-3.0', version: '>= 3.37.1')
-gsettings_desktop_dep = dependency('gsettings-desktop-schemas', version: '>= 3.35.91')
+gsettings_desktop_dep = dependency('gsettings-desktop-schemas', version: '>= 40')
gtk_dep = dependency('gtk+-3.0', version: '>= 3.15.3')
gtk_x11_dep = dependency('gtk+-x11-3.0')
gweather_dep = dependency('gweather-3.0', version: '>= 3.9.5')
diff --git a/plugins/xsettings/gsd-xsettings-manager.c b/plugins/xsettings/gsd-xsettings-manager.c
index 7b6fe439..adcdc440 100644
--- a/plugins/xsettings/gsd-xsettings-manager.c
+++ b/plugins/xsettings/gsd-xsettings-manager.c
@@ -33,6 +33,7 @@
#include <glib.h>
#include <glib/gi18n.h>
+#include <gdesktop-enums.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
@@ -42,6 +43,7 @@
#include "gsd-xsettings-manager.h"
#include "gsd-xsettings-gtk.h"
#include "gnome-settings-bus.h"
+#include "gsd-settings-migrate.h"
#include "xsettings-manager.h"
#include "fc-monitor.h"
#include "gsd-remote-display-manager.h"
@@ -66,9 +68,9 @@
#define CURSOR_SIZE_KEY "cursor-size"
#define CURSOR_THEME_KEY "cursor-theme"
-#define FONT_ANTIALIASING_KEY "antialiasing"
-#define FONT_HINTING_KEY "hinting"
-#define FONT_RGBA_ORDER_KEY "rgba-order"
+#define FONT_ANTIALIASING_KEY "font-antialiasing"
+#define FONT_HINTING_KEY "font-hinting"
+#define FONT_RGBA_ORDER_KEY "font-rgba-order"
#define GTK_SETTINGS_DBUS_PATH "/org/gtk/Settings"
#define GTK_SETTINGS_DBUS_NAME "org.gtk.Settings"
@@ -670,21 +672,21 @@ xft_settings_get (GsdXSettingsManager *manager,
GsdXftSettings *settings)
{
GSettings *interface_settings;
- GsdFontAntialiasingMode antialiasing;
- GsdFontHinting hinting;
- GsdFontRgbaOrder order;
+ GDesktopFontAntialiasingMode antialiasing;
+ GDesktopFontHinting hinting;
+ GDesktopFontRgbaOrder order;
gboolean use_rgba = FALSE;
double dpi;
int cursor_size;
interface_settings = g_hash_table_lookup (manager->settings, INTERFACE_SETTINGS_SCHEMA);
- antialiasing = g_settings_get_enum (manager->plugin_settings, FONT_ANTIALIASING_KEY);
- hinting = g_settings_get_enum (manager->plugin_settings, FONT_HINTING_KEY);
- order = g_settings_get_enum (manager->plugin_settings, FONT_RGBA_ORDER_KEY);
+ antialiasing = g_settings_get_enum (interface_settings, FONT_ANTIALIASING_KEY);
+ hinting = g_settings_get_enum (interface_settings, FONT_HINTING_KEY);
+ order = g_settings_get_enum (interface_settings, FONT_RGBA_ORDER_KEY);
- settings->antialias = (antialiasing != GSD_FONT_ANTIALIASING_MODE_NONE);
- settings->hinting = (hinting != GSD_FONT_HINTING_NONE);
+ settings->antialias = (antialiasing != G_DESKTOP_FONT_ANTIALIASING_MODE_NONE);
+ settings->hinting = (hinting != G_DESKTOP_FONT_HINTING_NONE);
settings->window_scale = get_window_scale (manager);
dpi = get_dpi_from_gsettings (manager);
settings->dpi = dpi * 1024; /* Xft wants 1/1024ths of an inch */
@@ -696,46 +698,46 @@ xft_settings_get (GsdXSettingsManager *manager,
settings->hintstyle = "hintfull";
switch (hinting) {
- case GSD_FONT_HINTING_NONE:
+ case G_DESKTOP_FONT_HINTING_NONE:
settings->hintstyle = "hintnone";
break;
- case GSD_FONT_HINTING_SLIGHT:
+ case G_DESKTOP_FONT_HINTING_SLIGHT:
settings->hintstyle = "hintslight";
break;
- case GSD_FONT_HINTING_MEDIUM:
+ case G_DESKTOP_FONT_HINTING_MEDIUM:
settings->hintstyle = "hintmedium";
break;
- case GSD_FONT_HINTING_FULL:
+ case G_DESKTOP_FONT_HINTING_FULL:
settings->hintstyle = "hintfull";
break;
}
switch (order) {
- case GSD_FONT_RGBA_ORDER_RGBA:
+ case G_DESKTOP_FONT_RGBA_ORDER_RGBA:
settings->rgba = "rgba";
break;
- case GSD_FONT_RGBA_ORDER_RGB:
+ case G_DESKTOP_FONT_RGBA_ORDER_RGB:
settings->rgba = "rgb";
break;
- case GSD_FONT_RGBA_ORDER_BGR:
+ case G_DESKTOP_FONT_RGBA_ORDER_BGR:
settings->rgba = "bgr";
break;
- case GSD_FONT_RGBA_ORDER_VRGB:
+ case G_DESKTOP_FONT_RGBA_ORDER_VRGB:
settings->rgba = "vrgb";
break;
- case GSD_FONT_RGBA_ORDER_VBGR:
+ case G_DESKTOP_FONT_RGBA_ORDER_VBGR:
settings->rgba = "vbgr";
break;
}
switch (antialiasing) {
- case GSD_FONT_ANTIALIASING_MODE_NONE:
+ case G_DESKTOP_FONT_ANTIALIASING_MODE_NONE:
settings->antialias = 0;
break;
- case GSD_FONT_ANTIALIASING_MODE_GRAYSCALE:
+ case G_DESKTOP_FONT_ANTIALIASING_MODE_GRAYSCALE:
settings->antialias = 1;
break;
- case GSD_FONT_ANTIALIASING_MODE_RGBA:
+ case G_DESKTOP_FONT_ANTIALIASING_MODE_RGBA:
settings->antialias = 1;
use_rgba = TRUE;
}
@@ -1262,6 +1264,22 @@ launch_xwayland_services (void)
}
}
+static void
+migrate_settings (void)
+{
+ GsdSettingsMigrateEntry xsettings_entries[] = {
+ { "antialiasing", "font-antialiasing", NULL },
+ { "hinting", "font-hinting", NULL },
+ { "rgba-order", "font-rgba-order", NULL },
+ };
+
+ gsd_settings_migrate_check ("org.gnome.settings-daemon.plugins.xsettings.deprecated",
+ "/org/gnome/settings-daemon/plugins/xsettings/",
+ "org.gnome.desktop.interface",
+ "/org/gnome/desktop/interface/",
+ xsettings_entries, G_N_ELEMENTS (xsettings_entries));
+}
+
gboolean
gsd_xsettings_manager_start (GsdXSettingsManager *manager,
GError **error)
@@ -1274,6 +1292,8 @@ gsd_xsettings_manager_start (GsdXSettingsManager *manager,
g_debug ("Starting xsettings manager");
gnome_settings_profile_start (NULL);
+ migrate_settings ();
+
if (!setup_xsettings_managers (manager)) {
g_set_error (error, GSD_XSETTINGS_ERROR,
GSD_XSETTINGS_ERROR_INIT,
diff --git a/plugins/xsettings/meson.build b/plugins/xsettings/meson.build
index f91b9637..b4a2b39f 100644
--- a/plugins/xsettings/meson.build
+++ b/plugins/xsettings/meson.build
@@ -14,6 +14,8 @@ sources = gsd_xsettings_gtk + fc_monitor + wm_button_layout_translation + files(
deps = plugins_deps + [
gtk_dep,
x11_dep,
+ libcommon_dep,
+ gsettings_desktop_dep,
dependency('fontconfig')
]