Subject: Re: bug#21415: 25.0.50; Emacs Trunk -- pixelwise width/height for x-create-frame

From: martin rudalics <[email-masked]>
Date: Tue, 08 Sep 2015 10:29:23 +0200

> When using the setting of `(setq ns-auto-hide-menu-bar t)`

Is this necessary to trigger the behavior?

 > and a
 > `make-frame` with pixelwise parameters for width/height, the result
 > when creating large frames -- (width 1909.0) (height . 1060.0) -- is a
 > frame that is one-half above the screen (out of sight) and one-half of
 > the frame is showing.  Adding a parameter of (top . 0) has no affect.

Probably because, as you say below, a height of 1060.0 makes the frame
have 1086 pixels outer height which is too large for your screen.

 > The pixelwise frame parameters of width/height for `make-frame` are
 > not behaving precisely -- e.g., a height specification of (height
 > . 1059.0) is 14 pixels shy of filling the entire screen [i.e., 1066
 > pixels outer width]; and a height specification of (height . 1060.0)
 > is 6 pixels larger than the full screen [i.e., 1086 pixels outer
 > width].  It is not presently possible to create a frame that precisely
 > fills the entire screen using the patch as-is.

I don't know how you calculated your values but I'll try to explain
what happens here.  Suppose with emacs -Q I do

(make-frame '((width . 599.0) (height . 399.0)))

Then I get a frame where

(let ((edges (frame-edges nil 'native-edges)))
   (cons (- (nth 2 edges) (nth 0 edges))
	(- (nth 3 edges) (nth 1 edges))))

returns (631 . 435).  The difference between the widths 631 and 599 is
32 pixels.  These consist of 16 pixels for one scroll bar, 8 pixels for
a left and 8 pixels for a right fringe.  The difference between the
heights 435 and 399 is 36.  This is exactly the height of my tool bar.

Evaluating

(let ((edges (frame-edges nil 'outer-edges)))
   (cons (- (nth 2 edges) (nth 0 edges))
	(- (nth 3 edges) (nth 1 edges))))

yields (639 . 481).  So the difference between outer (639) and native
(631) width is 8 pixels which is twice the size of the frame's external
border (4).  The difference between outer (481) and native (435) height
is 46 which equals twice the external border size (2 * 4) plus the title
bar height (19) and the menu bar height (19).

The outer width/height is what you need.  Which results do you get when
you do the same calculations on your system?

martin