From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: lorentey@elte.hu (=?iso-8859-2?Q?L=F5rentey_K=E1roly?=) Newsgroups: gmane.emacs.devel Subject: [PATCH] Fix `window-at' and `coordinates-in-window-p' Date: Sat, 24 Jul 2004 00:29:47 +0200 Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0156052236==" X-Trace: sea.gmane.org 1090623723 28184 80.91.224.253 (23 Jul 2004 23:02:03 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 23 Jul 2004 23:02:03 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jul 24 01:01:53 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Bo932-0000y1-00 for ; Sat, 24 Jul 2004 01:01:52 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Bo95v-0004NJ-C9 for ged-emacs-devel@m.gmane.org; Fri, 23 Jul 2004 19:04:52 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1Bo95W-0004NB-2P for emacs-devel@gnu.org; Fri, 23 Jul 2004 19:04:26 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1Bo95T-0004Ku-Bn for emacs-devel@gnu.org; Fri, 23 Jul 2004 19:04:25 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Bo95T-0004Kj-4o for emacs-devel@gnu.org; Fri, 23 Jul 2004 19:04:23 -0400 Original-Received: from [157.181.151.9] (helo=mx2.elte.hu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Bo92C-0008E8-Cj for emacs-devel@gnu.org; Fri, 23 Jul 2004 19:01:00 -0400 Original-Received: from mailbox1.caesar.elte.hu (mailbox1.caesar.elte.hu [157.181.151.157]) by mx2.elte.hu (Postfix) with ESMTP id 172281B3937 for ; Sat, 24 Jul 2004 00:57:09 +0200 (CEST) Original-Received: from eris.fnord.hu (AAnnecy-204-1-12-204.w81-48.abo.wanadoo.fr [81.48.211.204]) by mailbox1.caesar.elte.hu (Postfix) with ESMTP id 05F2AA011E0A for ; Sat, 24 Jul 2004 01:00:52 +0200 (CEST) Original-Received: by eris.fnord.hu (Postfix, from userid 1000) id F388822EC9A; Sat, 24 Jul 2004 00:29:48 +0200 (CEST) Original-To: emacs-devel@gnu.org User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux) X-ELTE-SpamVersion: MailScanner 4.31.6-itk1 (ELTE 1.2) SpamAssassin 2.63 ClamAV 0.73 X-ELTE-VirusStatus: clean X-ELTE-SpamCheck: no X-ELTE-SpamCheck-Details: score=-2.301, required 5.9, BAYES_00 -4.90, RCVD_IN_DYNABLOCK 2.60 X-ELTE-SpamLevel: X-ELTE-SpamScore: -2 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 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 Xref: main.gmane.org gmane.emacs.devel:25910 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:25910 --===============0156052236== Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Try this under X: emacs -q --no-site-file --internal-border 1 ^^^^^^^^^^^^^^^^^^^ M-: (window-at 0 0) M-: (coordinates-in-window-p '(0 . 0) (selected-window)) Under Emacs 21.3.1, both `window-at' and `coordinates-in-window-p' ignore the frame's internal border, and (IMHO) correctly return non-nil values; under the current CVS version, they both return nil. In CVS, the following functions always return nil if the internal-border-width frame parameter is non-zero. I think that is wrong. (defun test-coord-1 (window) (let ((edges (window-edges window))) (eq window (window-at (nth 0 edges) (nth 1 edges))))) (defun test-coord-2 (window) (let ((edges (window-edges window))) (coordinates-in-window-p (cons (nth 0 edges) (nth 1 edges)) window))) This bug confuses the windmove.el package and renders it almost unusable for me. I fixed it with the following patch: --=-=-= Content-Type: text/x-patch Content-Disposition: inline *** orig/src/frame.h --- mod/src/frame.h *************** *** 880,919 **** canonical char width is to be used. X must be a Lisp integer or float. Value is a C integer. */ ! #define FRAME_PIXEL_X_FROM_CANON_X(F, X) \ ! (INTEGERP (X) \ ! ? XINT (X) * FRAME_COLUMN_WIDTH (F) \ ! : (int) (XFLOAT_DATA (X) * FRAME_COLUMN_WIDTH (F))) /* Convert canonical value Y to pixels. F is the frame whose canonical character height is to be used. X must be a Lisp integer or float. Value is a C integer. */ #define FRAME_PIXEL_Y_FROM_CANON_Y(F, Y) \ ! (INTEGERP (Y) \ ! ? XINT (Y) * FRAME_LINE_HEIGHT (F) \ ! : (int) (XFLOAT_DATA (Y) * FRAME_LINE_HEIGHT (F))) /* Convert pixel-value X to canonical units. F is the frame whose canonical character width is to be used. X is a C integer. Result is a Lisp float if X is not a multiple of the canon width, otherwise it's a Lisp integer. */ ! #define FRAME_CANON_X_FROM_PIXEL_X(F, X) \ ! ((X) % FRAME_COLUMN_WIDTH (F) != 0 \ ! ? make_float ((double) (X) / FRAME_COLUMN_WIDTH (F)) \ ! : make_number ((X) / FRAME_COLUMN_WIDTH (F))) /* Convert pixel-value Y to canonical units. F is the frame whose canonical character height is to be used. Y is a C integer. Result is a Lisp float if Y is not a multiple of the canon width, otherwise it's a Lisp integer. */ ! #define FRAME_CANON_Y_FROM_PIXEL_Y(F, Y) \ ! ((Y) % FRAME_LINE_HEIGHT (F) \ ! ? make_float ((double) (Y) / FRAME_LINE_HEIGHT (F)) \ ! : make_number ((Y) / FRAME_LINE_HEIGHT (F))) ! /* Manipulating pixel sizes and character sizes. --- 880,924 ---- canonical char width is to be used. X must be a Lisp integer or float. Value is a C integer. */ ! #define FRAME_PIXEL_X_FROM_CANON_X(F, X) \ ! (FRAME_INTERNAL_BORDER_WIDTH (F) + \ ! (INTEGERP (X) \ ! ? XINT (X) * FRAME_COLUMN_WIDTH (F) \ ! : (int) (XFLOAT_DATA (X) * FRAME_COLUMN_WIDTH (F)))) /* Convert canonical value Y to pixels. F is the frame whose canonical character height is to be used. X must be a Lisp integer or float. Value is a C integer. */ #define FRAME_PIXEL_Y_FROM_CANON_Y(F, Y) \ ! (FRAME_INTERNAL_BORDER_WIDTH (F) + \ ! (INTEGERP (Y) \ ! ? XINT (Y) * FRAME_LINE_HEIGHT (F) \ ! : (int) (XFLOAT_DATA (Y) * FRAME_LINE_HEIGHT (F)))) /* Convert pixel-value X to canonical units. F is the frame whose canonical character width is to be used. X is a C integer. Result is a Lisp float if X is not a multiple of the canon width, otherwise it's a Lisp integer. */ ! #define FRAME_CANON_X_FROM_PIXEL_X(F, X) \ ! ((X - FRAME_INTERNAL_BORDER_WIDTH (F)) % FRAME_COLUMN_WIDTH (F) != 0 \ ! ? make_float ((double) (X - FRAME_INTERNAL_BORDER_WIDTH (F)) / \ ! FRAME_COLUMN_WIDTH (F)) \ ! : make_number ((X - FRAME_INTERNAL_BORDER_WIDTH (F)) / \ ! FRAME_COLUMN_WIDTH (F))) /* Convert pixel-value Y to canonical units. F is the frame whose canonical character height is to be used. Y is a C integer. Result is a Lisp float if Y is not a multiple of the canon width, otherwise it's a Lisp integer. */ ! #define FRAME_CANON_Y_FROM_PIXEL_Y(F, Y) \ ! ((Y - FRAME_INTERNAL_BORDER_WIDTH (F)) % FRAME_LINE_HEIGHT (F) != 0 \ ! ? make_float ((double) (Y - FRAME_INTERNAL_BORDER_WIDTH (F)) / \ ! FRAME_LINE_HEIGHT (F)) \ ! : make_number ((Y - FRAME_INTERNAL_BORDER_WIDTH (F)) / \ ! FRAME_LINE_HEIGHT (F))) /* Manipulating pixel sizes and character sizes. --=-=-= Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: quoted-printable 2004-07-23 K=E1roly L=F5rentey * frame.h (FRAME_PIXEL_X_FROM_CANON_X, FRAME_PIXEL_Y_FROM_CANON_Y) (FRAME_CANON_X_FROM_PIXEL_X, FRAME_CANON_Y_FROM_PIXEL_Y): Take the frame's internal border width into account. Arch changeset (from lorentey@elte.hu--2004/emacs--lorentey--patch-67): --=-=-= Content-Type: application/octet-stream Content-Disposition: inline; filename=fix-coords.cset.tar.gz Content-Transfer-Encoding: base64 H4sIAKGQAUEAA+1bW2/iRhjNa6z+g335qqoKhAzYxoYsarchhGTTkGRF2DZIK3kHewBrwY5sk0ur /vfOGAhgbDA3Z1ea8wB47jPnfN/ccNt8RrptO4ab1V3i5fZ2AJGiqKrsWyqq4vT3GHuSKIlinn5K hT1RUtVifg/UXTQmiIHrYQdgr2c7xPLIS1S6ZfHjjoy/fxC0A/zbjtkxLdxDttV7QYbpoD7xsIE9 vH4dbDwKihKff1kuyNIeJDKInP8Z/vu2YbZNYrwx/2pR5fwngSD/Dunbj5T+ttkjLsKO3jUfyYaz wsr+X6bR3P8ngiD/FnnaKvcMa/AviZz/RLCc/3/Zj/82kcHq/MuKJHL+k0Bs/kkf6+56Klid/7wq cv4TwYr8+58IjQcjnh5W57+gigrnPwlsyH/gGSExRBIr85+XirLM+U8C2Vw2d1KzrU7NtL7tqA42 Hov2f5Iqv/JPZ/49KoI88/+1HbVnBmP+N8UPyv/27X/8+4T0PJLtDhCSRVHZycEix8ZIgv/V/b8q y3z/lwi+C/9fUOb9f577/ySQmP9/wJ7epQk7fCb4nsD9P/f/b+7/iyH+X+H+Pwm8gf8f/ioU37rr HHvJ+f8F9i+JSj7U//P7392jTh5N17StEsxTidDYVIXyUAwlCLduoeIQ7NlOCa6wY/deoDZKBr8F M3wQzrBHC7rDHvw56IGsgCiWZKUkv4dK9a4Bfnl3HrYM7BjI8BOzMCQWkZw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a0gMJN LKwn8SysuYqFBQchjoHFqiC3zL6CI7Geea3SlhjWNU8PNa6ffPu6xpb5MOhhz7Q6QyMD1/yHuP6x 48Rc/LB1juoW7f9eT1I33AEuu/8rFKW59/8K/P2vRDCz/3slfGYHOAlle0DpKA8Z6eg92/1lps7l 4erd0Sl+lzodnv/ThwF7GN4ChF0DZITM/iFsfBie2V//ONw/D6clvE5KMU/EM8LkRkIGOMWO8wLn ptvtYwt+a7FHrT18PMGel7WI94H6SGrDL8xm6Wj6Fk677+Y61gD1TGvwnO2W4DOdfC4q2nW5fqXd NcqVKzaHaRruGwVF09hcNvTZxtZO5cPe/2WvfbJrDIM8b6UOZg/KSu9/iqpY4PafBEL5H14Ab00A y/iXVCXIf6HA3/9OBNnpQz4wNdFoi8oxIYgUWm2ktJVj1DLUAiJ53RBV1TCOdUXIzs4LNJtq6LqS V2kOMX+MFEmRUCtPC1BbRJV0o1hoGQq/SPwOEfL+/7bd/zr+Py/z9V8iCON/y+5/Kf+KErz/Ef33 /zj/u0d2d//vg7K2w9IFPnNxcHBwcHCsi/8BrJPvZwBQAAA= --=-=-= Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: quoted-printable =2D-=20 K=E1roly --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQBBAZFc6eoyqA+yej8RAo0KAJ9AHm21ZTqIGnBFeiar0f5Ng0ElEgCgnvZR BGMW/cLO7xk5S8XYsDjg2k8= =3LUF -----END PGP SIGNATURE----- --==-=-=-- --===============0156052236== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --===============0156052236==--