static void fcitx_im_context_init(FcitxIMContext *context) { FcitxLog(LOG_LEVEL, "fcitx_im_context_init"); context->client = NULL; context->area.x = -1; context->area.y = -1; context->area.width = 0; context->area.height = 0; context->use_preedit = TRUE; context->cursor_pos = 0; context->preedit_string = NULL; context->time = CLUTTER_CURRENT_TIME; context->client = FcitxIMClientOpen(_fcitx_im_context_connect_cb, _fcitx_im_context_destroy_cb, G_OBJECT(context)); }
int main() { if (get_im_socket() == -1) return 1; GIOChannel *iochannel_fbterm = g_io_channel_unix_new(get_im_socket()); g_io_add_watch(iochannel_fbterm, (GIOCondition)(G_IO_IN | G_IO_HUP | G_IO_ERR), (GIOFunc)iochannel_fbterm_callback, NULL); g_type_init(); client = FcitxIMClientOpen(_fcitx_fbterm_connect_cb, _fcitx_fbterm_destroy_cb, NULL); register_im_callbacks(cbs); connect_fbterm(1); main_loop = g_main_loop_new(NULL, FALSE); g_main_loop_run(main_loop); FcitxIMClientClose(client); g_io_channel_unref(iochannel_fbterm); g_main_loop_unref(main_loop); return 0; }