forked from linhuman/ibus-lunispim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlunispim_settings.c
46 lines (40 loc) · 1.33 KB
/
lunispim_settings.c
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
#include "lunispim_config.h"
#include "lunispim_settings.h"
#include <string.h>
#include <lunispim/lunispim_api.h>
static struct ColorSchemeDefinition preset_color_schemes[] = {
{ "aqua", 0xffffff, 0x0a3dfa },
{ "azure", 0xffffff, 0x0a3dea },
{ "ink", 0xffffff, 0x000000 },
{ "luna", 0x000000, 0xffff7f },
{ NULL, 0, 0 }
};
static struct IBusUnispimSettings ibus_unispim_settings_default = {
FALSE,
IBUS_ORIENTATION_SYSTEM,
&preset_color_schemes[0],
};
struct IBusUnispimSettings g_ibus_unispim_settings;
static void
select_color_scheme(struct IBusUnispimSettings* settings,
const char* color_scheme_id)
{
struct ColorSchemeDefinition* c;
for (c = preset_color_schemes; c->color_scheme_id; ++c) {
if (!strcmp(c->color_scheme_id, color_scheme_id)) {
settings->color_scheme = c;
g_debug("selected color scheme: %s", color_scheme_id);
return;
}
}
// fallback to default
settings->color_scheme = &preset_color_schemes[0];
}
void
ibus_unispim_load_settings()
{
g_ibus_unispim_settings = ibus_unispim_settings_default;
g_ibus_unispim_settings.embed_preedit_text = False; //不在输入框显示输入提示
g_ibus_unispim_settings.lookup_table_orientation = IBUS_ORIENTATION_HORIZONTAL;
select_color_scheme(&g_ibus_unispim_settings, "1");
}