• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ FcitxInstanceGetInputState函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中FcitxInstanceGetInputState函数的典型用法代码示例。如果您正苦于以下问题:C++ FcitxInstanceGetInputState函数的具体用法?C++ FcitxInstanceGetInputState怎么用?C++ FcitxInstanceGetInputState使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了FcitxInstanceGetInputState函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: LuaCallCommand

static void* LuaCallCommand(void* arg, FcitxModuleFunctionArg args) {
    LuaModule *luamodule = (LuaModule *)arg;
    UT_array *result = InputCommand(luamodule, (const char *)args.args[0]);
    if (result) {
        FcitxInputState* input = FcitxInstanceGetInputState(GetFcitx(luamodule));
        LuaResultItem *p = NULL;
        while ((p = (LuaResultItem *)utarray_next(result, p))) {
            FcitxCandidateWord candWord;
            if (args.args[1] && args.args[2]) {
                candWord.callback = args.args[1];
                candWord.owner = args.args[2];
            }
            else {
                candWord.callback = LuaGetCandWord;
                candWord.owner = luamodule;
            }
            candWord.priv = p->help ? strdup(p->help) : NULL;
            if (p->help || p->tip) {
                asprintf(&candWord.strExtra, "%s%s%s", p->help ? p->help : "", p->help && p->tip ? " " : "", p->tip ? p->tip : "");
            } else {
                candWord.strExtra = NULL;
            }
            candWord.strWord = strdup(p->result);
            candWord.wordType = MSG_TIPS;
            candWord.extraType = MSG_CODE;
            FcitxCandidateWordAppend(FcitxInputStateGetCandidateList(input), &candWord);
        }
        utarray_free(result);
    }
    return NULL;
}
开发者ID:mylxiaoyi,项目名称:fcitx,代码行数:31,代码来源:lua.c


示例2: CloudPinyinAddCandidateWord

void CloudPinyinAddCandidateWord(void* arg)
{
    FcitxCloudPinyin* cloudpinyin = (FcitxCloudPinyin*) arg;
    FcitxIM* im = FcitxInstanceGetCurrentIM(cloudpinyin->owner);
    FcitxInputState* input = FcitxInstanceGetInputState(cloudpinyin->owner);

    if (cloudpinyin->initialized == false)
        return;

    /* check whether the current im is pinyin */
    if (CHECK_VALID_IM)
    {
        /* there is something pending input */
        if (FcitxInputStateGetRawInputBufferSize(input) >= cloudpinyin->config.iMinimumPinyinLength)
        {
            char* strToFree = NULL, *inputString;
            strToFree = GetCurrentString(cloudpinyin);
            inputString = SplitHZAndPY(strToFree);

            if (inputString)
            {
                CloudPinyinCache* cacheEntry = CloudPinyinCacheLookup(cloudpinyin, inputString);
                FcitxLog(LOGLEVEL, "%s", inputString);
                if (cacheEntry == NULL)
                    CloudPinyinAddInputRequest(cloudpinyin, inputString);
                _CloudPinyinAddCandidateWord(cloudpinyin, inputString);
            }
            if (strToFree)
                free(strToFree);
        }
    }

    return;
}
开发者ID:pkg-ime,项目名称:fcitx-cloudpinyin,代码行数:34,代码来源:cloudpinyin.c


示例3: QuickPhraseDoInput

INPUT_RETURN_VALUE QuickPhraseDoInput(void* arg, FcitxKeySym sym, int state)
{
    QuickPhraseState *qpstate = (QuickPhraseState*) arg;
    FcitxInputState *input = FcitxInstanceGetInputState(qpstate->owner);
    FcitxGlobalConfig* fc = FcitxInstanceGetGlobalConfig(qpstate->owner);
    int retVal = IRV_TO_PROCESS;

    const FcitxHotkey* hkPrevPage = FcitxInstanceGetContextHotkey(qpstate->owner, CONTEXT_ALTERNATIVE_PREVPAGE_KEY);
    if (hkPrevPage == NULL)
        hkPrevPage = fc->hkPrevPage;

    const FcitxHotkey* hkNextPage = FcitxInstanceGetContextHotkey(qpstate->owner, CONTEXT_ALTERNATIVE_NEXTPAGE_KEY);
    if (hkNextPage == NULL)
        hkNextPage = fc->hkNextPage;

    if (FcitxHotkeyIsHotKey(sym, state, hkPrevPage)) {
        if (FcitxCandidateWordGoPrevPage(FcitxInputStateGetCandidateList(input)))
            retVal = IRV_DISPLAY_MESSAGE;
    } else if (FcitxHotkeyIsHotKey(sym, state, hkNextPage)) {
        if (FcitxCandidateWordGoNextPage(FcitxInputStateGetCandidateList(input)))
            retVal = IRV_DISPLAY_MESSAGE;
    } else if (FcitxHotkeyIsHotKeyDigit(sym, state)) {
        int iKey = FcitxHotkeyCheckChooseKey(sym, state, DIGIT_STR_CHOOSE);
        if (iKey >= 0)
            retVal = FcitxCandidateWordChooseByIndex(FcitxInputStateGetCandidateList(input), iKey);
    } else if (FcitxHotkeyIsHotKey(sym, state, FCITX_SPACE)) {
        if (FcitxCandidateWordPageCount(FcitxInputStateGetCandidateList(input)) != 0)
            retVal = FcitxCandidateWordChooseByIndex(FcitxInputStateGetCandidateList(input), 0);
    }

    return retVal;
}
开发者ID:niubenben,项目名称:fcitx,代码行数:32,代码来源:QuickPhrase.c


示例4: QWGetCandWords

INPUT_RETURN_VALUE QWGetCandWords(void *arg)
{
    FcitxQWState* qwstate = (FcitxQWState*) arg;
    FcitxInputState* input = FcitxInstanceGetInputState(qwstate->owner);
    int             iQu, iWei;
    int             i;

    FcitxCandidateWordSetPageSize(FcitxInputStateGetCandidateList(input), 10);
    FcitxCandidateWordSetChoose(FcitxInputStateGetCandidateList(input), DIGIT_STR_CHOOSE);
    if (FcitxInputStateGetRawInputBufferSize(input) == 3) {
        iQu = (FcitxInputStateGetRawInputBuffer(input)[0] - '0') * 10 + FcitxInputStateGetRawInputBuffer(input)[1] - '0';
        iWei = (FcitxInputStateGetRawInputBuffer(input)[2] - '0') * 10;

        for (i = 0; i < 10; i++) {
            FcitxCandidateWord candWord;
            candWord.callback = QWGetCandWord;
            candWord.owner = qwstate;
            candWord.priv = NULL;
            candWord.strExtra = NULL;
            candWord.strWord = strdup(GetQuWei(qwstate, iQu, iWei + i + 1));
            candWord.wordType = MSG_OTHER;
            FcitxCandidateWordAppend(FcitxInputStateGetCandidateList(input), &candWord);
        }
    }
    FcitxInputStateSetCursorPos(input, FcitxInputStateGetRawInputBufferSize(input));
    FcitxMessagesSetMessageCount(FcitxInputStateGetPreedit(input), 0);
    FcitxMessagesAddMessageAtLast(FcitxInputStateGetPreedit(input), MSG_INPUT, "%s", FcitxInputStateGetRawInputBuffer(input));

    return IRV_DISPLAY_CANDWORDS;
}
开发者ID:eguopt,项目名称:fcitx,代码行数:30,代码来源:qw.c


示例5: _CloudPinyinAddCandidateWord

void _CloudPinyinAddCandidateWord(FcitxCloudPinyin* cloudpinyin, const char* pinyin)
{
    CloudPinyinCache* cacheEntry = CloudPinyinCacheLookup(cloudpinyin, pinyin);
    FcitxInputState* input = FcitxInstanceGetInputState(cloudpinyin->owner);
    FcitxCandidateWordList* candList = FcitxInputStateGetCandidateList(input);

    int order = (cloudpinyin->config.iCandidateOrder <= 2) ?
        1 : (cloudpinyin->config.iCandidateOrder - 1);

    if (cacheEntry) {
        FcitxCandidateWord* cand;
        /* only check the first three page */
        int pagesize = FcitxCandidateWordGetPageSize(candList);
        int size = pagesize * CLOUDPINYIN_CHECK_PAGE_NUMBER;
        int i;
        if (cloudpinyin->config.iCandidateOrder <= 1) {
            order = 0;
        }
        for (i = 0;i < size &&
                 (cand = FcitxCandidateWordGetByTotalIndex(candList, i));i++) {
            if (strcmp(cand->strWord, cacheEntry->str) == 0) {
                if (i > order && i >= pagesize) {
                    FcitxCandidateWordMoveByWord(candList, cand, order);
                    if (order == 0) {
                        CloudSetClientPreedit(cloudpinyin, cacheEntry->str);
                    }
                }
                return;
            }
        }
        if (order == 0) {
            CloudSetClientPreedit(cloudpinyin, cacheEntry->str);
        }
    }

    FcitxCandidateWord candWord;
    CloudCandWord* cloudCand = fcitx_utils_malloc0(sizeof(CloudCandWord));
    if (cacheEntry) {
        cloudCand->filled = true;
        cloudCand->timestamp = 0;
        candWord.strWord = strdup(cacheEntry->str);
    } else {
        cloudCand->filled = false;
        cloudCand->timestamp = CloudGetTimeStamp();
        candWord.strWord = strdup("..");
    }

    candWord.callback = CloudPinyinGetCandWord;
    candWord.owner = cloudpinyin;
    candWord.priv = cloudCand;
    candWord.wordType = MSG_TIPS;
    if (cloudpinyin->config.bDontShowSource)
        candWord.strExtra = NULL;
    else {
        candWord.strExtra = strdup(_(" (via cloud)"));
        candWord.extraType = MSG_TIPS;
    }

    FcitxCandidateWordInsert(candList, &candWord, order);
}
开发者ID:fcitx,项目名称:fcitx-cloudpinyin,代码行数:60,代码来源:cloudpinyin.c


示例6: XimUpdatePreedit

void XimUpdatePreedit(void* arg, FcitxInputContext* ic)
{
    FcitxXimFrontend* xim = (FcitxXimFrontend*) arg;
    FcitxInputState* input = FcitxInstanceGetInputState(xim->owner);
    char* strPreedit = FcitxUIMessagesToCString(FcitxInputStateGetClientPreedit(input));
    char* str = FcitxInstanceProcessOutputFilter(xim->owner, strPreedit);
    if (str) {
        free(strPreedit);
        strPreedit = str;
    }

    if (strlen(strPreedit) == 0 && GetXimIC(ic)->bPreeditStarted == true) {
        XimPreeditCallbackDraw(xim, GetXimIC(ic), strPreedit, 0);
        XimPreeditCallbackDone(xim, GetXimIC(ic));
        GetXimIC(ic)->bPreeditStarted = false;
    }

    if (strlen(strPreedit) != 0 && GetXimIC(ic)->bPreeditStarted == false) {
        XimPreeditCallbackStart(xim, GetXimIC(ic));
        GetXimIC(ic)->bPreeditStarted = true;
    }
    if (strlen(strPreedit) != 0) {
        XimPreeditCallbackDraw(xim, GetXimIC(ic), strPreedit, FcitxInputStateGetClientCursorPos(input));
    }

    free(strPreedit);
}
开发者ID:adaptee,项目名称:fcitx,代码行数:27,代码来源:xim.c


示例7: IMSelectorPreFilter

boolean IMSelectorPreFilter(void* arg, FcitxKeySym sym, unsigned int state, INPUT_RETURN_VALUE* retval)
{
    IMSelector* imselector = arg;
    FcitxInstance* instance = imselector->owner;
    FcitxInputState *input = FcitxInstanceGetInputState(instance);
    FcitxGlobalConfig* fc = FcitxInstanceGetGlobalConfig(instance);
    if (!imselector->triggered)
        return false;
    FcitxCandidateWordList* candList = FcitxInputStateGetCandidateList(input);
    if (FcitxHotkeyIsHotKey(sym, state,
                            FcitxConfigPrevPageKey(instance, fc))) {
        FcitxCandidateWordGoPrevPage(candList);
        *retval = IRV_DISPLAY_MESSAGE;
    } else if (FcitxHotkeyIsHotKey(sym, state,
                                   FcitxConfigNextPageKey(instance, fc))) {
        FcitxCandidateWordGoNextPage(candList);
        *retval = IRV_DISPLAY_MESSAGE;
    } else if (FcitxHotkeyIsHotKey(sym, state, FCITX_SPACE)) {
        if (FcitxCandidateWordPageCount(candList) != 0)
            *retval = FcitxCandidateWordChooseByIndex(candList, 0);
    } else if (FcitxHotkeyIsHotKeyDigit(sym, state)) {
        int iKey = FcitxHotkeyCheckChooseKey(sym, state, DIGIT_STR_CHOOSE);
        if (iKey >= 0)
            *retval = FcitxCandidateWordChooseByIndex(candList, iKey);
    } else if (FcitxHotkeyIsHotKey(sym, state, FCITX_ESCAPE)) {
        *retval = IRV_CLEAN;
    }
    if (*retval == IRV_TO_PROCESS)
        *retval = IRV_DO_NOTHING;
    return true;
}
开发者ID:hiroshiyui,项目名称:fcitx,代码行数:31,代码来源:imselector.c


示例8: FcitxTabletGetCandWords

// This function is called from within fcitx. It is called when the
// list of input candidates has changed. It extracts the candidates
// from the recognition engine and puts them into the format required
// by fcitx for displaying in its popup window
INPUT_RETURN_VALUE FcitxTabletGetCandWords(void* arg) {
	FcitxTablet* tablet = (FcitxTablet*) arg;
	FcitxInputState *input = FcitxInstanceGetInputState(tablet->fcitx);
	FcitxInstanceCleanInputWindow(tablet->fcitx);
	char* c = tablet->engineInstance->GetCandidates(tablet->engineData);
	int len = strlen(c);
	int i = 0;
	do {
		int n = mblen(&c[i], len);
		if(n <= 0) break;
		FcitxCandidateWord cw;
		cw.callback = FcitxTabletGetCandWord;
		cw.strExtra = NULL;
		cw.priv = NULL;
		cw.owner = tablet;
		cw.wordType = MSG_OTHER;
		// TODO does fcitx free this?
		cw.strWord = (char*) malloc(n+1);
		memcpy(cw.strWord, &c[i], n);
		cw.strWord[n] = 0;
		FcitxCandidateWordAppend(FcitxInputStateGetCandidateList(input), &cw);
		i += n;
	} while(1);
	return IRV_DISPLAY_CANDWORDS;
}
开发者ID:kingctan,项目名称:fcitx-tablet,代码行数:29,代码来源:tablet.c


示例9: UnicodeGetCandWord

INPUT_RETURN_VALUE UnicodeGetCandWord(void* arg, FcitxCandidateWord* candWord)
{
    UnicodeModule* uni = arg;
    FcitxInputState *input = FcitxInstanceGetInputState(uni->owner);
    strcpy(FcitxInputStateGetOutputString(input), candWord->strWord);
    return IRV_COMMIT_STRING;
}
开发者ID:HenryHu,项目名称:fcitx,代码行数:7,代码来源:unicode.c


示例10: PostInputProcessAutoEng

boolean PostInputProcessAutoEng(void* arg, FcitxKeySym sym, unsigned int state, INPUT_RETURN_VALUE* retval)
{
    FcitxAutoEngState* autoEngState = (FcitxAutoEngState*) arg;
    FcitxInputState* input = FcitxInstanceGetInputState(autoEngState->owner);
    //boolean disableCheckUAZ = FcitxInstanceGetContextBoolean(autoEngState->owner, CONTEXT_DISABLE_AUTOENG);
    //if (disableCheckUAZ)
    //    return false;
    
    if (autoEngState->enable == false)
        return false;

	FcitxIM *im = FcitxInstanceGetCurrentIM(autoEngState->owner);
	if (im == NULL || strcmp("sogoupinyin", im->uniqueName) != 0)
		return false;

    if (FcitxHotkeyIsHotKeyUAZ(sym, state) &&
        (FcitxInputStateGetRawInputBufferSize(input) != 0 ||
         (FcitxInputStateGetKeyState(input) & FcitxKeyState_CapsLock) == 0) &&
        AutoEngCheckPreedit(autoEngState)) {
        AutoEngSetBuff(autoEngState, FcitxInputStateGetRawInputBuffer(input),
                       FcitxHotkeyPadToMain(sym));
        AutoEngActivate(autoEngState, input, retval);
        return true;
    }

    return false;
}
开发者ID:lenky0401,项目名称:fcitx-autoeng-ng,代码行数:27,代码来源:AutoEng.c


示例11: UnicodeGetCandWords

INPUT_RETURN_VALUE UnicodeGetCandWords(UnicodeModule* uni)
{
    FcitxInputState *input = FcitxInstanceGetInputState(uni->owner);
    FcitxInstanceCleanInputWindow(uni->owner);
    FcitxMessagesAddMessageStringsAtLast(FcitxInputStateGetPreedit(input),
                                         MSG_INPUT, uni->buffer);
    FcitxInputStateSetShowCursor(input, true);
    FcitxInputStateSetCursorPos(input, strlen(uni->buffer));

    FcitxCandidateWordList* candList = FcitxInputStateGetCandidateList(input);
    FcitxCandidateWordSetLayoutHint(candList, CLH_Vertical);

    UT_array* result = CharSelectDataFind(uni->charselectdata, uni->buffer);
    utarray_foreach(c, result, uint32_t) {
        char* s = fcitx_utils_malloc0(sizeof(char) * (UTF8_MAX_LENGTH + 1));
        fcitx_ucs4_to_utf8(*c, s);
        FcitxCandidateWord candWord;
        candWord.callback = UnicodeGetCandWord;
        candWord.owner = uni;
        candWord.priv = NULL;
        candWord.extraType = MSG_OTHER;
        candWord.wordType = MSG_CODE;
        candWord.strWord = s;
        char* name = CharSelectDataName(uni->charselectdata, *c);
        fcitx_utils_alloc_cat_str(candWord.strExtra, " ", name);
        free(name);
        FcitxCandidateWordAppend(candList, &candWord);
    }
开发者ID:HenryHu,项目名称:fcitx,代码行数:28,代码来源:unicode.c


示例12: QuickPhraseGetCandWord

INPUT_RETURN_VALUE QuickPhraseGetCandWord(void* arg, FcitxCandidateWord* candWord)
{
    QuickPhraseState *qpstate = (QuickPhraseState*) arg;
    QuickPhraseCand* qpcand = candWord->priv;
    FcitxInputState *input = FcitxInstanceGetInputState(qpstate->owner);
    strcpy(FcitxInputStateGetOutputString(input), qpcand->cand->strPhrase);
    return IRV_COMMIT_STRING;
}
开发者ID:niubenben,项目名称:fcitx,代码行数:8,代码来源:QuickPhrase.c


示例13: FcitxKkcDoInput

INPUT_RETURN_VALUE FcitxKkcDoInput(void* arg, FcitxKeySym _sym, unsigned int _state)
{
    FcitxKkc *kkc = (FcitxKkc*)arg;
    FcitxInputState* input = FcitxInstanceGetInputState(kkc->owner);
    FcitxKeySym sym = (FcitxKeySym) FcitxInputStateGetKeySym(input);
    uint32_t state = FcitxInputStateGetKeyState(input);
    return FcitxKkcDoInputReal(arg, sym, state);
}
开发者ID:fcitx,项目名称:fcitx-kkc,代码行数:8,代码来源:kkc.c


示例14: IMSelectorGetCands

void IMSelectorGetCands(IMSelector* imselector)
{
    FcitxInstance* instance = imselector->owner;
    FcitxInputState *input = FcitxInstanceGetInputState(instance);
    UT_array* imes = FcitxInstanceGetIMEs(instance);
    FcitxInstanceCleanInputWindow(instance);

    FcitxCandidateWordList* candList = FcitxInputStateGetCandidateList(input);
    FcitxCandidateWordSetPageSize(candList, 10);
    FcitxCandidateWordSetChoose(candList, DIGIT_STR_CHOOSE);
    FcitxInputStateSetShowCursor(input, false);
    FcitxCandidateWordSetOverrideDefaultHighlight(candList, false);
    FcitxCandidateWordSetLayoutHint(candList, CLH_Vertical);

    FcitxIM* im = FcitxInstanceGetCurrentIM(instance);
    FcitxInputContext* ic = FcitxInstanceGetCurrentIC(instance);
    FcitxInputContext2* ic2 = (FcitxInputContext2*) ic;
    if (!ic)
        return;

    FcitxMessages *aux_up = FcitxInputStateGetAuxUp(input);
    FcitxMessagesAddMessageStringsAtLast(aux_up, MSG_TIPS, imselector->global ?
                                         _("Select global input method: ") :
                                         _("Select local input method: "));
    if (ic2->imname) {
        int idx = FcitxInstanceGetIMIndexByName(instance, ic2->imname);
        FcitxIM *im = fcitx_array_eltptr(imes, idx);
        if (im) {
            FcitxMessagesAddMessageStringsAtLast(aux_up, MSG_TIPS,
                _("Current local input method is "), im->strName);
        }
    } else {
        FcitxMessagesAddMessageStringsAtLast(aux_up, MSG_TIPS,
                                             _("No local input method"));
    }

    utarray_foreach(pim, imes, FcitxIM) {
        FcitxCandidateWord candWord;
        candWord.callback = IMSelectorGetCand;
        candWord.owner = imselector;
        candWord.strExtra = NULL;
        if (ic2->imname && strcmp(ic2->imname, pim->uniqueName) == 0) {
            candWord.priv = NULL;
            candWord.strWord = strdup(_("Clear local input method"));
        }
        else {
            candWord.priv = strdup(pim->uniqueName);
            candWord.strWord = strdup(pim->strName);
        }

        if (im && strcmp(im->uniqueName, pim->uniqueName) == 0) {
            candWord.wordType = MSG_CANDIATE_CURSOR;
        } else {
            candWord.wordType = MSG_OTHER;
        }

        FcitxCandidateWordAppend(candList, &candWord);
    }
开发者ID:ezc,项目名称:fcitx,代码行数:58,代码来源:imselector.c


示例15: ShowQuickPhraseMessage

void ShowQuickPhraseMessage(QuickPhraseState *qpstate)
{
    FcitxInputState *input = FcitxInstanceGetInputState(qpstate->owner);
    FcitxInputStateSetCursorPos(input, strlen(FcitxInputStateGetRawInputBuffer(input)));
    FcitxInstanceCleanInputWindowUp(qpstate->owner);
    FcitxMessagesAddMessageAtLast(FcitxInputStateGetAuxUp(input), MSG_TIPS, "%s", _("Quick Phrase: "));
    FcitxMessagesAddMessageAtLast(FcitxInputStateGetPreedit(input), MSG_INPUT, "%s", FcitxInputStateGetRawInputBuffer(input));
    FcitxMessagesAddMessageAtLast(FcitxInputStateGetClientPreedit(input), MSG_INPUT, "%s", FcitxInputStateGetRawInputBuffer(input));
}
开发者ID:niubenben,项目名称:fcitx,代码行数:9,代码来源:QuickPhrase.c


示例16: QWGetCandWord

INPUT_RETURN_VALUE QWGetCandWord(void *arg, FcitxCandidateWord* candWord)
{
    FcitxQWState* qwstate = (FcitxQWState*) arg;
    FcitxInputState* input = FcitxInstanceGetInputState(qwstate->owner);

    strcpy(FcitxInputStateGetOutputString(input),
           candWord->strWord);
    return IRV_COMMIT_STRING;
}
开发者ID:eguopt,项目名称:fcitx,代码行数:9,代码来源:qw.c


示例17: FcitxChewingCreate

/**
 * @brief initialize the extra input method
 *
 * @param arg
 * @return successful or not
 **/
__EXPORT_API
void* FcitxChewingCreate(FcitxInstance* instance)
{
    if (GetFcitxChewingConfigDesc() == NULL)
        return NULL;
    
    char* user_path = NULL;
    FILE* fp = FcitxXDGGetFileUserWithPrefix("chewing", ".place_holder", "w", NULL);
    if (fp)
        fclose(fp);
    FcitxXDGGetFileUserWithPrefix("chewing", "", NULL, &user_path);
    FcitxLog(INFO, "Chewing storage path %s", user_path);
    if (0 == chewing_Init(CHEWING_DATADIR, user_path)) {
        FcitxLog(DEBUG, "chewing init ok");
    } else {
        FcitxLog(DEBUG, "chewing init failed");
        return NULL;
    }
    
    FcitxChewing* chewing = (FcitxChewing*) fcitx_utils_malloc0(sizeof(FcitxChewing));
    FcitxGlobalConfig* config = FcitxInstanceGetGlobalConfig(instance);
    FcitxInputState *input = FcitxInstanceGetInputState(instance);
    FcitxCandidateWordSetChoose(FcitxInputStateGetCandidateList(input), DIGIT_STR_CHOOSE);
    
    bindtextdomain("fcitx-chewing", LOCALEDIR);

    chewing->context = chewing_new();
    ChewingContext * c = chewing->context;
    chewing->owner = instance;
    chewing_set_ChiEngMode(c, CHINESE_MODE);
    chewing_set_maxChiSymbolLen(c, 16);
    // chewing will crash without set page
    chewing_set_candPerPage(c, config->iMaxCandWord);
    FcitxCandidateWordSetPageSize(FcitxInputStateGetCandidateList(input), config->iMaxCandWord);
    chewing_set_selKey(c, selKey, 10);
    LoadChewingConfig(&chewing->config);
    ConfigChewing(chewing);

    FcitxInstanceRegisterIM(
        instance,
        chewing,
        "chewing",
        _("Chewing"),
        "chewing",
        FcitxChewingInit,
        FcitxChewingReset,
        FcitxChewingDoInput,
        FcitxChewingGetCandWords,
        NULL,
        NULL,
        FcitxChewingReloadConfig,
        NULL,
        1,
        "zh_TW"
    );
    return chewing;
}
开发者ID:pkg-ime,项目名称:fcitx-chewing,代码行数:63,代码来源:eim.c


示例18: LuaGetCandWord

static INPUT_RETURN_VALUE
LuaGetCandWord(void *arg, FcitxCandidateWord *candWord)
{
    FCITX_UNUSED(arg);
    LuaModule *luamodule = (LuaModule*)candWord->owner;
    FcitxInputState *input = FcitxInstanceGetInputState(GetFcitx(luamodule));
    strncpy(FcitxInputStateGetOutputString(input),
            candWord->strWord, MAX_USER_INPUT);
    return IRV_COMMIT_STRING;
}
开发者ID:farseerfc,项目名称:fcitx,代码行数:10,代码来源:lua.c


示例19: FcitxInstanceGetInputState

/**
 * @brief sunpinyin called this function while commit the string
 *
 * @param str committed string
 * @return void
 **/
void FcitxWindowHandler::commit(const TWCHAR* str)
{
    FcitxInstance* instance = owner->owner;
    FcitxInputState* input = FcitxInstanceGetInputState(instance);
    char *buf_ = FcitxInputStateGetOutputString(input);
    memset(buf_, 0, MAX_USER_INPUT);
    WCSTOMBS(buf_, str, MAX_USER_INPUT);
    commit_flag = true;
    FcitxInputStateSetCursorPos(input, false);
}
开发者ID:cherry-wb,项目名称:fcitx-sunpinyin,代码行数:16,代码来源:handler.cpp


示例20: PreInputProcessAutoEng

static boolean PreInputProcessAutoEng(void* arg, FcitxKeySym sym,
                                      unsigned int state,
                                      INPUT_RETURN_VALUE *retval)
{
    FcitxAutoEngState *autoEngState = (FcitxAutoEngState*)arg;
    FcitxInputState *input = FcitxInstanceGetInputState(autoEngState->owner);
    //boolean disableCheckUAZ = FcitxInstanceGetContextBoolean(
    //    autoEngState->owner, CONTEXT_DISABLE_AUTOENG);
    //if (disableCheckUAZ)
    //    return false;
    if (autoEngState->enable == false)
        return false;
	
	FcitxIM *im = FcitxInstanceGetCurrentIM(autoEngState->owner);
	if (im == NULL || strcmp("sogoupinyin", im->uniqueName) != 0)
		return false;

    FcitxKeySym keymain = FcitxHotkeyPadToMain(sym);
    if (!autoEngState->active) {
        if (FcitxHotkeyIsHotKeySimple(sym, state)) {
            AutoEngSetBuff(autoEngState,
                           FcitxInputStateGetRawInputBuffer(input), keymain);
            if (SwitchToEng(autoEngState, autoEngState->buf)) {
                AutoEngActivate(autoEngState, input, retval);
                return true;
            }
        }
        return false;
    }
    if ((*retval = AutoEngCheckSelect(autoEngState, sym, state))) {
        return true;
    } else if (FcitxHotkeyIsHotKeySimple(keymain, state)) {
        *retval = AutoEngPushKey(autoEngState, keymain);
    } else if (FcitxHotkeyIsHotKey(sym, state, FCITX_BACKSPACE)) {
        AutoEngSetBuffLen(autoEngState, --autoEngState->index);
        if (autoEngState->index == 0) {
            ResetAutoEng(autoEngState);
            *retval = IRV_CLEAN;
        } else {
            *retval = IRV_DISPLAY_MESSAGE;
        }
    } else if (FcitxHotkeyIsHotkeyCursorMove(sym, state)) {
        *retval = IRV_DO_NOTHING;
        return true;
    } else if (FcitxHotkeyIsHotKey(sym, state, FCITX_ENTER)) {
        AutoEngCommit(autoEngState);
        ResetAutoEng(autoEngState);
        *retval = IRV_FLAG_UPDATE_INPUT_WINDOW | IRV_FLAG_RESET_INPUT;
    } else if (FcitxHotkeyIsHotKey(sym, state, FCITX_ESCAPE)) {
        *retval = IRV_CLEAN;
        return true;
    }
    ShowAutoEngMessage(autoEngState, retval);
    return true;
}
开发者ID:lenky0401,项目名称:fcitx-autoeng-ng,代码行数:55,代码来源:AutoEng.c



注:本文中的FcitxInstanceGetInputState函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FcitxLog函数代码示例发布时间:2022-05-30
下一篇:
C++ FcPatternGetString函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap