1 /* UIM input support for
9 ================================================================================
10 CVars introduced with the UIM extension
11 ================================================================================
14 cvar_t im_method = {CVAR_SAVE, "im_method", "anthy", "which input method to use if uim is supported and active"};
15 cvar_t im_enabled = {CVAR_SAVE, "im_enabled", "0", "use UIM input"};
18 ================================================================================
19 Library imports. Taken from the uim headers.
20 ================================================================================
23 struct uim_code_converter *quim_iconv;
25 int (*quim_init)(void);
26 void (*quim_quit)(void);
27 uim_candidate (*quim_get_candidate)(uim_context, int index, int accel_enum_hint);
28 void (*quim_candidate_free)(uim_candidate);
29 int (*quim_get_candidate_index)(uim_context);
30 const char* (*quim_candidate_get_cand_str)(uim_candidate);
31 const char* (*quim_get_default_im_name)(const char *localename);
32 uim_context (*quim_create_context)(void *cookie,
34 const char *im, const char *lang,
36 struct uim_code_converter *conv,
37 void (*commit_cb)(void *ptr, const char *str));
38 void (*quim_release_context)(uim_context);
39 int (*quim_helper_init_client_fd)(void (*disconnect_cb)(void));
40 void (*quim_close_client_fd)(int);
41 void (*quim_set_preedit_cb)(uim_context,
42 void (*clear_cb)(void*),
43 void (*pushback_cb)(void*, int attr, const char *str),
44 void (*update_cb)(void*));
45 //void (*quim_set_prop_list_update_cb)(uim_context,
46 // void (*update_cb)(void*, const char *longstr));
47 void (*quim_set_candidate_selector_cb)(uim_context,
48 void (*activate_cb)(void*, int nr, int display_limit),
49 void (*select_cb)(void*, int index),
50 void (*shift_page_cb)(void*, int direction),
51 void (*deactivate_cb)(void*));
52 void (*quim_prop_list_update)(uim_context);
53 void (*quim_press_key)(uim_context, int key, int mods);
54 void (*quim_release_key)(uim_context, int key, int mods);
57 ================================================================================
58 Support for dynamically loading the UIM library
59 ================================================================================
62 static dllfunction_t uimfuncs[] =
64 {"uim_init", (void **) &quim_init},
65 {"uim_quit", (void **) &quim_quit},
66 {"uim_get_candidate", (void **) &quim_get_candidate},
67 {"uim_candidate_free", (void **) &quim_candidate_free},
68 {"uim_get_candidate_index", (void **) &quim_get_candidate_index},
69 {"uim_candidate_get_cand_str", (void **) &quim_candidate_get_cand_str},
70 {"uim_get_default_im_name", (void **) &quim_get_default_im_name},
71 {"uim_create_context", (void **) &quim_create_context},
72 {"uim_release_context", (void **) &quim_release_context},
73 {"uim_helper_init_client_fd", (void **) &quim_helper_init_client_fd},
74 {"uim_close_client_fd", (void **) &quim_close_client_fd},
75 {"uim_set_preedit_cb", (void **) &quim_set_preedit_cb},
76 {"uim_set_candidate_selector_cb", (void **) &quim_set_candidate_selector_cb},
77 {"uim_prop_list_update", (void **) &quim_prop_list_update},
78 {"uim_press_key", (void **) &quim_press_key},
79 {"uim_release_key", (void **) &quim_release_key},
80 {"uim_iconv", (void **) &quim_iconv},
85 /// Handle for UIM dll
86 static dllhandle_t uim_dll = NULL;
88 /// Memory pool for uim
89 static mempool_t *uim_mempool= NULL;
98 void UIM_CloseLibrary (void)
101 Mem_FreePool(&uim_mempool);
102 Sys_UnloadLibrary (&uim_dll);
109 Try to load the UIM DLL
112 qboolean UIM_OpenLibrary (void)
114 const char* dllnames [] =
117 #error path for freetype 2 dll
119 #error path for freetype 2 dll
120 #elif defined(MACOSX)
134 if (!Sys_LoadLibrary (dllnames, &uim_dll, uimfuncs))