branch: externals/corfu
commit abfe0003d71b61ffdcf23fc6e546643486daeb69
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>
Improve repositioning and resizing
---
corfu.el | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/corfu.el b/corfu.el
index c0f41a9c55..ce06ac4568 100644
--- a/corfu.el
+++ b/corfu.el
@@ -491,14 +491,21 @@ FRAME is the existing frame."
;; Mark window as dedicated to prevent frame reuse (gh:minad/corfu#60)
(set-window-dedicated-p win t))
(redirect-frame-focus frame parent)
- (pcase-let ((`(,px . ,py) (frame-position frame)))
+ (pcase-let* ((`(,ox ,oy ,right ,bottom) (frame-edges frame 'outer-edges))
+ (border (* 2 corfu-border-width))
+ (ow (- (- right ox) left-fringe-width right-fringe-width
border))
+ (oh (- (- bottom oy) border))
+ (pos-change (or (/= x ox) (/= y oy)))
+ (size-change (or (/= ow width) (/= oh height))))
(cond
- ((and (= x px) (= y py)) (set-frame-size frame width height t))
- ;; New Emacs 31 function for faster resizing/movement in one go.
- ((fboundp 'set-frame-size-and-position-pixelwise)
- (set-frame-size-and-position-pixelwise frame width height x y))
- (t (set-frame-size frame width height t)
- (set-frame-position frame x y)))))
+ ((and pos-change size-change)
+ ;; New Emacs 31 function for faster resizing/movement in one go.
+ (static-if (fboundp 'set-frame-size-and-position-pixelwise)
+ (set-frame-size-and-position-pixelwise frame width height x y)
+ (set-frame-size frame width height t)
+ (set-frame-position frame x y)))
+ (pos-change (set-frame-position frame x y))
+ (size-change (set-frame-size frame width height t)))))
(make-frame-visible frame)
;; Unparent child frame if EXWM is used, otherwise EXWM buffers are drawn on
;; top of the Corfu child frame.