Magic-7.3 Command Reference

#

## cursor

Return magic internal coordinates of the cursor (X11 pointer)

### Usage:

> cursor glyphnum
> cursor [internal|lambda|user]
> cursor [microns|window|screen]

### Summary:

> The cursor command has two distinct uses. When followed by an integer value, the cursor glyph is changed to the indicated glyph, as defined internally to Magic.
> When used without an option, or when followed by a measurement metric "internal", "lambda", or "user", the cursor command returns the current position of the cursor (the X11 pointer, not the magic cursor box) in layout coordinates. The coordinates are given in the indicated metric, or in internal units by default.

> Magic version 8.1 defines the additional option "microns", which is like the metrics mentioned above bug returns the current position of the cursor in micron units, where the scalefactor for determining micron units is defined by the current CIF/GDS output style.

> Magic version 8.1 also defines two options for returning pixel coordinates: Option "window" returns the pointer coordinate in pixels from the bottom left-hand corner of the layout window. Option "screen" returns the pointer coordinate in pixels relative to the root screen. In X11, this is defined as the top left-hand corner of the screen. This second form is useful for interacting with the window manager, for example, to open up a new window or drop-down menu next to the pointer position.

### Implementation Notes:

> cursor is implemented as a built-in window command in magic. In the Tcl version of magic, it returns a Tcl result (list of two elements, x and y coordinates).

> Like all window commands, it reports relative to the existing window if only one window is present, or the active window if called with the "`:`" macro. Otherwise, it must be called using the tk_path_name command to specify relative to which layout window the cursor coordinates will be given.

> The value returned by cursor may be modified according to the state set by the snap command. cursor user reports units relative to the grid set by the grid command, which may differ in aspect between the X and Y axes.

> Note, as stated above, which versions of magic support which options.

### See Also:

> snap
> grid
> tk_path_name

Return to command index

Last updated: March 7, 2020 at 1:06pm