branch: externals/exwm
commit 78b6a428e605c3e0ed32a49f07e4f0bf7aa41c69
Author: Steven Allen <[email protected]>
Commit: Steven Allen <[email protected]>

    Revert "Place floating windows on the correct monitor"
    
    This reverts commit bc2c8eea1fbfc4cc337fcd8607e15055e9f8f715.
    
    The "geometry" is relative to the window's parent. We may need to adjust
    the requested geometry relative to the parent (although it SHOULD be the
    EXWM root window) , but doing so relative to the screen is definitely
    not correct.
    
    I'm not sure why chrome seems to be opening windows on the wrong screen,
    but that seems to be a different issue.
---
 exwm-floating.el | 33 +++++++++++++++------------------
 1 file changed, 15 insertions(+), 18 deletions(-)

diff --git a/exwm-floating.el b/exwm-floating.el
index eb631492eb..302a8d75a1 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -235,24 +235,21 @@ configured dimension is invalid."
         (when (= 0 width) (setq width (/ screen-width 2)))
         (when (= 0 height) (setq height (/ screen-height 2)))
 
-        ;; Center floating windows on the current screen/window if they have 
no explicit position,
-        ;; or move adjust their position relative to the current screen if 
they do.
-        (if (and (= x 0) (= y 0))
-            (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)))
-                      ((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)))
-              ;; Put at the center of screen
-              (setq x (/ (- screen-width width) 2)
-                    y (/ (- screen-height height) 2)))
-          ;; Adjust the requested position with respect to the current screen.
-          (setq x (+ x screen-x)
-                y (+ y screen-y)))
+        ;; Center floating windows unless they have explicit positions.
+        (when (and (or (= x 0) (= x screen-x))
+                   (or (= y 0) (= y screen-y)))
+          (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)))
+                    ((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)))
+            ;; Put at the center of screen
+            (setq x (/ (- screen-width width) 2)
+                  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.

Reply via email to