[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/exwm 84f0f03 15/64: Fix input focus lost after closing
From: |
Chris Feng |
Subject: |
[elpa] externals/exwm 84f0f03 15/64: Fix input focus lost after closing window |
Date: |
Thu, 17 Sep 2015 23:17:54 +0000 |
branch: externals/exwm
commit 84f0f0328b173af82c873e395353bd9a6c3bf1f6
Author: Chris Feng <address@hidden>
Commit: Chris Feng <address@hidden>
Fix input focus lost after closing window
Also insert some debug messages.
---
exwm-input.el | 35 +++++++++++++++++++++++++----------
exwm-layout.el | 3 +++
exwm-manage.el | 6 ++++--
exwm-workspace.el | 2 ++
4 files changed, 34 insertions(+), 12 deletions(-)
diff --git a/exwm-input.el b/exwm-input.el
index f94cf50..c312ff7 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -57,17 +57,22 @@ It's updated in several occasions, and only used by
`exwm-input--set-focus'.")
(defun exwm-input--set-focus (id)
"Set input focus to window ID in a proper way."
(exwm--with-current-id id
+ (exwm--log "Set focus ID to #x%x" id)
(setq exwm-input--focus-id id)
(if (and (not exwm--hints-input)
(memq xcb:Atom:WM_TAKE_FOCUS exwm--protocols))
- (xcb:+request exwm--connection
- (make-instance 'xcb:icccm:SendEvent
- :destination id
- :event (xcb:marshal
- (make-instance 'xcb:icccm:WM_TAKE_FOCUS
- :window id
- :time exwm-input--timestamp)
- exwm--connection)))
+ (progn
+ (exwm--log "Focus on #x%x with WM_TAKE_FOCUS" id)
+ (xcb:+request exwm--connection
+ (make-instance 'xcb:icccm:SendEvent
+ :destination id
+ :event (xcb:marshal
+ (make-instance 'xcb:icccm:WM_TAKE_FOCUS
+ :window id
+ :time
+ exwm-input--timestamp)
+ exwm--connection))))
+ (exwm--log "Focus on #x%x with SetInputFocus" id)
(xcb:+request exwm--connection
(make-instance 'xcb:SetInputFocus
:revert-to xcb:InputFocus:Parent :focus id
@@ -85,24 +90,34 @@ It's updated in several occasions, and only used by
`exwm-input--set-focus'.")
(setq exwm-input--focus-lock t)
(when (eq (current-buffer) (window-buffer)) ;e.g. with-temp-buffer
(if (eq major-mode 'exwm-mode)
- (progn (setq exwm-input--focus-id exwm--id)
+ (progn (exwm--log "Set focus ID to #x%x" exwm--id)
+ (setq exwm-input--focus-id exwm--id)
(when exwm--floating-frame
(if (eq (selected-frame) exwm--floating-frame)
;; Cancel the possible input focus redirection
- (redirect-frame-focus exwm--floating-frame nil)
+ (progn
+ (exwm--log "Cancel input focus redirection on %s"
+ exwm--floating-frame)
+ (redirect-frame-focus exwm--floating-frame nil))
;; Focus the floating frame
+ (exwm--log "Focus on floating frame %s"
+ exwm--floating-frame)
(x-focus-frame exwm--floating-frame)))
;; Finally focus the window
(exwm-input--set-focus exwm-input--focus-id))
(exwm--with-current-id exwm-input--focus-id
+ (exwm--log "Set focus ID to #x%x" xcb:Window:None)
(setq exwm-input--focus-id xcb:Window:None)
(let ((frame (selected-frame)))
(if exwm--floating-frame
(unless (or (eq frame exwm--floating-frame)
(active-minibuffer-window))
;; Redirect input focus to the workspace frame
+ (exwm--log "Redirect input focus (%s => %s)"
+ exwm--floating-frame frame)
(redirect-frame-focus exwm--floating-frame frame))
;; Focus the workspace frame
+ (exwm--log "Focus on workspace %s" frame)
(x-focus-frame frame))))))
(setq exwm-input--focus-lock nil)))
diff --git a/exwm-layout.el b/exwm-layout.el
index 7630b68..1dd8333 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -28,6 +28,7 @@
(defun exwm-layout--show (id &optional window)
"Show window ID exactly fit in the Emacs window WINDOW."
+ (exwm--log "Show #x%x in %s" id window)
(xcb:+request exwm--connection (make-instance 'xcb:MapWindow :window id))
(xcb:+request exwm--connection
(make-instance 'xcb:icccm:set-WM_STATE
@@ -69,6 +70,7 @@
"Hide window ID."
(unless (eq xcb:icccm:WM_STATE:IconicState ;already hidden
(with-current-buffer (exwm--id->buffer id) exwm-state))
+ (exwm--log "Hide #x%x" id)
(xcb:+request exwm--connection
(make-instance 'xcb:ChangeWindowAttributes
:window id :value-mask xcb:CW:EventMask
@@ -162,6 +164,7 @@
"Refresh layout."
(unless (compare-window-configurations exwm-layout--window-configuration
(current-window-configuration))
+ (exwm--log "Refresh layout")
(setq exwm-layout--window-configuration (current-window-configuration))
(let ((frame (selected-frame))
windows)
diff --git a/exwm-manage.el b/exwm-manage.el
index 0d2c74f..7c82696 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -178,8 +178,10 @@ corresponding buffer.")
:window id :property xcb:Atom:WM_STATE))
(xcb:flush exwm--connection))
(setq kill-buffer-query-functions nil)
- (kill-buffer)
- (select-frame-set-input-focus exwm-workspace--current)))))
+ (let ((floating exwm--floating-frame))
+ (kill-buffer)
+ (when floating
+ (select-frame-set-input-focus exwm-workspace--current)))))))
(defun exwm-manage--scan ()
"Search for existing windows and try to manage them."
diff --git a/exwm-workspace.el b/exwm-workspace.el
index b175543..da3f9ce 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -152,7 +152,9 @@ The optional FORCE option is for internal use only."
"Fix unexpected frame switch."
(unless exwm-workspace--switch-lock
(let ((index (cl-position (selected-frame) exwm-workspace--list)))
+ (exwm--log "Focus on workspace %s" index)
(when (and index (/= index exwm-workspace-current-index))
+ (exwm--log "Workspace was switched unexpectedly")
(exwm-workspace-switch index)))))
(defun exwm-workspace-move-window (index &optional id)
- [elpa] externals/exwm 3fc0cb2 10/64: Various fixes, (continued)
- [elpa] externals/exwm 3fc0cb2 10/64: Various fixes, Chris Feng, 2015/09/17
- [elpa] externals/exwm 3fb90b9 12/64: Fix fullscreen issues, Chris Feng, 2015/09/17
- [elpa] externals/exwm 86764d2 07/64: Add basic RandR support, Chris Feng, 2015/09/17
- [elpa] externals/exwm 1e36a22 13/64: Check buffer mode in exwm-reset, Chris Feng, 2015/09/17
- [elpa] externals/exwm 14628a9 16/64: Fix race conditions when managing a window, Chris Feng, 2015/09/17
- [elpa] externals/exwm 5298489 18/64: Fix some input focus issues, Chris Feng, 2015/09/17
- [elpa] externals/exwm 3b9d0dd 17/64: Fixes for manage/unmanage window, Chris Feng, 2015/09/17
- [elpa] externals/exwm 42f4ec6 20/64: Show moved window by default, Chris Feng, 2015/09/17
- [elpa] externals/exwm 36bb579 21/64: Refresh when minibuffer grows (fix #10), Chris Feng, 2015/09/17
- [elpa] externals/exwm 2ad1a89 14/64: Various input fixes, Chris Feng, 2015/09/17
- [elpa] externals/exwm 84f0f03 15/64: Fix input focus lost after closing window,
Chris Feng <=
- [elpa] externals/exwm 63402b0 19/64: Correct layout refresh problems, Chris Feng, 2015/09/17
- [elpa] externals/exwm edc70eb 22/64: Remove redundant code caused by the concurrency of events, Chris Feng, 2015/09/17
- [elpa] externals/exwm 2d4104a 23/64: Fix emacsclient bugs, Chris Feng, 2015/09/17
- [elpa] externals/exwm 24b964b 25/64: Ignore repeated `MappingNotify` events, Chris Feng, 2015/09/17
- [elpa] externals/exwm 801185c 27/64: Fix buffer switch problems, Chris Feng, 2015/09/17
- [elpa] externals/exwm 1ce18af 28/64: Center floating windows by default, Chris Feng, 2015/09/17
- [elpa] externals/exwm 048994c 24/64: Remove redundant code caused by the concurrency of events (continued), Chris Feng, 2015/09/17
- [elpa] externals/exwm 35560a4 30/64: Minor fixes for emacsclient, Chris Feng, 2015/09/17
- [elpa] externals/exwm b755296 26/64: Remove redundant code caused by the concurrency of events (contd, 2), Chris Feng, 2015/09/17
- [elpa] externals/exwm 7bfd429 33/64: Honor `value-mask` field in ConfigureRequest event, Chris Feng, 2015/09/17