From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs Subject: RE: frame-pixel-(width|height) is incorrect Date: Thu, 27 Dec 2007 16:14:29 -0800 Message-ID: References: <476B84B3.3080606@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1198800914 29770 80.91.229.12 (28 Dec 2007 00:15:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 28 Dec 2007 00:15:14 +0000 (UTC) Cc: David Reitter To: "Bug-Gnu-Emacs" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Dec 28 01:15:28 2007 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1J82sj-0008H4-A4 for geb-bug-gnu-emacs@m.gmane.org; Fri, 28 Dec 2007 01:15:21 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J82sO-0003zr-41 for geb-bug-gnu-emacs@m.gmane.org; Thu, 27 Dec 2007 19:15:00 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J82sJ-0003yB-9S for bug-gnu-emacs@gnu.org; Thu, 27 Dec 2007 19:14:55 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J82sI-0003xC-Rx for bug-gnu-emacs@gnu.org; Thu, 27 Dec 2007 19:14:54 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J82sI-0003x9-HQ for bug-gnu-emacs@gnu.org; Thu, 27 Dec 2007 19:14:54 -0500 Original-Received: from rgminet01.oracle.com ([148.87.113.118]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1J82sE-0002tT-AR; Thu, 27 Dec 2007 19:14:50 -0500 Original-Received: from agmgw1.us.oracle.com (agmgw1.us.oracle.com [152.68.180.212]) by rgminet01.oracle.com (Switch-3.2.4/Switch-3.1.6) with ESMTP id lBS0El2W027260; Thu, 27 Dec 2007 17:14:47 -0700 Original-Received: from acsmt351.oracle.com (acsmt351.oracle.com [141.146.40.151]) by agmgw1.us.oracle.com (Switch-3.2.0/Switch-3.2.0) with ESMTP id lBR91Dws022955; Thu, 27 Dec 2007 17:14:46 -0700 Original-Received: from dhcp-4op11-4op12-west-130-35-178-158.us.oracle.com by acsmt350.oracle.com with ESMTP id 3466722861198800864; Thu, 27 Dec 2007 16:14:24 -0800 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: <476B84B3.3080606@gnu.org> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:17266 Archived-At: > From: Jason Rumney Sent: Friday, December 21, 2007 1:18 AM > > emacs -Q > > > > I've checked the pixel size of Emacs frames with a couple of tools on > > Windows, and these functions both return incorrect results: > > frame-pixel-width, frame-pixel-height. > > They return results consistent with their documentation. Well, their doc is pretty skimpy. I'm using Emacs 22.1 (release). (My concern is for a window-mgr frame, not a terminal frame, BTW.) The doc strings say only that the functions "return frame's width in pixels" (or height). Practically useless. The Elisp manual says only: "the height and width of FRAME, measured in pixels". Just as useless. There is nowhere any information about which parts of the frame are included. David quotes the doc as stating that only the height available for text is counted. Perhaps he has a more recent version of Emacs - I don't see that doc in Emacs 22.1. Checking the code, I'm led from `frame-pixel-width' to `x_pixel_width' to `FRAME_PIXEL_WIDTH' to `FRAME_TEXT_COLS_TO_PIXEL_WIDTH' after several greps. And there I see this: #define FRAME_TEXT_COLS_TO_PIXEL_WIDTH(f, cols) \ (FRAME_COL_TO_PIXEL_X (f, cols) \ + (f)->scroll_bar_actual_width \ + FRAME_TOTAL_FRINGE_WIDTH (f) \ + FRAME_INTERNAL_BORDER_WIDTH (f)) So, it looks like the doc should say that it is the width of the text area inside a frame plus the width of the scroll bar (if visible) plus the width of the internal frame border. Similarly, for height. I agree with David that these functions, or possibly some other functions, should give the _outside_ dimensions of the frame. For this or whatever functions do provide the _outside_ frame dimensions: If the window-mgr title bar thickness (height) cannot be known, then so be it - just mention that it includes everything else - but see below for a better approach. If there is another exception (I don't think there is), then mention that too. The doc must be explicit about what is measured; otherwise, it is little help. In particular, this means that the outside-dimension functions should include the `border-width' frame parameter, that is, the external frame border, as well as the internal border. David gave the reason that outside-dimension functions are needed: calculating frame sizes and positions. One example is tiling frames. Another suggestion: If it is indeed impossible for Emacs to obtain the title-bar thickness (height), then this should be a user option, and its value should be included in the outside frame dimension calculations. That way, a user can at least measure the title bar by hand once, customize the option, and thereafter count on accurate frame-size calculations. BTW, in my original bug report, I was mistakenly assuming that the functions frame-pixel-* returned outside dimensions. That is what I am after, whether by these functions or some new functions. Thx.