Class KeyEvent

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class KeyEvent extends Event
An event related to a key-based device.
  • Constructor Details

    • KeyEvent

      public KeyEvent(MemorySegment address)
      Create a KeyEvent instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the KeyEvent class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected KeyEvent asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class Event
      Returns:
      the instance as if it were its parent type
    • getConsumedModifiers

      public Set<ModifierType> 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

      public boolean getMatch(Out<Integer> keyval, Out<Set<ModifierType>> modifiers)

      Gets a keyval and modifier combination that will match the event.

      See matches(int, Set).

      Parameters:
      keyval - return location for a keyval
      modifiers - return location for modifiers
      Returns:
      true on success
    • isModifier

      public boolean isModifier()
      Extracts whether the key event is for a modifier key.
      Returns:
      true if the this KeyEvent is for a modifier key
    • matches

      public KeyMatch matches(int keyval, Set<ModifierType> modifiers)

      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 match
      modifiers - the modifiers to match
      Returns:
      a GdkKeyMatch value describing whether this KeyEvent matches
    • matches

      public KeyMatch matches(int keyval, ModifierType... modifiers)

      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 match
      modifiers - the modifiers to match
      Returns:
      a GdkKeyMatch value describing whether this KeyEvent matches