// -v -> vertical
// -h -> horizontal
// -t -> table
QString CandidateWindowProxy::candidateWindowStyle()
{
    QString windowStyle;
    // uim-candwin-prog is deprecated
    char *candwinprog = uim_scm_symbol_value_str("uim-candwin-prog");
    if (candwinprog) {
        if (!strncmp(candwinprog, "uim-candwin-tbl", 15))
            windowStyle = "-t";
        else if (!strncmp(candwinprog, "uim-candwin-horizontal", 22))
            windowStyle = "-h";
    } else {
        char *style = uim_scm_symbol_value_str("candidate-window-style");
        if (style) {
            if (!strcmp(style, "table"))
                windowStyle = "-t";
            else if (!strcmp(style, "horizontal"))
                windowStyle = "-h";
        }
        free(style);
    }
    free(candwinprog);
    
    if (windowStyle.isEmpty())
        return "-v";
    return windowStyle;
}
Beispiel #2
0
Datei: curl.c Projekt: NgoHuy/uim
static CURLcode
uim_curl_perform(CURL *curl)
{
  uim_bool use_proxy;
  char *ua;
  char *referer;
  char *http_proxy;
  CURLcode res;

  ua = uim_scm_symbol_value_str("uim-curl-user-agent");
  referer = uim_scm_symbol_value_str("uim-curl-referer");
  use_proxy = uim_scm_symbol_value_bool("uim-curl-use-proxy?");
  http_proxy = uim_scm_symbol_value_str("uim-curl-http-proxy");

  curl_easy_setopt(curl, CURLOPT_USERAGENT,
		   (ua != NULL) ? ua : "libcurl-agent/1.0");
  curl_easy_setopt(curl, CURLOPT_REFERER,
		   (referer != NULL) ? referer : "");
  if (use_proxy) {
    curl_easy_setopt(curl, CURLOPT_PROXY,
		     (http_proxy != NULL) ? http_proxy : "");
  }

  res = curl_easy_perform(curl);

  free(ua);
  free(referer);
  free(http_proxy);

  return res;
}
Beispiel #3
0
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();
}
Beispiel #4
0
void QUimInputContext::readIMConf()
{
    char * leftp = uim_scm_symbol_value_str( "candidate-window-position" );
    if ( leftp && !strcmp( leftp, "left" ) )
        cwin->setAlwaysLeftPosition( true );
    else
        cwin->setAlwaysLeftPosition( false );
    free( leftp );
}
Beispiel #5
0
static const char *candwin_command(void)
{
    static char candwin_prog[MAXPATHLEN];
    const char *user_config;
    char *str, *style;

#ifdef NO_TOOLKIT
    return NULL;
#else
    /*
      Search order of candwin_command be summarized as follows
	 1. UIM_CANDWIN_PROG -- mainly for debugging purpose
	 2. value in 'uim-candwin-prog' symbol (deprecated)
	 3. default toolkit's candwin program determined by ./configure
	    and the style is selected from 'candidate-window-style' symbol
     */

    user_config = getenv("UIM_CANDWIN_PROG");
    str = user_config ?  strdup(user_config) :
	    uim_scm_symbol_value_str("uim-candwin-prog");

    if (str && *str) {
	snprintf(candwin_prog, MAXPATHLEN, UIM_LIBEXECDIR "/%s", str);
	free(str);

	return candwin_prog;
    }
    free(str);

#define TYPELEN	20
    style = uim_scm_symbol_value_str("candidate-window-style");
    char type[TYPELEN] = "";
    if (style) {
	if (!strcmp(style, "table"))
	    strlcpy(type, "-tbl", TYPELEN);
	else if (!strcmp(style, "horizontal"))
	    strlcpy(type, "-horizontal", TYPELEN);
    }
    snprintf(candwin_prog, MAXPATHLEN, "%s%s%s", CANDWIN_PROG_PREFIX, type, CANDWIN_PROG_SUFFIX);

    return candwin_prog;
#endif
}
Beispiel #6
0
static gboolean
is_imsw_coverage_system_global()
{
    char *coverage;
    gboolean ret;

    coverage = uim_scm_symbol_value_str("imsw-coverage");

    ret =  (gboolean)!strcmp(coverage, "system-global");
    free(coverage);

    return ret;
}
Beispiel #7
0
void
check_candwin_pos_type()
{
    char *candwin_pos_type = uim_scm_symbol_value_str("candidate-window-position");

    if (candwin_pos_type && !strcmp(candwin_pos_type, "left"))
	XimServer::gCandWinPosType = Left;
    else if (candwin_pos_type && !strcmp(candwin_pos_type, "right"))
	XimServer::gCandWinPosType = Right;
    else
	XimServer::gCandWinPosType = Caret;

    free(candwin_pos_type);
}
Beispiel #8
0
void
uim_cand_win_gtk_get_window_pos_type(UIMCandWinGtk *cwin)
{
    char *win_pos;

    win_pos = uim_scm_symbol_value_str("candidate-window-position");
    if (win_pos && !strcmp(win_pos, "left")) {
        cwin->position = UIM_CAND_WIN_POS_LEFT;
    } else if (win_pos && !strcmp(win_pos, "right")) {
        cwin->position = UIM_CAND_WIN_POS_RIGHT;
    } else {
        cwin->position = UIM_CAND_WIN_POS_CARET;
    }
    free(win_pos);
}
Beispiel #9
0
void
check_candwin_style()
{
    char *style = uim_scm_symbol_value_str("candidate-window-style");
    CandWinStyle PrevStyle = XimServer::gCandWinStyle;

    if (style && !strcmp(style, "table"))
	XimServer::gCandWinStyle = Table;
    else if (style && !strcmp(style, "horizontal"))
	XimServer::gCandWinStyle = Horizontal;
    else
	XimServer::gCandWinStyle = Vertical;

    XimServer::gCandWinStyleUpdated =
	    (PrevStyle != XimServer::gCandWinStyle) ? true : false;
    free(style);
}