InputEventWithModifiers
Inherits: InputEventFromWindow < InputEvent < Resource < RefCounted < Object
Inherited by: InputEventGesture, InputEventKey, InputEventMouse
Description
Section titled “Description”Abstract base class for input events affected by modifier keys like Shift and Alt.
Stores information about mouse, keyboard, and touch gesture input events. This includes information about which modifier keys are pressed, such as Shift or Alt. See Entity._input().
Note: Modifier keys are considered modifiers only when used in combination with another key. As a result, their corresponding member variables, such as ctrl_pressed, will return false if the key is pressed on its own.
Properties
Section titled “Properties”| Type | Name | Default |
|---|---|---|
| bool | alt_pressed |
false |
| bool | command_or_control_autoremap |
false |
| bool | ctrl_pressed |
false |
| int | device |
16 (overrides InputEvent) |
| bool | meta_pressed |
false |
| bool | shift_pressed |
false |
Methods
Section titled “Methods”| Returns | Method |
|---|---|
| BitField[KeyModifierMask] | get_modifiers_mask() const |
| bool | is_command_or_control_pressed() const |
Property descriptions
Section titled “Property descriptions”alt_pressed
bool alt_pressed = false
State of the Alt modifier.
command_or_control_autoremap
bool command_or_control_autoremap = false
Automatically use Meta (Cmd) on macOS and Ctrl on other platforms. If true, ctrl_pressed and meta_pressed cannot be set.
ctrl_pressed
bool ctrl_pressed = false
State of the Ctrl modifier.
meta_pressed
bool meta_pressed = false
State of the Meta modifier. On Windows and Linux, this represents the Windows key (sometimes called “meta” or “super” on Linux). On macOS, this represents the Command key.
shift_pressed
bool shift_pressed = false
State of the Shift modifier.
Method descriptions
Section titled “Method descriptions”get_modifiers_mask
BitField[KeyModifierMask] get_modifiers_mask() const
Returns the keycode combination of modifier keys.
is_command_or_control_pressed
bool is_command_or_control_pressed() const
On macOS, returns true if Meta (Cmd) is pressed.
On other platforms, returns true if Ctrl is pressed.
