Subject: Re: bug#25542: 25.1; Restoring the frame from fullscreen to maximized

From: Ken Brown <[email-masked]>
Date: Thu, 10 Sep 2020 11:05:24 -0400

On 9/10/2020 3:16 AM, martin rudalics wrote:
>  >> I just tried this on a Cygwin-w32 build from the master branch.  I put the 
> taskbar on the left, started emacs, maximized it, attached gdb, put breakpoints 
> at each of the ShowWindow lines, and ran through Dani's recipe for producing the 
> bug.  The breakpoints were never hit.
>  >
>  > I just tried again, but this time with a breakpoint at w32fullscreen_hook so 
> that I could follow the flow.  Here are the relevant excerpts from the gdb session:
> 
> Thank you very much for checking.
> 
>  > Breakpoint 2 at 0x10069507a: file ../../master/src/w32term.c, line 6441.
>  > (gdb) r -Q
>  > Starting program: /home/kbrown/src/emacs/x86_64-w32/src/emacs -Q
>  >
>  > [...]
>  >
>  > [Press F11]
>  >
>  > Thread 1 "emacs" hit Breakpoint 2, w32fullscreen_hook (f=0x8001f7c88)
>  >      at ../../master/src/w32term.c:6441
> [...]
>  > 6464          FRAME_PREV_FSMODE (f) = f->want_fullscreen;
>  > (gdb) p f->want_fullscreen
>  > $1 = FULLSCREEN_BOTH
> 
> While this is the expected value ...
> 
>  > [...]
>  >
>  > (gdb) c
>  > Continuing.
>  >
>  > [Press F11 again]
>  >
>  > Thread 1 "emacs" hit Breakpoint 2, w32fullscreen_hook (f=0x8001f7c88)
>  >      at ../../master/src/w32term.c:6441
> [...]
>  > 6451          if (FRAME_PREV_FSMODE (f) == FULLSCREEN_NONE)
>  > (gdb) p f->want_fullscreen
>  > $2 = FULLSCREEN_NONE
> 
> ... the value I would have expected here is FULLSCREEN_MAXIMIZED.
> Something must have got broken before.  Can you please
> 
> (1) Verify that the
> 
>        f->want_fullscreen &= ~FULLSCREEN_WAIT;
> 
>      does not interfere in any respect.  That is, does f->want_fullscreen
>      have the same value FULLSCREEN_NONE before anding it with
>      FULLSCREEN_WAIT?

Yes.

> (2) Does 'toggle-frame-fullscreen' the second time when you type F11
>      correctly call
> 
>     (set-frame-parameter frame 'fullscreen fullscreen-restore)
> 
>     with 'fullscreen-restore' equal to 'maximized' at all?

No.  The value of 'fullscreen-restore' is nil.  But if I repeat the experiment 
with the taskbar on the bottom, the value of fullscreen-restore is 'maximized'.

> (3) Verify that calling w32fullscreen_hook with the taskbar on the
>      bottom does hit the breakpoints and subsequently maximize the frame
>      as expected.

With the taskbar on the bottom, f->want_fullscreen == FULLSCREEN_MAXIMIZED when 
I hit line 6449 after the second F11, and everything goes as expected after that.

Ken