summaryrefslogtreecommitdiff
path: root/capplets
diff options
context:
space:
mode:
Diffstat (limited to 'capplets')
-rw-r--r--capplets/appearance/appearance-font.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/capplets/appearance/appearance-font.c b/capplets/appearance/appearance-font.c
index f47504f3..2e68508d 100644
--- a/capplets/appearance/appearance-font.c
+++ b/capplets/appearance/appearance-font.c
@@ -419,10 +419,18 @@ dpi_from_pixels_and_mm (int pixels, int mm)
static double
get_dpi_from_x_server (void)
{
- GdkScreen *screen;
+#if GTK_CHECK_VERSION (3, 22, 0)
+ GdkDisplay *display;
+ GdkMonitor *monitor;
+#endif
+ GdkScreen *screen;
double dpi;
screen = gdk_screen_get_default ();
+#if GTK_CHECK_VERSION (3, 22, 0)
+ display = gdk_screen_get_display (screen);
+ monitor = gdk_display_get_primary_monitor (display);
+#endif
if (screen) {
double width_dpi, height_dpi;
gint sc_width, sc_height;
@@ -430,8 +438,13 @@ get_dpi_from_x_server (void)
gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL,
&sc_width, &sc_height);
+#if GTK_CHECK_VERSION (3, 22, 0)
+ width_dpi = dpi_from_pixels_and_mm (sc_width, gdk_monitor_get_width_mm (monitor));
+ height_dpi = dpi_from_pixels_and_mm (sc_height, gdk_monitor_get_height_mm (monitor));
+#else
width_dpi = dpi_from_pixels_and_mm (sc_width, gdk_screen_get_width_mm (screen));
height_dpi = dpi_from_pixels_and_mm (sc_height, gdk_screen_get_height_mm (screen));
+#endif
if (width_dpi < DPI_LOW_REASONABLE_VALUE || width_dpi > DPI_HIGH_REASONABLE_VALUE ||
height_dpi < DPI_LOW_REASONABLE_VALUE || height_dpi > DPI_HIGH_REASONABLE_VALUE)