branch: externals/posframe
commit 13d756d6a6614e934316be92cee2eb10bc6d4b3f
Merge: 304c298 6ddf9c3
Author: tumashu <[email protected]>
Commit: GitHub <[email protected]>
Merge pull request #55 from tttuuu888/work-redirect-focus
posframe.el (posframe--redirect-posframe-focus): simplify
---
posframe.el | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/posframe.el b/posframe.el
index b5cc2c4..8015b19 100644
--- a/posframe.el
+++ b/posframe.el
@@ -595,19 +595,11 @@ You can use `posframe-delete-all' to delete all
posframes."
(cons position height))
height)))
-(defvar posframe--previous-frame nil)
-
(defun posframe--redirect-posframe-focus ()
- "Redirect focus from the posframe to the previous frame. This prevents the
+ "Redirect focus from the posframe to the parent frame. This prevents the
posframe from catching keyboard input if the window manager selects it."
- (interactive)
- (if (eq (selected-frame) posframe--frame)
- (when posframe--previous-frame
- (redirect-frame-focus posframe--frame posframe--previous-frame))
- (progn
- (setf posframe--previous-frame (selected-frame))
- (when posframe--frame
- (redirect-frame-focus posframe--frame posframe--previous-frame)))))
+ (when (eq (selected-frame) posframe--frame)
+ (redirect-frame-focus posframe--frame (frame-parent))))
(add-hook 'focus-in-hook #'posframe--redirect-posframe-focus)