all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Spenser Truex <web@spensertruex.com>
To: Robert Pluim <rpluim@gmail.com>
Cc: 31920@debbugs.gnu.org,
	Jonathan Kyle Mitchell <kyle@jonathanmitchell.org>
Subject: bug#31920: 26.1; frame appears in wrong part of desktop after restoring frameset from fullscreen
Date: Sun, 30 Jun 2019 23:08:40 -0700	[thread overview]
Message-ID: <87imsm1e3b.fsf@spensertruex.com> (raw)
In-Reply-To: <87zhzn0w1y.fsf@gmail.com> (Robert Pluim's message of "Fri, 22 Jun 2018 15:50:49 +0200")

Robert Pluim <rpluim@gmail.com> writes:

> diff --git i/lisp/frame.el w/lisp/frame.el
> index 29c31f41cb..a58fad6481 100644
> --- i/lisp/frame.el
> +++ w/lisp/frame.el
> @@ -2413,7 +2413,7 @@ toggle-frame-maximized
>       (t
>        (set-frame-parameter nil 'fullscreen 'maximized)))))
>
> -(defun toggle-frame-fullscreen ()
> +(defun toggle-frame-fullscreen (&optional frame)
>    "Toggle fullscreen state of selected frame.
>  Make selected frame fullscreen or restore its previous size if it
>  is already fullscreen.
> @@ -2431,14 +2431,14 @@ toggle-frame-fullscreen
>
>  See also `toggle-frame-maximized'."
>    (interactive)
> -  (let ((fullscreen (frame-parameter nil 'fullscreen)))
> +  (let ((fullscreen (frame-parameter frame 'fullscreen)))
>      (if (memq fullscreen '(fullscreen fullboth))
> -	(let ((fullscreen-restore (frame-parameter nil 'fullscreen-restore)))
> +	(let ((fullscreen-restore (frame-parameter frame 'fullscreen-restore)))
>  	  (if (memq fullscreen-restore '(maximized fullheight fullwidth))
> -	      (set-frame-parameter nil 'fullscreen fullscreen-restore)
> -	    (set-frame-parameter nil 'fullscreen nil)))
> +	      (set-frame-parameter frame 'fullscreen fullscreen-restore)
> +	    (set-frame-parameter frame 'fullscreen nil)))
>        (modify-frame-parameters
> -       nil `((fullscreen . fullboth) (fullscreen-restore . ,fullscreen))))
> +       frame `((fullscreen . fullboth) (fullscreen-restore . ,fullscreen))))
>      ;; Manipulating a frame without waiting for the fullscreen
>      ;; animation to complete can cause a crash, or other unexpected
>      ;; behavior, on macOS (bug#28496).
> diff --git i/lisp/frameset.el w/lisp/frameset.el
> index 0e3363d7ae..ffbf6722a7 100644
> --- i/lisp/frameset.el
> +++ w/lisp/frameset.el
> @@ -1085,6 +1085,11 @@ frameset--restore-frame
>        (when (frame-live-p parent-frame)
>          (set-frame-parameter frame 'parent-frame parent-frame)))
>
> +    (let ((old-fullscreen (frame-parameter frame 'fullscreen)))
> +      (and (not (eq old-fullscreen fullscreen))
> +           (memq old-fullscreen '(fullscreen fullboth))
> +           (not fullscreen)
> +           (toggle-frame-fullscreen frame)))
>      (modify-frame-parameters frame
>  			     (if (eq (frame-parameter frame 'fullscreen) fullscreen)
>  				 ;; Workaround for bug#14949
>
>
>
>

I've just discovered this bug for myself, without any register
manipulation. Here is the recipe (almost the same as the original):

1) Make a window and use the WM to make it 1/2 the screen size. I
usually grab the window with the mouse and hit it against the right side
of the screen.
2) F11 to toggle fullscreen.
3) do #2 again.

Now the window isn't perfectly 1/2 the window.

Checking the value of (frame-parameter nil 'fullscreen) produces the
symbol fullheight, which indicates the problem: the emacs restore
procedure (fullscreen-restore) only stores *some* information about the
previous window configuration. The following diff shows the workaround I
was using so I could happily use f11 with my emacs:
--- lisp/frame.el	2019-06-30 21:42:29.257939995 -0700
+++ lisp/frame.el	2019-06-30 21:41:34.239940756 -0700
@@ -2621,21 +2621,21 @@
 `frame-resize-pixelwise' to non-nil in order to make a frame
 appear truly fullscreen.  In addition, you may have to set
 `x-frame-normalize-before-maximize' in order to enable
 transitions from one fullscreen state to another.

 See also `toggle-frame-maximized'."
   (interactive)
   (let ((fullscreen (frame-parameter frame 'fullscreen)))
     (if (memq fullscreen '(fullscreen fullboth))
 	(let ((fullscreen-restore (frame-parameter frame 'fullscreen-restore)))
-	  (if (memq fullscreen-restore '(maximized fullheight fullwidth))
+	  (if (memq fullscreen-restore '(maximized))
 	      (set-frame-parameter frame 'fullscreen fullscreen-restore)
 	    (set-frame-parameter frame 'fullscreen nil)))
       (modify-frame-parameters
        frame `((fullscreen . fullboth) (fullscreen-restore . ,fullscreen))))
     ;; Manipulating a frame without waiting for the fullscreen
     ;; animation to complete can cause a crash, or other unexpected
     ;; behavior, on macOS (bug#28496).
     (when (featurep 'cocoa) (sleep-for 0.5))))

 \f

So I just threw out all width and height information. To do a proper
fix, I think Emacs needs to keep track of sufficient information about
the window. Window height, width, and location must be stored. The
current one only stores height or width.

This way the window manager seems to be able to make all the decisions
about window size, though I actually have no idea what is going on.

For toggle-frame-maximized the problem still exists though, and I have
not found any workaround.

--
Spenser Truex





  parent reply	other threads:[~2019-07-01  6:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-21  3:12 bug#31920: 26.1; frame appears in wrong part of desktop after restoring frameset from fullscreen Jonathan Kyle Mitchell
2018-06-21  7:16 ` martin rudalics
2018-06-21 10:25   ` Robert Pluim
2018-06-22  8:55     ` martin rudalics
2018-06-22 11:19       ` Robert Pluim
2018-06-22 12:17         ` martin rudalics
2018-06-22 13:50           ` Robert Pluim
2018-06-23  8:40             ` martin rudalics
2018-06-27  9:07               ` Robert Pluim
2018-06-28  8:03                 ` martin rudalics
2019-07-01  6:08             ` Spenser Truex [this message]
2018-06-21 15:54   ` Eli Zaretskii
2018-06-22  8:55     ` martin rudalics

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

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

  git send-email \
    --in-reply-to=87imsm1e3b.fsf@spensertruex.com \
    --to=web@spensertruex.com \
    --cc=31920@debbugs.gnu.org \
    --cc=kyle@jonathanmitchell.org \
    --cc=rpluim@gmail.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.