emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Display-relative coordinates


From: Eli Zaretskii
Subject: Display-relative coordinates
Date: Thu, 28 Jul 2016 17:41:21 +0300

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 via email to

[Prev in Thread] Current Thread [Next in Thread]