[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-26 2892f05 1/2: Scale monitor dimensions obtained fr
From: |
Martin Rudalics |
Subject: |
[Emacs-diffs] emacs-26 2892f05 1/2: Scale monitor dimensions obtained from GTK |
Date: |
Wed, 24 Jan 2018 02:57:10 -0500 (EST) |
branch: emacs-26
commit 2892f05792e1f52b0966f92c5ed1aa75dcdd66a3
Author: Robert Pluim <address@hidden>
Commit: Martin Rudalics <address@hidden>
Scale monitor dimensions obtained from GTK
This is part one of a two part fix for the GTK scaling
problems. See the thread starting at
http://lists.gnu.org/archive/html/emacs-devel/2018-01/msg00372.html
for an explanation of why it has been added to Emacs 26.
* src/xfns.c (Fx_display_monitor_attributes_list): Take scaling factor
into account when using GTK to query the monitor dimensions, which
allows frameset-restore to position frames correctly.
---
src/xfns.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/xfns.c b/src/xfns.c
index dd3b36c..4ea5113 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -4940,6 +4940,7 @@ Internal use only, use `display-monitor-attributes-list'
instead. */)
gint width_mm = -1, height_mm = -1;
GdkRectangle rec, work;
struct MonitorInfo *mi = &monitors[i];
+ int scale;
#if GTK_CHECK_VERSION (3, 22, 0)
GdkMonitor *monitor = gdk_display_get_monitor (gdpy, i);
@@ -4985,6 +4986,16 @@ Internal use only, use `display-monitor-attributes-list'
instead. */)
}
#endif
+ /* GTK returns scaled sizes for the workareas. */
+#if GTK_CHECK_VERSION (3, 22, 0)
+ scale = gdk_monitor_get_scale_factor (monitor);
+#else
+ scale = gdk_screen_get_monitor_scale_factor (gscreen, i);
+#endif
+ rec.width *= scale;
+ rec.height *= scale;
+ work.width *= scale;
+ work.height *= scale;
mi->geom.x = rec.x;
mi->geom.y = rec.y;