Fix some input focus issues

* Fix input focus lost after moving window to another workspace
* Enhance `exwm-reset` to provide user a way to reset input focus when it's
  lost unexpectedly
This commit is contained in:
Chris Feng 2015-08-08 11:16:17 +08:00
parent 3b9d0dd921
commit 52984898ec
2 changed files with 11 additions and 5 deletions

View file

@ -181,14 +181,17 @@ The optional FORCE option is for internal use only."
(if exwm--floating-frame (if exwm--floating-frame
;; Move the floating frame is enough ;; Move the floating frame is enough
(xcb:+request exwm--connection (xcb:+request exwm--connection
(make-instance 'xcb:ReparentWindow (make-instance 'xcb:ReparentWindow
:window (frame-parameter exwm--floating-frame :window (frame-parameter exwm--floating-frame
'exwm-outer-id) 'exwm-outer-id)
:parent (frame-parameter frame 'exwm-window-id) :parent (frame-parameter frame 'exwm-window-id)
:x 0 :y 0)) :x 0 :y 0))
;; Move the window itself ;; Move the window itself
(bury-buffer) (bury-buffer)
(exwm-layout--hide id) (exwm-layout--hide id)
;; Force update input focus
(setq exwm-input--focus-id xcb:Window:None)
(exwm-input--update-focus)
(xcb:+request exwm--connection (xcb:+request exwm--connection
(make-instance 'xcb:ReparentWindow (make-instance 'xcb:ReparentWindow
:window id :window id

View file

@ -198,6 +198,9 @@
(with-current-buffer (window-buffer) (with-current-buffer (window-buffer)
(when (eq major-mode 'exwm-mode) (when (eq major-mode 'exwm-mode)
(when exwm--fullscreen (exwm-layout-unset-fullscreen)) (when exwm--fullscreen (exwm-layout-unset-fullscreen))
;; Force update input focus
(setq exwm-input--focus-id xcb:Window:None)
(exwm-input--update-focus)
(exwm-input-grab-keyboard)))) (exwm-input-grab-keyboard))))
(defmacro exwm--with-current-id (id &rest body) (defmacro exwm--with-current-id (id &rest body)