Function: posframe-poshandler-point-1

posframe-poshandler-point-1 is a byte-compiled function defined in posframe.el.

Signature

(posframe-poshandler-point-1 INFO &optional FONT-HEIGHT UPWARD)

Documentation

The internal function used to deal with point-poshandler.

Argument INFO .

Optional arguments: FONT-HEIGHT and UPWARD.

Source Code

;; Defined in ~/.emacs.d/elpa/posframe-20260415.14/posframe.el
(defun posframe-poshandler-point-1 (info &optional font-height upward)
  "The internal function used to deal with point-poshandler.
Argument INFO .

Optional arguments: FONT-HEIGHT and UPWARD."
  (let* ((x-pixel-offset (plist-get info :x-pixel-offset))
         (y-pixel-offset (plist-get info :y-pixel-offset))
         (posframe-width (plist-get info :posframe-width))
         (posframe-height (plist-get info :posframe-height))
         (window (plist-get info :parent-window))
         (xmax (plist-get info :parent-frame-width))
         (ymax (plist-get info :parent-frame-height))
         (position-info (plist-get info :position))
         (position-info
          (if (integerp position-info)
              (posn-at-point position-info window)
            position-info))
         (header-line-height (plist-get info :header-line-height))
         (tab-line-height (plist-get info :tab-line-height))
         (x (+ (car (window-inside-pixel-edges window))
               (- (or (car (posn-x-y position-info)) 0)
                  (or (car (posn-object-x-y position-info)) 0))
               x-pixel-offset))
         (y-top (+ (cadr (window-pixel-edges window))
                   tab-line-height
                   header-line-height
                   (- (or (cdr (posn-x-y position-info)) 0)
                      ;; Fix the conflict with flycheck
                      ;; http://lists.gnu.org/archive/html/emacs-devel/2018-01/msg00537.html
                      (or (cdr (posn-object-x-y position-info)) 0))
                   y-pixel-offset))
         (font-height (or font-height (plist-get info :font-height)))
         (y-bottom (+ y-top font-height)))
    (cons (max 0 (min x (- xmax (or posframe-width 0))))
          (max 0 (if (if upward
                         (> (- y-bottom (or posframe-height 0)) 0)
                       (> (+ y-bottom (or posframe-height 0)) ymax))
                     (- y-top (or posframe-height 0))
                   y-bottom)))))