about summary refs log tree commit diff
path: root/exwm-floating.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-floating.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-floating.el')
-rw-r--r--exwm-floating.el16
1 files changed, 6 insertions, 10 deletions
diff --git a/exwm-floating.el b/exwm-floating.el
index 7888fd2d0b..e1d8738270 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -179,12 +179,7 @@
             exwm--floating-frame frame)
       (set-window-buffer window (current-buffer)) ;this changes current buffer
       (set-window-dedicated-p window t))
-    (with-current-buffer (exwm--id->buffer id)
-      ;; Some window should not get input focus on creation
-      ;; FIXME: other conditions?
-      (unless (memq xcb:Atom:_NET_WM_WINDOW_TYPE_UTILITY exwm-window-type)
-        (x-focus-frame exwm--floating-frame)
-        (exwm-input--set-focus id)))))
+    (select-window window)))
 
 (defun exwm-floating--unset-floating (id)
   "Make window ID non-floating."
@@ -212,11 +207,12 @@
         (set-window-dedicated-p (frame-first-window exwm--floating-frame) nil)
         (delete-frame exwm--floating-frame))) ;remove the floating frame
     (with-current-buffer buffer
-      (setq exwm--floating-frame nil
+      (setq window-size-fixed nil
+            exwm--floating-frame nil
             exwm--frame exwm-workspace--current))
-    (select-frame exwm-workspace--current t)
-    (set-window-buffer nil buffer)
-    (exwm-input--set-focus id)))
+    (let ((window (frame-selected-window exwm-workspace--current)))
+      (set-window-buffer window buffer)
+      (select-window window))))
 
 (defun exwm-floating-toggle-floating ()
   "Toggle the current window between floating and non-floating states."