[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/posframe 940645d 2/2: Add posframe-mouse-banish-functio
From: |
ELPA Syncer |
Subject: |
[elpa] externals/posframe 940645d 2/2: Add posframe-mouse-banish-function variable. Fix #108 |
Date: |
Tue, 9 Nov 2021 05:57:25 -0500 (EST) |
branch: externals/posframe
commit 940645d9a114981f625c1aff50bffe582099bbcc
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>
Add posframe-mouse-banish-function variable. Fix #108
* posframe.el (posframe-mouse-banish-function): New customize variable.
(posframe-show): Use posframe-mouse-banish-function.
(posframe--mouse-banish): Rename from ...
(posframe-mouse-banish-default): to this.
(posframe-mouse-banish-simple): New function.
---
posframe.el | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/posframe.el b/posframe.el
index 937b165..cada136 100644
--- a/posframe.el
+++ b/posframe.el
@@ -50,6 +50,10 @@
:group 'posframe
:type 'boolean)
+(defcustom posframe-mouse-banish-function #'posframe-mouse-banish-default
+ "The function used to banish mouse."
+ :type 'function)
+
(defvar-local posframe--frame nil
"Record posframe's frame.")
@@ -679,7 +683,8 @@ You can use `posframe-delete-all' to delete all posframes."
(cons parent-buffer-name parent-buffer)))
;; Mouse banish
- (posframe--mouse-banish
+ (funcall
+ posframe-mouse-banish-function
(list :parent-frame parent-frame
:mouse-x (when (car mouse-position)
(+ (or (car ref-position) 0)
@@ -722,7 +727,12 @@ You can use `posframe-delete-all' to delete all posframes."
(cons position height))
height)))
-(defun posframe--mouse-banish (info)
+(defun posframe-mouse-banish-simple (info)
+ "Banish mouse to (0, 0)."
+ (let ((parent-frame (plist-get info :parent-frame)))
+ (set-mouse-pixel-position parent-frame 0 0)))
+
+(defun posframe-mouse-banish-default (info)
"Banish mouse base on INFO.
FIXME: This is a hacky fix for the mouse focus problem, which like: