void XimServer::reloadConfigs() { #if 1 uim_prop_reload_configs(); reload_uim(0); #else reload_uim(1); #endif // Updated global IM of XimServer char *im = uim_scm_symbol_value_str("default-im-name"); if (im) set_im(im); free(im); #if HAVE_XFT_UTF8_STRING update_default_xftfont(); #endif if (!uim_scm_symbol_value_bool("bridge-show-input-state?")) { Canddisp *disp = canddisp_singleton(); disp->hide_caret_state(); } check_candwin_style(); check_candwin_pos_type(); }
void XimServer::customContext(const char *custom, const char *val) { std::list<InputContext *>::iterator it; for (it = ic_list.begin(); it != ic_list.end(); ++it) { (*it)->customContext(custom, val); break; } // Updated global IM of XimServer if (!strcmp(custom, "custom-preserved-default-im-name") && uim_scm_symbol_value_bool("custom-activate-default-im-name?")) set_im(++val); #if HAVE_XFT_UTF8_STRING if (!strcmp(custom, "uim-xim-xft-font-name")) update_default_xftfont(); #endif if (!strcmp(custom, "bridge-show-input-state?") && !uim_scm_symbol_value_bool("bridge-show-input-state?")) { Canddisp *disp = canddisp_singleton(); disp->hide_caret_state(); } if (!strcmp(custom, "candidate-window-position")) check_candwin_pos_type(); if (!strcmp(custom, "candidate-window-style")) check_candwin_style(); }
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; }