summaryrefslogtreecommitdiff
path: root/src/gtkutil.c
diff options
context:
space:
mode:
authorRobert Pluim <rpluim@gmail.com>2018-01-24 08:55:34 +0100
committerMartin Rudalics <rudalics@gmx.at>2018-01-24 08:55:34 +0100
commit59db8dca030ba6a34d143c3cc6715f02beba1068 (patch)
treef27726034b2bc43dcad5d3524f064a0a4ec8e79e /src/gtkutil.c
parent2892f05792e1f52b0966f92c5ed1aa75dcdd66a3 (diff)
downloademacs-59db8dca030ba6a34d143c3cc6715f02beba1068.tar.gz
emacs-59db8dca030ba6a34d143c3cc6715f02beba1068.tar.bz2
emacs-59db8dca030ba6a34d143c3cc6715f02beba1068.zip
Use scaled coordinates when calling into GTK
This is part two 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/gtkutil.c (xg_set_geometry): Scale down the coordinates that we pass to gtk_window_move and to gtk_window_parse_geometry. * src/xterm.c (x_set_offset): Likewise.
Diffstat (limited to 'src/gtkutil.c')
-rw-r--r--src/gtkutil.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 123236f5f08..83b306a730a 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -823,6 +823,7 @@ xg_set_geometry (struct frame *f)
{
if (f->size_hint_flags & (USPosition | PPosition))
{
+ int scale = xg_get_scale (f);
#if ! GTK_CHECK_VERSION (3, 22, 0)
if (x_gtk_use_window_move)
{
@@ -838,8 +839,9 @@ xg_set_geometry (struct frame *f)
f->top_pos = (x_display_pixel_height (FRAME_DISPLAY_INFO (f))
- FRAME_PIXEL_HEIGHT (f) + f->top_pos);
+ /* GTK works in scaled pixels, so convert from X pixels. */
gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
- f->left_pos, f->top_pos);
+ f->left_pos / scale, f->top_pos / scale);
/* Reset size hint flags. */
f->size_hint_flags &= ~ (XNegative | YNegative);
@@ -847,9 +849,10 @@ xg_set_geometry (struct frame *f)
}
else
{
- int left = f->left_pos;
+ /* GTK works in scaled pixels, so convert from X pixels. */
+ int left = f->left_pos / scale;
int xneg = f->size_hint_flags & XNegative;
- int top = f->top_pos;
+ int top = f->top_pos / scale;
int yneg = f->size_hint_flags & YNegative;
char geom_str[sizeof "=x--" + 4 * INT_STRLEN_BOUND (int)];
guint id;