all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: emacs-devel@gnu.org
Subject: Display-relative coordinates
Date: Thu, 28 Jul 2016 17:41:21 +0300	[thread overview]
Message-ID: <831t2dsu3y.fsf@gnu.org> (raw)

Moved here from bug-gnu-emacs.

> 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?).



             reply	other threads:[~2016-07-28 14:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-28 14:41 Eli Zaretskii [this message]
2016-07-28 19:07 ` Display-relative coordinates martin rudalics
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=831t2dsu3y.fsf@gnu.org \
    --to=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.