[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/corfu 77932f45ce 3/3: Try different frame redirection
From: |
ELPA Syncer |
Subject: |
[elpa] externals/corfu 77932f45ce 3/3: Try different frame redirection |
Date: |
Wed, 11 May 2022 14:57:26 -0400 (EDT) |
branch: externals/corfu
commit 77932f45ce98dfc3e9f00f451af29433c3b241c9
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Try different frame redirection
---
corfu.el | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/corfu.el b/corfu.el
index c3cc2d9eca..87aef110f9 100644
--- a/corfu.el
+++ b/corfu.el
@@ -366,18 +366,12 @@ The completion backend can override this with
map)
"Ignore all mouse clicks.")
-(defun corfu--popup-redirect-focus ()
- "Redirect focus from popup."
- (redirect-frame-focus corfu--frame (frame-parent corfu--frame)))
-
(defun corfu--make-buffer (content)
"Create corfu buffer with CONTENT."
(let ((fr face-remapping-alist)
(ls line-spacing)
(buffer (get-buffer-create " *corfu*")))
(with-current-buffer buffer
- ;;; XXX HACK install redirect focus hook
- (add-hook 'pre-command-hook #'corfu--popup-redirect-focus nil 'local)
;;; XXX HACK install mouse ignore map
(use-local-map corfu--mouse-ignore-map)
(dolist (var corfu--buffer-parameters)
@@ -421,13 +415,14 @@ The completion backend can override this with
(y (if (> (+ yb (* corfu-count ch) ch ch) (frame-pixel-height))
(- yb height ch 1)
yb))
- (buffer (corfu--make-buffer content)))
+ (buffer (corfu--make-buffer content))
+ (parent (window-frame)))
(unless (and (frame-live-p corfu--frame)
- (eq (frame-parent corfu--frame) (window-frame)))
+ (eq (frame-parent corfu--frame) parent))
(when corfu--frame (delete-frame corfu--frame))
(setq corfu--frame (make-frame
- `((parent-frame . ,(window-frame))
- (minibuffer . ,(minibuffer-window (window-frame)))
+ `((parent-frame . ,parent)
+ (minibuffer . ,(minibuffer-window parent))
;; Set `internal-border-width' for Emacs 27
(internal-border-width . ,border)
,@corfu--frame-parameters))))
@@ -459,7 +454,8 @@ The completion backend can override this with
;; display content.
(set-frame-position corfu--frame x y)
(redisplay 'force)
- (make-frame-visible corfu--frame))))
+ (make-frame-visible corfu--frame))
+ (redirect-frame-focus corfu--frame parent)))
(defun corfu--popup-show (pos off width lines &optional curr lo bar)
"Show LINES as popup at POS - OFF.