From d85c4d508105431699fc200135a14bfa7d86c0d7 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Sat, 27 Jul 2013 03:02:00 +0200 Subject: [PATCH] lisp/desktop.el: Restore frames at their positions, even if offscreen. (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 | 8 +++++++- lisp/desktop.el | 24 ++++++++++++++++-------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9f0fdddc574..42ad403583b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2013-07-27 Juanma Barranquero + + * 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 * vc/vc-dir.el (vc-dir-mode-map): Add binding for vc-root-diff. @@ -15,7 +21,7 @@ 2013-07-26 Juanma Barranquero * desktop.el (desktop--select-frame): - Try harder to reuse the initial frame. + Try harder to reuse existing frames. 2013-07-26 Stefan Monnier diff --git a/lisp/desktop.el b/lisp/desktop.el index d5895a8de57..297f09b269e 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el @@ -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)) -- 2.11.4.GIT