about summary refs log tree commit diff
path: root/exwm-randr.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-randr.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-randr.el')
-rw-r--r--exwm-randr.el13
1 files changed, 12 insertions, 1 deletions
diff --git a/exwm-randr.el b/exwm-randr.el
index c9ad1ce6ae7b..cd40fb43bd3f 100644
--- a/exwm-randr.el
+++ b/exwm-randr.el
@@ -26,8 +26,11 @@
 ;; tools such as xrandr(1) to properly configure RandR first. This dependency
 ;; may be removed in the future, but more work is needed before that.
 
-;; To use this module, first set `exwm-randr-workspace-output-plist':
+;; To use this module, first load/enable it and properly configure the variable
+;; `exwm-randr-workspace-output-plist':
+;;   (require 'exwm-randr)
 ;;   (setq exwm-randr-workspace-output-plist '(0 "VGA1"))
+;;   (exwm-randr-enable)
 ;; Then configure RandR with 'xrandr':
 ;;   $ xrandr --output VGA1 --left-of LVDS1 --auto
 ;; With above lines, workspace 0 should be assigned to the output named "VGA1",
@@ -82,6 +85,8 @@
           (setq geometry default-geometry
                 output nil))
         (set-frame-parameter frame 'exwm-randr-output output)
+        (set-frame-parameter frame 'exwm-x (elt geometry 0))
+        (set-frame-parameter frame 'exwm-y (elt geometry 1))
         (xcb:+request exwm--connection
             (make-instance 'xcb:ConfigureWindow
                            :window (frame-parameter frame 'exwm-outer-id)
@@ -108,9 +113,11 @@
         (exwm-randr--refresh)
         (xcb:+event exwm--connection 'xcb:randr:ScreenChangeNotify
                     (lambda (data synthetic)
+                      (exwm--log "(RandR) ScreenChangeNotify")
                       (exwm-randr--refresh)))
         ;; (xcb:+event exwm--connection 'xcb:randr:Notify
         ;;             (lambda (data synthetic)
+        ;;               (exwm--log "(RandR) Notify")
         ;;               (exwm-randr--refresh)))
         (xcb:+request exwm--connection
             (make-instance 'xcb:randr:SelectInput
@@ -124,6 +131,10 @@
                            ))
         (xcb:flush exwm--connection)))))
 
+(defun exwm-randr-enable ()
+  "Enable RandR support for EXWM."
+  (add-hook 'exwm-init-hook 'exwm-randr--init))
+
 
 
 (provide 'exwm-randr)