GNU bug report logs - #19075
`toggle-frame-maximized' and `toggle-frame-fullscreen' on Windows

Previous Next

Package: emacs;

Reported by: Alexander Shukaev <haroogan <at> gmail.com>

Date: Mon, 17 Nov 2014 08:15:03 UTC

Severity: normal

Done: martin rudalics <rudalics <at> gmx.at>

Bug is archived. No further changes may be made.

Full log


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

From: martin rudalics <rudalics <at> gmx.at>
To: Alexander Shukaev <haroogan <at> gmail.com>, 19075 <at> debbugs.gnu.org
Subject: Re: bug#19075: `toggle-frame-maximized' and `toggle-frame-fullscreen'
 on Windows
Date: Fri, 13 Feb 2015 19:25:35 +0100
> `init.el':
>
> (add-hook 'window-setup-hook 'toggle-frame-maximized t)
> (add-hook 'window-setup-hook 'toggle-frame-fullscreen t)

Actually, this could never have worked.  Emacs internally sets up a list
of parameters to be used for the initial frame and the second form just
annihilates any effect of the first.

> does not work as expected. Emacs goes fullscreen indeed. However, running
> manually `(toggle-frame-fullscreen)' once again after Emacs loaded, does
> not bring Emacs into maximized state, it rather returns to a small initial
> frame (of the default size, `emacs -q' to remind yourself how it looks
> like).

In fact.  Emacs never went to the maximized state so it can't return to
it.

> Changing `init.el' to:
>
> (add-to-list 'default-frame-alist '(fullscreen . maximized))
> (add-hook 'window-setup-hook 'toggle-frame-fullscreen t)
>
> does not help either.

The effect is the same as above.

> One could think that somehow `maximized' parameter is not set, but if one
> has in `init.el' only:
>
> (add-to-list 'default-frame-alist '(fullscreen . maximized))
>
> or
>
> (add-hook 'window-setup-hook 'toggle-frame-maximized t)
>
> then Emacs is loaded into maximized state indeed (*).

Because there's no fullscreen request that overrides it.

> On the other hand in `emacs -q', if one runs
>
> (toggle-frame-maximized)
> (toggle-frame-fullscreen)
>
> manually, and then runs `(toggle-frame-fullscreen)' manually once again,
> then Emacs is brought to maximized state.

Indeed.  These are two commands processed separately.

> All this makes me think that there is some problem with memorizing
> `maximized' parameter during `window-setup-hook', but note that this
> actually contradicts (*) what makes this problem even more confusing.

I've now implemented a couple of changes on trunk which allow to
memorize that parameter, which I renamed to `fullscreen-restore'.  In
particular, using an equivalent of the following form in your init file
should accomplish what you want.

(setq initial-frame-alist
      '((fullscreen . fullboth) (fullscreen-restore . maximized)))

Using `toggle-frame-fullscreen' and `toggle-frame-fullscreen' in the
initial file is confusing.  These specify transitions rather than states
and an initial file should rather specify the desired initial state of a
frame.

martin




This bug report was last modified 10 years and 24 days ago.

Previous Next


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