]> git.eshelyaron.com Git - emacs.git/commitdiff
lisp/desktop.el: Restore frames at their positions, even if offscreen.
authorJuanma Barranquero <lekktu@gmail.com>
Sat, 27 Jul 2013 01:02:00 +0000 (03:02 +0200)
committerJuanma Barranquero <lekktu@gmail.com>
Sat, 27 Jul 2013 01:02:00 +0000 (03:02 +0200)
(desktop--make-frame): Apply most frame parameters after creating the frame
to force (partially or totally) offscreen frames to be restored as such.

lisp/ChangeLog
lisp/desktop.el

index 9f0fdddc574c67cb25e6747b6df03aae59f9ef59..42ad403583b35f394caf07ece89201bcc17034a9 100644 (file)
@@ -1,3 +1,9 @@
+2013-07-27  Juanma Barranquero  <lekktu@gmail.com>
+
+       * desktop.el (desktop--make-frame): Apply most frame parameters after
+       creating the frame to force (partially or totally) offscreen frames to
+       be restored as such.
+
 2013-07-26  Xue Fuqiao  <xfq.free@gmail.com>
 
        * vc/vc-dir.el (vc-dir-mode-map): Add binding for vc-root-diff.
@@ -15,7 +21,7 @@
 2013-07-26  Juanma Barranquero  <lekktu@gmail.com>
 
        * desktop.el (desktop--select-frame):
-       Try harder to reuse the initial frame.
+       Try harder to reuse existing frames.
 
 2013-07-26  Stefan Monnier  <monnier@iro.umontreal.ca>
 
index d5895a8de5707ee6e32a08b1eeab691b1c64d02f..297f09b269ecb2c4f0e22a892b7596b5c5969b34 100644 (file)
@@ -1311,14 +1311,22 @@ its window state.  Internal use only."
        (push visible alt-cfg)
        (push (cons 'fullscreen fullscreen) alt-cfg)))
 
-    ;; Time to select or create a frame an apply the big bunch of parameters
-    (if (setq frame (desktop--select-frame display filtered-cfg))
-       (modify-frame-parameters frame
-                                (if (eq (frame-parameter frame 'fullscreen) fullscreen)
-                                    ;; Workaround for bug#14949
-                                    (assq-delete-all 'fullscreen filtered-cfg)
-                                  filtered-cfg))
-      (setq frame (make-frame-on-display display filtered-cfg)))
+    ;; Time to find or create a frame an apply the big bunch of parameters.
+    ;; If a frame needs to be created and it falls partially or wholly offscreen,
+    ;; sometimes it gets "pushed back" onscreen; however, moving it afterwards is
+    ;; allowed.  So we create the frame as invisible and then reapply the full
+    ;; parameter list (including position and size parameters).
+    (setq frame (or (desktop--select-frame display filtered-cfg)
+                   (make-frame-on-display display
+                                          (cons '(visibility)
+                                                (cl-loop
+                                                 for param in '(left top width height)
+                                                 collect (assq param filtered-cfg))))))
+    (modify-frame-parameters frame
+                            (if (eq (frame-parameter frame 'fullscreen) fullscreen)
+                                ;; Workaround for bug#14949
+                                (assq-delete-all 'fullscreen filtered-cfg)
+                              filtered-cfg))
 
     ;; Let's give the finishing touches (visibility, tool-bar, maximization).
     (when lines (push lines alt-cfg))