diff options
author | Aaron Jensen <aaronjensen@gmail.com> | 2017-12-16 09:36:35 +0100 |
---|---|---|
committer | Martin Rudalics <rudalics@gmx.at> | 2017-12-16 09:36:35 +0100 |
commit | 804b37ca63ecd68c5359febbedbec120c06918af (patch) | |
tree | 6d27a9c110360f3c79ce45277d11bcc31adc525b /lisp | |
parent | 777fe9466168d935e9055c7592b943cd4d2d2ff9 (diff) | |
download | emacs-804b37ca63ecd68c5359febbedbec120c06918af.tar.gz emacs-804b37ca63ecd68c5359febbedbec120c06918af.tar.bz2 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)
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/frameset.el | 28 |
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 - `delete-before' via `frameset--delete-before' - `parent-frame' via `frameset--parent-frame' - `mouse-wheel-frame' via `frameset--mouse-wheel-frame' +- `text-pixel-width' via `frameset--text-pixel-width' +- `text-pixel-height' via `frameset--text-pixel-height' Internal use only." ;; Record frames with their own minibuffer @@ -791,7 +793,23 @@ Internal use only." 'frameset--mini (cons nil (and mb-frame - (frameset-frame-id mb-frame)))))))))) + (frameset-frame-id mb-frame))))))))) + ;; Now store text-pixel width and height if it differs from the calculated + ;; width and height and the frame is not fullscreen. + (dolist (frame frame-list) + (unless (frame-parameter frame 'fullscreen) + (unless (eq (* (frame-parameter frame 'width) + (frame-char-width frame)) + (frame-text-width frame)) + (set-frame-parameter + frame 'frameset--text-pixel-width + (frame-text-width frame))) + (unless (eq (* (frame-parameter frame 'height) + (frame-char-height frame)) + (frame-text-height frame)) + (set-frame-parameter + frame 'frameset--text-pixel-height + (frame-text-height frame)))))) ;;;###autoload (cl-defun frameset-save (frame-list @@ -1002,6 +1020,14 @@ Internal use only." (display (cdr (assq 'display filtered-cfg))) ;; post-filtering alt-cfg frame) + ;; Use text-pixels for height and width, if available. + (let ((text-pixel-width (cdr (assq 'frameset--text-pixel-width parameters))) + (text-pixel-height (cdr (assq 'frameset--text-pixel-height parameters)))) + (when text-pixel-width + (setf (alist-get 'width filtered-cfg) (cons 'text-pixels text-pixel-width))) + (when text-pixel-height + (setf (alist-get 'height filtered-cfg) (cons 'text-pixels text-pixel-height)))) + (when fullscreen ;; Currently Emacs has the limitation that it does not record the size ;; and position of a frame before maximizing it, so we cannot save & |