int main(int argc, char *argv[]) { setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); bind_textdomain_codeset(PACKAGE, "UTF-8"); gtk_init(&argc, &argv); if (uim_init() < 0) { fprintf(stderr, "uim_init() failed.\n"); return -1; } if (uim_custom_enable()) { GtkWidget *pref; im_uim_init_modifier_keys(); g_idle_add((GSourceFunc) check_dot_uim_file, NULL); pref = create_pref_window(); gtk_widget_show_all(pref); gtk_main(); } else { fprintf(stderr, "uim_custom_enable() failed.\n"); uim_quit(); return -1; } uim_quit(); return 0; }
int main(int argc, char *argv[]) { if (uim_init() < 0) { fprintf(stderr, "uim_init() failed.\n"); return -1; } if (uim_custom_enable()) { char **primary_groups, **grp; primary_groups = uim_custom_primary_groups(); for (grp = primary_groups; *grp; grp++) { dump_group(*grp); } uim_custom_symbol_list_free(primary_groups); } else { fprintf(stderr, "uim_custom_enable() failed.\n"); uim_quit(); return -1; } uim_quit(); return 0; }
int main(int argc, char *argv[]) { if (uim_init() < 0) { fprintf(stderr, "uim_init() failed.\n"); return -1; } if (uim_custom_enable()) { /* save custom variables into ~/.uim.d/customs/custom-*.scm */ uim_custom_save(); /* broadcast updated custom variables to every uim client processes via uim-helper-server */ } else { fprintf(stderr, "uim_custom_enable() failed.\n"); uim_quit(); return -1; } uim_quit(); return 0; }
int main(int argc, char *argv[]) { if (uim_init() < 0) { fprintf(stderr, "uim_init() failed.\n"); return -1; } if (uim_custom_enable()) { uim_bool succeeded; struct uim_custom *custom; custom = uim_custom_get("anthy-candidate-op-count"); if (custom) { inspect_custom(custom); printf("\ntrying that modify the custom value to 100\n"); custom->value->as_int = 100; /* out of range */ succeeded = uim_custom_set(custom); printf("succeeded = %s\n", succeeded ? "true" : "false"); printf("\ncurrent status of struct uim_custom *custom\n"); inspect_custom(custom); /* shows 100 as value */ uim_custom_free(custom); printf("\ncurrent status of real custom value\n"); custom = uim_custom_get("anthy-candidate-op-count"); inspect_custom(custom); /* shows real value */ printf("\ntrying that modify the custom value to 5\n"); custom->value->as_int = 5; /* valid */ succeeded = uim_custom_set(custom); printf("succeeded = %s\n\n", succeeded ? "true" : "false"); inspect_custom(custom); uim_custom_free(custom); } uim_custom_save(); /* save updated custom value into ~/.uim.d/customs/ */ } else { fprintf(stderr, "uim_custom_enable() failed.\n"); uim_quit(); return -1; } uim_quit(); return 0; }
int main(int argc, char *argv[]) { GtkWidget *icon; EggTrayIcon *tray; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); bind_textdomain_codeset(PACKAGE, "UTF-8"); uim_init(); gtk_init(&argc, &argv); tray = egg_tray_icon_new("uim"); gtk_window_set_wmclass(GTK_WINDOW(tray), "ibus-ui-gtk", "ibus-ui-gtk"); icon = uim_toolbar_trayicon_new(); g_signal_connect(G_OBJECT(tray), "embedded", G_CALLBACK(embedded_cb), icon); gtk_container_add(GTK_CONTAINER(tray), icon); gtk_widget_show(GTK_WIDGET(tray)); gtk_main(); uim_quit(); return 0; }
int main(int argc, char *argv[]) { uim_lisp args, exit_status_; int exit_status; /* TODO: be able to suppress ordinary initialization process */ uim_init(); uim_scm_require_file("uim-sh.scm"); args = uim_scm_null(); exit_status_ = uim_scm_f(); uim_scm_gc_protect(&args); uim_scm_gc_protect(&exit_status_); args = uim_scm_array2list((void **)argv, argc, (uim_lisp (*)(void *))uim_scm_make_str); exit_status_ = uim_scm_callf("uim-sh", "o", args); exit_status = uim_scm_c_int(exit_status_); uim_quit(); return exit_status; }
void uim_counted_quit() { uim_init_count--; if (uim_init_count != 0) return; uim_quit(); }
void reload_uim(int reload_libuim) { if (reload_libuim) { fprintf(stderr, "\nReloading uim...\n\n"); terminate_canddisp_connection(); helper_disconnect_cb(); terminate_x_connection(); std::map<Window, XimServer *>::iterator it; std::list<InputContext *>::iterator it_c; for (it = XimServer::gServerMap.begin(); it != XimServer::gServerMap.end(); ++it) { XimServer *xs = it->second; for (it_c = xs->ic_list.begin(); it_c != xs->ic_list.end(); ++it_c) (*it_c)->clear(); } uim_quit(); } clear_uim_info(); get_uim_info(); //print_uim_info(); if (reload_libuim) { std::map<Window, XimServer *>::iterator it; std::list<InputContext *>::iterator it_c; for (it = XimServer::gServerMap.begin(); it != XimServer::gServerMap.end(); ++it) { XimServer *xs = it->second; for (it_c = xs->ic_list.begin(); it_c != xs->ic_list.end(); ++it_c) { const char *engine = (*it_c)->get_engine_name(); (*it_c)->createUimContext(engine); } } // make sure to use appropriate locale for the focused context InputContext *focusedContext = InputContext::focusedContext(); if (focusedContext) focusedContext->focusIn(); pretrans_setup(); } }
int main(int argc, char **argv) { struct agent_context *ac = &default_context; uim_init();uim_quit(); return 0; init_agent(); /**/ printf("Hello World.\n"); while (1) { char buf[32]; if (fgets(buf, 32, stdin) == NULL) { continue; } if (isalpha((unsigned char)buf[0])) { uim_press_key(ac->uc, buf[0], 0); } else { uim_press_key(ac->uc, UKey_Return, 0); } } return 0; }
int main(int argc, char *argv[]) { GIOChannel *channel; /* disable uim context in annotation window */ setenv("GTK_IM_MODULE", "gtk-im-context-simple", 1); gtk_init(&argc, &argv); if (uim_init() < 0) return 0; init_candidate_win(); channel = g_io_channel_unix_new(0); read_tag = g_io_add_watch(channel, G_IO_IN | G_IO_HUP | G_IO_ERR, read_cb, 0); g_io_channel_unref(channel); gtk_main(); uim_quit(); return 0; }
static void right_click_menu_quit_activated(GtkMenu *menu_item, gpointer data) { gtk_main_quit(); uim_quit(); }
int main(int argc, char *argv[]) { int opt; setlocale(LC_CTYPE, ""); 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"); while (1) { int cid, serial; char *p1, *p2, *c; char buf[2048], keyname[32]; uim_key ukey; fflush(stdout); if (fgets(buf, sizeof (buf), stdin) == NULL) { if (feof(stdin)) debug_printf(DEBUG_NOTE, "unexpected EOF\n"); else debug_printf(DEBUG_ERROR, "failed to read command: %s\n", strerror (errno)); goto QUIT; } p1 = buf; serial = -1; /* command format serial CID COMMAND OPTION key format serial CID [keyvector] */ if ((p2 = strchr(p1, ' ')) == NULL) { debug_printf(DEBUG_WARNING, "input error: space after 1st string\n"); goto ERROR; } /* 1st string must be digit */ *p2 = '\0'; serial = strtol(p1, &c, 10); if (c != p2) { debug_printf(DEBUG_WARNING, "input error: invalid serial %d\n", serial); goto ERROR; } p1 = p2 + 1; if ((p2 = strchr(p1, ' ')) == NULL) { debug_printf(DEBUG_WARNING, "input error: no space after 2nd string\n"); goto ERROR; } /* 2nd string must be digit */ *p2 = '\0'; cid = strtol(p1, &c, 10); if (c != p2) { debug_printf(DEBUG_WARNING, "invalid cid %d\n", cid); goto ERROR; } /* 3rd string */ p1 = p2 + 1; if (*p1 == '[') { /* keyvector if 3rd string starts with [ */ if ((p2 = strchr(p1, ']')) == NULL) { /* no corresponding ] */ debug_printf(DEBUG_WARNING, "']' not found\n"); goto ERROR; } p2 ++; if (*p2 == ']') p2 ++; /* for [X-]] */ *p2 = '\0'; /* replace character after ] with \0 */ ukey.mod = 0; ukey.key = -1; keyname[0] = '\0'; if (analyze_keyvector(p1, &ukey, keyname, sizeof(keyname)) > 0) { a_printf("( %d %d ", serial, cid); if (process_keyvector(serial, cid, ukey, keyname) < 0) a_printf(" ( f ) "); else a_printf(" ( a ) "); a_printf(" )\n"); fflush(stdout); continue; } goto ERROR; } else if (*p1 >= 'A' && *p1 <= 'Z') { /* command */ if (strncmp(p1, "QUIT", 4) == 0) goto QUIT; a_printf("( %d %d ", serial, cid); if (process_command(serial, cid, p1) < 0) { debug_printf(DEBUG_WARNING, "command error\n"); a_printf(" ( f ) "); /* command error */ } else { a_printf(" ( a ) "); /* command ok */ } a_printf(" )\n"); fflush(stdout); continue; } debug_printf(DEBUG_WARNING, "invalid input\n"); ERROR: a_printf("( %d 0 ( x ) )\n", serial); fflush(stdout); } QUIT: uim_quit(); return 0; }
void cleanup(void) { uim_quit(); }
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; }
const char * uninit(const char *args) { uim_quit(); return NULL; }
Window::~Window() { delete widget; uim_quit(); }
void uim_force_quit_regardless_of_count() { uim_init_count = 0; uim_quit(); }
UimStandaloneToolbar::~UimStandaloneToolbar() { uim_quit(); }