libghostty
Loading...
Searching...
No Matches
event.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <ghostty/vt/result.h>
#include <ghostty/vt/allocator.h>

Go to the source code of this file.

Macros

#define GHOSTTY_MODS_SHIFT   (1 << 0)
#define GHOSTTY_MODS_CTRL   (1 << 1)
#define GHOSTTY_MODS_ALT   (1 << 2)
#define GHOSTTY_MODS_SUPER   (1 << 3)
#define GHOSTTY_MODS_CAPS_LOCK   (1 << 4)
#define GHOSTTY_MODS_NUM_LOCK   (1 << 5)
#define GHOSTTY_MODS_SHIFT_SIDE   (1 << 6)
#define GHOSTTY_MODS_CTRL_SIDE   (1 << 7)
#define GHOSTTY_MODS_ALT_SIDE   (1 << 8)
#define GHOSTTY_MODS_SUPER_SIDE   (1 << 9)

Typedefs

typedef struct GhosttyKeyEventGhosttyKeyEvent
typedef uint16_t GhosttyMods

Enumerations

enum  GhosttyKeyAction { GHOSTTY_KEY_ACTION_RELEASE = 0 , GHOSTTY_KEY_ACTION_PRESS = 1 , GHOSTTY_KEY_ACTION_REPEAT = 2 }
enum  GhosttyKey

Functions

GhosttyResult ghostty_key_event_new (const GhosttyAllocator *allocator, GhosttyKeyEvent *event)
void ghostty_key_event_free (GhosttyKeyEvent event)
void ghostty_key_event_set_action (GhosttyKeyEvent event, GhosttyKeyAction action)
GhosttyKeyAction ghostty_key_event_get_action (GhosttyKeyEvent event)
void ghostty_key_event_set_key (GhosttyKeyEvent event, GhosttyKey key)
GhosttyKey ghostty_key_event_get_key (GhosttyKeyEvent event)
void ghostty_key_event_set_mods (GhosttyKeyEvent event, GhosttyMods mods)
GhosttyMods ghostty_key_event_get_mods (GhosttyKeyEvent event)
void ghostty_key_event_set_consumed_mods (GhosttyKeyEvent event, GhosttyMods consumed_mods)
GhosttyMods ghostty_key_event_get_consumed_mods (GhosttyKeyEvent event)
void ghostty_key_event_set_composing (GhosttyKeyEvent event, bool composing)
bool ghostty_key_event_get_composing (GhosttyKeyEvent event)
void ghostty_key_event_set_utf8 (GhosttyKeyEvent event, const char *utf8, size_t len)
const char * ghostty_key_event_get_utf8 (GhosttyKeyEvent event, size_t *len)
void ghostty_key_event_set_unshifted_codepoint (GhosttyKeyEvent event, uint32_t codepoint)
uint32_t ghostty_key_event_get_unshifted_codepoint (GhosttyKeyEvent event)

Detailed Description

Key event representation and manipulation.

Definition in file event.h.

Macro Definition Documentation

◆ GHOSTTY_MODS_ALT

#define GHOSTTY_MODS_ALT   (1 << 2)

Alt/Option key is pressed

Definition at line 63 of file event.h.

◆ GHOSTTY_MODS_ALT_SIDE

#define GHOSTTY_MODS_ALT_SIDE   (1 << 8)

Right alt is pressed (0 = left, 1 = right). Only meaningful when GHOSTTY_MODS_ALT is set.

Definition at line 85 of file event.h.

◆ GHOSTTY_MODS_CAPS_LOCK

#define GHOSTTY_MODS_CAPS_LOCK   (1 << 4)

Caps Lock is active

Definition at line 67 of file event.h.

◆ GHOSTTY_MODS_CTRL

#define GHOSTTY_MODS_CTRL   (1 << 1)

Control key is pressed

Examples
c-vt-key-encode/src/main.c.

Definition at line 61 of file event.h.

◆ GHOSTTY_MODS_CTRL_SIDE

#define GHOSTTY_MODS_CTRL_SIDE   (1 << 7)

Right ctrl is pressed (0 = left, 1 = right). Only meaningful when GHOSTTY_MODS_CTRL is set.

Definition at line 80 of file event.h.

◆ GHOSTTY_MODS_NUM_LOCK

#define GHOSTTY_MODS_NUM_LOCK   (1 << 5)

Num Lock is active

Definition at line 69 of file event.h.

◆ GHOSTTY_MODS_SHIFT

#define GHOSTTY_MODS_SHIFT   (1 << 0)

Shift key is pressed

Definition at line 59 of file event.h.

◆ GHOSTTY_MODS_SHIFT_SIDE

#define GHOSTTY_MODS_SHIFT_SIDE   (1 << 6)

Right shift is pressed (0 = left, 1 = right). Only meaningful when GHOSTTY_MODS_SHIFT is set.

Definition at line 75 of file event.h.

◆ GHOSTTY_MODS_SUPER

#define GHOSTTY_MODS_SUPER   (1 << 3)

Super/Command/Windows key is pressed

Definition at line 65 of file event.h.

◆ GHOSTTY_MODS_SUPER_SIDE

#define GHOSTTY_MODS_SUPER_SIDE   (1 << 9)

Right super is pressed (0 = left, 1 = right). Only meaningful when GHOSTTY_MODS_SUPER is set.

Definition at line 90 of file event.h.