aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Jensen2017-12-16 09:36:35 +0100
committerMartin Rudalics2017-12-16 09:36:35 +0100
commit804b37ca63ecd68c5359febbedbec120c06918af (patch)
tree6d27a9c110360f3c79ce45277d11bcc31adc525b
parent777fe9466168d935e9055c7592b943cd4d2d2ff9 (diff)
downloademacs-804b37ca63ecd68c5359febbedbec120c06918af.tar.gz
emacs-804b37ca63ecd68c5359febbedbec120c06918af.zip
Save and restore text-pixel height and width of frames (Bug#28442)
* lisp/frameset.el (frameset--record-relationships): Record text-pixel-height and text-pixel-width of frame. (frameset--restore-frame): Restore text-pixel-height and text-pixel-width of frame if available. (Bug#28442)
-rw-r--r--lisp/frameset.el28
1 files changed, 27 insertions, 1 deletions
diff --git a/lisp/frameset.el b/lisp/frameset.el
index 16940f814a9..e2d26411e96 100644
--- a/lisp/frameset.el
+++ b/lisp/frameset.el
@@ -745,6 +745,8 @@ The relationships recorded for each frame are
745- `delete-before' via `frameset--delete-before' 745- `delete-before' via `frameset--delete-before'
746- `parent-frame' via `frameset--parent-frame' 746- `parent-frame' via `frameset--parent-frame'
747- `mouse-wheel-frame' via `frameset--mouse-wheel-frame' 747- `mouse-wheel-frame' via `frameset--mouse-wheel-frame'
748- `text-pixel-width' via `frameset--text-pixel-width'
749- `text-pixel-height' via `frameset--text-pixel-height'
748 750
749Internal use only." 751Internal use only."
750 ;; Record frames with their own minibuffer 752 ;; Record frames with their own minibuffer
@@ -791,7 +793,23 @@ Internal use only."
791 'frameset--mini 793 'frameset--mini
792 (cons nil 794 (cons nil
793 (and mb-frame 795 (and mb-frame
794 (frameset-frame-id mb-frame)))))))))) 796 (frameset-frame-id mb-frame)))))))))
797 ;; Now store text-pixel width and height if it differs from the calculated
798 ;; width and height and the frame is not fullscreen.
799 (dolist (frame frame-list)
800 (unless (frame-parameter frame 'fullscreen)
801 (unless (eq (* (frame-parameter frame 'width)
802 (frame-char-width frame))
803 (frame-text-width frame))
804 (set-frame-parameter
805 frame 'frameset--text-pixel-width
806 (frame-text-width frame)))
807 (unless (eq (* (frame-parameter frame 'height)
808 (frame-char-height frame))
809 (frame-text-height frame))
810 (set-frame-parameter
811 frame 'frameset--text-pixel-height
812 (frame-text-height frame))))))
795 813
796;;;###autoload 814;;;###autoload
797(cl-defun frameset-save (frame-list 815(cl-defun frameset-save (frame-list
@@ -1002,6 +1020,14 @@ Internal use only."
1002 (display (cdr (assq 'display filtered-cfg))) ;; post-filtering 1020 (display (cdr (assq 'display filtered-cfg))) ;; post-filtering
1003 alt-cfg frame) 1021 alt-cfg frame)
1004 1022
1023 ;; Use text-pixels for height and width, if available.
1024 (let ((text-pixel-width (cdr (assq 'frameset--text-pixel-width parameters)))
1025 (text-pixel-height (cdr (assq 'frameset--text-pixel-height parameters))))
1026 (when text-pixel-width
1027 (setf (alist-get 'width filtered-cfg) (cons 'text-pixels text-pixel-width)))
1028 (when text-pixel-height
1029 (setf (alist-get 'height filtered-cfg) (cons 'text-pixels text-pixel-height))))
1030
1005 (when fullscreen 1031 (when fullscreen
1006 ;; Currently Emacs has the limitation that it does not record the size 1032 ;; Currently Emacs has the limitation that it does not record the size
1007 ;; and position of a frame before maximizing it, so we cannot save & 1033 ;; and position of a frame before maximizing it, so we cannot save &