From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Display-relative coordinates Date: Thu, 28 Jul 2016 17:41:21 +0300 Message-ID: <831t2dsu3y.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1469719171 17629 80.91.229.3 (28 Jul 2016 15:19:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 28 Jul 2016 15:19:31 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 28 17:19:22 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bSn5m-0006fq-65 for ged-emacs-devel@m.gmane.org; Thu, 28 Jul 2016 17:19:22 +0200 Original-Received: from localhost ([::1]:53899 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSn5l-0004NI-8s for ged-emacs-devel@m.gmane.org; Thu, 28 Jul 2016 11:19:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSmVA-0002G9-7w for emacs-devel@gnu.org; Thu, 28 Jul 2016 10:41:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSmV7-0001Pt-1w for emacs-devel@gnu.org; Thu, 28 Jul 2016 10:41:32 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:45698) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSmV6-0001Pn-Uf for emacs-devel@gnu.org; Thu, 28 Jul 2016 10:41:28 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3989 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bSmV6-0004FT-73 for emacs-devel@gnu.org; Thu, 28 Jul 2016 10:41:28 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:206207 Archived-At: 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?).