Hi,
I found one problem related to `toggle-to-maximized'. If this happened right after `frame-resize-pixelwise' was set to a non-nil value, the NSWindow parameter `resizeIncrement' must be updated. If this does not occur, the frame size is rounded down to only accommodate full characters. The extra space was distributed evenly above and below the frame. The attached patch fixes this issue.
To see the difference, run Emacs -Q and evaluate the following. After the patch is applied, the frame is no longer moves down.
(progn
(setq frame-resize-pixelwise t)
(toggle-frame-maximized))
Unfortunately, the frame still doesn't cover the entire screen. The documentation to `windowWillUseStandardFrame' says:
"The size of the current screen, which is the screen containing the largest part of the window's current frame, possibly reduced on the top, bottom, left, or right, depending on the current interface style."
Effectively, this mean that the frame is reduced one pixel on the top (if the menu bar is visible) and four pixels at the bottom. This corresponds to how other applications, like Chrome, works.
I think it would be relatively easy to override this (well, at least the four pixels at the bottom), but I'm not sure if we should and, if so, under which conditions. (I can image that some users would like Emacs to fill the entire screen whereas others might prefer the standard four pixels to be unused at the bottom.)
In the Info documentation to the `fullscreen' frame parameter, there are two values missing: `nil' and `fullscreen'. The former indicates that the frame is in non-maximized state and the latter seems to behave like `fullboth'. Interestingly, the function `toggle-frame-fullscreen' seems to use this undocumented parameter value. (In addition, there are some control characters showing on the first line.)
On a side note, the NSTRACE rewrite is coming along nicely (it really helped in tracking down this problem) but it's not yet ready for release.
Sincerely,
Anders Lindgren