diff options
| author | Robert Pluim | 2018-01-24 08:53:59 +0100 |
|---|---|---|
| committer | Martin Rudalics | 2018-01-24 08:53:59 +0100 |
| commit | 2892f05792e1f52b0966f92c5ed1aa75dcdd66a3 (patch) | |
| tree | 519fe53a75493426f6a3c9335297162c85c9676f /src | |
| parent | 1fc98ed073a2d26ad941748ecb13aa6f47dd7b01 (diff) | |
| download | emacs-2892f05792e1f52b0966f92c5ed1aa75dcdd66a3.tar.gz emacs-2892f05792e1f52b0966f92c5ed1aa75dcdd66a3.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfns.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/xfns.c b/src/xfns.c index dd3b36c1330..4ea5113265b 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -4940,6 +4940,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */) | |||
| 4940 | gint width_mm = -1, height_mm = -1; | 4940 | gint width_mm = -1, height_mm = -1; |
| 4941 | GdkRectangle rec, work; | 4941 | GdkRectangle rec, work; |
| 4942 | struct MonitorInfo *mi = &monitors[i]; | 4942 | struct MonitorInfo *mi = &monitors[i]; |
| 4943 | int scale; | ||
| 4943 | 4944 | ||
| 4944 | #if GTK_CHECK_VERSION (3, 22, 0) | 4945 | #if GTK_CHECK_VERSION (3, 22, 0) |
| 4945 | GdkMonitor *monitor = gdk_display_get_monitor (gdpy, i); | 4946 | GdkMonitor *monitor = gdk_display_get_monitor (gdpy, i); |
| @@ -4985,6 +4986,16 @@ Internal use only, use `display-monitor-attributes-list' instead. */) | |||
| 4985 | } | 4986 | } |
| 4986 | #endif | 4987 | #endif |
| 4987 | 4988 | ||
| 4989 | /* GTK returns scaled sizes for the workareas. */ | ||
| 4990 | #if GTK_CHECK_VERSION (3, 22, 0) | ||
| 4991 | scale = gdk_monitor_get_scale_factor (monitor); | ||
| 4992 | #else | ||
| 4993 | scale = gdk_screen_get_monitor_scale_factor (gscreen, i); | ||
| 4994 | #endif | ||
| 4995 | rec.width *= scale; | ||
| 4996 | rec.height *= scale; | ||
| 4997 | work.width *= scale; | ||
| 4998 | work.height *= scale; | ||
| 4988 | 4999 | ||
| 4989 | mi->geom.x = rec.x; | 5000 | mi->geom.x = rec.x; |
| 4990 | mi->geom.y = rec.y; | 5001 | mi->geom.y = rec.y; |