[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/exwm 07e59e0 31/64: Fix multi-screen bugs
From: |
Chris Feng |
Subject: |
[elpa] externals/exwm 07e59e0 31/64: Fix multi-screen bugs |
Date: |
Thu, 17 Sep 2015 23:18:01 +0000 |
branch: externals/exwm
commit 07e59e0429c4b13a5036e9a207e37fc02135f599
Author: Chris Feng <address@hidden>
Commit: Chris Feng <address@hidden>
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-floating.el | 14 +++++++++-----
exwm-input.el | 23 +++++++++++++----------
exwm-layout.el | 19 ++++++++++---------
exwm-manage.el | 13 ++++++++++---
exwm-randr.el | 13 ++++++++++++-
exwm.el | 2 --
6 files changed, 54 insertions(+), 30 deletions(-)
diff --git a/exwm-floating.el b/exwm-floating.el
index e1d8738..06d6fa5 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))))
diff --git a/exwm-input.el b/exwm-input.el
index b9a5f20..0ef7232 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -77,7 +77,7 @@ It's updated in several occasions, and only used by
`exwm-input--set-focus'.")
:time xcb:Time:CurrentTime)))
(xcb:flush exwm--connection)))
-(defvar exwm-input--focus-buffer nil "The buffer to be focused.")
+(defvar exwm-input--focus-window nil "The (Emacs) window to be focused.")
(defvar exwm-input--redirected nil
"Indicate next update on buffer list is actually a result of redirection.")
(defvar exwm-input--timer nil "Currently running timer.")
@@ -85,15 +85,17 @@ It's updated in several occasions, and only used by
`exwm-input--set-focus'.")
(defun exwm-input--on-buffer-list-update ()
"Run in buffer-list-update-hook to track input focus."
(let ((frame (selected-frame))
+ (window (selected-window))
(buffer (current-buffer)))
(when (and (not (minibufferp buffer))
(frame-parameter frame 'exwm-window-id) ;e.g. emacsclient frame
(eq buffer (window-buffer))) ;e.g. `with-temp-buffer'
(unless (and exwm-input--redirected
- exwm-input--focus-buffer
- (with-current-buffer exwm-input--focus-buffer
+ exwm-input--focus-window
+ (with-current-buffer (window-buffer
+ exwm-input--focus-window)
exwm--floating-frame))
- (setq exwm-input--focus-buffer buffer)
+ (setq exwm-input--focus-window window)
(when exwm-input--timer (cancel-timer exwm-input--timer))
(setq exwm-input--timer
(run-with-timer 0.01 nil 'exwm-input--update-focus)))
@@ -108,22 +110,23 @@ It's updated in several occasions, and only used by
`exwm-input--set-focus'.")
(defun exwm-input--update-focus ()
"Update input focus."
- (when exwm-input--focus-buffer
- (with-current-buffer exwm-input--focus-buffer
- (exwm--log "Set focus on %s" exwm-input--focus-buffer)
- (setq exwm-input--focus-buffer nil)
+ (when exwm-input--focus-window
+ (with-current-buffer (window-buffer exwm-input--focus-window)
+ (exwm--log "Set focus on %s" exwm-input--focus-window)
(if (eq major-mode 'exwm-mode)
(progn
(when exwm--floating-frame
(redirect-frame-focus exwm--floating-frame nil)
(select-frame-set-input-focus exwm--floating-frame t))
(exwm-input--set-focus exwm--id))
- (select-frame-set-input-focus exwm-workspace--current t)
+ (select-frame-set-input-focus (window-frame exwm-input--focus-window)
+ t)
(dolist (pair exwm--id-buffer-alist)
(with-current-buffer (cdr pair)
(when (and exwm--floating-frame
(eq exwm--frame exwm-workspace--current))
- (redirect-frame-focus exwm--floating-frame exwm--frame))))))))
+ (redirect-frame-focus exwm--floating-frame exwm--frame)))))
+ (setq exwm-input--focus-window nil))))
(defun exwm-input--finish-key-sequence ()
"Mark the end of a key sequence (with the aid of `pre-command-hook')."
diff --git a/exwm-layout.el b/exwm-layout.el
index f2d4eb0..a6b450f 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -111,8 +111,9 @@
xcb:ConfigWindow:Width
xcb:ConfigWindow:Height)
:x 0 :y 0
- :width (x-display-pixel-width)
- :height (x-display-pixel-height))))
+ :width (frame-pixel-width exwm-workspace--current)
+ :height (frame-pixel-height
+ exwm-workspace--current))))
(xcb:flush exwm--connection))
(xcb:+request exwm--connection
(make-instance 'xcb:ConfigureWindow
@@ -122,8 +123,8 @@
xcb:ConfigWindow:Width
xcb:ConfigWindow:Height)
:x 0 :y 0
- :width (x-display-pixel-width)
- :height (x-display-pixel-height)))
+ :width (frame-pixel-width exwm-workspace--current)
+ :height (frame-pixel-height exwm-workspace--current)))
(xcb:+request exwm--connection
(make-instance 'xcb:ewmh:set-_NET_WM_STATE
:window exwm--id
@@ -168,11 +169,11 @@
(if (frame-parameter frame 'exwm-window-id)
;; Refresh a floating frame
(progn
- (cl-assert (eq major-mode 'exwm-mode))
- (let ((window (frame-first-window frame)))
- (with-current-buffer (window-buffer window)
- (exwm--log "Refresh floating window #x%x" exwm--id)
- (exwm-layout--show exwm--id window))))
+ (when (eq major-mode 'exwm-mode)
+ (let ((window (frame-first-window frame)))
+ (with-current-buffer (window-buffer window)
+ (exwm--log "Refresh floating window #x%x" exwm--id)
+ (exwm-layout--show exwm--id window)))))
;; Other frames (e.g. terminal/graphical frame of emacsclient)
;; We shall bury all `exwm-mode' buffers in this case
(unless placeholder ;create the *scratch* buffer if it's killed
diff --git a/exwm-manage.el b/exwm-manage.el
index d1736ff..4f11874 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -98,8 +98,14 @@ corresponding buffer.")
:window id
:value-mask (logior xcb:ConfigWindow:X
xcb:ConfigWindow:Y)
- :x (/ (- (x-display-pixel-width) width) 2)
- :y (/ (- (x-display-pixel-height) height) 2)))))
+ :x (/ (- (frame-pixel-width
+ exwm-workspace--current)
+ width)
+ 2)
+ :y (/ (- (frame-pixel-height
+ exwm-workspace--current)
+ height)
+ 2)))))
(xcb:flush exwm--connection)
(setq kill-buffer-query-functions nil)
(setq exwm--id-buffer-alist (assq-delete-all id exwm--id-buffer-alist))
@@ -277,7 +283,8 @@ corresponding buffer.")
(setq edges
(if exwm--fullscreen
(list 0 0
- (x-display-pixel-width) (x-display-pixel-height))
+ (frame-pixel-width exwm-workspace--current)
+ (frame-pixel-height exwm-workspace--current))
(or exwm--floating-edges
(window-inside-absolute-pixel-edges
(get-buffer-window)))))
diff --git a/exwm-randr.el b/exwm-randr.el
index c9ad1ce..cd40fb4 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)
diff --git a/exwm.el b/exwm.el
index d33ab26..7dffa87 100644
--- a/exwm.el
+++ b/exwm.el
@@ -144,7 +144,6 @@
(require 'exwm-floating)
(require 'exwm-manage)
(require 'exwm-input)
-(require 'exwm-randr)
(defvar exwm-debug-on nil "Non-nil to turn on debug for EXWM.")
@@ -616,7 +615,6 @@
(exwm-floating--init)
(exwm-manage--init)
(exwm-input--init)
- (exwm-randr--init)
(exwm--unlock)
;; Manage exiting windows
(exwm-manage--scan)
- [elpa] externals/exwm 7bfd429 33/64: Honor `value-mask` field in ConfigureRequest event, (continued)
- [elpa] externals/exwm 7bfd429 33/64: Honor `value-mask` field in ConfigureRequest event, Chris Feng, 2015/09/17
- [elpa] externals/exwm dba43b0 32/64: Fix input focus stealing, Chris Feng, 2015/09/17
- [elpa] externals/exwm d998b42 34/64: Provide hooks run when the floating state of a window changes (close #28), Chris Feng, 2015/09/17
- [elpa] externals/exwm 15ad591 35/64: Fix bug when moving a window to the current workspace, Chris Feng, 2015/09/17
- [elpa] externals/exwm 43b00d2 36/64: fix buffer renaming, Chris Feng, 2015/09/17
- [elpa] externals/exwm 2d07429 39/64: Merge branch 'move-window-fix' of https://github.com/pipcet/exwm into pipcet-move-window-fix, Chris Feng, 2015/09/17
- [elpa] externals/exwm 5882015 40/64: Merge branch 'pipcet-move-window-fix', Chris Feng, 2015/09/17
- [elpa] externals/exwm 04e4269 29/64: Improve input focus switch mechanism, Chris Feng, 2015/09/17
- [elpa] externals/exwm 7120291 38/64: Merge branch 'pipcet-robustness', Chris Feng, 2015/09/17
- [elpa] externals/exwm 5210e13 41/64: Only manage windows mapped as the direct children of root window (close #38), Chris Feng, 2015/09/17
- [elpa] externals/exwm 07e59e0 31/64: Fix multi-screen bugs,
Chris Feng <=
- [elpa] externals/exwm d1806e9 37/64: Improve code robustness., Chris Feng, 2015/09/17
- [elpa] externals/exwm bb4ebde 46/64: Fix `exwm-workspace-rename-buffer`, Chris Feng, 2015/09/17
- [elpa] externals/exwm 94bdbfc 42/64: Avoid using the "no window manager" code in Emacs, Chris Feng, 2015/09/17
- [elpa] externals/exwm 874c383 43/64: Merge pull request #42 from pipcet/ewmh-fullscreen, Chris Feng, 2015/09/17
- [elpa] externals/exwm 5f9f673 47/64: Fix window size calculations, Chris Feng, 2015/09/17
- [elpa] externals/exwm 7032ee7 48/64: Re-enable complete refresh of keyboard mapping, Chris Feng, 2015/09/17
- [elpa] externals/exwm 981293f 44/64: Replay KeyPress events instead of fake them in line-mode, Chris Feng, 2015/09/17
- [elpa] externals/exwm f7bec7a 51/64: Minor fix, Chris Feng, 2015/09/17
- [elpa] externals/exwm 5222dc1 49/64: Avoid deleting the frame created by Emacs client by accident, Chris Feng, 2015/09/17
- [elpa] externals/exwm f1d37b9 53/64: Ungrab pointer timely when resizing is aborted, Chris Feng, 2015/09/17