emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/posframe 5dc3da4 01/13: prevent posframes from getting


From: Feng Shu
Subject: [elpa] externals/posframe 5dc3da4 01/13: prevent posframes from getting keyboard input
Date: Sun, 5 Apr 2020 07:58:03 -0400 (EDT)

branch: externals/posframe
commit 5dc3da4635c2d608cfc1276f96fbd85f6896a531
Author: modula t. worm <address@hidden>
Commit: modula t. worm <address@hidden>

    prevent posframes from getting keyboard input
---
 posframe.el | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/posframe.el b/posframe.el
index fe1abc5..7142d2ff 100644
--- a/posframe.el
+++ b/posframe.el
@@ -595,6 +595,22 @@ 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
+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)))))
+
+(add-hook 'focus-in-hook #'posframe--redirect-posframe-focus)
+
 (defun posframe--mouse-banish (frame)
   "Banish mouse to the (0 . 0) of FRAME.
 FIXME: This is a hacky fix for the mouse focus problem, which like:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]