Subject: bug#31920: 26.1; frame appears in wrong part of desktop after restoring frameset from fullscreen

From: martin rudalics <[email-masked]>
Date: Thu, 21 Jun 2018 09:16:24 +0200

> 1. save a frameset with an unmaximized frame
 > start from emacs -Q
 > create a second window with `C-x 2'
 > use the mouse to move the frame to the right side of the desktop
 > save the split window frame with `C-x r f a'
 >
 > 2. save a frameset with a maximized/fullscreen frame
 > delete one of the windows with `C-x 1'
 > press `f11' to make the frame fullscreen
 > save the fullscreen frame with `C-x r f b'
 >
 > 3. restore the unmaximized frameset with `C-x r j a'
 > After jumping between framesets from register b to register a, the
 > non-fullscreen frame appears on the opposite (left) side of the desktop
 > than it was originally. Typing `C-x r j a' a second time moves the frame
 > to its original location.
 >
 > I've reproduced this using Emacs 26.1 in both Windows 10 and Fedora 28
 > KDE desktop environments.
 >
 > In GNU Emacs 26.1 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.22.30)
 >   of 2018-06-04 built on buildvm-10.phx2.fedoraproject.org

Thanks for the report.  Here I can't reproduce the behavior you
observe on Windows XP even if I modify your recipe in various ways.
Maybe someone else can give it a try.

Do you really have to split the window in step 1 and delete a window
in step 2 to produce the bug?  These actions appear unrelated to the
behavior you observe since window managers pretty much ignore Emacs
windows.

Also what happens if, in step 2, you maximize the window instead of
making it fullscreen?  frameset.el has

     (modify-frame-parameters frame
			     (if (eq (frame-parameter frame 'fullscreen) fullscreen)
				 ;; Workaround for bug#14949
				 (assq-delete-all 'fullscreen filtered-cfg)
			       filtered-cfg))

which might affect the behavior on your system.  Can you take out this
form, reevaluate 'frameset--restore-frame' and see whether anything
changes?

And maybe you could also try with

     (when (and force-onscreen
	       ;; FIXME: iconified frames should be checked too,
	       ;; but it is impossible without deiconifying them.
	       (not (eq (frame-parameter frame 'visibility) 'icon)))
       (frameset-move-onscreen frame force-onscreen))

removed from 'frameset--restore-frame'.

martin