From: Robert Pluim <rpluim@gmail.com>
To: martin rudalics <rudalics@gmx.at>
Cc: Feng Shu <tumashu@163.com>, emacs-devel@gnu.org
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 [thread overview]
Message-ID: <87incbe47u.fsf@gmail.com> (raw)
In-Reply-To: 87608c54xw.fsf@163.com
"Feng Shu" <tumashu@163.com> writes:
> martin rudalics <rudalics@gmx.at> 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;
next prev parent reply other threads:[~2018-01-09 10:06 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-08 11:53 Child-frame can not move to proper position when run "env GDK_SCALE=2 emacs" Feng Shu
2018-01-08 18:17 ` martin rudalics
2018-01-08 23:03 ` Feng Shu
2018-01-09 9:43 ` martin rudalics
2018-01-09 10:56 ` Robert Pluim
2018-01-10 10:19 ` martin rudalics
2018-01-10 13:45 ` Robert Pluim
2018-01-11 10:54 ` martin rudalics
2018-01-09 10:06 ` Robert Pluim [this message]
2018-01-10 0:52 ` Dmitry Gutov
2018-01-10 13:19 ` Stefan Monnier
2018-01-10 13:48 ` Robert Pluim
2018-01-10 14:27 ` Dmitry Gutov
2018-01-10 15:08 ` Robert Pluim
2018-01-10 15:36 ` Dmitry Gutov
2018-01-10 15:58 ` Robert Pluim
2018-01-10 16:24 ` Dmitry Gutov
2018-01-10 10:19 ` martin rudalics
2018-01-10 13:35 ` Robert Pluim
2018-01-11 10:54 ` martin rudalics
2018-01-11 0:16 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87incbe47u.fsf@gmail.com \
--to=rpluim@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=rudalics@gmx.at \
--cc=tumashu@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.