InputEventWithModifiers
Inherits: InputEventFromWindow < InputEvent < Resource < RefCounted < Object
Inherited By: InputEventGesture, InputEventKey, InputEventMouse
Abstract base class for input events affected by modifier keys like :kbd:Shift and :kbd:Alt.
Description
Stores information about mouse, keyboard, and touch gesture input events. This includes information about which modifier keys are pressed, such as :kbd:Shift or :kbd:Alt. See Node._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.
Tutorials
Properties
| bool | alt_pressed | false |
|---|---|---|
| bool | command_or_control_autoremap | false |
| bool | ctrl_pressed | false |
| bool | meta_pressed | false |
| bool | shift_pressed | false |
Methods
| BitField[KeyModifierMask] | get_modifiers_mask\ (\ ) const |
|---|---|
| bool | is_command_or_control_pressed\ (\ ) const |
Property Descriptions
State of the :kbd:Alt modifier.
bool command_or_control_autoremap = false 🔗
Automatically use :kbd:Meta (:kbd:Cmd) on macOS and :kbd:Ctrl on other platforms. If true, ctrl_pressed and meta_pressed cannot be set.
State of the :kbd:Ctrl modifier.
State of the :kbd: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.
State of the :kbd:Shift modifier.
Method Descriptions
BitField[KeyModifierMask] get_modifiers_mask\ (\ ) const 🔗
Returns the keycode combination of modifier keys.
bool is_command_or_control_pressed\ (\ ) const 🔗
On macOS, returns true if :kbd:Meta (:kbd:Cmd) is pressed.
On other platforms, returns true if :kbd:Ctrl is pressed.