* frame-pixel-(width|height) is incorrect
@ 2007-12-20 22:49 Drew Adams
2007-12-21 9:17 ` Jason Rumney
0 siblings, 1 reply; 7+ messages in thread
From: Drew Adams @ 2007-12-20 22:49 UTC (permalink / raw)
To: Bug-Gnu-Emacs
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.
For the default frame from emacs -Q, the size I measure is this:
width 688 pixels
height 742 pixels, including the title bar, which seems to be about 29
The Emacs functions return 680 and 688 pixels for the frame width and
height, respectively. I suppose that the title bar is not counted in
the frame-pixel-height (why not, BTW?), but even accounting for that
the value is incorrect.
This has an impact on frame-size calculation for operations such as
tiling frames across and down the display.
Please correct the frame pixel sizes. If you use Windows, you can pick
up free ($) tools (e.g. mbruler) to measure the actual sizes; I don't
know about tools for other platforms.
In GNU Emacs 22.1.1 (i386-mingw-nt5.1.2600)
of 2007-06-02 on RELEASE
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --cflags -Ic:/gnuwin32/include'
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: frame-pixel-(width|height) is incorrect
2007-12-20 22:49 frame-pixel-(width|height) is incorrect Drew Adams
@ 2007-12-21 9:17 ` Jason Rumney
2007-12-21 10:46 ` David Reitter
2007-12-28 0:14 ` Drew Adams
0 siblings, 2 replies; 7+ messages in thread
From: Jason Rumney @ 2007-12-21 9:17 UTC (permalink / raw)
To: Drew Adams; +Cc: Bug-Gnu-Emacs
Drew Adams wrote:
> 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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: frame-pixel-(width|height) is incorrect
2007-12-21 9:17 ` Jason Rumney
@ 2007-12-21 10:46 ` David Reitter
2007-12-21 10:50 ` Jason Rumney
2007-12-28 0:14 ` Drew Adams
1 sibling, 1 reply; 7+ messages in thread
From: David Reitter @ 2007-12-21 10:46 UTC (permalink / raw)
To: Jason Rumney; +Cc: Bug-Gnu-Emacs, Drew Adams
On 21 Dec 2007, at 09:17, Jason Rumney wrote:
> Drew Adams wrote:
>> 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.
frame-pixel-width is correct in the Carbon port.
frame-pixel-height returns a value that is too low, as it doesn't
contain the title bar. This seems consistent across the platforms,
from what I hear, but it is annoying nevertheless.
The documentation reads:
"This counts only the height available for text lines, not menu bars
on window-system Emacs frames."
If you count the tool-bar as "available for text lines", and the title
bar as part of the non-existant menu bar (on my system), then that is
indeed correct.
So, either way, it would be useful to have the full height of a frame.
Consider that (frame-parameter nil 'top) returns the position of the
top edge, and not the y ordinate of the location where text could
potentially be displayed in the frame.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: frame-pixel-(width|height) is incorrect
2007-12-21 10:46 ` David Reitter
@ 2007-12-21 10:50 ` Jason Rumney
2007-12-21 18:41 ` David Reitter
0 siblings, 1 reply; 7+ messages in thread
From: Jason Rumney @ 2007-12-21 10:50 UTC (permalink / raw)
To: David Reitter; +Cc: Bug-Gnu-Emacs, Drew Adams
David Reitter wrote:
> If you count the tool-bar as "available for text lines", and the title
> bar as part of the non-existant menu bar (on my system), then that is
> indeed correct.
I think it is a bug to count the tool-bar as available for text lines,
but certainly the title bar is not available. The question that needs
answering before making any changes is; what code relies on the current
behaviour?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: frame-pixel-(width|height) is incorrect
2007-12-21 10:50 ` Jason Rumney
@ 2007-12-21 18:41 ` David Reitter
0 siblings, 0 replies; 7+ messages in thread
From: David Reitter @ 2007-12-21 18:41 UTC (permalink / raw)
To: Jason Rumney; +Cc: Bug-Gnu-Emacs, Drew Adams
On 21 Dec 2007, at 10:50, Jason Rumney wrote:
> David Reitter wrote:
>> If you count the tool-bar as "available for text lines", and the
>> title
>> bar as part of the non-existant menu bar (on my system), then that is
>> indeed correct.
> I think it is a bug to count the tool-bar as available for text lines,
> but certainly the title bar is not available. The question that needs
> answering before making any changes is; what code relies on the
> current
> behaviour?
frame-pixel-* are used by dframe, ediff, quail, lucid, and x-dnd.
What I would really need is a function that gives me the total frame
extensions, in order to place the frame on the screen.
Isn't the pixel size of the text area automatically (* (frame-height)
(frame-char-height)) anyways? At least that's what it is for me.
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: frame-pixel-(width|height) is incorrect
2007-12-21 9:17 ` Jason Rumney
2007-12-21 10:46 ` David Reitter
@ 2007-12-28 0:14 ` Drew Adams
2007-12-28 13:56 ` Richard Stallman
1 sibling, 1 reply; 7+ messages in thread
From: Drew Adams @ 2007-12-28 0:14 UTC (permalink / raw)
To: Bug-Gnu-Emacs; +Cc: David Reitter
> 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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: frame-pixel-(width|height) is incorrect
2007-12-28 0:14 ` Drew Adams
@ 2007-12-28 13:56 ` Richard Stallman
0 siblings, 0 replies; 7+ messages in thread
From: Richard Stallman @ 2007-12-28 13:56 UTC (permalink / raw)
To: Drew Adams; +Cc: bug-gnu-emacs, dreitter
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 will install something like that in the manual.
I agree with David that these functions, or possibly some other functions,
should give the _outside_ dimensions of the frame.
It would be useful to offer that, to the extent it is possible.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-12-28 13:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-20 22:49 frame-pixel-(width|height) is incorrect Drew Adams
2007-12-21 9:17 ` Jason Rumney
2007-12-21 10:46 ` David Reitter
2007-12-21 10:50 ` Jason Rumney
2007-12-21 18:41 ` David Reitter
2007-12-28 0:14 ` Drew Adams
2007-12-28 13:56 ` Richard Stallman
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.