Function: popup-menu-normalize-position
popup-menu-normalize-position is a byte-compiled function defined in
menu-bar.el.gz.
Signature
(popup-menu-normalize-position POSITION)
Documentation
Convert the POSITION to the form which popup-menu expects internally.
POSITION can be an event, a posn- value, a value having the form ((XOFFSET YOFFSET) WINDOW), or nil. If nil, the current mouse position is used, or nil if there is no mouse.
Source Code
;; Defined in /usr/src/emacs/lisp/menu-bar.el.gz
(defun popup-menu-normalize-position (position)
"Convert the POSITION to the form which `popup-menu' expects internally.
POSITION can be an event, a posn- value, a value having the
form ((XOFFSET YOFFSET) WINDOW), or nil.
If nil, the current mouse position is used, or nil if there is no mouse."
(pcase position
;; nil -> mouse cursor position
('nil
(let ((mp (mouse-pixel-position)))
(list (list (cadr mp) (cddr mp)) (car mp))))
;; Value returned from `event-end' or `posn-at-point'.
((pred posnp)
(let ((xy (posn-x-y position)))
(list (list (car xy) (cdr xy))
(posn-window position))))
;; Event.
((pred eventp)
(popup-menu-normalize-position (event-end position)))
(_ position)))