Class KeyEvent
java.lang.Object
org.javagi.base.ProxyInstance
org.gnome.gobject.TypeInstance
org.gnome.gdk.Event
org.gnome.gdk.KeyEvent
- All Implemented Interfaces:
Proxy
An event related to a key-based device.
-
Nested Class Summary
Nested classes/interfaces inherited from class Event
Event.Event$Impl -
Constructor Summary
ConstructorsConstructorDescriptionKeyEvent(MemorySegment address) Create a KeyEvent instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected KeyEventasParent()Return this instance as if it were its parent type.Extracts the consumed modifiers from a key event.intExtracts the keycode from a key event.intExtracts the keyval from a key event.intExtracts the layout from a key event.intgetLevel()Extracts the shift level from a key event.booleanGets a keyval and modifier combination that will match the event.static MemoryLayoutThe memory layout of the native struct.static @Nullable TypegetType()Get the GType of the KeyEvent class.booleanExtracts whether the key event is for a modifier key.matches(int keyval, Set<ModifierType> modifiers) Matches a key event against a keyval and modifiers.matches(int keyval, ModifierType... modifiers) Matches a key event against a keyval and modifiers.Methods inherited from class Event
eventsGetAngle, eventsGetCenter, eventsGetDistance, getAxes, getAxis, getDevice, getDeviceTool, getDisplay, getEventSequence, getEventType, getHistory, getModifierState, getPointerEmulated, getPosition, getSeat, getSurface, getTime, ref, triggersContextMenu, unrefMethods inherited from class TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
KeyEvent
Create a KeyEvent instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
-
getConsumedModifiers
Extracts the consumed modifiers from a key event.- Returns:
- the consumed modifiers or this KeyEvent
-
getKeycode
public int getKeycode()Extracts the keycode from a key event.- Returns:
- the keycode of this KeyEvent
-
getKeyval
public int getKeyval()Extracts the keyval from a key event.- Returns:
- the keyval of this KeyEvent
-
getLayout
public int getLayout()Extracts the layout from a key event.- Returns:
- the layout of this KeyEvent
-
getLevel
public int getLevel()Extracts the shift level from a key event.- Returns:
- the shift level of this KeyEvent
-
getMatch
Gets a keyval and modifier combination that will match the event.
See
matches(int, Set).- Parameters:
keyval- return location for a keyvalmodifiers- return location for modifiers- Returns:
trueon success
-
isModifier
public boolean isModifier()Extracts whether the key event is for a modifier key.- Returns:
trueif the this KeyEvent is for a modifier key
-
matches
Matches a key event against a keyval and modifiers.
This is typically used to trigger keyboard shortcuts such as Ctrl-C.
Partial matches are possible where the combination matches if the currently active group is ignored.
Note that we ignore Caps Lock for matching.
- Parameters:
keyval- the keyval to matchmodifiers- the modifiers to match- Returns:
- a
GdkKeyMatchvalue describing whether this KeyEvent matches
-
matches
Matches a key event against a keyval and modifiers.
This is typically used to trigger keyboard shortcuts such as Ctrl-C.
Partial matches are possible where the combination matches if the currently active group is ignored.
Note that we ignore Caps Lock for matching.
- Parameters:
keyval- the keyval to matchmodifiers- the modifiers to match- Returns:
- a
GdkKeyMatchvalue describing whether this KeyEvent matches
-