void InputContext::focusIn() { setlocale(LC_CTYPE, mLocaleName); check_helper_connection(); uim_helper_client_focus_in(mUc); mFocusedContext = this; if (mConvdisp) { mConvdisp->unset_focus(); mConvdisp->move_candwin(); mConvdisp->update_caret_state(); } uim_prop_list_update(mUc); uim_prop_label_update(mUc); if (hasActiveCandwin()) candidate_update(); uim_focus_in_context(mUc); }
int main(int argc, char **argv) { const char *locale; printf("uim <-> XIM bridge. Supporting multiple locales.\n"); get_runtime_env(); parse_args(argc, argv); if (g_option_mask & OPT_ON_DEMAND_SYNC) printf("Using on-demand-synchronous XIM event flow (not safe for Tcl/TK)\n"); else printf("Using full-synchronous XIM event flow\n"); signal(SIGPIPE, SIG_IGN); signal(SIGUSR1, reload_uim); check_helper_connection(); XimServer::gDpy = XOpenDisplay(NULL); if (!XimServer::gDpy) { printf("failed to open display!\n"); return 1; } if (!pretrans_register()) { printf("pretrans_register failed\n"); return 1; } get_uim_info(); print_uim_info(); locale = setlocale(LC_CTYPE, ""); if (!locale) locale = setlocale(LC_CTYPE, "C"); check_default_engine(locale); init_supported_locales(); init_modifier_keys(); std::list<UIMInfo>::iterator it; bool res = false; // First, setup conversion engine selected by cmdline option or // "default-im-name" on ~/.uim. for (it = uim_info.begin(); it != uim_info.end(); ++it) { if (strcmp(it->name, default_engine) == 0) { XimServer *xs = new XimServer(it->name, it->lang); res = xs->setupConnection(true); if (res) printf("XMODIFIERS=@im=uim registered, selecting %s (%s) as default conversion engine\n", it->name, it->lang); else delete xs; break; } } if (!res) { printf("aborting...\n"); return 1; } connection_setup(); error_handler_setup(); if (pretrans_setup() == -1) return 0; #if HAVE_XFT_UTF8_STRING if (uim_scm_symbol_value_bool("uim-xim-use-xft-font?")) init_default_xftfont(); // setup Xft fonts for Ov/Rw preedit #endif check_candwin_style(); check_candwin_pos_type(); // Handle pending events to prevent hang just after startup check_pending_xevent(); main_loop(); return 0; }
int main(int argc, char *argv[]) { int opt; while ((opt = getopt(argc, argv, "d")) != -1) { switch (opt) { case 'd': debug_level ++; break; } } if (debug_level == 0) fclose(stderr); if (uim_init() < 0) { debug_printf(DEBUG_ERROR, "uim_init failed\n"); return -1; } atexit(cleanup); a_printf("OK\n"); cmdbuf_len = DEFAULT_MESSAGE_SIZE; cmdbuf = uim_malloc(cmdbuf_len); cmdbuf[0] = '\0'; while (1) { char *msg; fd_set rfds; check_helper_connection(); wait_data_arrival(&rfds); debug_printf(DEBUG_NOTE, "data arrive\n"); if (FD_ISSET(STDIN_FILENO, &rfds)) { if (!read_command()) goto QUIT; } if (FD_ISSET(helper_fd, &rfds)) { /* read message from helper */ uim_helper_read_proc(helper_fd); } while (command_exists_in_cmdbuf()) process_command(); while ((msg = uim_helper_get_message())) { process_message(msg); } fflush(NULL); } QUIT: uim_quit(); return 0; }