about summary refs log tree commit diff
path: root/exwm-floating.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2015-08-13T04·02+0800
committerChris Feng <chris.w.feng@gmail.com>2015-08-13T04·02+0800
commit07e59e0429c4b13a5036e9a207e37fc02135f599 (patch)
treed8bdf8d27ecdbbb115775e0ca8a1b4e4f91ea58f /exwm-floating.el
parent35560a49d6c03f96c1f62bfee72ee667cffadb9e (diff)
Fix multi-screen bugs
* RandR module is now made optional; users can enable it with
  `exwm-randr-enable`.
* Correct the calculation of sizes/coordinates at various places.
* Input focus is now tracked with (Emacs) window instead of buffer since the
  latter can be ambiguous in multi-screen settings.
Diffstat (limited to 'exwm-floating.el')
-rw-r--r--exwm-floating.el14
1 files changed, 9 insertions, 5 deletions
diff --git a/exwm-floating.el b/exwm-floating.el
index e1d8738270..06d6fa505c 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -39,8 +39,9 @@
 (defun exwm-floating--set-floating (id)
   "Make window ID floating."
   (interactive)
-  (when (get-buffer-window (exwm--id->buffer id)) ;window in non-floating state
-    (set-window-buffer (selected-window) (other-buffer))) ;hide it first
+  (let ((window (get-buffer-window (exwm--id->buffer id))))
+    (when window                        ;window in non-floating state
+      (set-window-buffer window (other-buffer)))) ;hide it first
   (let* ((original-frame
           (with-current-buffer (exwm--id->buffer id)
             (if (and exwm-transient-for (exwm--id->buffer exwm-transient-for))
@@ -78,8 +79,8 @@
         (exwm-workspace--update-switch-history)))
     ;; Fix illegal parameters
     ;; FIXME: check normal hints restrictions
-    (let* ((display-width (x-display-pixel-width))
-           (display-height (- (x-display-pixel-height)
+    (let* ((display-width (frame-pixel-width original-frame))
+           (display-height (- (frame-pixel-height original-frame)
                               (window-pixel-height (minibuffer-window
                                                     original-frame))
                               (* 2 (window-mode-line-height))
@@ -373,6 +374,8 @@
   "Perform move/resize."
   (when exwm-floating--moveresize-calculate
     (let ((obj (make-instance 'xcb:MotionNotify))
+          (frame-x (or (frame-parameter exwm-workspace--current 'exwm-x) 0))
+          (frame-y (or (frame-parameter exwm-workspace--current 'exwm-y) 0))
           result)
       (xcb:unmarshal obj data)
       (setq result (funcall exwm-floating--moveresize-calculate
@@ -380,7 +383,8 @@
       (xcb:+request exwm--connection
           (make-instance 'xcb:ConfigureWindow
                          :window (elt result 0) :value-mask (elt result 1)
-                         :x (elt result 2) :y (elt result 3)
+                         :x (- (elt result 2) frame-x)
+                         :y (-  (elt result 3) frame-y)
                          :width (elt result 4) :height (elt result 5)))
       (xcb:flush exwm--connection))))