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.
This commit is contained in:
Chris Feng 2015-08-13 12:02:44 +08:00
parent 35560a49d6
commit 07e59e0429
6 changed files with 54 additions and 30 deletions

View file

@ -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)