aboutsummaryrefslogtreecommitdiffstats
path: root/src/gtkutil.c
diff options
context:
space:
mode:
authorRobert Pluim2018-01-24 08:55:34 +0100
committerMartin Rudalics2018-01-24 08:55:34 +0100
commit59db8dca030ba6a34d143c3cc6715f02beba1068 (patch)
treef27726034b2bc43dcad5d3524f064a0a4ec8e79e /src/gtkutil.c
parent2892f05792e1f52b0966f92c5ed1aa75dcdd66a3 (diff)
downloademacs-59db8dca030ba6a34d143c3cc6715f02beba1068.tar.gz
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)
823{ 823{
824 if (f->size_hint_flags & (USPosition | PPosition)) 824 if (f->size_hint_flags & (USPosition | PPosition))
825 { 825 {
826 int scale = xg_get_scale (f);
826#if ! GTK_CHECK_VERSION (3, 22, 0) 827#if ! GTK_CHECK_VERSION (3, 22, 0)
827 if (x_gtk_use_window_move) 828 if (x_gtk_use_window_move)
828 { 829 {
@@ -838,8 +839,9 @@ xg_set_geometry (struct frame *f)
838 f->top_pos = (x_display_pixel_height (FRAME_DISPLAY_INFO (f)) 839 f->top_pos = (x_display_pixel_height (FRAME_DISPLAY_INFO (f))
839 - FRAME_PIXEL_HEIGHT (f) + f->top_pos); 840 - FRAME_PIXEL_HEIGHT (f) + f->top_pos);
840 841
842 /* GTK works in scaled pixels, so convert from X pixels. */
841 gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 843 gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
842 f->left_pos, f->top_pos); 844 f->left_pos / scale, f->top_pos / scale);
843 845
844 /* Reset size hint flags. */ 846 /* Reset size hint flags. */
845 f->size_hint_flags &= ~ (XNegative | YNegative); 847 f->size_hint_flags &= ~ (XNegative | YNegative);
@@ -847,9 +849,10 @@ xg_set_geometry (struct frame *f)
847 } 849 }
848 else 850 else
849 { 851 {
850 int left = f->left_pos; 852 /* GTK works in scaled pixels, so convert from X pixels. */
853 int left = f->left_pos / scale;
851 int xneg = f->size_hint_flags & XNegative; 854 int xneg = f->size_hint_flags & XNegative;
852 int top = f->top_pos; 855 int top = f->top_pos / scale;
853 int yneg = f->size_hint_flags & YNegative; 856 int yneg = f->size_hint_flags & YNegative;
854 char geom_str[sizeof "=x--" + 4 * INT_STRLEN_BOUND (int)]; 857 char geom_str[sizeof "=x--" + 4 * INT_STRLEN_BOUND (int)];
855 guint id; 858 guint id;