Commit b42b894d authored by Sergey Trofimov's avatar Sergey Trofimov Committed by Martin Rudalics

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
parent 366fd4fd
Pipeline #4906 failed with stage
in 62 minutes and 34 seconds
...@@ -8794,8 +8794,7 @@ parameters of FRAME." ...@@ -8794,8 +8794,7 @@ parameters of FRAME."
(parent (frame-parent frame)) (parent (frame-parent frame))
(monitor-attributes (monitor-attributes
(unless parent (unless parent
(car (display-monitor-attributes-list (frame-monitor-attributes frame)))
(frame-parameter frame 'display)))))
;; FRAME'S parent or display sizes. Used in connection ;; FRAME'S parent or display sizes. Used in connection
;; with margins. ;; with margins.
(geometry (geometry
...@@ -8804,11 +8803,11 @@ parameters of FRAME." ...@@ -8804,11 +8803,11 @@ parameters of FRAME."
(parent-or-display-width (parent-or-display-width
(if parent (if parent
(frame-native-width parent) (frame-native-width parent)
(- (nth 2 geometry) (nth 0 geometry)))) (nth 2 geometry)))
(parent-or-display-height (parent-or-display-height
(if parent (if parent
(frame-native-height parent) (frame-native-height parent)
(- (nth 3 geometry) (nth 1 geometry)))) (nth 3 geometry)))
;; FRAME's parent or workarea sizes. Used when no margins ;; FRAME's parent or workarea sizes. Used when no margins
;; are specified. ;; are specified.
(parent-or-workarea (parent-or-workarea
...@@ -8870,13 +8869,15 @@ parameters of FRAME." ...@@ -8870,13 +8869,15 @@ parameters of FRAME."
(window--sanitize-margin (window--sanitize-margin
(nth 2 margins) left-margin (nth 2 margins) left-margin
parent-or-display-width)) parent-or-display-width))
(nth 2 parent-or-workarea))) (+ (nth 0 parent-or-workarea)
(nth 2 parent-or-workarea))))
(bottom-margin (if (nth 3 margins) (bottom-margin (if (nth 3 margins)
(- parent-or-display-height (- parent-or-display-height
(window--sanitize-margin (window--sanitize-margin
(nth 3 margins) top-margin (nth 3 margins) top-margin
parent-or-display-height)) parent-or-display-height))
(nth 3 parent-or-workarea))) (+ (nth 1 parent-or-workarea)
(nth 3 parent-or-workarea))))
;; Minimum and maximum sizes specified for FRAME. ;; Minimum and maximum sizes specified for FRAME.
(sizes (or (frame-parameter frame 'fit-frame-to-buffer-sizes) (sizes (or (frame-parameter frame 'fit-frame-to-buffer-sizes)
fit-frame-to-buffer-sizes)) fit-frame-to-buffer-sizes))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment