summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/a11y-keyboard/msd-a11y-preferences-dialog.c27
-rw-r--r--plugins/xsettings/msd-xsettings-manager.c24
2 files changed, 11 insertions, 40 deletions
diff --git a/plugins/a11y-keyboard/msd-a11y-preferences-dialog.c b/plugins/a11y-keyboard/msd-a11y-preferences-dialog.c
index 2dedd56..165d5b0 100644
--- a/plugins/a11y-keyboard/msd-a11y-preferences-dialog.c
+++ b/plugins/a11y-keyboard/msd-a11y-preferences-dialog.c
@@ -29,6 +29,7 @@
#include <glib/gi18n.h>
#include <glib-object.h>
#include <gtk/gtk.h>
+#include <gdk/gdkx.h>
#include <dbus/dbus-glib.h>
@@ -177,27 +178,11 @@ get_dpi_from_x_server (void)
if (screen != NULL) {
double width_dpi;
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
+
+ Screen *xscreen = gdk_x11_screen_get_xscreen (screen);
+
+ width_dpi = dpi_from_pixels_and_mm (WidthOfScreen (xscreen), WidthMMOfScreen (xscreen));
+ height_dpi = dpi_from_pixels_and_mm (HeightOfScreen (xscreen), HeightMMOfScreen (xscreen));
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 a548dd4..a9635a8 100644
--- a/plugins/xsettings/msd-xsettings-manager.c
+++ b/plugins/xsettings/msd-xsettings-manager.c
@@ -237,25 +237,11 @@ get_dpi_from_x_server (void)
screen = gdk_screen_get_default ();
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
+
+ Screen *xscreen = gdk_x11_screen_get_xscreen (screen);
+
+ width_dpi = dpi_from_pixels_and_mm (WidthOfScreen (xscreen), WidthMMOfScreen (xscreen));
+ height_dpi = dpi_from_pixels_and_mm (HeightOfScreen (xscreen), HeightMMOfScreen (xscreen));
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) {