Esempio n. 1
0
static int
process_command()
{
  char *p;
  char *cmd;
  unsigned rest;

  debug_printf(DEBUG_NOTE, "process command\n");
  
  /* cmd always terminates with \n */

  p = strchr(cmdbuf, '\n');
  *p = '\0';

  /* send command to helper-server */
  cmd = helper_message_decode(cmdbuf);
  uim_helper_send_message(helper_fd, cmd);

  if (strcmp(cmd, "focus_in\n") == 0)
	focused = 1;

  free(cmd);

  rest = strlen(p + 1);

  if (rest > 0)
	memmove(cmdbuf, p + 1, rest);
  else
	cmdbuf[0] = '\0';

  return 1;
}
Esempio n. 2
0
File: qt4.cpp Progetto: DirtYiCE/uim
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();
}
Esempio n. 3
0
void InputContext::switch_system_global_im(const char *name)
{
    char *msg;
    std::map<Window, XimServer *>::iterator it;

    for (it = XimServer::gServerMap.begin(); it != XimServer::gServerMap.end(); ++it)
	(*it).second->changeContext(name);

    if (asprintf(&msg, "im_change_whole_desktop\n%s\n", name) == -1) {
        free(msg);
        return;
    }
    uim_helper_send_message(lib_uim_fd, msg);
    free(msg);
}
Esempio n. 4
0
static void
prop_menu_activate(GtkMenu *menu_item, gpointer data)
{
    GString *msg;
    const gchar *str;

    str = g_object_get_data(G_OBJECT(menu_item), "prop_action");
    msg = g_string_new(str);
    g_string_prepend(msg, "prop_activate\n");
    g_string_append(msg, "\n");
    uim_helper_send_message(uim_fd, msg->str);
    if (is_msg_imsw(str) && is_imsw_coverage_system_global()) {
        const char *im = get_imsw_im(str);
        save_default_im(im);
    }

    g_string_free(msg, TRUE);
}
Esempio n. 5
0
void InputContext::update_prop_list(const char *str)
{
    char *buf;

    if (asprintf(&buf, "prop_list_update\ncharset=UTF-8\n%s", str) == -1) {
        free(buf);
        return;
    }
    uim_helper_send_message(lib_uim_fd, buf);
    free(buf);

#if 1
    // Show caret state indicator with this function instead of
    // InputContext::update_prop_label() to workaround the label
    // mismatch during IM switch caused from context-update-widgets.
    uim_bool show_caret_state =
	uim_scm_symbol_value_bool("bridge-show-input-state?");
    char *show_caret_with =
	uim_scm_c_symbol(uim_scm_symbol_value("bridge-show-with?"));
    uim_bool show_caret_mode = (strcmp(show_caret_with, "mode") == 0);
    uim_bool show_caret_mode_on = uim_scm_symbol_value_bool("bridge-show-input-state-mode-on?");

    if (show_caret_state == UIM_TRUE && !(show_caret_mode && !show_caret_mode_on)) {
	char *label;
	int timeout;
	Canddisp *disp = canddisp_singleton();

	if (strcmp(show_caret_with, "time") == 0)
	    timeout = static_cast<int>(uim_scm_symbol_value_int(
				    "bridge-show-input-state-time-length"));
	else
	    timeout = 0;

	label = get_caret_state_label_from_prop_list(str);
	disp->show_caret_state(label, timeout);
	free(label);
	mCaretStateShown = true;
    } else if (show_caret_mode && !show_caret_mode_on) {
	Canddisp *disp = canddisp_singleton();
	disp->hide_caret_state();
    }
    free(show_caret_with);
#endif
}
Esempio n. 6
0
void InputContext::update_prop_label(const char *str)
{
    char *buf;

    if (asprintf(&buf, "prop_label_update\ncharset=UTF-8\n%s", str) == -1) {
        free(buf);
        return;
    }
    uim_helper_send_message(lib_uim_fd, buf);
    free(buf);
#if 0    
    uim_bool show_caret_state = uim_scm_symbol_value_bool("bridge-show-input-state?");
    if (show_caret_state == UIM_TRUE) {
	int timeout = uim_scm_symbol_value_int("bridge-show-input-state-time-length");
	Canddisp *disp = canddisp_singleton();
	disp->show_caret_state(str, timeout);
	mCaretStateShown = true;
    }
#endif
}
Esempio n. 7
0
void
uim_toolbar_get_im_list(void)
{
    uim_helper_send_message(uim_fd, "im_list_get\n");
}
Esempio n. 8
0
void KUimCharDict::slotCharSelected( const QString &c )
{
    m_charLineEdit->setText( m_charLineEdit->text() + c );
    uim_helper_send_message( uim_fd,
        ( "commit_string\n" + c + '\n' ).toUtf8().data() );
}
Esempio n. 9
0
void
uim_helper_client_get_prop_list(void)
{
  uim_helper_send_message(uim_fd, "prop_list_get\n");
}
Esempio n. 10
0
void
uim_helper_client_focus_out(uim_context uc)
{
  if (uc)
    uim_helper_send_message(uc->uim_fd != -1 ? uc->uim_fd : uim_fd, "focus_out\n");
}
Esempio n. 11
0
File: uim.c Progetto: qsniyg/uim-led
void uimled_uim_proplist(void)
{
  uim_helper_send_message(uimled_uim_fd, "prop_list_get\n");
}