From: Lars Ingebrigtsen Date: Sun, 16 Jul 2017 15:31:54 +0000 (+0200) Subject: Make scaling work (?) on pre-GTK3 systems X-Git-Tag: emacs-26.0.90~518^2~71 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=552c90edb8cbf673b9a7d07ea39338585fce904a;p=emacs.git Make scaling work (?) on pre-GTK3 systems * src/gtkutil.c (xg_get_gdk_scale): Reinstate function. (xg_get_scale): Use it on non-GTK3 systems. --- diff --git a/src/gtkutil.c b/src/gtkutil.c index 6c9e069001e..dddf8b1c25c 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -204,13 +204,30 @@ xg_display_open (char *display_name, Display **dpy) *dpy = gdpy ? GDK_DISPLAY_XDISPLAY (gdpy) : NULL; } +static int +xg_get_gdk_scale (void) +{ + const char *sscale = getenv ("GDK_SCALE"); + + if (sscale) + { + long scale = atol (sscale); + if (0 < scale) + return min (scale, INT_MAX); + } + + return 1; +} + /* Scaling/HiDPI functions. */ int xg_get_scale (struct frame *f) { +#ifdef HAVE_GTK3 if (FRAME_GTK_WIDGET (f)) return gtk_widget_get_scale_factor (FRAME_GTK_WIDGET (f)); - return 1; +#endif + return xg_get_gdk_scale (); } /* Close display DPY. */