Kōtuku
  • Gallery
  • API
  • Wiki
  • GitHub
    • Audio
    • Config
    • Core
    • Display
    • Document
    • Font
    • HTTP
    • Network
    • Regex
    • SVG
    • Tiri
    • Vector
    • XML
    • XQuery
    • XRandR
      • Audio
      • MP3
      • Sound
      • File
      • MetaClass
      • Module
      • StorageDevice
      • Task
      • Thread
      • Time
      • Compression
      • CompressedStream
      • Config
      • LZMAStream
      • Script
      • Tiri
      • XML
      • XQuery
      • Controller
      • BlurFX
      • ColourFX
      • CompositeFX
      • ConvolveFX
      • DisplacementFX
      • FilterEffect
      • FloodFX
      • ImageFX
      • LightingFX
      • MergeFX
      • MorphologyFX
      • OffsetFX
      • RemapFX
      • SourceFX
      • TurbulenceFX
      • WaveFunctionFX
      • Scintilla
      • Bitmap
      • Clipboard
      • Display
      • Document
      • Font
      • Image
      • Pointer
      • Surface
      • SVG
      • ClientSocket
      • HTTP
      • NetClient
      • NetLookup
      • NetServer
      • NetSocket
      • Proxy
      • Gradient
      • GradientConic
      • GradientContour
      • GradientDiamond
      • GradientDiffusion
      • GradientDistal
      • GradientGouraud
      • GradientLinear
      • GradientMesh
      • GradientRadial
      • GradientVoronoi
      • Vector
      • VectorClip
      • VectorColour
      • VectorEllipse
      • VectorFilter
      • VectorGradient
      • VectorGroup
      • VectorImage
      • VectorPath
      • VectorPattern
      • VectorPolygon
      • VectorRectangle
      • VectorScene
      • VectorShape
      • VectorSpiral
      • VectorText
      • VectorTransition
      • VectorViewport
      • VectorWave
      • Linux Builds
      • Windows Builds
      • Customising Your Build
      • Kōtuku Objects
      • Kōtuku In Depth
      • Kōtuku Design Patterns
      • Coding With AI
      • Regex Manual
      • XML Comparisons
      • Tiri Reference Manual
      • Config API
      • Defer Syntax
      • GUI API
      • HTTP Server API
      • I/O API
      • JSON API
      • OAuth API
      • Options API
      • Proxy Server API
      • Tempus API
      • URL API
      • VFX API
      • Widgets
      • RIPL Reference Manual
      • Origo
      • Flute / Unit Testing
      • Tuku
      • Embedded Document Format
      • TDL Reference Manual
      • TDL Tools
      • Action Reference Manual
      • System Error Codes

Pointer Class

Tracks pointer position, button state and cursor image selection.

The Pointer class represents the active pointing device used by the display system. It tracks global pointer coordinates, the surface and object under the hot spot, button state, drag state and the cursor image currently being shown to the user.

On hosted systems such as Windows and X11, pointer movement and cursor images are synchronised with the host windowing system. On native displays, the display module is responsible for drawing and managing the cursor directly.

A system-wide pointer object named SystemPointer is created automatically. Applications and module code should use this shared object, usually via AccessPointer(), when reading pointer state or changing cursor behaviour.

Structure

The Pointer class consists of the following fields:

Access
NameTypeComment
 AccelerationDOUBLEThe rate of acceleration for relative pointer movement.

This field affects relative pointer movement before the final coordinates are applied. It is normally treated as a user preference, because suitable acceleration values depend on the input device and user expectations.

Hosted display drivers may apply their own pointer acceleration before events reach the display module, so this field is not always relevant in hosted environments.

 AnchorOBJECTIDCan refer to a surface that the pointer has been anchored to.

If the pointer has been anchored to a surface through SetCursor(), this field refers to the surface that receives anchored movement events.

 Bitmap*BitmapRefers to bitmap in which custom cursor images can be drawn.

The pointer graphic can be changed to a custom image by drawing into this Bitmap and selecting PTC::CUSTOM with SetCustomCursor().

 ButtonOrderSTRINGDefines the order in which mouse buttons are interpreted.

This field defines how physical pointer buttons are mapped to logical button positions when pressed. It can be used to remap a right-handed device for left-handed use, or to normalise unusual button layouts.

The default button order is 123456789AB. The left, right and middle buttons are defined as 1, 2 and 3 respectively. Additional buttons are assigned by the device.

Buttons may be referenced more than once. For example, 111 maps the first three physical buttons to the logical left button.

Changes to this field will have an immediate impact on the pointing device's behaviour.

 ButtonStateINTIndicates the current button-press state.

This field returns the current pointer button state as bit flags after ButtonOrder mapping has been applied. A set bit indicates that the corresponding logical button is being held down.

The first three bits represent left, right and middle button state respectively, with the left button at bit position zero. Additional buttons are supported, but their order depends on the device and the active ButtonOrder setting.

 ClickSlopINTA leniency value that assists in determining if the user intended to click or drag.

ClickSlop defines the allowed pointer movement, in pixels, before a press-and-release sequence is treated as a drag rather than a click. The same tolerance is used when deciding whether a second click is close enough to qualify as a double-click.

 CursorIDPTCIdentifies the active cursor image.

This field stores the cursor image currently selected for the pointer. Use SetCursor() or SetCustomCursor() to change the cursor after initialisation.

NameDescription
PTC::CROSSHAIRThe cross hair is used for targeting specific pixel points (common in paint programs).
PTC::CUSTOMWorks in conjunction with the SetCustomCursor() function to represent a program defined bitmap.
PTC::DEFAULTThe default cursor (usually an arrow pointing to the upper left).
PTC::DRAGGABLEUsed to indicate that a surface or object can be dragged by the user.
PTC::END
PTC::HANDThe hand cursor is often used for indicating click-able content (hyper-links, icons etc).
PTC::HAND_LEFTSimilar to the standard hand cursor, but points to the left.
PTC::HAND_RIGHTSimilar to the standard hand cursor, but points to the right.
PTC::INVISIBLEThe cursor graphic is invisible (but will continue to operate as normal in all other respects).
PTC::MAGNIFIERRepresents a magnifying glass.
PTC::NO_CHANGE
PTC::PAINTBRUSHThe paintbrush cursor is typically employed by paint programs.
PTC::SIZE_BOTTOMSizing cursor - for resizing the bottom edge of any rectangular area.
PTC::SIZE_BOTTOM_LEFTSizing cursor - for resizing the bottom left corner of any rectangular area.
PTC::SIZE_BOTTOM_RIGHTSizing cursor - for resizing the bottom right corner of any rectangular area.
PTC::SIZE_LEFTSizing cursor - for resizing the left edge of any rectangular area.
PTC::SIZE_RIGHTSizing cursor - for resizing the right edge of any rectangular area.
PTC::SIZE_TOPSizing cursor - for resizing the top edge of any rectangular area.
PTC::SIZE_TOP_LEFTSizing cursor - for resizing the top left corner of any rectangular area.
PTC::SIZE_TOP_RIGHTSizing cursor - for resizing the top right corner of any rectangular area.
PTC::SIZINGMulti-directional sizing cursor - for resizing in any direction.
PTC::SLEEPThe sleep cursor is used to inform the user that the computer is busy.
PTC::SPLIT_HORIZONTALThe horizontal split cursor is typically used for splitting rectangles in half, or dragging a horizontal split within a large rectangular space.
PTC::SPLIT_VERTICALThe vertical split cursor is typically used for splitting rectangles in half, or dragging a vertical split within a large rectangular space.
PTC::STOPThe stop cursor is used to inform the user that an operation is not possible (e.g. drag and drop to an unsupported object area).
PTC::TEXTThe text cursor is popular for the precise positioning of text cursors.
 CursorOwnerOBJECTIDThe object that currently owns the cursor state.

If the cursor is currently locked by an owner, this field refers to that owner's object ID. Cursor ownership is managed by SetCursor() and released with RestoreCursor().

 DoubleClickDOUBLEThe maximum interval between two clicks for a double click to be recognised.

A double-click is recognised when two presses of the same logical button occur within this interval. The value is measured in seconds and defaults to the user's pointer preference.

 DragItemINTThe currently dragged item, as defined by StartCursorDrag().

When a drag-and-drop operation is active, this field contains the custom item number supplied to StartCursorDrag(). At all other times it is zero.

 DragSourceOBJECTIDThe object managing the current drag operation, as defined by StartCursorDrag().

When a drag-and-drop operation is active, this field refers to the object managing the source data. At all other times it is zero.

Item dragging is managed by StartCursorDrag().

 FlagsPFOptional flags.
NameDescription
PF::ANCHORAllow the pointer to be anchored.
PF::UNUSED
PF::VISIBLEIndicates that the pointer is currently visible. Read-only.
 InputOBJECTIDDeclares the I/O object to read movement from.

This field records an alternate object intended to supply pointer movement. Input records delivered to the pointer must use the same DATA::DEVICE_INPUT format accepted by DataFeed().

 MaxSpeedINTRestricts the maximum speed of a pointer's movement.

This field limits the maximum relative movement applied to the pointer during a single update. Values assigned to the field are clamped to the supported range.

 OverObjectOBJECTIDReadable field that gives the ID of the object under the pointer.

This field returns the object directly under the pointer hot spot. NULL can be returned if there is no surface object under the pointer.

 OverXDOUBLEThe horizontal position of the pointer with respect to the object underneath the hot spot.

This field gives the horizontal position of the pointer hot spot relative to OverObject. It can be read when handling input to determine the object-local coordinate affected by a click, wheel or movement event.

 OverYDOUBLEThe vertical position of the pointer with respect to the object underneath the hot spot.

This field gives the vertical position of the pointer hot spot relative to OverObject. It can be read together with OverX to determine the object-local coordinate affected by pointer input.

 OverZDOUBLEThe position of the Pointer within an object.

This field is reserved for interfaces that can report pointer depth. It reflects the pointer coordinate on the Z axis relative to the object under the hot spot.

 RestrictOBJECTIDRefers to a surface when the pointer is restricted.

If the pointer has been restricted to a surface through SetCursor(), this field refers to that surface. If the pointer is not restricted, this field is zero.

 SpeedDOUBLESpeed multiplier for pointer movement.

This field controls the relative movement multiplier, expressed as a percentage. Values below 100 reduce movement, while values above 100 increase movement. MaxSpeed is applied as a separate upper limit.

 SurfaceOBJECTIDThe top-most surface that is under the pointer's hot spot.

This field refers to the top-most Surface under the pointer hot spot. It is automatically updated when the pointer moves or when surface visibility, position or stacking changes affect the object under the pointer.

 WheelSpeedDOUBLEDefines a multiplier to be applied to the mouse wheel.

This field defines a multiplier applied to pointer wheel values. A setting of 1.0 leaves wheel input unchanged, while 2.0 doubles the reported value.

 XDOUBLEThe horizontal position of the pointer within its display.
 YDOUBLEThe vertical position of the pointer within its display.

Setting X or Y on an initialised pointer forwards the change through MoveToPoint().

Actions

The following actions are currently supported:

DataFeedSends device input events to the pointer.
ERR acDataFeed(*Object, OBJECTID Object, DATA Datatype, std::span<const int8_t> Buffer)
ParameterDescription
ObjectMust refer to the unique ID of the object that you represent. If you do not represent an object, set this parameter to the current task ID.
DatatypeThe type of data being sent.
BufferThe data being sent to the target object.

Use DataFeed with the DATA::DEVICE_INPUT data type to submit one or more dcDeviceInput records to a pointer object. The supplied records are interpreted in the same way as input received from host or native hardware.

Button presses are stateful. If a submitted record presses a button, the client must later submit the corresponding release record so click, drag and repeat handling can return to a consistent state.

HideHides the pointer cursor.
MoveMoves the pointer by a relative offset.
ERR acMove(*Object, DOUBLE DeltaX, DOUBLE DeltaY, DOUBLE DeltaZ)
ParameterDescription
DeltaXThe number of units to move along the X axis.
DeltaYThe number of units to move along the Y axis.
DeltaZThe number of units to move along the Z axis.

The Move action adjusts the current X and Y coordinates by the supplied delta values. It applies the movement immediately by forwarding the resulting position to MoveToPoint().

MoveToPointMoves the pointer to an absolute location.
ERR acMoveToPoint(*Object, DOUBLE X, DOUBLE Y, DOUBLE Z, MTF Flags)
ParameterDescription
XThe new X position to move the object to.
YThe new Y position to move the object to.
ZThe new Z position to move the object to.
FlagsSet the relevant MTF flag for each provided parameter.

The MoveToPoint action changes the pointer's X and Y coordinates immediately. It updates the host cursor position where supported, refreshes the object under the hot spot and notifies subscribers to MoveToPoint with the final coordinates.

This action is intended for programmatic repositioning. Hardware input is normally delivered through DataFeed and is translated into input events for the affected surface or object.

RefreshRefreshes the pointer's target and cursor image.
ERR acRefresh(*Object)

This action recalculates the object under the pointer hot spot and reapplies any cursor image selected by the underlying surface.

ResetRestores user-adjustable pointer settings to their defaults.
ERR acReset(*Object)

This action resets movement speed, acceleration, double-click interval, maximum speed and wheel speed. It does not move the pointer or clear the current cursor ownership state.

SaveToObjectSaves pointer preferences to another object.
ERR acSaveToObject(*Object, OBJECTID Dest, CLASSID ClassID)
ParameterDescription
DestRefers to an object that will receive the encoded data.
ClassIDCan refer to a derived class that should be used when encoding the data.

This action writes the current speed, acceleration, double-click interval, maximum speed, wheel speed and button order to the destination object in configuration format.

ShowShows the pointer cursor.
Pointer class documentation © Paul Manias © 2003-2026

PF Type

Flags for the Pointer class.

NameDescription
PF::ANCHORAllow the pointer to be anchored.
PF::UNUSED
PF::VISIBLEIndicates that the pointer is currently visible. Read-only.
Pointer module documentation © Paul Manias © 2003-2026

PTC Type

Predefined cursor styles

NameDescription
PTC::CROSSHAIRThe cross hair is used for targeting specific pixel points (common in paint programs).
PTC::CUSTOMWorks in conjunction with the SetCustomCursor() function to represent a program defined bitmap.
PTC::DEFAULTThe default cursor (usually an arrow pointing to the upper left).
PTC::DRAGGABLEUsed to indicate that a surface or object can be dragged by the user.
PTC::END
PTC::HANDThe hand cursor is often used for indicating click-able content (hyper-links, icons etc).
PTC::HAND_LEFTSimilar to the standard hand cursor, but points to the left.
PTC::HAND_RIGHTSimilar to the standard hand cursor, but points to the right.
PTC::INVISIBLEThe cursor graphic is invisible (but will continue to operate as normal in all other respects).
PTC::MAGNIFIERRepresents a magnifying glass.
PTC::NO_CHANGE
PTC::PAINTBRUSHThe paintbrush cursor is typically employed by paint programs.
PTC::SIZE_BOTTOMSizing cursor - for resizing the bottom edge of any rectangular area.
PTC::SIZE_BOTTOM_LEFTSizing cursor - for resizing the bottom left corner of any rectangular area.
PTC::SIZE_BOTTOM_RIGHTSizing cursor - for resizing the bottom right corner of any rectangular area.
PTC::SIZE_LEFTSizing cursor - for resizing the left edge of any rectangular area.
PTC::SIZE_RIGHTSizing cursor - for resizing the right edge of any rectangular area.
PTC::SIZE_TOPSizing cursor - for resizing the top edge of any rectangular area.
PTC::SIZE_TOP_LEFTSizing cursor - for resizing the top left corner of any rectangular area.
PTC::SIZE_TOP_RIGHTSizing cursor - for resizing the top right corner of any rectangular area.
PTC::SIZINGMulti-directional sizing cursor - for resizing in any direction.
PTC::SLEEPThe sleep cursor is used to inform the user that the computer is busy.
PTC::SPLIT_HORIZONTALThe horizontal split cursor is typically used for splitting rectangles in half, or dragging a horizontal split within a large rectangular space.
PTC::SPLIT_VERTICALThe vertical split cursor is typically used for splitting rectangles in half, or dragging a vertical split within a large rectangular space.
PTC::STOPThe stop cursor is used to inform the user that an operation is not possible (e.g. drag and drop to an unsupported object area).
PTC::TEXTThe text cursor is popular for the precise positioning of text cursors.
Pointer module documentation © Paul Manias © 2003-2026