Next: , Up: Miscellaneous Functions


20.1 Pointer Functions

— Function: query-pointer &optional from-server

Returns a cons cell (x . y) representing the current mouse pointer position, relative to the origin of the root window.

If there is a mouse update current event, the position is read directly from that event. Otherwise it is read from the server. If from-server is non-nil then the position is read directly from the server in any case.

— Function: query-pointer-window

Returns the top-level window under the mouse pointer, or nil if the cursor is in the root window.

— Function: query-last-pointer

Returns a cons cell (x . y) representing the second most recent mouse pointer position, relative to the root window.

— Function: query-button-press-pointer

Returns (mouse-x . mouse-y) representing the mouse position relative to the root window at the last button-press event.

Use this function to track the displacement of the pointer during a drag.

— Function: query-button-press-window

Returns the window that the mouse was in when the button was pressed.

— Function: warp-cursor x y

Move the mouse pointer to position (x, y) relative to the origin of the root window.

— Function: warp-cursor-to-window window &optional x y

Move the mouse pointer to position (x, y) relative to the client window associated with object window.

If x and y are nil, then they are taken as the top-left corner of the window's frame.

— Variable: warp-to-window-offset

Offset (%) from window edges when warping pointer. A negative number means outside the left window edge.

— Variable: warp-to-window-enabled

When false, disable warping the cursor to windows.

— Variable: pointer-motion-threshold

If set to an integer value, a pointer must move by this many pixels on either axis before Sawfish considers it to have moved. If the pointer has not moved by this amount, Sawfish will ignore MotionNotify events from X. The variable defaults to 2 pixels. If not an integer, Sawfish assumes a threshold of 0 pixels.