unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#19075: `toggle-frame-maximized' and `toggle-frame-fullscreen' on Windows
@ 2014-11-17  8:13 Alexander Shukaev
  2014-11-17  9:29 ` martin rudalics
  2015-02-13 18:25 ` martin rudalics
  0 siblings, 2 replies; 8+ messages in thread
From: Alexander Shukaev @ 2014-11-17  8:13 UTC (permalink / raw)
  To: 19075

[-- Attachment #1: Type: text/plain, Size: 1320 bytes --]

`init.el':

(add-hook 'window-setup-hook 'toggle-frame-maximized t)
(add-hook 'window-setup-hook 'toggle-frame-fullscreen t)

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

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 (*).

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.

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.

It's Emacs 24.4.50 on Windows.

[-- Attachment #2: Type: text/html, Size: 1842 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#19075: `toggle-frame-maximized' and `toggle-frame-fullscreen' on Windows
  2014-11-17  8:13 bug#19075: `toggle-frame-maximized' and `toggle-frame-fullscreen' on Windows Alexander Shukaev
@ 2014-11-17  9:29 ` martin rudalics
  2014-11-17  9:48   ` Alexander Shukaev
  2015-02-13 18:25 ` martin rudalics
  1 sibling, 1 reply; 8+ messages in thread
From: martin rudalics @ 2014-11-17  9:29 UTC (permalink / raw)
  To: Alexander Shukaev, 19075

 > (add-hook 'window-setup-hook 'toggle-frame-maximized t)
 > (add-hook 'window-setup-hook 'toggle-frame-fullscreen t)
 >
 > 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).
[...]
 > It's Emacs 24.4.50 on Windows.

Can you try with Emacs 25.0.50?

martin





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#19075: `toggle-frame-maximized' and `toggle-frame-fullscreen' on Windows
  2014-11-17  9:29 ` martin rudalics
@ 2014-11-17  9:48   ` Alexander Shukaev
  2014-11-17 10:16     ` martin rudalics
  0 siblings, 1 reply; 8+ messages in thread
From: Alexander Shukaev @ 2014-11-17  9:48 UTC (permalink / raw)
  To: martin rudalics; +Cc: 19075

[-- Attachment #1: Type: text/plain, Size: 218 bytes --]

>
> Can you try with Emacs 25.0.50?


It's the same problem. By the way, I forgot to mention that sometimes it
works and sometimes not, like if there was some concurrency issue. But in
the most cases it does not work.

[-- Attachment #2: Type: text/html, Size: 442 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#19075: `toggle-frame-maximized' and `toggle-frame-fullscreen' on Windows
  2014-11-17  9:48   ` Alexander Shukaev
@ 2014-11-17 10:16     ` martin rudalics
  2014-11-17 16:03       ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: martin rudalics @ 2014-11-17 10:16 UTC (permalink / raw)
  To: Alexander Shukaev; +Cc: 19075

 > It's the same problem.

What does (with Emacs 25.0.50)

(frame-parameter nil 'maximized)

give with your initial screen, that is, before you do
(toggle-frame-fullscreen)?

 > By the way, I forgot to mention that sometimes it
 > works and sometimes not, like if there was some concurrency issue.

I think so too.  You should be able to verify that by putting

(toggle-frame-maximized)
(sit-for 0)
(toggle-frame-fullscreen)

into your .emacs.

 > But in
 > the most cases it does not work.

It works here on Windows XP with Emacs 25.0.50.

martin





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#19075: `toggle-frame-maximized' and `toggle-frame-fullscreen' on Windows
  2014-11-17 10:16     ` martin rudalics
@ 2014-11-17 16:03       ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2014-11-17 16:03 UTC (permalink / raw)
  To: martin rudalics; +Cc: haroogan, 19075

> Date: Mon, 17 Nov 2014 11:16:10 +0100
> From: martin rudalics <rudalics@gmx.at>
> Cc: 19075@debbugs.gnu.org
> 
>  > By the way, I forgot to mention that sometimes it
>  > works and sometimes not, like if there was some concurrency issue.
> 
> I think so too.  You should be able to verify that by putting
> 
> (toggle-frame-maximized)
> (sit-for 0)
> (toggle-frame-fullscreen)
> 
> into your .emacs.

The concurrency issue is fundamental, since the Windows messages are
handled in a separate thread, and a command sent to a frame is not
executed immediately.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#19075: `toggle-frame-maximized' and `toggle-frame-fullscreen' on Windows
  2014-11-17  8:13 bug#19075: `toggle-frame-maximized' and `toggle-frame-fullscreen' on Windows Alexander Shukaev
  2014-11-17  9:29 ` martin rudalics
@ 2015-02-13 18:25 ` martin rudalics
  2015-06-27 15:24   ` Alexander Shukaev
  1 sibling, 1 reply; 8+ messages in thread
From: martin rudalics @ 2015-02-13 18:25 UTC (permalink / raw)
  To: Alexander Shukaev, 19075

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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#19075: `toggle-frame-maximized' and `toggle-frame-fullscreen' on Windows
  2015-02-13 18:25 ` martin rudalics
@ 2015-06-27 15:24   ` Alexander Shukaev
  2015-06-29  9:45     ` martin rudalics
  0 siblings, 1 reply; 8+ messages in thread
From: Alexander Shukaev @ 2015-06-27 15:24 UTC (permalink / raw)
  To: martin rudalics; +Cc: 19075

[-- Attachment #1: Type: text/plain, Size: 2652 bytes --]

On Fri, Feb 13, 2015 at 8:25 PM, martin rudalics <rudalics@gmx.at> wrote:

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

​Amazing.  Thanks, Martin!  This one can be definitely closed.​

[-- Attachment #2: Type: text/html, Size: 4355 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#19075: `toggle-frame-maximized' and `toggle-frame-fullscreen' on Windows
  2015-06-27 15:24   ` Alexander Shukaev
@ 2015-06-29  9:45     ` martin rudalics
  0 siblings, 0 replies; 8+ messages in thread
From: martin rudalics @ 2015-06-29  9:45 UTC (permalink / raw)
  To: Alexander Shukaev; +Cc: 19075-done

 > ​This one can be definitely closed.​

Done.

martin






^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-06-29  9:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-17  8:13 bug#19075: `toggle-frame-maximized' and `toggle-frame-fullscreen' on Windows Alexander Shukaev
2014-11-17  9:29 ` martin rudalics
2014-11-17  9:48   ` Alexander Shukaev
2014-11-17 10:16     ` martin rudalics
2014-11-17 16:03       ` Eli Zaretskii
2015-02-13 18:25 ` martin rudalics
2015-06-27 15:24   ` Alexander Shukaev
2015-06-29  9:45     ` martin rudalics

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).