mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
core: add KeyEvent
This commit is contained in:
@ -1139,6 +1139,40 @@ pub fn charCallback(
|
|||||||
try self.io_thread.wakeup.notify();
|
try self.io_thread.wakeup.notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A key input event.
|
||||||
|
pub const KeyEvent = struct {
|
||||||
|
/// The action: press, release, etc.
|
||||||
|
action: input.Action,
|
||||||
|
|
||||||
|
/// "key" is the logical key that was pressed. For example, if
|
||||||
|
/// a Dvorak keyboard layout is being used on a US keyboard,
|
||||||
|
/// the "i" physical key will be reported as "c". The physical
|
||||||
|
/// key is the key that was physically pressed on the keyboard.
|
||||||
|
key: input.Key,
|
||||||
|
physical_key: input.Key,
|
||||||
|
|
||||||
|
/// Mods are the modifiers that are pressed.
|
||||||
|
mods: input.Mods,
|
||||||
|
|
||||||
|
/// The mods that were consumed in order to generate the text
|
||||||
|
/// in utf8. This has the mods set that were consumed, so to
|
||||||
|
/// get the set of mods that are effective you must negate
|
||||||
|
/// mods with this.
|
||||||
|
///
|
||||||
|
/// This field is meaningless if utf8 is empty.
|
||||||
|
consumed_mods: input.Mods,
|
||||||
|
|
||||||
|
/// Composing is true when this key event is part of a dead key
|
||||||
|
/// composition sequence and we're in the middle of it.
|
||||||
|
composing: bool,
|
||||||
|
|
||||||
|
/// The utf8 sequence that was generated by this key event.
|
||||||
|
/// This will be an empty string if there is no text generated.
|
||||||
|
/// If composing is true and this is non-empty, this is preedit
|
||||||
|
/// text.
|
||||||
|
utf8: []const u8,
|
||||||
|
};
|
||||||
|
|
||||||
/// Called for a single key event.
|
/// Called for a single key event.
|
||||||
///
|
///
|
||||||
/// This will return true if the key was handled/consumed. In that case,
|
/// This will return true if the key was handled/consumed. In that case,
|
||||||
|
Reference in New Issue
Block a user