From 07e59e0429c4b13a5036e9a207e37fc02135f599 Mon Sep 17 00:00:00 2001 From: Chris Feng Date: Thu, 13 Aug 2015 12:02:44 +0800 Subject: 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. --- exwm-randr.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'exwm-randr.el') 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) -- cgit 1.4.1