unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ken Brown <kbrown@cornell.edu>
To: martin rudalics <rudalics@gmx.at>,
	Dani Moncayo <dmoncayo@gmail.com>, Eli Zaretskii <eliz@gnu.org>
Cc: Lars Magne Ingebrigtsen <larsi@gnus.org>,
	25542@debbugs.gnu.org,
	Noam Postavsky <npostavs@users.sourceforge.net>
Subject: bug#25542: 25.1; Restoring the frame from fullscreen to maximized
Date: Fri, 11 Sep 2020 16:16:09 -0400	[thread overview]
Message-ID: <5d802046-c401-3a50-78b7-f5db80095114@cornell.edu> (raw)
In-Reply-To: <ead6e24c-6004-9cfe-ed92-a356670e5a68@gmx.at>

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

On 9/11/2020 3:53 AM, martin rudalics wrote:
>  >> ... after
>  >> maximizing the frame with the mouse, the value of
>  >>
>  >> (frame-parameter nil 'fullscreen)
>  >>
>  >> is nil.  Correct?
>  >
>  > Yes.
>  >
>  >> And what is its value if, instead, you maximize the
>  >> frame via 'toggle-frame-maximized'?
>  >
>  > maximized.
> 
> Mixing frame resizing triggered by Emacs commands and external tools is
> tricky to handle.
> 
>  >> Apparently some check _is_ needed (why?) so probably
>  >> using
>  >>
>  >>              if (x < 0 || y < 0)
>  >>                store_frame_param (f, Qfullscreen, Qmaximized);
>  >>
>  >> instead will fix it.  Can you try that (as I said elsewhere it will then
>  >> fail for borderless, maximized frames)?
>  >
>  > Yes, that does fix it.
> 
> So we'll probably have to use that.  Can you install it?

Patch attached (under your name).  Please check it and see if the commit message 
and comment change are OK.

Eli and Lars, I think this should go to master rather than the emacs-27 branch, 
since there's too much that we don't understand about the fix.  Do you agree?

>  > I haven't tried to test anything involving borderless frames.
> 
> If you
> 
> (set-frame-parameter nil 'undecorated t)
> 
> and maximize the frame via some Windows (Aero, IIRC) command, what does

Sorry, but I don't know what an Aero command is, and I'm not interested in 
learning if I don't have to.  If anyone really cares about this case and can't 
carry out the experiment themselves, I'm willing to do it, but I'll need 
explicit instructions.

> (frame-parameter nil 'fullscreen)
> 
> report?  With and without the && ~> || change.
> 
> And it would still be interesting to understand your earlier finding,
> namely that
> 
>    If I make this change and follow Dani's recipe from the original bug
>    report, the second F11 press doesn't restore the previous state.
>    Instead, the frame appears to get slightly smaller for an instant and
>    then immediately reverts to fullscreen mode.
> 
> That second F11 should set the 'fullscreen parameter to 'maximized so I
> fail to see how a subsequent action can restore it to 'fullboth.  In
> retrospect, that
> 
>            /* Windows can send us a SIZE_MAXIMIZED message even
>               when fullscreen is fullboth ....
> 
> comment apparently matches your experience now but I cannot even recall
> based on what experience I added it back then.
> 
> Thanks, martin

Ken

[-- Attachment #2: 0001-Fix-toggle-frame-fullscreen-on-w32-builds.patch --]
[-- Type: text/plain, Size: 1320 bytes --]

From 9dd0fe7a16fba2b37e79be24acbd325b159086c6 Mon Sep 17 00:00:00 2001
From: Martin Rudalics <rudalics@gmx.at>
Date: Fri, 11 Sep 2020 16:04:20 -0400
Subject: [PATCH] Fix toggle-frame-fullscreen on w32 builds

* src/w32term.c (w32_read_socket): Set 'fullscreen' to 'maximized'
if Windows sends SIZE_MAXIMIZED and either the top or the left of
the frame is outside the screen.  (Bug#25542)
---
 src/w32term.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/w32term.c b/src/w32term.c
index 1766b32514..2669f29b56 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -5478,15 +5478,15 @@ w32_read_socket (struct terminal *terminal,
 		  /* Windows can send us a SIZE_MAXIMIZED message even
 		     when fullscreen is fullboth.  The following is a
 		     simple hack to check that based on the fact that
-		     only a maximized fullscreen frame should have both
-		     top/left outside the screen.  */
+		     only a maximized fullscreen frame should have top
+		     or left outside the screen.  */
 		  if (EQ (fullscreen, Qfullwidth) || EQ (fullscreen, Qfullheight)
 		      || NILP (fullscreen))
 		      {
 			int x, y;
 
 			w32_real_positions (f, &x, &y);
-			if (x < 0 && y < 0)
+			if (x < 0 || y < 0)
 			  store_frame_param (f, Qfullscreen, Qmaximized);
 		      }
 		  }
-- 
2.28.0


  reply	other threads:[~2020-09-11 20:16 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-26  8:15 bug#25542: 25.1; Restoring the frame from fullscreen to maximized Dani Moncayo
2017-01-26  9:51 ` martin rudalics
2017-01-26 10:20   ` Dani Moncayo
2017-01-26 10:54     ` Dani Moncayo
2017-01-26 17:49       ` Dani Moncayo
2017-01-26 18:02         ` Noam Postavsky
2017-01-26 19:06         ` martin rudalics
2017-01-27  7:54           ` Dani Moncayo
2017-01-27  9:18             ` martin rudalics
2017-01-26 14:00     ` martin rudalics
2017-01-26 15:43       ` Noam Postavsky
2017-01-26 16:10         ` Eli Zaretskii
2017-01-27  8:03       ` Dani Moncayo
2017-01-27  8:16         ` Eli Zaretskii
2017-01-27  8:22           ` Dani Moncayo
2017-01-27  9:19         ` martin rudalics
2017-01-27  9:25           ` Dani Moncayo
2017-01-27  9:31             ` Dani Moncayo
2017-01-27  9:50               ` martin rudalics
2017-01-27 10:22                 ` Dani Moncayo
2017-01-27 10:27                   ` Dani Moncayo
2017-01-27  9:34             ` martin rudalics
2017-01-27 10:01               ` Dani Moncayo
2017-01-27 13:47                 ` martin rudalics
2017-01-27 18:50                   ` Noam Postavsky
2017-01-28  8:02                     ` martin rudalics
2020-09-04 12:32                       ` Lars Ingebrigtsen
2020-09-04 17:50                         ` Dani Moncayo
2020-09-05  6:46                           ` Eli Zaretskii
2020-09-05 11:59                             ` Dani Moncayo
2020-09-05 12:17                               ` Eli Zaretskii
2020-09-05 12:19                                 ` Dani Moncayo
2020-09-05 12:30                                   ` Eli Zaretskii
2020-09-05 12:32                                     ` Dani Moncayo
2020-09-05 12:48                                       ` Eli Zaretskii
2020-09-05 15:10                                       ` Ken Brown
2020-09-05 16:07                                         ` Eli Zaretskii
2020-09-05 16:10                                           ` Ken Brown
2020-09-05 16:41                                             ` Eli Zaretskii
2020-09-09  8:44                               ` martin rudalics
2020-09-09 16:46                                 ` Dani Moncayo
2020-09-09 18:19                                 ` Ken Brown
2020-09-09 20:24                                   ` Ken Brown
2020-09-10  7:16                                     ` martin rudalics
2020-09-10 15:05                                       ` Ken Brown
2020-09-10 18:16                                         ` martin rudalics
2020-09-10 19:04                                           ` Ken Brown
2020-09-11  7:53                                             ` martin rudalics
2020-09-11 20:16                                               ` Ken Brown [this message]
2020-09-11 20:33                                                 ` Achim Gratz
2020-09-11 21:18                                                   ` Ken Brown
2020-09-12  6:54                                                     ` martin rudalics
2020-09-12 11:37                                                       ` Ken Brown
2020-09-12  6:54                                                   ` martin rudalics
2020-09-12  6:06                                                 ` Eli Zaretskii
2020-09-12  6:54                                                 ` martin rudalics
2017-01-26 16:08   ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5d802046-c401-3a50-78b7-f5db80095114@cornell.edu \
    --to=kbrown@cornell.edu \
    --cc=25542@debbugs.gnu.org \
    --cc=dmoncayo@gmail.com \
    --cc=eliz@gnu.org \
    --cc=larsi@gnus.org \
    --cc=npostavs@users.sourceforge.net \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).