Skip to content
Download
API reference

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.

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.

TypeNameDefault
boolalt_pressedfalse
boolcommand_or_control_autoremapfalse
boolctrl_pressedfalse
intdevice16
boolmeta_pressedfalse
boolshift_pressedfalse
ReturnsMethod
KeyModifierMaskget_modifiers_mask()
boolis_command_or_control_pressed()

bool alt_pressed = false

Setter/getter: set_alt_pressed(), is_alt_pressed()

State of the Alt modifier.

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.

bool ctrl_pressed = false

Setter/getter: set_ctrl_pressed(), is_ctrl_pressed()

State of the Ctrl modifier.

int device = 16

Setter/getter: set_device(), get_device()

No description yet.

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.

bool shift_pressed = false

Setter/getter: set_shift_pressed(), is_shift_pressed()

State of the Shift modifier.

KeyModifierMask get_modifiers_mask() const

Returns the keycode combination of modifier keys.

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.