GNU bug report logs - #31795
26.1; Undecorated frame resize issues on macOS

Previous Next

Package: emacs;

Reported by: Boris Buliga <boris <at> d12frosted.io>

Date: Tue, 12 Jun 2018 07:56:03 UTC

Severity: minor

Merged with 28512

Found in versions 26.0.60, 26.1

Done: Alan Third <alan <at> idiocy.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 31795 in the body.
You can then email your comments to 31795 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#31795; Package emacs. (Tue, 12 Jun 2018 07:56:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Boris Buliga <boris <at> d12frosted.io>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 12 Jun 2018 07:56:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Boris Buliga <boris <at> d12frosted.io>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.1; Undecorated frame resize issues on macOS
Date: Mon, 11 Jun 2018 21:38:57 +0300
[Message part 1 (text/plain, inline)]
Message-ID: <m2a7s1mavt.fsf <at> gmail.com>
--text follows this line--

1. Create ~/undecorated.el file with following content:

  (add-to-list 'default-frame-alist '(undecorated . t))

2. Start Emacs:

   $ emacs -Q --load ~/undecorated.el

   or (if you don't want to create files)

   $ emacs -q --execute "(add-to-list 'default-frame-alist '(undecorated .
t))"

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.

3.2. Use Spectacle.app (or similar application for resizing windows in
     macOS)

     Frame is not resized.

In both cases I expect frames to properly resize.

Note that calling toggle-frame-maximized after the startup works like a
charm.

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

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

But it didn't make the trick.

Let me know if you need any additional information.

In GNU Emacs 26.1 (build 1, x86_64-apple-darwin14.5.0, NS appkit-1348.17
Version 10.10.5 (Build 14F2511))
of 2018-05-31 built on builder10-10.porkrind.org
Windowing system distributor 'Apple', version 10.3.1561
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
user-error: Beginning of history; no preceding item
user-error: End of history; no default available

Configured using:
'configure --with-ns '--enable-locallisppath=/Library/Application
Support/Emacs/${version}/site-lisp:/Library/Application
Support/Emacs/site-lisp' --with-modules'

Configured features:
NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS

Important settings:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils thingatpt elec-pair
time-date tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util
term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote kqueue cocoa ns multi-tty make-network-process emacs)

Memory information:
((conses 16 204085 7246)
(symbols 48 20096 1)
(miscs 40 44 157)
(strings 32 28985 1457)
(string-bytes 1 764133)
(vectors 16 35057)
(vector-slots 8 713646 16946)
(floats 8 49 67)
(intervals 56 197 0)
(buffers 992 11))


Best regards,
Boris
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31795; Package emacs. (Tue, 12 Jun 2018 20:08:02 GMT) Full text and rfc822 format available.

Message #8 received at 31795 <at> debbugs.gnu.org (full text, mbox):

From: Alan Third <alan <at> idiocy.org>
To: Boris Buliga <boris <at> d12frosted.io>
Cc: 31795 <at> debbugs.gnu.org
Subject: Re: bug#31795: 26.1; Undecorated frame resize issues on macOS
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




Merged 28512 31795. Request was from Alan Third <alan <at> idiocy.org> to control <at> debbugs.gnu.org. (Tue, 12 Jun 2018 20:12:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31795; Package emacs. (Wed, 13 Jun 2018 04:10:01 GMT) Full text and rfc822 format available.

Message #13 received at 31795 <at> debbugs.gnu.org (full text, mbox):

From: Boris Buliga <boris <at> d12frosted.io>
To: alan <at> idiocy.org
Cc: 31795 <at> debbugs.gnu.org
Subject: Re: bug#31795: 26.1; Undecorated frame resize issues on macOS
Date: Wed, 13 Jun 2018 07:09:33 +0300
[Message part 1 (text/plain, inline)]
Hey Alan,

Thank you for your reply!

> merge 31795 28512

Apparently, my search-fu has failed me as I didn't know about ticket 28512
before submitting new one. Thanks for linking.

That ticket actually reveals some insights on why the whole thing with
borderless mask doesn't behave as I want it to behave. As you say in your
message:

> Apparently macOS doesn’t like you changing the window style on the fly,
and
> resizing breaks.

As it turns out, you can achieve goal by creating a window without
NSWindowStyleMaskTitled regardless the undecorated flag value. It's not a
solution in general way, but in case someone is interested, I can share a
patch.

Though it would be nice to make it working with undecorated frame option.

> and switch to using NSFullSizeContentViewWindowMask and its relatives.

I should try this out.

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

Maybe. Because (let's say) it's not useful as is :)

> I would expect that to work.

OK, so I am not the only one :)

> Is the line break just because of your email client?

Exactly. Originally I've put it in one line.

>> 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.

I was desperate.

On Tue, 12 Jun 2018 at 23:07, Alan Third <alan <at> idiocy.org> wrote:

> 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
>


-- 
Cheers,
Boris
[Message part 2 (text/html, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 01 Feb 2022 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 197 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.