summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZenWalker <[email protected]>2017-08-14 02:07:39 +0200
committerraveit65 <[email protected]>2017-08-14 08:03:54 +0200
commit6c076109eb3c0e4c0f4f197c45bf8a5d87df0db1 (patch)
tree62b831d9459a6ce5f85d1d7e645bcf4acaa8f86f
parent7f887e614812ccb86f5d784e2db58bede8daa712 (diff)
downloadmate-settings-daemon-6c076109eb3c0e4c0f4f197c45bf8a5d87df0db1.tar.bz2
mate-settings-daemon-6c076109eb3c0e4c0f4f197c45bf8a5d87df0db1.tar.xz
gtk 3.22: avoid deprecated gdk_screen_get_width/height_mm
-rw-r--r--plugins/a11y-keyboard/msd-a11y-preferences-dialog.c13
-rw-r--r--plugins/xsettings/msd-xsettings-manager.c12
2 files changed, 25 insertions, 0 deletions
diff --git a/plugins/a11y-keyboard/msd-a11y-preferences-dialog.c b/plugins/a11y-keyboard/msd-a11y-preferences-dialog.c
index 92b75c3..2dedd56 100644
--- a/plugins/a11y-keyboard/msd-a11y-preferences-dialog.c
+++ b/plugins/a11y-keyboard/msd-a11y-preferences-dialog.c
@@ -179,12 +179,25 @@ get_dpi_from_x_server (void)
double height_dpi;
gint sc_width;
gint sc_height;
+#if GTK_CHECK_VERSION (3, 22, 0)
+ GdkDisplay *display;
+ GdkMonitor *monitor;
+
+
+ display = gdk_screen_get_display (screen);
+ monitor = gdk_display_get_primary_monitor (display);
+#endif
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
diff --git a/plugins/xsettings/msd-xsettings-manager.c b/plugins/xsettings/msd-xsettings-manager.c
index c3d06dd..a548dd4 100644
--- a/plugins/xsettings/msd-xsettings-manager.c
+++ b/plugins/xsettings/msd-xsettings-manager.c
@@ -238,12 +238,24 @@ get_dpi_from_x_server (void)
if (screen != NULL) {
double width_dpi, height_dpi;
gint sc_width, sc_height;
+#if GTK_CHECK_VERSION (3, 22, 0)
+ GdkDisplay *display;
+ GdkMonitor *monitor;
+
+ display = gdk_screen_get_display (screen);
+ monitor = gdk_display_get_primary_monitor (display);
+#endif
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) {