Starboard Module Reference: input.h
Stay organized with collections
Save and categorize content based on your preferences.
Defines input events and associated data types.
Enums
Identifies possible input subsystem types. The types of events that each device
type produces correspond to SbInputEventType
values.
Values
kSbInputDeviceTypeGesture
Input from a gesture-detection mechanism. Examples include Kinect, Wiimotes,
etc...
Produces Move
, Press
and Unpress
events.
kSbInputDeviceTypeGamepad
Input from a gamepad, following the layout provided in the W3C Web Gamepad
API. [ https://www.w3.org/TR/gamepad/ ]
Produces Move
, Press
and Unpress
events.
kSbInputDeviceTypeKeyboard
Keyboard input from a traditional keyboard or game controller chatpad.
Produces Press
and Unpress
events.
kSbInputDeviceTypeMouse
Input from a traditional mouse.
Produces Move
, Press
, and Unpress
events.
kSbInputDeviceTypeRemote
Input from a TV remote-control-style device.
Produces Press
and Unpress
events.
kSbInputDeviceTypeTouchScreen
Input from a single- or multi-touchscreen.
Produces Move
, Press
, and Unpress
events.
kSbInputDeviceTypeTouchPad
Input from a touchpad that is not masquerading as a mouse.
Produces Move
, Press
, and Unpress
events.
kSbInputDeviceTypeOnScreenKeyboard
Keyboard input from an on screen keyboard.
Produces Input
events.
The action that an input event represents.
Values
kSbInputEventTypeMove
Device Movement. In the case of Mouse
, and perhaps Gesture
, the movement
tracks an absolute cursor position. In the case of TouchPad
, only relative
movements are provided.
kSbInputEventTypePress
Key or button press activation. This could be a key on a keyboard, a button
on a mouse or game controller, a push from a touch screen, or a gesture. An
Unpress
event is subsequently delivered when the Press
event terminates,
such as when the key/button/finger is raised. Injecting repeat presses is up
to the client.
kSbInputEventTypeUnpress
Key or button deactivation. The counterpart to the Press
event, this event
is sent when the key or button being pressed is released.
kSbInputEventTypeWheel
Wheel movement. Provides relative movements of the Mouse
wheel.
kSbInputEventTypeInput
https://w3c.github.io/uievents/#event-type-input
Structs
Event data for kSbEventTypeInput
events.
Members
SbWindow window
The window in which the input was generated.
SbInputEventType type
The type of input event that this represents.
SbInputDeviceType device_type
The type of device that generated this input event.
int device_id
An identifier that is unique among all connected devices.
SbKey key
An identifier that indicates which keyboard key or mouse button was involved
in this event, if any. All known keys for all devices are mapped to a single
ID space, defined by the SbKey
enum in key.h
.
wchar_t character
The character that corresponds to the key. For an external keyboard, this
character also depends on the keyboard language. The value is 0
if there
is no corresponding character.
SbKeyLocation key_location
The location of the specified key, in cases where there are multiple
instances of the button on the keyboard. For example, some keyboards have
more than one "shift" key.
unsigned int key_modifiers
Key modifiers (e.g. Ctrl
, Shift
) held down during this input event.
SbInputVector position
The (x, y) coordinates of the persistent cursor controlled by this device.
The value is 0
if this data is not applicable. For events with type
kSbInputEventTypeMove and device_type kSbInputDeviceTypeGamepad, this field
is interpreted as a stick position with the range [-1, 1], with positive
values for the down and right direction.
SbInputVector delta
The relative motion vector of this input. The value is 0
if this data is
not applicable.
float pressure
The normalized pressure of the pointer input in the range of [0,1], where 0
and 1 represent the minimum and maximum pressure the hardware is capable of
detecting, respectively. Use NaN for devices that do not report pressure.
This value is used for input events with device type mouse or touch screen.
SbInputVector size
The (width, height) of the contact geometry of the pointer. This defines the
size of the area under the pointer position. If (NaN, NaN) is specified, the
value (0,0) will be used. This value is used for input events with device
type mouse or touch screen.
SbInputVector tilt
The (x, y) angle in degrees, in the range of [-90, 90] of the pointer,
relative to the z axis. Positive values are for tilt to the right (x), and
towards the user (y). Use (NaN, NaN) for devices that do not report tilt.
This value is used for input events with device type mouse or touch screen.
const char * input_text
The text to input for events of type Input
.
bool is_composing
Set to true if the input event is part of a composition event.
A 2-dimensional vector used to represent points and motion vectors.
Members
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-09-03 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-03 UTC."],[[["\u003cp\u003eDefines input events and their associated data types, including device types and event types.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eSbInputDeviceType\u003c/code\u003e enum identifies input sources like keyboard, mouse, touchscreen, gamepad, etc., each producing specific event types.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eSbInputEventType\u003c/code\u003e enum defines actions like move, press, unpress, wheel, and input, which are used to describe the nature of an input event.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eSbInputData\u003c/code\u003e struct provides detailed information about each input event, including device type, key, modifiers, position, pressure, etc.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eSbInputVector\u003c/code\u003e struct represents 2D points and motion vectors using x and y coordinates.\u003c/p\u003e\n"]]],["Input events originate from various device types, including `Gesture`, `Gamepad`, `Keyboard`, `Mouse`, `Remote`, `TouchScreen`, `TouchPad`, and `OnScreenKeyboard`. Each device produces specific event types: `Move`, `Press`, `Unpress`, `Wheel`, or `Input`. `SbInputData` structures capture these events, detailing the `window`, `type`, `device_type`, `device_id`, `key`, `character`, `key_location`, `key_modifiers`, `position`, `delta`, `pressure`, `size`, `tilt`, `input_text`, and `is_composing` data. `SbInputVector` represents 2D coordinates.\n"],null,["Defines input events and associated data types.\n\nEnums\n\nSbInputDeviceType\n\nIdentifies possible input subsystem types. The types of events that each device\ntype produces correspond to `SbInputEventType` values.\n\nValues\n\n- `kSbInputDeviceTypeGesture`\n\n Input from a gesture-detection mechanism. Examples include Kinect, Wiimotes,\n etc...\n\n Produces `Move`, `Press` and `Unpress` events.\n- `kSbInputDeviceTypeGamepad`\n\n Input from a gamepad, following the layout provided in the W3C Web Gamepad\n API. \\[ \u003chttps://www.w3.org/TR/gamepad/\u003e \\]\n\n Produces `Move`, `Press` and `Unpress` events.\n- `kSbInputDeviceTypeKeyboard`\n\n Keyboard input from a traditional keyboard or game controller chatpad.\n\n Produces `Press` and `Unpress` events.\n- `kSbInputDeviceTypeMouse`\n\n Input from a traditional mouse.\n\n Produces `Move`, `Press`, and `Unpress` events.\n- `kSbInputDeviceTypeRemote`\n\n Input from a TV remote-control-style device.\n\n Produces `Press` and `Unpress` events.\n- `kSbInputDeviceTypeTouchScreen`\n\n Input from a single- or multi-touchscreen.\n\n Produces `Move`, `Press`, and `Unpress` events.\n- `kSbInputDeviceTypeTouchPad`\n\n Input from a touchpad that is not masquerading as a mouse.\n\n Produces `Move`, `Press`, and `Unpress` events.\n- `kSbInputDeviceTypeOnScreenKeyboard`\n\n Keyboard input from an on screen keyboard.\n\n Produces `Input` events.\n\nSbInputEventType\n\nThe action that an input event represents.\n\nValues\n\n- `kSbInputEventTypeMove`\n\n Device Movement. In the case of `Mouse`, and perhaps `Gesture`, the movement\n tracks an absolute cursor position. In the case of `TouchPad`, only relative\n movements are provided.\n- `kSbInputEventTypePress`\n\n Key or button press activation. This could be a key on a keyboard, a button\n on a mouse or game controller, a push from a touch screen, or a gesture. An\n `Unpress` event is subsequently delivered when the `Press` event terminates,\n such as when the key/button/finger is raised. Injecting repeat presses is up\n to the client.\n- `kSbInputEventTypeUnpress`\n\n Key or button deactivation. The counterpart to the `Press` event, this event\n is sent when the key or button being pressed is released.\n- `kSbInputEventTypeWheel`\n\n Wheel movement. Provides relative movements of the `Mouse` wheel.\n- `kSbInputEventTypeInput`\n\n \u003chttps://w3c.github.io/uievents/#event-type-input\u003e\n\nStructs\n\nSbInputData\n\nEvent data for `kSbEventTypeInput` events.\n\nMembers\n\n- `SbWindow window`\n\n The window in which the input was generated.\n- `SbInputEventType type`\n\n The type of input event that this represents.\n- `SbInputDeviceType device_type`\n\n The type of device that generated this input event.\n- `int device_id`\n\n An identifier that is unique among all connected devices.\n- `SbKey key`\n\n An identifier that indicates which keyboard key or mouse button was involved\n in this event, if any. All known keys for all devices are mapped to a single\n ID space, defined by the `SbKey` enum in `key.h`.\n- `wchar_t character`\n\n The character that corresponds to the key. For an external keyboard, this\n character also depends on the keyboard language. The value is `0` if there\n is no corresponding character.\n- `SbKeyLocation key_location`\n\n The location of the specified key, in cases where there are multiple\n instances of the button on the keyboard. For example, some keyboards have\n more than one \"shift\" key.\n- `unsigned int key_modifiers`\n\n Key modifiers (e.g. `Ctrl`, `Shift`) held down during this input event.\n- `SbInputVector position`\n\n The (x, y) coordinates of the persistent cursor controlled by this device.\n The value is `0` if this data is not applicable. For events with type\n kSbInputEventTypeMove and device_type kSbInputDeviceTypeGamepad, this field\n is interpreted as a stick position with the range \\[-1, 1\\], with positive\n values for the down and right direction.\n- `SbInputVector delta`\n\n The relative motion vector of this input. The value is `0` if this data is\n not applicable.\n- `float pressure`\n\n The normalized pressure of the pointer input in the range of \\[0,1\\], where 0\n and 1 represent the minimum and maximum pressure the hardware is capable of\n detecting, respectively. Use NaN for devices that do not report pressure.\n This value is used for input events with device type mouse or touch screen.\n- `SbInputVector size`\n\n The (width, height) of the contact geometry of the pointer. This defines the\n size of the area under the pointer position. If (NaN, NaN) is specified, the\n value (0,0) will be used. This value is used for input events with device\n type mouse or touch screen.\n- `SbInputVector tilt`\n\n The (x, y) angle in degrees, in the range of \\[-90, 90\\] of the pointer,\n relative to the z axis. Positive values are for tilt to the right (x), and\n towards the user (y). Use (NaN, NaN) for devices that do not report tilt.\n This value is used for input events with device type mouse or touch screen.\n- `const char * input_text`\n\n The text to input for events of type `Input`.\n- `bool is_composing`\n\n Set to true if the input event is part of a composition event.\n\nSbInputVector\n\nA 2-dimensional vector used to represent points and motion vectors.\n\nMembers\n\n- `float x`\n- `float y`"]]