Repository navigation
Expand file tree
/
Copy pathime_overlay_stub.c
More file actions
117 lines (89 loc) · 2.55 KB
/
Copy pathime_overlay_stub.c
File metadata and controls
117 lines (89 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// IME Overlay Stub for Non-Darwin Platforms
// Linux: delegates to IBus bridge. Other platforms: no-op.
#ifndef __APPLE__
#include <stddef.h>
#include "ime_overlay_darwin.h"
#ifdef __linux__
#ifdef VGLYPH_HAS_IBUS
#include "ime_bridge_linux.h"
// Sentinel value returned as "handle" to indicate active bridge
static int ime_linux_sentinel = 1;
void* vglyph_create_ime_overlay(void* mtk_view) {
(void)mtk_view;
vglyph_ime_linux_init();
return &ime_linux_sentinel;
}
void vglyph_set_focused_field(void* handle, const char* field_id) {
if (!handle) return;
if (field_id)
vglyph_ime_linux_focus_in();
else
vglyph_ime_linux_focus_out();
}
void vglyph_overlay_free(void* handle) {
if (!handle) return;
vglyph_ime_linux_shutdown();
}
void vglyph_overlay_register_callbacks(void* handle,
VGlyphIMECallbacks callbacks) {
if (!handle) return;
vglyph_ime_linux_register_callbacks(callbacks);
}
void* vglyph_discover_mtkview_from_window(void* ns_window) {
(void)ns_window;
return NULL;
}
void* vglyph_create_ime_overlay_auto(void* ns_window) {
(void)ns_window;
vglyph_ime_linux_init();
return &ime_linux_sentinel;
}
#else /* Linux without IBus */
void* vglyph_create_ime_overlay(void* mtk_view) {
(void)mtk_view;
return NULL;
}
void vglyph_set_focused_field(void* handle, const char* field_id) {
(void)handle; (void)field_id;
}
void vglyph_overlay_free(void* handle) {
(void)handle;
}
void vglyph_overlay_register_callbacks(void* handle,
VGlyphIMECallbacks callbacks) {
(void)handle; (void)callbacks;
}
void* vglyph_discover_mtkview_from_window(void* ns_window) {
(void)ns_window;
return NULL;
}
void* vglyph_create_ime_overlay_auto(void* ns_window) {
(void)ns_window;
return NULL;
}
#endif /* VGLYPH_HAS_IBUS */
#else /* Non-Linux, non-Darwin */
void* vglyph_create_ime_overlay(void* mtk_view) {
(void)mtk_view;
return NULL;
}
void vglyph_set_focused_field(void* handle, const char* field_id) {
(void)handle; (void)field_id;
}
void vglyph_overlay_free(void* handle) {
(void)handle;
}
void vglyph_overlay_register_callbacks(void* handle,
VGlyphIMECallbacks callbacks) {
(void)handle; (void)callbacks;
}
void* vglyph_discover_mtkview_from_window(void* ns_window) {
(void)ns_window;
return NULL;
}
void* vglyph_create_ime_overlay_auto(void* ns_window) {
(void)ns_window;
return NULL;
}
#endif /* __linux__ */
#endif /* !__APPLE__ */