From: martin rudalics <rudalics@gmx.at>
To: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: Display-relative coordinates
Date: Thu, 28 Jul 2016 21:07:55 +0200 [thread overview]
Message-ID: <579A580B.9010507@gmx.at> (raw)
In-Reply-To: <831t2dsu3y.fsf@gnu.org>
>> I've been fiddling a bit with test code like this, but haven't
>> really found anything reasonable yet:
>
>> ;; Try to get screen-relative X, Y (pixels) for current point
>> (let* ((posn-at-pt (posn-at-point))
>> (x-y (and posn-at-pt (posn-x-y posn-at-pt)))
>> (win-edges (and x-y (window-inside-absolute-pixel-edges)))
>> (x (and x-y (+ (car x-y) (car win-edges))))
>> (y (and x-y (+ (cdr x-y) (cadr win-edges))))
>> (y (and y (top-fudge-pixels y))))
>> ...)
>
>> (defun top-fudge-pixels (y)
>> (let ((y2 y))
>> (when tool-bar-mode (setq y2 (+ 40 tp)))
>> (when menu-bar-mode (setq y2 (+ 25 tp)))
>> (setq y2 (+ y2 28)) ; Frame title bar
>> y2))
>
> What are the problems you see with the above (except that 'tp' is a
> void variable)? It looks OK to me, modulo the kludges in
> top-fudge-pixels (why not use frame-geometry, which exists for that
> purpose?).
FWIW ‘window-inside-absolute-pixel-edges’ didn't work on Windows before
Emacs 25. On Emacs 25 ‘window-absolute-pixel-position’ is all that's
needed.
martin
next prev parent reply other threads:[~2016-07-28 19:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-28 14:41 Display-relative coordinates Eli Zaretskii
2016-07-28 19:07 ` martin rudalics [this message]
2016-07-28 20:20 ` Drew Adams
2016-07-29 5:54 ` martin rudalics
2016-07-29 15:38 ` Drew Adams
[not found] <<831t2dsu3y.fsf@gnu.org>
2016-07-28 20:20 ` Drew Adams
2016-07-29 13:39 ` Eli Zaretskii
[not found] <<<831t2dsu3y.fsf@gnu.org>
[not found] ` <<bd748cdc-2ab2-4576-9e85-1040706ffcc8@default>
[not found] ` <<83d1lwr2at.fsf@gnu.org>
2016-07-29 15:38 ` Drew Adams
2016-07-29 17:42 ` Eli Zaretskii
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=579A580B.9010507@gmx.at \
--to=rudalics@gmx.at \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
/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.