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

From: Robert Pluim <[email-masked]>
Date: Fri, 22 Jun 2018 13:19:36 +0200

martin rudalics <[email-masked]> writes:

>> I see this on my Ubuntu 16.04 box, also running KDE, but only if I go
>> through the restore cycle twice. Also, if I restore frameset a again,
>> the frame ends up in the right place, ie:
>>
>> restore a -> OK
>> restore b -> OK
>> restore a -> NOK
>> restore a -> OK
>
> Confirmed.  The transition from b to a via C-x r j a always moves the
> frame to the top/left corner of the screen here.
>
> IIUC C-x r f runs the command 'frameset-to-register' which stores a
> "framset" in a register.  C-x r j runs the command 'jump-to-register'
> which does _not_ restore a frame's state via 'frameset--restore-frame'
> but goes to 'set-frame-configuration' instead.  Apparently, framesets
> and frame configurations differ in a couple of minor aspects and the
> fullscreen state is one of them.

They do, but when edebugging jump-to-register, I end up in this branch
of the cond:

     ((registerv-p val)
      (cl-assert (registerv-jump-func val) nil
              "Don't know how to jump to register %s"
              (single-key-description register))
      (funcall (registerv-jump-func val) (registerv-data val)))

Which ends up calling frameset--restore-frame, so the problem is elsewhere.

>> Neither of those make any difference for me, nor does using
>> toggle-frame-maximized.
>
> Obviously so because 'frameset--restore-frame' does not get called in
> the first place.

I think I tested the wrong thing, probably because I forgot an
'eval-defun' somewhere.

The code that causes the frame to be restored in the wrong place is
this:

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

in framset--restore-frame, which means Iʼm going to have to break out
gdb and/or printf. (Iʼm surprised Eli is seeing this on MS-Windows
though, I thought the low-level frame implementation was completely
separate)

Robert