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

From: Anders Lindgren <[email-masked]>
Date: Sat, 14 Nov 2015 20:42:04 +0100

Hi,

I found some time to look into this. When the frame was maximized and the
tool-bar was disabled, the function x_set_window_size was never called.

The following patch makes the frame exit the fullheight or maximized states
when the tool-bar is disabled, which makes the call x_set_window_size
reappear. It does NOT, however, return the frame to the fullheight or
maximized states when the toolbar is re-enabled (I don't even know if it
should). In addition, it does not support frame-inhibit-implied-resize
either (which would require a lot more work).

I read in the emacs-devel group that there is a feature-freeze in place --
does this mean that I shouldn't commit this?

Also, the current Emacs master branch doesn't build on OS X 10.6.8 after an
attempt to David Reitter to eliminate warnings -- I think it's an easy fix
(David don't have access to a 10.6.8 machine but fortunately I do).

    -- Anders

On Thu, Oct 29, 2015 at 3:47 AM, Keith David Bershatsky <[email-masked]>
wrote:

> The following are results of my tests with `emacs-repository-version`
> "ffa41ad2a02dbd1202d71a08bac34831f25662d0" built this evening (October 28,
> 2015).
>
> Starting from Emacs -Q, and then turning off the toolbar using the mouse
> by clicking the option in the menubar, the frame shrinks slightly. Clicking
> the toolbar option again restores the frame to its original position.
>
> `M-x toggle-frame-maximized` results in a frame properly maximized.
>
> The first time I turned off the toolbar from a maximized frame, the frame
> shrunk a little.  When I turned the toolbar back on again, the frame did
> not return to a maximized position -- i.e., it remained a few pixels shy of
> full-screen in terms of height.  When I turned the toolbar off again, the
> main window reduced in size and the height of the echo area increased to
> about 3 lines in height -- the frame remained the same size.  When I turned
> the toolbar on again, the main window returned to its prior size and the
> echo area returned to a size of just one line -- the frame stayed the same
> size (i.e., a few pixels shy of full-screen in terms of height).
>
> Keith
>
diff --git a/src/nsfns.m b/src/nsfns.m
index cffb599..8510327 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -671,6 +671,18 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
         {
           free_frame_tool_bar (f);
           FRAME_EXTERNAL_TOOL_BAR (f) = 0;
+
+          {
+            Lisp_Object fullscreen = get_frame_param (f, Qfullscreen);
+            if (EQ (fullscreen, Qmaximized))
+              {
+                store_frame_param (f, Qfullscreen, Qfullwidth);
+              }
+            else if (EQ (fullscreen, Qfullheight))
+              {
+                store_frame_param (f, Qfullscreen, Qnil);
+              }
+          }
         }
     }