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[]) { 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; }
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; }
const char * init(const char *args) { if (uim_init() != 0) return "uim_init() failed"; /* according to uim.c, this never happen. */ return NULL; }
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 uim_counted_init() { uim_init_count++; if (uim_init_count != 1) return 0; return uim_init(); }
void uimled_uim_init(void) { uim_init(); pthread_mutex_init(&uimled_uim_text_mut, NULL); pthread_cond_init(&uimled_uim_text_cond, NULL); uimled_uim_connect(); }
UimApplet::UimApplet(const QString& configFile, Type type, int actions, QWidget *parent, const char *name) : KPanelApplet(configFile, type, actions, parent, name) { uim_init(); setBackgroundMode(QWidget::X11ParentRelative); toolbar = new UimToolbar(this); toolbar->resize(QSize(toolbar->preferedWidthForHeight(), size().height())); toolbar->show(); QObject::connect( toolbar, SIGNAL( toolbarResized() ), this, SLOT( slotToolbarResized() ) ); setCustomMenu(toolbar->contextMenu()); }
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; }
UimImSwitcher::UimImSwitcher( QWidget *parent ) : QDialog( parent ) { /* connect to uim helper message bus */ uim_fd = -1; checkHelperConnection(); /* to check if another uim-im-switcher exists */ uim_helper_send_message( uim_fd, "im_switcher_start\n" ); /* to load input method list */ uim_helper_send_message( uim_fd, "im_list_get\n" ); uim_init(); customEnabled = uim_custom_enable(); /* create GUI */ createGUI(); }
Window::Window(int argc, char *argv[]) { uim_init(); if (argc > 1) { // vertical if (!strcmp(argv[1], "-v")) { widget = new CandidateWindow(0, true); // horizontal } else if (!strcmp(argv[1], "-h")) { widget = new CandidateWindow(0, false); // table } else if (!strcmp(argv[1], "-t")) { widget = new CandidateTableWindow(0); } else { widget = new XimCandidateWindow; } } else { widget = new XimCandidateWindow; } }
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; }
static void init_agent() { uim_context uc; int i, nr; if (uim_init() == -1) { printf("failed to init\n"); exit(EXIT_FAILURE); } /**/ uc =uim_create_context(&default_context, "EUC-JP", NULL, NULL, uim_iconv, commit_cb); nr = uim_get_nr_im(uc); for (i = 0; i < nr; i++) { printf("%s\n", uim_get_im_name(uc, i)); } uim_set_preedit_cb(uc, clear_cb, pushback_cb, update_cb); default_context.uc = uc; default_context.next = NULL; }
static gboolean uim_applet_new(PanelApplet *applet, const gchar *iid, gpointer data) { GtkWidget *toolbar; uimapplet = applet; if (strcmp(iid, "OAFIID:GNOME_UimApplet") != 0) return FALSE; uim_init(); toolbar = (GtkWidget*)uim_toolbar_applet_new(); gtk_container_add(GTK_CONTAINER(applet), toolbar); gtk_widget_show_all(GTK_WIDGET(applet)); panel_applet_setup_menu(applet, uim_menu_xml, uim_menu_verbs, toolbar); #if LIBPANEL_APPLET_HAVE_SET_BACKGROUND_WIDGET panel_applet_set_background_widget(applet, GTK_WIDGET(applet)); #endif return TRUE; }
static void get_uim_info() { int res; res = uim_init(); if (res) { printf("Failed to init uim\n"); exit(1); } uim_context uc = uim_create_context(NULL, "UTF-8", NULL, NULL, uim_iconv, NULL); struct UIMInfo ui; int nr = uim_get_nr_im(uc); for (int i = 0; i < nr; i++) { ui.name = strdup(uim_get_im_name(uc, i)); ui.lang = strdup(uim_get_im_language(uc, i)); ui.desc = strdup(uim_get_im_short_desc(uc, i)); uim_info.push_back(ui); } uim_release_context(uc); }
UimStandaloneToolbar::UimStandaloneToolbar( QWidget *parent, const char *name ) : QHBox( parent, name, Qt::WStyle_NoBorder | Qt::WX11BypassWM ) { uim_init(); adjustSize(); UimToolbarDraggingHandler *h = new UimToolbarDraggingHandler( this ); h->adjustSize(); h->show(); QObject::connect( h, SIGNAL( handleDoubleClicked() ), this, SLOT( slotToolbarDoubleClicked() ) ); toolbar = new QUimHelperToolbar( this ); toolbar->adjustSize(); toolbar->show(); QObject::connect( toolbar, SIGNAL( toolbarResized() ), this, SLOT( slotToolbarResized() ) ); toolbar->setMargin(TOOLBAR_MARGIN_SIZE); // Move int panelHeight = 64; // FIXME! int screenwidth = QApplication::desktop() ->screenGeometry().width(); int screenheight = QApplication::desktop() ->screenGeometry().height(); QPoint p( screenwidth - width() - panelHeight, screenheight - height() - panelHeight ); move( p ); // Enable Dragging Feature QObject::connect( h, SIGNAL( moveTo( const QPoint & ) ), this, SLOT( move( const QPoint & ) ) ); // Quit QObject::connect( toolbar, SIGNAL( quitToolbar() ), qApp, SLOT( quit() ) ); show(); }
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; }
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; }
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; }