branch: externals/exwm
commit ecb38085262e4a1d7d72953215f9247fe83900e3
Author: Steven Allen <[email protected]>
Commit: Steven Allen <[email protected]>
Fix centering of floating windows
1. Center transient windows relative to their parents, not the screen.
2. Center floating windows relative to the screen (workspace), not the
origin.
* exwm-floating.el (exwm-floating--set-floating): Correctly enter
floating windows. (bug #167)
---
exwm-floating.el | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/exwm-floating.el b/exwm-floating.el
index 776dd440c2..62e1256f3a 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -241,15 +241,17 @@ configured dimension is invalid."
(if-let* ((parent-buffer (exwm--id->buffer exwm-transient-for))
(parent-window (get-buffer-window parent-buffer))
(parent-edges (exwm--window-inside-absolute-pixel-edges
parent-window))
- (parent-width (- (elt parent-edges 2) (elt parent-edges
0)))
- (parent-height (- (elt parent-edges 3) (elt parent-edges
1)))
+ (parent-x (elt parent-edges 0))
+ (parent-y (elt parent-edges 1))
+ (parent-width (- (elt parent-edges 2) parent-x))
+ (parent-height (- (elt parent-edges 3) parent-y))
((and (<= width parent-width) (<= height parent-height))))
;; Put at the center of leading window
- (setq x (+ screen-x (/ (- parent-width width) 2))
- y (+ screen-y (/ (- parent-height height) 2)))
+ (setq x (+ parent-x (/ (- parent-width width) 2))
+ y (+ parent-y (/ (- parent-height height) 2)))
;; Put at the center of screen
- (setq x (/ (- screen-width width) 2)
- y (/ (- screen-height height) 2))))
+ (setq x (+ screen-x (/ (- screen-width width) 2))
+ y (+ screen-y (/ (- screen-height height) 2)))))
;; Translate the window size hints into the correct container size.
;; But avoid moving the window border off-screen in the process.