Function: mouse-pixel-position
mouse-pixel-position is a function defined in frame.c.
Signature
(mouse-pixel-position)
Documentation
Return a list (FRAME X . Y) giving the current mouse frame and position.
The position is given in pixel units, where (0, 0) is the upper-left corner of the frame, X is the horizontal offset, and Y is the vertical offset. If Emacs is running on a mouseless terminal or hasn't been programmed to read the mouse position, it returns the selected frame for FRAME and nil for X and Y.
Probably introduced at or before Emacs version 19.23.
Source Code
// Defined in /usr/src/emacs/src/frame.c
{
struct frame *f;
Lisp_Object lispy_dummy;
Lisp_Object x, y, retval;
f = SELECTED_FRAME ();
x = y = Qnil;
/* It's okay for the hook to refrain from storing anything. */
if (FRAME_TERMINAL (f)->mouse_position_hook)
{
enum scroll_bar_part party_dummy;
Time time_dummy;
(*FRAME_TERMINAL (f)->mouse_position_hook) (&f, -1,
&lispy_dummy, &party_dummy,
&x, &y,
&time_dummy);
}
XSETFRAME (lispy_dummy, f);
retval = Fcons (lispy_dummy, Fcons (x, y));
if (!NILP (Vmouse_position_function))
retval = call1 (Vmouse_position_function, retval);
return retval;
}