mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-25 07:28:20 +00:00
Fix image-mode-fit-frame some more
* lisp/image-mode.el (image-mode-fit-frame): Use frame-text-width and fit-frame-to-buffer instead of computing things ourselves (bug#37630). This makes things work better across platforms.
This commit is contained in:
parent
cae187e430
commit
0e739909ab
@ -419,12 +419,10 @@ window configuration prior to the last `image-mode-fit-frame'
|
|||||||
call."
|
call."
|
||||||
(interactive (list nil t))
|
(interactive (list nil t))
|
||||||
(let* ((buffer (current-buffer))
|
(let* ((buffer (current-buffer))
|
||||||
(display (image-get-display-property))
|
|
||||||
(size (image-display-size display t))
|
|
||||||
(saved (frame-parameter frame 'image-mode-saved-params))
|
(saved (frame-parameter frame 'image-mode-saved-params))
|
||||||
(window-configuration (current-window-configuration frame))
|
(window-configuration (current-window-configuration frame))
|
||||||
(frame-width (frame-pixel-width frame))
|
(frame-width (frame-text-width frame))
|
||||||
(frame-height (frame-pixel-height frame)))
|
(frame-height (frame-text-height frame)))
|
||||||
(with-selected-frame (or frame (selected-frame))
|
(with-selected-frame (or frame (selected-frame))
|
||||||
(if (and toggle saved
|
(if (and toggle saved
|
||||||
(= (caar saved) frame-width)
|
(= (caar saved) frame-width)
|
||||||
@ -436,24 +434,16 @@ call."
|
|||||||
(set-frame-parameter frame 'image-mode-saved-params nil))
|
(set-frame-parameter frame 'image-mode-saved-params nil))
|
||||||
(delete-other-windows)
|
(delete-other-windows)
|
||||||
(switch-to-buffer buffer t t)
|
(switch-to-buffer buffer t t)
|
||||||
(let* ((edges (window-inside-pixel-edges))
|
(fit-frame-to-buffer frame)
|
||||||
(inner-width (- (nth 2 edges) (nth 0 edges)))
|
;; The frame size after the above `set-frame-*' calls may
|
||||||
(inner-height (- (nth 3 edges) (nth 1 edges))))
|
;; differ from what we specified, due to window manager
|
||||||
(set-frame-width frame (+ (ceiling (car size))
|
;; interference. We have to call `frame-width' and
|
||||||
(- frame-width inner-width))
|
;; `frame-height' to get the actual results.
|
||||||
nil t)
|
(set-frame-parameter frame 'image-mode-saved-params
|
||||||
(set-frame-height frame (+ (ceiling (cdr size))
|
(list (cons (frame-text-width frame)
|
||||||
(- frame-height inner-height))
|
(frame-text-height frame))
|
||||||
nil t)
|
(cons frame-width frame-height)
|
||||||
;; The frame size after the above `set-frame-*' calls may
|
window-configuration))))))
|
||||||
;; differ from what we specified, due to window manager
|
|
||||||
;; interference. We have to call `frame-width' and
|
|
||||||
;; `frame-height' to get the actual results.
|
|
||||||
(set-frame-parameter frame 'image-mode-saved-params
|
|
||||||
(list (cons (frame-pixel-width frame)
|
|
||||||
(frame-pixel-height frame))
|
|
||||||
(cons frame-width frame-height)
|
|
||||||
window-configuration)))))))
|
|
||||||
|
|
||||||
;;; Image Mode setup
|
;;; Image Mode setup
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user