about summary refs log tree commit diff
path: root/exwm.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2015-08-12T10·09+0800
committerChris Feng <chris.w.feng@gmail.com>2015-08-12T10·09+0800
commit04e426961736c67046fa3809fc14f1ac027dae77 (patch)
tree7a7515c778e25f741ad98ca5aec3c22c9b0e9cee /exwm.el
parent1ce18afd0559bacc3a7c43f5a73342814a5b176f (diff)
Improve input focus switch mechanism
This commit should fix most input focus bugs (especially those related to
floating windows). The actual settings of input focus are delayed to exclude
redundant event. Dead code since this commit is removed.

This commit also fixes a bug for non-floating windows converted form floating
state. The workaround for `ido-mode` is also improved to properly handle
`exwm-mode` buffers.
Diffstat (limited to 'exwm.el')
-rw-r--r--exwm.el18
1 files changed, 6 insertions, 12 deletions
diff --git a/exwm.el b/exwm.el
index 7e909cdef681..989bf88156b5 100644
--- a/exwm.el
+++ b/exwm.el
@@ -195,15 +195,9 @@
 (defun exwm-reset ()
   "Reset window to standard state: non-fullscreen, line-mode."
   (interactive)
-  (unless (frame-parameter nil 'exwm-window-id)
-    ;; Move focus away form a non-EXWM frame
-    (x-focus-frame exwm-workspace--current))
   (with-current-buffer (window-buffer)
     (when (eq major-mode 'exwm-mode)
       (when exwm--fullscreen (exwm-layout-unset-fullscreen))
-      ;; Force update input focus
-      (setq exwm-input--focus-id xcb:Window:None)
-      (exwm-input--update-focus)
       ;; Force refresh
       (exwm-layout--refresh)
       (exwm-input-grab-keyboard))))
@@ -709,12 +703,12 @@
 
 (defun exwm--ido-buffer-window-other-frame (orig-fun buffer)
   "Wrapper for `ido-buffer-window-other-frame' to exclude invisible windows."
-  (let* ((window (funcall orig-fun buffer))
-         (frame (window-frame window)))
-    ;; Exclude windows on other workspaces
-    (unless (and (memq frame exwm-workspace--list)
-                 (not (eq frame exwm-workspace--current)))
-      window)))
+  (with-current-buffer buffer
+    (if (eq major-mode 'exwm-mode)
+        ;; `ido-mode' works well with `exwm-mode' buffers
+        (funcall orig-fun buffer)
+      ;; Other buffers should be selected within the same workspace
+      (get-buffer-window buffer exwm-workspace--current))))
 
 (defun exwm--fix-ido-buffer-window-other-frame ()
   "Fix `ido-buffer-window-other-frame'."