summaryrefslogtreecommitdiff
path: root/src/modules/ecore/immodules/xim/ecore_imf_xim.c
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2013-01-08 14:12:45 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2013-01-08 14:12:45 +0000
commitb7c81581c51aa1d494d3ccfb2ec6c2098749d650 (patch)
treeba99804f289e0fc4fa058b8b8798ecd0b1efe367 /src/modules/ecore/immodules/xim/ecore_imf_xim.c
parent19b5f5a1b54d1d4ef7b26e91d20dc8c401e9ff65 (diff)
efl/ecore_imf: namespace all functions.
SVN revision: 82417
Diffstat (limited to '')
-rw-r--r--src/modules/ecore/immodules/xim/ecore_imf_xim.c236
1 files changed, 119 insertions, 117 deletions
diff --git a/src/modules/ecore/immodules/xim/ecore_imf_xim.c b/src/modules/ecore/immodules/xim/ecore_imf_xim.c
index ac6ecb0853..f2dfdbba23 100644
--- a/src/modules/ecore/immodules/xim/ecore_imf_xim.c
+++ b/src/modules/ecore/immodules/xim/ecore_imf_xim.c
@@ -64,51 +64,53 @@ struct _Ecore_IMF_Context_Data
64}; 64};
65 65
66/* prototype */ 66/* prototype */
67Ecore_IMF_Context_Data *imf_context_data_new(void); 67static Ecore_IMF_Context_Data *_ecore_imf_xim_context_data_new(void);
68void imf_context_data_destroy(Ecore_IMF_Context_Data *imf_context_data); 68static void _ecore_imf_xim_context_data_destroy(Ecore_IMF_Context_Data *imf_context_data);
69 69
70static void add_feedback_attr(Eina_List **attrs, 70static void _ecore_imf_xim_feedback_attr_add(Eina_List **attrs,
71 const char *str, 71 const char *str,
72 XIMFeedback feedback, 72 XIMFeedback feedback,
73 int start_pos, 73 int start_pos,
74 int end_pos); 74 int end_pos);
75 75
76static void reinitialize_ic(Ecore_IMF_Context *ctx); 76static void _ecore_imf_xim_ic_reinitialize(Ecore_IMF_Context *ctx);
77static void set_ic_client_window(Ecore_IMF_Context *ctx, 77static void _ecore_imf_xim_ic_client_window_set(Ecore_IMF_Context *ctx,
78 Ecore_X_Window window); 78 Ecore_X_Window window);
79static int preedit_start_callback(XIC xic, 79static int _ecore_imf_xim_preedit_start_call(XIC xic,
80 XPointer client_data, 80 XPointer client_data,
81 XPointer call_data); 81 XPointer call_data);
82static void preedit_done_callback(XIC xic, 82static void _ecore_imf_xim_preedit_done_call(XIC xic,
83 XPointer client_data, 83 XPointer client_data,
84 XPointer call_data); 84 XPointer call_data);
85static int xim_text_to_utf8(Ecore_IMF_Context *ctx, 85static void _ecore_imf_xim_preedit_draw_call(XIC xic,
86 XIMText *xim_text, 86 XPointer client_data,
87 char **text); 87 XIMPreeditDrawCallbackStruct *call_data);
88static void preedit_draw_callback(XIC xic, 88static void _ecore_imf_xim_preedit_caret_call(XIC xic,
89 XPointer client_data, 89 XPointer client_data,
90 XIMPreeditDrawCallbackStruct *call_data); 90 XIMPreeditCaretCallbackStruct *call_data);
91static void preedit_caret_callback(XIC xic, 91
92 XPointer client_data, 92static int _ecore_imf_xim_text_to_utf8(Ecore_IMF_Context *ctx,
93 XIMPreeditCaretCallbackStruct *call_data); 93 XIMText *xim_text,
94static XVaNestedList preedit_callback_set(Ecore_IMF_Context *ctx); 94 char **text);
95static XIC get_ic(Ecore_IMF_Context *ctx); 95
96static XIM_Im_Info *get_im(Ecore_X_Window window, 96static XVaNestedList _ecore_imf_xim_preedit_callback_set(Ecore_IMF_Context *ctx);
97 char *locale); 97static XIC _ecore_imf_xim_ic_get(Ecore_IMF_Context *ctx);
98static void xim_info_try_im(XIM_Im_Info *info); 98static XIM_Im_Info *_ecore_imf_xim_im_get(Ecore_X_Window window,
99static void xim_info_display_closed(Ecore_X_Display *display, 99 char *locale);
100static void _ecore_imf_xim_info_im_init(XIM_Im_Info *info);
101static void _ecore_imf_xim_info_im_shutdown(Ecore_X_Display *display,
100 int is_error, 102 int is_error,
101 XIM_Im_Info *info); 103 XIM_Im_Info *info);
102static void xim_instantiate_callback(Display *display, 104static void _ecore_imf_xim_instantiate_cb(Display *display,
105 XPointer client_data,
106 XPointer call_data);
107static void _ecore_imf_xim_destroy_cb(XIM xim,
103 XPointer client_data, 108 XPointer client_data,
104 XPointer call_data); 109 XPointer call_data);
105static void setup_im(XIM_Im_Info *info); 110static void _ecore_imf_xim_im_setup(XIM_Im_Info *info);
106static void xim_destroy_callback(XIM xim,
107 XPointer client_data,
108 XPointer call_data);
109 111
110static unsigned int 112static unsigned int
111utf8_offset_to_index(const char *str, int offset) 113_ecore_imf_xim_utf8_offset_to_index(const char *str, int offset)
112{ 114{
113 int idx = 0; 115 int idx = 0;
114 int i; 116 int i;
@@ -127,7 +129,7 @@ _ecore_imf_context_xim_add(Ecore_IMF_Context *ctx)
127 129
128 EINA_LOG_DBG("in"); 130 EINA_LOG_DBG("in");
129 131
130 imf_context_data = imf_context_data_new(); 132 imf_context_data = _ecore_imf_xim_context_data_new();
131 EINA_SAFETY_ON_NULL_RETURN(imf_context_data); 133 EINA_SAFETY_ON_NULL_RETURN(imf_context_data);
132 134
133 imf_context_data->use_preedit = EINA_TRUE; 135 imf_context_data->use_preedit = EINA_TRUE;
@@ -156,7 +158,7 @@ _ecore_imf_context_xim_del(Ecore_IMF_Context *ctx)
156 dsp = ecore_x_display_get(); 158 dsp = ecore_x_display_get();
157 XUnregisterIMInstantiateCallback(dsp, 159 XUnregisterIMInstantiateCallback(dsp,
158 NULL, NULL, NULL, 160 NULL, NULL, NULL,
159 xim_instantiate_callback, 161 _ecore_imf_xim_instantiate_cb,
160 (XPointer)imf_context_data->im_info); 162 (XPointer)imf_context_data->im_info);
161 } 163 }
162 else if (imf_context_data->im_info->im) 164 else if (imf_context_data->im_info->im)
@@ -170,9 +172,9 @@ _ecore_imf_context_xim_del(Ecore_IMF_Context *ctx)
170 } 172 }
171 } 173 }
172 174
173 set_ic_client_window(ctx, 0); 175 _ecore_imf_xim_ic_client_window_set(ctx, 0);
174 176
175 imf_context_data_destroy(imf_context_data); 177 _ecore_imf_xim_context_data_destroy(imf_context_data);
176} 178}
177 179
178static void 180static void
@@ -180,7 +182,7 @@ _ecore_imf_context_xim_client_window_set(Ecore_IMF_Context *ctx,
180 void *window) 182 void *window)
181{ 183{
182 EINA_LOG_DBG("in"); 184 EINA_LOG_DBG("in");
183 set_ic_client_window(ctx, (Ecore_X_Window)((Ecore_Window)window)); 185 _ecore_imf_xim_ic_client_window_set(ctx, (Ecore_X_Window)((Ecore_Window)window));
184} 186}
185 187
186static void 188static void
@@ -244,7 +246,7 @@ _ecore_imf_context_xim_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx
244 if (new_feedback != last_feedback) 246 if (new_feedback != last_feedback)
245 { 247 {
246 if (start >= 0) 248 if (start >= 0)
247 add_feedback_attr(attrs, *str, last_feedback, start, i); 249 _ecore_imf_xim_feedback_attr_add(attrs, *str, last_feedback, start, i);
248 250
249 last_feedback = new_feedback; 251 last_feedback = new_feedback;
250 start = i; 252 start = i;
@@ -252,7 +254,7 @@ _ecore_imf_context_xim_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx
252 } 254 }
253 255
254 if (start >= 0) 256 if (start >= 0)
255 add_feedback_attr(attrs, *str, last_feedback, start, i); 257 _ecore_imf_xim_feedback_attr_add(attrs, *str, last_feedback, start, i);
256} 258}
257 259
258static void 260static void
@@ -402,21 +404,21 @@ _ecore_imf_context_xim_use_preedit_set(Ecore_IMF_Context *ctx,
402 if (imf_context_data->use_preedit != use_preedit) 404 if (imf_context_data->use_preedit != use_preedit)
403 { 405 {
404 imf_context_data->use_preedit = use_preedit; 406 imf_context_data->use_preedit = use_preedit;
405 reinitialize_ic(ctx); 407 _ecore_imf_xim_ic_reinitialize(ctx);
406 } 408 }
407} 409}
408 410
409static void 411static void
410add_feedback_attr(Eina_List **attrs, 412_ecore_imf_xim_feedback_attr_add(Eina_List **attrs,
411 const char *str, 413 const char *str,
412 XIMFeedback feedback, 414 XIMFeedback feedback,
413 int start_pos, 415 int start_pos,
414 int end_pos) 416 int end_pos)
415{ 417{
416 Ecore_IMF_Preedit_Attr *attr = NULL; 418 Ecore_IMF_Preedit_Attr *attr = NULL;
417 419
418 unsigned int start_index = utf8_offset_to_index(str, start_pos); 420 unsigned int start_index = _ecore_imf_xim_utf8_offset_to_index(str, start_pos);
419 unsigned int end_index = utf8_offset_to_index(str, end_pos); 421 unsigned int end_index = _ecore_imf_xim_utf8_offset_to_index(str, end_pos);
420 422
421 if (feedback & FEEDBACK_MASK) 423 if (feedback & FEEDBACK_MASK)
422 { 424 {
@@ -580,7 +582,7 @@ _ecore_imf_context_xim_filter_event(Ecore_IMF_Context *ctx,
580 if (!imf_context_data) return EINA_FALSE; 582 if (!imf_context_data) return EINA_FALSE;
581 ic = imf_context_data->ic; 583 ic = imf_context_data->ic;
582 if (!ic) 584 if (!ic)
583 ic = get_ic(ctx); 585 ic = _ecore_imf_xim_ic_get(ctx);
584 586
585 if (type == ECORE_IMF_EVENT_KEY_DOWN) 587 if (type == ECORE_IMF_EVENT_KEY_DOWN)
586 { 588 {
@@ -760,8 +762,8 @@ xim_imf_module_exit(void)
760 return NULL; 762 return NULL;
761} 763}
762 764
763Eina_Bool 765static Eina_Bool
764ecore_imf_xim_init(void) 766_ecore_imf_xim_init(void)
765{ 767{
766 EINA_LOG_DBG("%s in", __FUNCTION__); 768 EINA_LOG_DBG("%s in", __FUNCTION__);
767 eina_init(); 769 eina_init();
@@ -773,29 +775,29 @@ ecore_imf_xim_init(void)
773 return EINA_TRUE; 775 return EINA_TRUE;
774} 776}
775 777
776void 778static void
777ecore_imf_xim_shutdown(void) 779_ecore_imf_xim_shutdown(void)
778{ 780{
779 while (open_ims) 781 while (open_ims)
780 { 782 {
781 XIM_Im_Info *info = open_ims->data; 783 XIM_Im_Info *info = open_ims->data;
782 Ecore_X_Display *display = ecore_x_display_get(); 784 Ecore_X_Display *display = ecore_x_display_get();
783 785
784 xim_info_display_closed(display, EINA_FALSE, info); 786 _ecore_imf_xim_info_im_shutdown(display, EINA_FALSE, info);
785 } 787 }
786 788
787 ecore_x_shutdown(); 789 ecore_x_shutdown();
788 eina_shutdown(); 790 eina_shutdown();
789} 791}
790 792
791EINA_MODULE_INIT(ecore_imf_xim_init); 793EINA_MODULE_INIT(_ecore_imf_xim_init);
792EINA_MODULE_SHUTDOWN(ecore_imf_xim_shutdown); 794EINA_MODULE_SHUTDOWN(_ecore_imf_xim_shutdown);
793 795
794/* 796/*
795 * internal functions 797 * internal functions
796 */ 798 */
797Ecore_IMF_Context_Data * 799static Ecore_IMF_Context_Data *
798imf_context_data_new(void) 800_ecore_imf_xim_context_data_new(void)
799{ 801{
800 Ecore_IMF_Context_Data *imf_context_data = NULL; 802 Ecore_IMF_Context_Data *imf_context_data = NULL;
801 char *locale; 803 char *locale;
@@ -813,12 +815,12 @@ imf_context_data_new(void)
813 815
814 return imf_context_data; 816 return imf_context_data;
815error: 817error:
816 imf_context_data_destroy(imf_context_data); 818 _ecore_imf_xim_context_data_destroy(imf_context_data);
817 return NULL; 819 return NULL;
818} 820}
819 821
820void 822static void
821imf_context_data_destroy(Ecore_IMF_Context_Data *imf_context_data) 823_ecore_imf_xim_context_data_destroy(Ecore_IMF_Context_Data *imf_context_data)
822{ 824{
823 if (!imf_context_data) 825 if (!imf_context_data)
824 return; 826 return;
@@ -839,9 +841,9 @@ imf_context_data_destroy(Ecore_IMF_Context_Data *imf_context_data)
839} 841}
840 842
841static int 843static int
842preedit_start_callback(XIC xic EINA_UNUSED, 844_ecore_imf_xim_preedit_start_call(XIC xic EINA_UNUSED,
843 XPointer client_data, 845 XPointer client_data,
844 XPointer call_data EINA_UNUSED) 846 XPointer call_data EINA_UNUSED)
845{ 847{
846 EINA_LOG_DBG("in"); 848 EINA_LOG_DBG("in");
847 Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)client_data; 849 Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)client_data;
@@ -858,9 +860,9 @@ preedit_start_callback(XIC xic EINA_UNUSED,
858} 860}
859 861
860static void 862static void
861preedit_done_callback(XIC xic EINA_UNUSED, 863_ecore_imf_xim_preedit_done_call(XIC xic EINA_UNUSED,
862 XPointer client_data, 864 XPointer client_data,
863 XPointer call_data EINA_UNUSED) 865 XPointer call_data EINA_UNUSED)
864{ 866{
865 EINA_LOG_DBG("in"); 867 EINA_LOG_DBG("in");
866 Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)client_data; 868 Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)client_data;
@@ -886,9 +888,9 @@ preedit_done_callback(XIC xic EINA_UNUSED,
886 888
887/* FIXME */ 889/* FIXME */
888static int 890static int
889xim_text_to_utf8(Ecore_IMF_Context *ctx EINA_UNUSED, 891_ecore_imf_xim_text_to_utf8(Ecore_IMF_Context *ctx EINA_UNUSED,
890 XIMText *xim_text, 892 XIMText *xim_text,
891 char **text) 893 char **text)
892{ 894{
893 int text_length = 0; 895 int text_length = 0;
894 char *result = NULL; 896 char *result = NULL;
@@ -930,9 +932,9 @@ xim_text_to_utf8(Ecore_IMF_Context *ctx EINA_UNUSED,
930} 932}
931 933
932static void 934static void
933preedit_draw_callback(XIC xic EINA_UNUSED, 935_ecore_imf_xim_preedit_draw_call(XIC xic EINA_UNUSED,
934 XPointer client_data, 936 XPointer client_data,
935 XIMPreeditDrawCallbackStruct *call_data) 937 XIMPreeditDrawCallbackStruct *call_data)
936{ 938{
937 EINA_LOG_DBG("in"); 939 EINA_LOG_DBG("in");
938 Eina_Bool ret = EINA_FALSE; 940 Eina_Bool ret = EINA_FALSE;
@@ -954,7 +956,7 @@ preedit_draw_callback(XIC xic EINA_UNUSED,
954 if (ret == EINA_FALSE) goto done; 956 if (ret == EINA_FALSE) goto done;
955 } 957 }
956 958
957 new_text_length = xim_text_to_utf8(ctx, t, &tmp); 959 new_text_length = _ecore_imf_xim_text_to_utf8(ctx, t, &tmp);
958 if (tmp) 960 if (tmp)
959 { 961 {
960 int tmp_len; 962 int tmp_len;
@@ -1021,9 +1023,9 @@ done:
1021} 1023}
1022 1024
1023static void 1025static void
1024preedit_caret_callback(XIC xic EINA_UNUSED, 1026_ecore_imf_xim_preedit_caret_call(XIC xic EINA_UNUSED,
1025 XPointer client_data, 1027 XPointer client_data,
1026 XIMPreeditCaretCallbackStruct *call_data) 1028 XIMPreeditCaretCallbackStruct *call_data)
1027{ 1029{
1028 EINA_LOG_DBG("in"); 1030 EINA_LOG_DBG("in");
1029 Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)client_data; 1031 Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)client_data;
@@ -1044,22 +1046,22 @@ preedit_caret_callback(XIC xic EINA_UNUSED,
1044} 1046}
1045 1047
1046static XVaNestedList 1048static XVaNestedList
1047preedit_callback_set(Ecore_IMF_Context *ctx) 1049_ecore_imf_xim_preedit_callback_set(Ecore_IMF_Context *ctx)
1048{ 1050{
1049 Ecore_IMF_Context_Data *imf_context_data; 1051 Ecore_IMF_Context_Data *imf_context_data;
1050 imf_context_data = ecore_imf_context_data_get(ctx); 1052 imf_context_data = ecore_imf_context_data_get(ctx);
1051 1053
1052 imf_context_data->preedit_start_cb.client_data = (XPointer)ctx; 1054 imf_context_data->preedit_start_cb.client_data = (XPointer)ctx;
1053 imf_context_data->preedit_start_cb.callback = (XIMProc)preedit_start_callback; 1055 imf_context_data->preedit_start_cb.callback = (XIMProc)_ecore_imf_xim_preedit_start_call;
1054 1056
1055 imf_context_data->preedit_done_cb.client_data = (XPointer)ctx; 1057 imf_context_data->preedit_done_cb.client_data = (XPointer)ctx;
1056 imf_context_data->preedit_done_cb.callback = (XIMProc)preedit_done_callback; 1058 imf_context_data->preedit_done_cb.callback = (XIMProc)_ecore_imf_xim_preedit_done_call;
1057 1059
1058 imf_context_data->preedit_draw_cb.client_data = (XPointer)ctx; 1060 imf_context_data->preedit_draw_cb.client_data = (XPointer)ctx;
1059 imf_context_data->preedit_draw_cb.callback = (XIMProc)preedit_draw_callback; 1061 imf_context_data->preedit_draw_cb.callback = (XIMProc)_ecore_imf_xim_preedit_draw_call;
1060 1062
1061 imf_context_data->preedit_caret_cb.client_data = (XPointer)ctx; 1063 imf_context_data->preedit_caret_cb.client_data = (XPointer)ctx;
1062 imf_context_data->preedit_caret_cb.callback = (XIMProc)preedit_caret_callback; 1064 imf_context_data->preedit_caret_cb.callback = (XIMProc)_ecore_imf_xim_preedit_caret_call;
1063 1065
1064 return XVaCreateNestedList(0, 1066 return XVaCreateNestedList(0,
1065 XNPreeditStartCallback, 1067 XNPreeditStartCallback,
@@ -1074,7 +1076,7 @@ preedit_callback_set(Ecore_IMF_Context *ctx)
1074} 1076}
1075 1077
1076static XIC 1078static XIC
1077get_ic(Ecore_IMF_Context *ctx) 1079_ecore_imf_xim_ic_get(Ecore_IMF_Context *ctx)
1078{ 1080{
1079 Ecore_IMF_Context_Data *imf_context_data; 1081 Ecore_IMF_Context_Data *imf_context_data;
1080 XIC ic; 1082 XIC ic;
@@ -1156,7 +1158,7 @@ get_ic(Ecore_IMF_Context *ctx)
1156 { 1158 {
1157 im_style |= XIMPreeditCallbacks; 1159 im_style |= XIMPreeditCallbacks;
1158 im_style |= XIMStatusNothing; 1160 im_style |= XIMStatusNothing;
1159 preedit_attr = preedit_callback_set(ctx); 1161 preedit_attr = _ecore_imf_xim_preedit_callback_set(ctx);
1160 } 1162 }
1161 name = XNPreeditAttributes; 1163 name = XNPreeditAttributes;
1162 } 1164 }
@@ -1234,7 +1236,7 @@ get_ic(Ecore_IMF_Context *ctx)
1234} 1236}
1235 1237
1236static void 1238static void
1237reinitialize_ic(Ecore_IMF_Context *ctx) 1239_ecore_imf_xim_ic_reinitialize(Ecore_IMF_Context *ctx)
1238{ 1240{
1239 Ecore_IMF_Context_Data *imf_context_data = ecore_imf_context_data_get(ctx); 1241 Ecore_IMF_Context_Data *imf_context_data = ecore_imf_context_data_get(ctx);
1240 EINA_SAFETY_ON_NULL_RETURN(imf_context_data); 1242 EINA_SAFETY_ON_NULL_RETURN(imf_context_data);
@@ -1256,7 +1258,7 @@ reinitialize_ic(Ecore_IMF_Context *ctx)
1256} 1258}
1257 1259
1258static void 1260static void
1259set_ic_client_window(Ecore_IMF_Context *ctx, 1261_ecore_imf_xim_ic_client_window_set(Ecore_IMF_Context *ctx,
1260 Ecore_X_Window window) 1262 Ecore_X_Window window)
1261{ 1263{
1262 EINA_LOG_DBG("in"); 1264 EINA_LOG_DBG("in");
@@ -1266,7 +1268,7 @@ set_ic_client_window(Ecore_IMF_Context *ctx,
1266 EINA_SAFETY_ON_NULL_RETURN(imf_context_data); 1268 EINA_SAFETY_ON_NULL_RETURN(imf_context_data);
1267 1269
1268 /* reinitialize IC */ 1270 /* reinitialize IC */
1269 reinitialize_ic(ctx); 1271 _ecore_imf_xim_ic_reinitialize(ctx);
1270 1272
1271 old_win = imf_context_data->win; 1273 old_win = imf_context_data->win;
1272 EINA_LOG_DBG("old_win:%d window:%d ", old_win, window); 1274 EINA_LOG_DBG("old_win:%d window:%d ", old_win, window);
@@ -1285,7 +1287,7 @@ set_ic_client_window(Ecore_IMF_Context *ctx,
1285 if (window) /* XXX */ 1287 if (window) /* XXX */
1286 { 1288 {
1287 XIM_Im_Info *info = NULL; 1289 XIM_Im_Info *info = NULL;
1288 info = get_im(window, imf_context_data->locale); 1290 info = _ecore_imf_xim_im_get(window, imf_context_data->locale);
1289 imf_context_data->im_info = info; 1291 imf_context_data->im_info = info;
1290 imf_context_data->im_info->ics = 1292 imf_context_data->im_info->ics =
1291 eina_list_prepend(imf_context_data->im_info->ics, 1293 eina_list_prepend(imf_context_data->im_info->ics,
@@ -1296,8 +1298,8 @@ set_ic_client_window(Ecore_IMF_Context *ctx,
1296} 1298}
1297 1299
1298static XIM_Im_Info * 1300static XIM_Im_Info *
1299get_im(Ecore_X_Window window, 1301_ecore_imf_xim_im_get(Ecore_X_Window window,
1300 char *locale) 1302 char *locale)
1301{ 1303{
1302 EINA_LOG_DBG("in"); 1304 EINA_LOG_DBG("in");
1303 1305
@@ -1330,13 +1332,13 @@ get_im(Ecore_X_Window window,
1330 info->reconnecting = EINA_FALSE; 1332 info->reconnecting = EINA_FALSE;
1331 } 1333 }
1332 1334
1333 xim_info_try_im(info); 1335 _ecore_imf_xim_info_im_init(info);
1334 return info; 1336 return info;
1335} 1337}
1336 1338
1337/* initialize info->im */ 1339/* initialize info->im */
1338static void 1340static void
1339xim_info_try_im(XIM_Im_Info *info) 1341_ecore_imf_xim_info_im_init(XIM_Im_Info *info)
1340{ 1342{
1341 Ecore_X_Display *dsp; 1343 Ecore_X_Display *dsp;
1342 1344
@@ -1354,19 +1356,19 @@ xim_info_try_im(XIM_Im_Info *info)
1354 { 1356 {
1355 XRegisterIMInstantiateCallback(dsp, 1357 XRegisterIMInstantiateCallback(dsp,
1356 NULL, NULL, NULL, 1358 NULL, NULL, NULL,
1357 xim_instantiate_callback, 1359 _ecore_imf_xim_instantiate_cb,
1358 (XPointer)info); 1360 (XPointer)info);
1359 info->reconnecting = EINA_TRUE; 1361 info->reconnecting = EINA_TRUE;
1360 return; 1362 return;
1361 } 1363 }
1362 setup_im(info); 1364 _ecore_imf_xim_im_setup(info);
1363 } 1365 }
1364} 1366}
1365 1367
1366static void 1368static void
1367xim_info_display_closed(Ecore_X_Display *display EINA_UNUSED, 1369_ecore_imf_xim_info_im_shutdown(Ecore_X_Display *display EINA_UNUSED,
1368 int is_error EINA_UNUSED, 1370 int is_error EINA_UNUSED,
1369 XIM_Im_Info *info) 1371 XIM_Im_Info *info)
1370{ 1372{
1371 Eina_List *ics, *tmp_list; 1373 Eina_List *ics, *tmp_list;
1372 Ecore_IMF_Context *ctx; 1374 Ecore_IMF_Context *ctx;
@@ -1377,13 +1379,13 @@ xim_info_display_closed(Ecore_X_Display *display EINA_UNUSED,
1377 info->ics = NULL; 1379 info->ics = NULL;
1378 1380
1379 EINA_LIST_FOREACH (ics, tmp_list, ctx) 1381 EINA_LIST_FOREACH (ics, tmp_list, ctx)
1380 set_ic_client_window(ctx, 0); 1382 _ecore_imf_xim_ic_client_window_set(ctx, 0);
1381 1383
1382 EINA_LIST_FREE (ics, ctx) 1384 EINA_LIST_FREE (ics, ctx)
1383 { 1385 {
1384 Ecore_IMF_Context_Data *imf_context_data; 1386 Ecore_IMF_Context_Data *imf_context_data;
1385 imf_context_data = ecore_imf_context_data_get(ctx); 1387 imf_context_data = ecore_imf_context_data_get(ctx);
1386 imf_context_data_destroy(imf_context_data); 1388 _ecore_imf_xim_context_data_destroy(imf_context_data);
1387 } 1389 }
1388 1390
1389 free(info->locale); 1391 free(info->locale);
@@ -1395,9 +1397,9 @@ xim_info_display_closed(Ecore_X_Display *display EINA_UNUSED,
1395} 1397}
1396 1398
1397static void 1399static void
1398xim_instantiate_callback(Display *display, 1400_ecore_imf_xim_instantiate_cb(Display *display,
1399 XPointer client_data, 1401 XPointer client_data,
1400 XPointer call_data EINA_UNUSED) 1402 XPointer call_data EINA_UNUSED)
1401{ 1403{
1402 XIM_Im_Info *info = (XIM_Im_Info *)client_data; 1404 XIM_Im_Info *info = (XIM_Im_Info *)client_data;
1403 XIM im = NULL; 1405 XIM im = NULL;
@@ -1411,16 +1413,16 @@ xim_instantiate_callback(Display *display,
1411 } 1413 }
1412 1414
1413 info->im = im; 1415 info->im = im;
1414 setup_im(info); 1416 _ecore_imf_xim_im_setup(info);
1415 1417
1416 XUnregisterIMInstantiateCallback(display, NULL, NULL, NULL, 1418 XUnregisterIMInstantiateCallback(display, NULL, NULL, NULL,
1417 xim_instantiate_callback, 1419 _ecore_imf_xim_instantiate_cb,
1418 (XPointer)info); 1420 (XPointer)info);
1419 info->reconnecting = EINA_FALSE; 1421 info->reconnecting = EINA_FALSE;
1420} 1422}
1421 1423
1422static void 1424static void
1423setup_im(XIM_Im_Info *info) 1425_ecore_imf_xim_im_setup(XIM_Im_Info *info)
1424{ 1426{
1425 XIMValuesList *ic_values = NULL; 1427 XIMValuesList *ic_values = NULL;
1426 XIMCallback im_destroy_callback; 1428 XIMCallback im_destroy_callback;
@@ -1429,7 +1431,7 @@ setup_im(XIM_Im_Info *info)
1429 return; 1431 return;
1430 1432
1431 im_destroy_callback.client_data = (XPointer)info; 1433 im_destroy_callback.client_data = (XPointer)info;
1432 im_destroy_callback.callback = (XIMProc)xim_destroy_callback; 1434 im_destroy_callback.callback = (XIMProc)_ecore_imf_xim_destroy_cb;
1433 XSetIMValues(info->im, 1435 XSetIMValues(info->im,
1434 XNDestroyCallback, &im_destroy_callback, 1436 XNDestroyCallback, &im_destroy_callback,
1435 NULL); 1437 NULL);
@@ -1465,16 +1467,16 @@ setup_im(XIM_Im_Info *info)
1465} 1467}
1466 1468
1467static void 1469static void
1468xim_destroy_callback(XIM xim EINA_UNUSED, 1470_ecore_imf_xim_destroy_cb(XIM xim EINA_UNUSED,
1469 XPointer client_data, 1471 XPointer client_data,
1470 XPointer call_data EINA_UNUSED) 1472 XPointer call_data EINA_UNUSED)
1471{ 1473{
1472 XIM_Im_Info *info = (XIM_Im_Info *)client_data; 1474 XIM_Im_Info *info = (XIM_Im_Info *)client_data;
1473 1475
1474 if (info->user) info->user->ic = NULL; 1476 if (info->user) info->user->ic = NULL;
1475 info->im = NULL; 1477 info->im = NULL;
1476// reinitialize_ic(ctx); 1478// _ecore_imf_xim_ic_reinitialize(ctx);
1477 xim_info_try_im(info); 1479 _ecore_imf_xim_info_im_init(info);
1478 1480
1479 return; 1481 return;
1480} 1482}