Function: posframe-poshandler-window-center

posframe-poshandler-window-center is a byte-compiled function defined in posframe.el.

Signature

(posframe-poshandler-window-center INFO)

Documentation

Posframe's position handler.

This poshandler function let center of posframe align to center of window.

The structure of INFO can be found in docstring of posframe-show.

Source Code

;; Defined in ~/.emacs.d/elpa/posframe-20260415.14/posframe.el
(defun posframe-poshandler-window-center (info)
  "Posframe's position handler.

This poshandler function let center of posframe align to center
of window.

The structure of INFO can be found in docstring of
`posframe-show'."
  (let* ((window-left (plist-get info :parent-window-left))
         (window-top (plist-get info :parent-window-top))
         (window-width (plist-get info :parent-window-width))
         (window-height (plist-get info :parent-window-height))
         (posframe-width (plist-get info :posframe-width))
         (posframe-height (plist-get info :posframe-height)))
    (cons (max 0 (+ window-left (/ (- window-width posframe-width) 2)))
          (max 0 (+ window-top (/ (- window-height posframe-height) 2))))))