[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Child-frame can not move to proper position when run "env GDK_SCALE=
From: |
Robert Pluim |
Subject: |
Re: Child-frame can not move to proper position when run "env GDK_SCALE=2 emacs" |
Date: |
Tue, 09 Jan 2018 11:06:29 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) |
"Feng Shu" <address@hidden> writes:
> martin rudalics <address@hidden> writes:
>
>>> When I run "env GDK_SCALE=2 emacs", the below code can not work properly
>>>
>>> ```
>>> (let ((test (let ((after-make-frame-functions nil))
>>> (make-frame
>>> `((parent-frame . ,(window-frame))
>>> (width . 50)
>>> (height . 1)))))
>>> (pos (posn-x-y (posn-at-point (point) (selected-window)))))
>>> (set-frame-position test (car pos) (cdr pos)))<I>
>>> ```
>>>
>>> When I eval the code at the <I>, the new created frame can not move to
>>> <I>, it move to the wrong position.
>>
>> What happens when you divide the pos values by two?
>
> When (/ x 2) and (/ y 2), It works! :-)
>
>>
>> We do not expose the GTK/GDK scale values in Lisp, maybe we should.
>> Robert any ideas?
Ugh. I don't think we should expose the scale values, we should fix
whatever the issue is with set-frame-position. Naively that's the
attached patch, but I worry about other places that assume unscaled
coordinates. I'll run with it for a while and see if any pop up.
Longer term we need to implement your 'eliminate direct X calls' plan,
and have everything inside Emacs use GTK coordinates.
Robert
diff --git i/src/xterm.c w/src/xterm.c
index f771631daf..950e6231e0 100644
--- i/src/xterm.c
+++ w/src/xterm.c
@@ -10311,6 +10311,14 @@ x_set_offset (struct frame *f, register int xoff,
register int yoff, int change_
{
int modified_top, modified_left;
+#ifdef USE_GTK
+ {
+ int scale = xg_get_scale(f);
+ xoff /= scale;
+ yoff /= scale;
+ }
+#endif
+
if (change_gravity > 0)
{
f->top_pos = yoff;
- Child-frame can not move to proper position when run "env GDK_SCALE=2 emacs", Feng Shu, 2018/01/08
- Re: Child-frame can not move to proper position when run "env GDK_SCALE=2 emacs", martin rudalics, 2018/01/08
- Re: Child-frame can not move to proper position when run "env GDK_SCALE=2 emacs", Feng Shu, 2018/01/08
- Re: Child-frame can not move to proper position when run "env GDK_SCALE=2 emacs", martin rudalics, 2018/01/09
- Re: Child-frame can not move to proper position when run "env GDK_SCALE=2 emacs", Robert Pluim, 2018/01/09
- Re: Child-frame can not move to proper position when run "env GDK_SCALE=2 emacs", martin rudalics, 2018/01/10
- Re: Child-frame can not move to proper position when run "env GDK_SCALE=2 emacs", Robert Pluim, 2018/01/10
- Re: Child-frame can not move to proper position when run "env GDK_SCALE=2 emacs", martin rudalics, 2018/01/11
- Re: Child-frame can not move to proper position when run "env GDK_SCALE=2 emacs",
Robert Pluim <=
- Re: Child-frame can not move to proper position when run "env GDK_SCALE=2 emacs", Dmitry Gutov, 2018/01/09
- Re: Child-frame can not move to proper position when run "env GDK_SCALE=2 emacs", Stefan Monnier, 2018/01/10
- Re: Child-frame can not move to proper position when run "env GDK_SCALE=2 emacs", Robert Pluim, 2018/01/10
- Re: Child-frame can not move to proper position when run "env GDK_SCALE=2 emacs", Dmitry Gutov, 2018/01/10
- Re: Child-frame can not move to proper position when run "env GDK_SCALE=2 emacs", Robert Pluim, 2018/01/10
- Re: Child-frame can not move to proper position when run "env GDK_SCALE=2 emacs", Dmitry Gutov, 2018/01/10
- Re: Child-frame can not move to proper position when run "env GDK_SCALE=2 emacs", Robert Pluim, 2018/01/10
- Re: Child-frame can not move to proper position when run "env GDK_SCALE=2 emacs", Dmitry Gutov, 2018/01/10
- Re: Child-frame can not move to proper position when run "env GDK_SCALE=2 emacs", martin rudalics, 2018/01/10
- Re: Child-frame can not move to proper position when run "env GDK_SCALE=2 emacs", Robert Pluim, 2018/01/10