File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,6 +9,37 @@ module gui
99import sokol.sapp
1010import vglyph
1111
12+ // IME holds per-window Input Method Editor state.
13+ // Created lazily because the native window is not ready during
14+ // init_fn.
15+ struct IME {
16+ mut :
17+ overlay voidptr = unsafe { nil }
18+ handler voidptr = unsafe { nil }
19+ initialized bool
20+ }
21+
22+ // ime_create_overlay creates the platform-specific IME overlay.
23+ // Returns nil on platforms without IME overlay support.
24+ fn ime_create_overlay () voidptr {
25+ $if macos {
26+ ns_window := sapp.macos_get_window ()
27+ if ns_window == unsafe { nil } {
28+ return unsafe { nil }
29+ }
30+ return vglyph.ime_overlay_create_auto (ns_window)
31+ } $if windows {
32+ hwnd := sapp.win32_get_hwnd ()
33+ if hwnd == unsafe { nil } {
34+ return unsafe { nil }
35+ }
36+ return hwnd
37+ } $else {
38+ // Linux: vglyph stubs return nil (no overlay yet).
39+ return unsafe { nil }
40+ }
41+ }
42+
1243// init_ime lazily creates the IME overlay and registers
1344// callbacks via VGlyph's StandardIMEHandler.
1445fn (mut w Window) init_ime () {
You can’t perform that action at this time.
0 commit comments