Next: , Up: Miscellaneous Functions   [Contents][Index]


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.

If warp-to-window-enabled is nil, this function does nothing.

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.

Sawfish provides functions to move the pointer relative to the current positions. They’re named “move-cursor”, and defined in sawfish.wm.commands.move-cursor.

Function: move-cursor right down

Move the cursor right pixels to the right across the screen, and down pixels down the screen. The cursor stops at the edge of the screen (although in multi-head environments, this may not be at the edge of the display).

There are also more specialized cursor movement functions. All of them are commands, too.

Function: move-cursor-left-fine
Function: move-cursor-right-fine
Function: move-cursor-up-fine
Function: move-cursor-down-fine
Function: move-cursor-northwest-fine
Function: move-cursor-northeast-fine
Function: move-cursor-southwest-fine
Function: move-cursor-southeast-fine

Move the cursor 1 pixel in the indicated direction.

Function: move-cursor-left
Function: move-cursor-right
Function: move-cursor-up
Function: move-cursor-down
Function: move-cursor-northwest
Function: move-cursor-northeast
Function: move-cursor-southwest
Function: move-cursor-southeast

Move the cursor move-cursor-increment pixels in the indicated direction. move-cursor-northeast is equal to the northward move cobmined with the eastward.

Function: move-cursor-center

Move the cursor to the center of the screen.

Variable: move-cursor-increment 16

The move-cursor-DIRECTION functions move this cursor this many pixels at a time.


Next: , Up: Miscellaneous Functions   [Contents][Index]