aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Trofimov2020-03-01 19:49:18 +0100
committerMartin Rudalics2020-03-01 19:49:18 +0100
commitb42b894d1def7180ab715615116fe6af65b76bd8 (patch)
tree8d4145c2f9053e1090c56ed9f4cc255066c584bb
parent366fd4fd07898fa78ed67409f882bd8553f059b1 (diff)
downloademacs-b42b894d1def7180ab715615116fe6af65b76bd8.tar.gz
emacs-b42b894d1def7180ab715615116fe6af65b76bd8.zip
Fix fit-frame-to-buffer for multi-monitor setup
* lisp/window.el (fit-frame-to-buffer): Call 'frame-monitor-attributes' instead of 'display-monitor-attributes-list'. Fix geometry calculations for multiple monitors. Copyright-paperwork-exempt: yes
-rw-r--r--lisp/window.el13
1 files changed, 7 insertions, 6 deletions
diff --git a/lisp/window.el b/lisp/window.el
index 40c4bf5ad47..ceab43f7cd3 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -8794,8 +8794,7 @@ parameters of FRAME."
8794 (parent (frame-parent frame)) 8794 (parent (frame-parent frame))
8795 (monitor-attributes 8795 (monitor-attributes
8796 (unless parent 8796 (unless parent
8797 (car (display-monitor-attributes-list 8797 (frame-monitor-attributes frame)))
8798 (frame-parameter frame 'display)))))
8799 ;; FRAME'S parent or display sizes. Used in connection 8798 ;; FRAME'S parent or display sizes. Used in connection
8800 ;; with margins. 8799 ;; with margins.
8801 (geometry 8800 (geometry
@@ -8804,11 +8803,11 @@ parameters of FRAME."
8804 (parent-or-display-width 8803 (parent-or-display-width
8805 (if parent 8804 (if parent
8806 (frame-native-width parent) 8805 (frame-native-width parent)
8807 (- (nth 2 geometry) (nth 0 geometry)))) 8806 (nth 2 geometry)))
8808 (parent-or-display-height 8807 (parent-or-display-height
8809 (if parent 8808 (if parent
8810 (frame-native-height parent) 8809 (frame-native-height parent)
8811 (- (nth 3 geometry) (nth 1 geometry)))) 8810 (nth 3 geometry)))
8812 ;; FRAME's parent or workarea sizes. Used when no margins 8811 ;; FRAME's parent or workarea sizes. Used when no margins
8813 ;; are specified. 8812 ;; are specified.
8814 (parent-or-workarea 8813 (parent-or-workarea
@@ -8870,13 +8869,15 @@ parameters of FRAME."
8870 (window--sanitize-margin 8869 (window--sanitize-margin
8871 (nth 2 margins) left-margin 8870 (nth 2 margins) left-margin
8872 parent-or-display-width)) 8871 parent-or-display-width))
8873 (nth 2 parent-or-workarea))) 8872 (+ (nth 0 parent-or-workarea)
8873 (nth 2 parent-or-workarea))))
8874 (bottom-margin (if (nth 3 margins) 8874 (bottom-margin (if (nth 3 margins)
8875 (- parent-or-display-height 8875 (- parent-or-display-height
8876 (window--sanitize-margin 8876 (window--sanitize-margin
8877 (nth 3 margins) top-margin 8877 (nth 3 margins) top-margin
8878 parent-or-display-height)) 8878 parent-or-display-height))
8879 (nth 3 parent-or-workarea))) 8879 (+ (nth 1 parent-or-workarea)
8880 (nth 3 parent-or-workarea))))
8880 ;; Minimum and maximum sizes specified for FRAME. 8881 ;; Minimum and maximum sizes specified for FRAME.
8881 (sizes (or (frame-parameter frame 'fit-frame-to-buffer-sizes) 8882 (sizes (or (frame-parameter frame 'fit-frame-to-buffer-sizes)
8882 fit-frame-to-buffer-sizes)) 8883 fit-frame-to-buffer-sizes))