diff options
| author | eunhhu <[email protected]> | 2026-09-27 20:03:30 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-27 20:03:30 +0100 |
| commit | 7b93a66dbffaf2b20b0a1925786f56db54066c9b (patch) | |
| tree | 000f214ae6743dcc3d6e861fc2a27b49d875ee2d /surfaces/vega.h | |
| parent | c20c8fa13c77d08d093aede126a1ec7646da0905 (diff) | |
| download | vega-7b93a66dbffaf2b20b0a1925786f56db54066c9b.tar.gz vega-7b93a66dbffaf2b20b0a1925786f56db54066c9b.zip | |
Type Hangul on the keyboard (두벌식)
Surfaces that read keys (the display, through evdev) had only a US
layout's letters. After the 한/영 key (Lang1, or AltRight standing for
it), letter keys now give jamo that compose syllables in the entry line
(surfaces/hangul.c): an initial, a vowel and an optional final, joined
vowels and finals, a final that moves on to a vowel after it (도깨비불),
Shift's doubled consonants, a lone jamo as its compatibility letter. The
syllable being composed shows after the entry line; Backspace takes it
back a jamo at a time before deleting what was typed; Enter, Tab, the
toggle or any key but a letter finishes it. The script language gains
hangul, letters HEX and back to drive it.
The check types ten cases through it (안녕하세요, 값을, 안자, 와원, 까원,
갑 after Backspace, 한글, ㅏ, 안ㅈ, 안녕 2) and follows the composing line
jamo by jamo; the messenger check has Alice type 안녕 on her display with
recorded keys, drawn on Bob's.
Diffstat (limited to 'surfaces/vega.h')
| -rw-r--r-- | surfaces/vega.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/surfaces/vega.h b/surfaces/vega.h index fd8780b..cd6b1ee 100644 --- a/surfaces/vega.h +++ b/surfaces/vega.h @@ -153,6 +153,25 @@ bool vega_display_show(VegaDisplay *); const uint32_t *vega_display_captured(const VegaDisplay *, size_t *stride); void vega_display_close(VegaDisplay *); +/* Hangul typed on a US keyboard as the two-set layout (두벌식, hangul.c): + * letter keys give jamo that compose syllables as they come. type takes a + * letter (A-Z with Shift) and gives what it finished (UTF-8, at most one + * syllable) into done; false for a key that is not a letter. composing is + * the syllable being composed (0 bytes: none); back takes back its last jamo + * (false: none was being composed); finish ends it into out. */ +struct VegaJamo { signed char initial, vowel; unsigned char final; }; +typedef struct { + signed char initial, vowel; /* -1: none */ + unsigned char final; /* 0: none */ + unsigned char steps; /* what it was before each jamo, for Backspace */ + struct VegaJamo before[8]; +} VegaHangul; +void vega_hangul_reset(VegaHangul *); +bool vega_hangul_type(VegaHangul *, char key, char done[4], size_t *done_length); +size_t vega_hangul_composing(const VegaHangul *, char out[4]); +bool vega_hangul_back(VegaHangul *); +size_t vega_hangul_finish(VegaHangul *, char out[4]); + /* Input from evdev: keyboards (key names and the text they type on a US * layout), mice and touch screens (presses at a pixel of a width x height * screen). With count paths, recorded events are read from those files |
