Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use internal-border-width instead of child-frame-border-width
  • Loading branch information
minad committed Dec 29, 2023
1 parent cbeab25 commit 497c853
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
15 changes: 6 additions & 9 deletions corfu.el
Expand Up @@ -325,7 +325,8 @@ See also the settings `corfu-auto-delay', `corfu-auto-prefix' and
(min-width . t)
(min-height . t)
(border-width . 0)
(child-frame-border-width . 1)
(outer-border-width . 0)
(internal-border-width . 1)
(left-fringe . 0)
(right-fringe . 0)
(vertical-scroll-bars . nil)
Expand Down Expand Up @@ -467,10 +468,9 @@ FRAME is the existing frame."
;; Check before applying the setting. Without the check, the frame flickers
;; on Mac. We have to apply the face background before adjusting the frame
;; parameter, otherwise the border is not updated.
(let* ((face (if (facep 'child-frame-border) 'child-frame-border 'internal-border))
(new (face-attribute 'corfu-border :background nil 'default)))
(unless (equal (face-attribute face :background frame 'default) new)
(set-face-background face new frame)))
(let ((new (face-attribute 'corfu-border :background nil 'default)))
(unless (equal (face-attribute 'internal-border :background frame 'default) new)
(set-face-background 'internal-border new frame)))
;; Reset frame parameters if they changed. For example `tool-bar-mode'
;; overrides the parameter `tool-bar-lines' for every frame, including child
;; frames. The child frame API is a pleasure to work with. It is full of
Expand All @@ -480,9 +480,6 @@ FRAME is the existing frame."
(lambda (p) (equal (alist-get (car p) params) (cdr p)))
`((background-color
. ,(face-attribute 'corfu-default :background nil 'default))
;; Set `internal-border-width' for Emacs 27
(internal-border-width
. ,(alist-get 'child-frame-border-width corfu--frame-parameters))
(font . ,(frame-parameter parent 'font))
,@corfu--frame-parameters))))
(modify-frame-parameters frame reset))
Expand Down Expand Up @@ -1027,7 +1024,7 @@ A scroll bar is displayed from LO to LO+BAR."
;; parent frame (gh:minad/corfu#261).
(height (max lh (* (length lines) ch)))
(edge (window-inside-pixel-edges))
(border (alist-get 'child-frame-border-width corfu--frame-parameters))
(border (alist-get 'internal-border-width corfu--frame-parameters))
(x (max 0 (min (+ (car edge) (- (or (car pos) 0) ml (* cw off) border))
(- (frame-pixel-width) width))))
(yb (+ (cadr edge) (window-tab-line-height) (or (cdr pos) 0) lh))
Expand Down
4 changes: 2 additions & 2 deletions extensions/corfu-popupinfo.el
Expand Up @@ -288,7 +288,7 @@ form (X Y WIDTH HEIGHT DIR)."
(pcase-let*
((cw (default-font-width))
(lh (default-line-height))
(border (alist-get 'child-frame-border-width corfu--frame-parameters))
(border (alist-get 'internal-border-width corfu--frame-parameters))
(`(,_pfx ,_pfy ,pfw ,pfh)
(corfu-popupinfo--frame-geometry (frame-parent corfu--frame)))
(`(,cfx ,cfy ,cfw ,cfh) (corfu-popupinfo--frame-geometry corfu--frame))
Expand Down Expand Up @@ -358,7 +358,7 @@ form (X Y WIDTH HEIGHT DIR)."
(corfu-popupinfo--hide)
(setq cand-changed nil coords-changed nil)))
(when (or cand-changed coords-changed)
(pcase-let* ((border (alist-get 'child-frame-border-width corfu--frame-parameters))
(pcase-let* ((border (alist-get 'internal-border-width corfu--frame-parameters))
(`(,area-x ,area-y ,area-w ,area-h ,area-d)
(corfu-popupinfo--area
(if cand-changed
Expand Down

2 comments on commit 497c853

@galeo
Copy link
Contributor

@galeo galeo commented on 497c853 Dec 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit caused the problem that the popup border cannot be displayed on the Emacs Mac Port.

@minad
Copy link
Owner Author

@minad minad commented on 497c853 Dec 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fixed by f29735c.

Please sign in to comment.