mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-26 19:18:50 +00:00
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.
This commit is contained in:
parent
2892f05792
commit
59db8dca03
@ -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;
|
||||
|
11
src/xterm.c
11
src/xterm.c
@ -10310,6 +10310,7 @@ void
|
||||
x_set_offset (struct frame *f, register int xoff, register int yoff, int change_gravity)
|
||||
{
|
||||
int modified_top, modified_left;
|
||||
int scale = xg_get_scale (f);
|
||||
|
||||
if (change_gravity > 0)
|
||||
{
|
||||
@ -10332,11 +10333,12 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, int change_
|
||||
if (x_gtk_use_window_move)
|
||||
{
|
||||
/* When a position change was requested and the outer GTK widget
|
||||
has been realized already, leave it to gtk_window_move to DTRT
|
||||
and return. Used for Bug#25851 and Bug#25943. */
|
||||
has been realized already, leave it to gtk_window_move to
|
||||
DTRT and return. Used for Bug#25851 and Bug#25943. Convert
|
||||
from X pixels to GTK scaled pixels. */
|
||||
if (change_gravity != 0 && FRAME_GTK_OUTER_WIDGET (f))
|
||||
gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
|
||||
f->left_pos, f->top_pos);
|
||||
f->left_pos / scale, f->top_pos / scale);
|
||||
unblock_input ();
|
||||
return;
|
||||
}
|
||||
@ -10355,8 +10357,9 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, int change_
|
||||
}
|
||||
|
||||
#ifdef USE_GTK
|
||||
/* Make sure we adjust for possible scaling. */
|
||||
gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
|
||||
modified_left, modified_top);
|
||||
modified_left / scale, modified_top / scale);
|
||||
#else
|
||||
XMoveWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
|
||||
modified_left, modified_top);
|
||||
|
Loading…
Reference in New Issue
Block a user