Subject: Re: bug#31795: 26.1; Undecorated frame resize issues on macOS

From: Alan Third <[email-masked]>
Date: Tue, 12 Jun 2018 21:07:48 +0100

merge 31795 28512
thank you

On Mon, Jun 11, 2018 at 09:38:57PM +0300, Boris Buliga wrote:
<create an undecorated frame>
> 3. Try one of the following actions
> 
> 3.1. M-x toggle-frame-fullsreen
> 
>      Frames' window (in macOS sense) becomes fullscreen. But it doesn't
>      cover all screen, instead it remains of the same default size with
>      black area around.

Hmm, this isn’t very good. Maybe we should be resetting the window
style before and after toggling fullscreen.

> 3.2. Use Spectacle.app (or similar application for resizing windows in
>      macOS)
> 
>      Frame is not resized.

Unfortunately this is expected. Apparently macOS doesn’t like you
changing the window style on the fly, and resizing breaks. The
solution appears to be to recreate the NSWindow, or give up on
NSWindowStyleMaskBorderless and switch to using
NSFullSizeContentViewWindowMask and its relatives.

> I've tried patching src/nsterm.m file by chaning definition of
> FRAME_DECORATED_FLAGS from
> 
>   #define FRAME_UNDECORATED_FLAGS NSWindowStyleMaskBorderless
> 
> to
> 
>   #define FRAME_UNDECORATED_FLAGS NSWindowStyleMaskBorderless |
>    NSWindowStyleMaskResizable

I would expect that to work. Is the line break just because of your
email client? If not then you need to escape the newline like this:

    #define FRAME_UNDECORATED_FLAGS NSWindowStyleMaskBorderless \
                                    | NSWindowStyleMaskResizable

> and creating EmacsFSWindow instead of EmacsWindow (so canBecomeKeyWindow
> and canBecomeMainWindow both return YES).

You don’t need this. IIRC EmacsFSWindow exists solely for non‐native
fullscreen.

-- 
Alan Third