summaryrefslogtreecommitdiff
path: root/capplets
diff options
context:
space:
mode:
authorZenWalker <[email protected]>2017-08-12 01:53:56 +0200
committerraveit65 <[email protected]>2017-08-15 17:20:58 +0200
commitb2c80db482ccba74a92e1bb588c9c0f4fcfc3f66 (patch)
tree8cc3c88755ec775dd680809827618eb444fbaac8 /capplets
parent061f3780a3af6224a804d239f9b9dfc5c81873f6 (diff)
downloadmate-control-center-b2c80db482ccba74a92e1bb588c9c0f4fcfc3f66.tar.bz2
mate-control-center-b2c80db482ccba74a92e1bb588c9c0f4fcfc3f66.tar.xz
appearance-font.c: avoid deprecated gdk_screen_get_width/height_mm
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)