summaryrefslogtreecommitdiff
path: root/capplets/appearance
diff options
context:
space:
mode:
Diffstat (limited to 'capplets/appearance')
-rw-r--r--capplets/appearance/appearance-font.c41
1 files changed, 3 insertions, 38 deletions
diff --git a/capplets/appearance/appearance-font.c b/capplets/appearance/appearance-font.c
index 8012e151..0df8d4eb 100644
--- a/capplets/appearance/appearance-font.c
+++ b/capplets/appearance/appearance-font.c
@@ -420,53 +420,18 @@ dpi_from_pixels_and_mm (int pixels, int mm)
static double
get_dpi_from_x_server (void)
{
-#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 = 0;
- gint sc_height = 0;
-#if GTK_CHECK_VERSION (3, 22, 0)
- gint n =0;
- gint i = 0;
- GdkRectangle geometry;
-
- n = gdk_display_get_n_monitors (display);
-
- for (i = 0; i < n; ++i)
- {
- monitor = gdk_display_get_monitor (display, i);
-
- gdk_monitor_get_geometry (monitor, &geometry);
- sc_width = sc_width + geometry.width;
-
- if (geometry.height > sc_height)
- sc_height = sc_height + geometry.height;
- }
-#else
- gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL,
- &sc_width, &sc_height);
-#endif
-#if GTK_CHECK_VERSION (3, 22, 0)
Screen *xscreen = gdk_x11_screen_get_xscreen (screen);
- width_dpi = dpi_from_pixels_and_mm (sc_width, WidthMMOfScreen (xscreen));
- height_dpi = dpi_from_pixels_and_mm (sc_height, HeightMMOfScreen (xscreen));
-#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
+ 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)