[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 552c90e 4/5: Make scaling work (?) on pre-GTK3 syst
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] master 552c90e 4/5: Make scaling work (?) on pre-GTK3 systems |
Date: |
Mon, 17 Jul 2017 10:59:04 -0400 (EDT) |
branch: master
commit 552c90edb8cbf673b9a7d07ea39338585fce904a
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>
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.
---
src/gtkutil.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 6c9e069..dddf8b1 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. */