InputEventWithModifiers
Inherits: InputEventFromWindow < InputEvent < Resource < Shared < Object
Inherited by: InputEventGesture, InputEventKey, InputEventMouse
Abstract base class for input events affected by modifier keys like Shift and Alt.
Description
Section titled “Description”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 Actor._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 |
| bool | meta_pressed | false |
| bool | shift_pressed | false |
Methods
Section titled “Methods”| Returns | Method |
|---|---|
| KeyModifierMask | get_modifiers_mask() |
| bool | is_command_or_control_pressed() |
Property descriptions
Section titled “Property descriptions”alt_pressed
Section titled “alt_pressed”bool alt_pressed = false
Setter/getter: set_alt_pressed(), is_alt_pressed()
State of the Alt modifier.
command_or_control_autoremap
Section titled “command_or_control_autoremap”bool command_or_control_autoremap = false
Setter/getter: set_command_or_control_autoremap(), is_command_or_control_autoremap()
Automatically use Meta (Cmd) on macOS and Ctrl on other platforms. If true, ctrl_pressed and meta_pressed cannot be set.
ctrl_pressed
Section titled “ctrl_pressed”bool ctrl_pressed = false
Setter/getter: set_ctrl_pressed(), is_ctrl_pressed()
State of the Ctrl modifier.
device
Section titled “device”int device = 16
Setter/getter: set_device(), get_device()
No description yet.
meta_pressed
Section titled “meta_pressed”bool meta_pressed = false
Setter/getter: set_meta_pressed(), is_meta_pressed()
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
Section titled “shift_pressed”bool shift_pressed = false
Setter/getter: set_shift_pressed(), is_shift_pressed()
State of the Shift modifier.
Method descriptions
Section titled “Method descriptions”get_modifiers_mask
Section titled “get_modifiers_mask”KeyModifierMask get_modifiers_mask() const
Returns the keycode combination of modifier keys.
is_command_or_control_pressed
Section titled “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.