summaryrefslogtreecommitdiff
path: root/capplets/appearance/appearance-font.c
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2017-12-01 20:57:28 +0100
committerPablo Barciela <[email protected]>2017-12-01 21:11:06 +0100
commit65b2fdd63e4e17563cf4a5cf6d3e2835e4598108 (patch)
tree15c3016466e2bb39535ebe4986c42b484fe00db5 /capplets/appearance/appearance-font.c
parent776e33ba18ef7703d2f762034045d0b293ccb504 (diff)
downloadmate-control-center-65b2fdd63e4e17563cf4a5cf6d3e2835e4598108.tar.bz2
mate-control-center-65b2fdd63e4e17563cf4a5cf6d3e2835e4598108.tar.xz
Fixes font dpi with "org.mate.desktop.font-rendering.dpi" by default
Diffstat (limited to 'capplets/appearance/appearance-font.c')
-rw-r--r--capplets/appearance/appearance-font.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/capplets/appearance/appearance-font.c b/capplets/appearance/appearance-font.c
index 2e68508d..8012e151 100644
--- a/capplets/appearance/appearance-font.c
+++ b/capplets/appearance/appearance-font.c
@@ -27,6 +27,7 @@
#include <glib/gi18n.h>
#include <gio/gio.h>
+#include <gdk/gdkx.h>
#include "capplet-util.h"
@@ -433,14 +434,35 @@ get_dpi_from_x_server (void)
#endif
if (screen) {
double width_dpi, height_dpi;
- gint sc_width, sc_height;
+ 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)
- 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));
+ 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));