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."
  (cond
    ;; nil -> mouse cursor position
    ((eq position nil)
     (let ((mp (mouse-pixel-position)))
       (list (list (cadr mp) (cddr mp)) (car mp))))
    ;; Value returned from `event-end' or `posn-at-point'.
    ((posnp position)
     (let ((xy (posn-x-y position)))
       (list (list (car xy) (cdr xy))
	     (posn-window position))))
    ;; `touchscreen-begin' or `touchscreen-end' event.
    ((or (eq (car-safe position) 'touchscreen-begin)
         (eq (car-safe position) 'touchscreen-end))
     position)
    ;; Event.
    ((eventp position)
     (popup-menu-normalize-position (event-end position)))
    ;; Some other value.
    (t position)))