您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ FcitxInstanceGetInputState函数代码示例

51自学网 2021-06-01 20:45:49
  C++
这篇教程C++ FcitxInstanceGetInputState函数代码示例写得很实用,希望能帮到您。

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

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


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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 windowINPUT_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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例17: FcitxChewingCreate

/** * @brief initialize the extra input method * * @param arg * @return successful or not **/__EXPORT_APIvoid* 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,


示例18: LuaGetCandWord

static INPUT_RETURN_VALUELuaGetCandWord(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,


示例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,


示例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,


示例21: AutoEngCheckSelect

static INPUT_RETURN_VALUEAutoEngCheckSelect(FcitxAutoEngState *autoEngState,                   FcitxKeySym sym, unsigned int state){    FcitxCandidateWordList *candList = FcitxInputStateGetCandidateList(        FcitxInstanceGetInputState(autoEngState->owner));    int iKey = FcitxCandidateWordCheckChooseKey(candList, sym, state);    if (iKey >= 0)        return FcitxCandidateWordChooseByIndex(candList, iKey);    return 0;}
开发者ID:areslp,项目名称:fcitx,代码行数:11,


示例22: AutoEngCheckPreedit

static booleanAutoEngCheckPreedit(FcitxAutoEngState *autoEngState){    FcitxInputState *input;    char *preedit;    input = FcitxInstanceGetInputState(autoEngState->owner);    preedit = FcitxUIMessagesToCString(FcitxInputStateGetPreedit(input));    boolean res = !(preedit && *fcitx_utils_get_ascii_end(preedit));    free(preedit);    return res;}
开发者ID:gt945,项目名称:fcitx,代码行数:11,


示例23: FcitxChewingDoInput

/** * @brief Process Key Input and return the status * * @param keycode keycode from XKeyEvent * @param state state from XKeyEvent * @param count count from XKeyEvent * @return INPUT_RETURN_VALUE **/__EXPORT_APIINPUT_RETURN_VALUE FcitxChewingDoInput(void* arg, FcitxKeySym sym, unsigned int state){    FcitxChewing* chewing = (FcitxChewing*) arg;    FcitxInputState *input = FcitxInstanceGetInputState(chewing->owner);    ChewingContext * c = chewing->context;    if (FcitxCandidateWordGetListSize(FcitxInputStateGetCandidateList(input)) > 0        && (FcitxHotkeyIsHotKeyDigit(sym, state) || FcitxHotkeyIsHotKey(sym, state, FCITX_RIGHT) || FcitxHotkeyIsHotKey(sym, state, FCITX_LEFT)))        return IRV_TO_PROCESS;    if (FcitxHotkeyIsHotKeySimple(sym, state)) {        int scan_code = (int) sym & 0xff;        chewing_handle_Default(c, scan_code);    } else if (FcitxHotkeyIsHotKey(sym, state, FCITX_BACKSPACE)) {        chewing_handle_Backspace(c);    } else if (FcitxHotkeyIsHotKey(sym, state, FCITX_ESCAPE)) {        chewing_handle_Esc(c);    } else if (FcitxHotkeyIsHotKey(sym, state, FCITX_DELETE)) {        chewing_handle_Del(c);    } else if (FcitxHotkeyIsHotKey(sym, state, FCITX_SPACE)) {        chewing_handle_Space(c);    } else if (FcitxHotkeyIsHotKey(sym, state, FCITX_CHEWING_UP)) {        chewing_handle_Up(c);    } else if (FcitxHotkeyIsHotKey(sym, state, FCITX_CHEWING_DOWN)) {        chewing_handle_Down(c);    } else if (FcitxHotkeyIsHotKey(sym, state, FCITX_CHEWING_PGUP)) {        chewing_handle_PageDown(c);    } else if (FcitxHotkeyIsHotKey(sym, state, FCITX_CHEWING_PGDN)) {        chewing_handle_PageUp(c);    } else if (FcitxHotkeyIsHotKey(sym, state, FCITX_RIGHT)) {        chewing_handle_Right(c);    } else if (FcitxHotkeyIsHotKey(sym, state, FCITX_LEFT)) {        chewing_handle_Left(c);    } else if (FcitxHotkeyIsHotKey(sym, state, FCITX_ENTER)) {        chewing_handle_Enter(c);    } else if (state == FcitxKeyState_Ctrl && FcitxHotkeyIsHotKeyDigit(sym, FcitxKeyState_None)) {        chewing_handle_CtrlNum(c, sym);    } else {        // to do: more chewing_handle        return IRV_TO_PROCESS;    }    if (chewing_keystroke_CheckAbsorb(c)) {        return IRV_DISPLAY_CANDWORDS;    } else if (chewing_keystroke_CheckIgnore(c)) {        return IRV_TO_PROCESS;    } else if (chewing_commit_Check(c)) {        char* str = chewing_commit_String(c);        strcpy(FcitxInputStateGetOutputString(input), str);        chewing_free(str);        return IRV_COMMIT_STRING;    } else        return IRV_DISPLAY_CANDWORDS;}
开发者ID:pkg-ime,项目名称:fcitx-chewing,代码行数:62,


示例24: _CloudPinyinAddCandidateWord

void _CloudPinyinAddCandidateWord(FcitxCloudPinyin* cloudpinyin, const char* pinyin){    CloudPinyinCache* cacheEntry = CloudPinyinCacheLookup(cloudpinyin, pinyin);    FcitxInputState* input = FcitxInstanceGetInputState(cloudpinyin->owner);    struct _FcitxCandidateWordList* candList = FcitxInputStateGetCandidateList(input);        if (cacheEntry) {        FcitxCandidateWord* cand;        /* only check the first three page */        int size = FcitxCandidateWordGetPageSize(candList) * CLOUDPINYIN_CHECK_PAGE_NUMBER;        int i = 0;        for (cand = FcitxCandidateWordGetFirst(FcitxInputStateGetCandidateList(input));             cand != NULL;             cand = FcitxCandidateWordGetNext(FcitxInputStateGetCandidateList(input), cand))        {            if (strcmp(cand->strWord, cacheEntry->str) == 0)                return;            i ++;            if (i >= size)                break;        }    }    FcitxCandidateWord candWord;    CloudCandWord* cloudCand = fcitx_utils_malloc0(sizeof(CloudCandWord));    if (cacheEntry)    {        cloudCand->filled = true;        candWord.strWord = strdup(cacheEntry->str);    }    else    {        cloudCand->filled = false;        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;    }    int order = cloudpinyin->config.iCandidateOrder - 1;    if (order < 0)        order = 0;    FcitxCandidateWordInsert(candList, &candWord, order);}
开发者ID:pkg-ime,项目名称:fcitx-cloudpinyin,代码行数:53,


示例25: CloudPinyinFillCandidateWord

void CloudPinyinFillCandidateWord(FcitxCloudPinyin* cloudpinyin, const char* pinyin){    CloudPinyinCache* cacheEntry = CloudPinyinCacheLookup(cloudpinyin, pinyin);    FcitxInputState* input = FcitxInstanceGetInputState(cloudpinyin->owner);    struct _FcitxCandidateWordList* candList = FcitxInputStateGetCandidateList(input);    if (cacheEntry)    {        FcitxCandidateWord* candWord;        for (candWord = FcitxCandidateWordGetFirst(candList);             candWord != NULL;             candWord = FcitxCandidateWordGetNext(candList, candWord))        {            if (candWord->owner == cloudpinyin)                break;        }        if (candWord == NULL)            return;        CloudCandWord* cloudCand = candWord->priv;        if (cloudCand->filled)            return;        FcitxCandidateWord* cand;        int i = 0;        int size = FcitxCandidateWordGetPageSize(candList) * CLOUDPINYIN_CHECK_PAGE_NUMBER;        for (cand = FcitxCandidateWordGetFirst(candList);             cand != NULL;             cand = FcitxCandidateWordGetNext(candList, cand))        {            if (strcmp(cand->strWord, cacheEntry->str) == 0) {                FcitxCandidateWordRemove(candList, candWord);                FcitxUIUpdateInputWindow(cloudpinyin->owner);                candWord = NULL;                break;            }            i ++;            if (i >= size)                break;        }                if (candWord)        {            if (cloudCand->filled == false)            {                cloudCand->filled = true;                free(candWord->strWord);                candWord->strWord = strdup(cacheEntry->str);                FcitxUIUpdateInputWindow(cloudpinyin->owner);            }        }    }}
开发者ID:pkg-ime,项目名称:fcitx-cloudpinyin,代码行数:53,


示例26: LuaUpdateCandidateWordHookCallback

void LuaUpdateCandidateWordHookCallback(void *arg) {    LuaModule *luamodule = (LuaModule *)arg;    FcitxInputState* input = FcitxInstanceGetInputState(GetFcitx(luamodule));    char *text = FcitxInputStateGetRawInputBuffer(input);    UT_array *result = InputTrigger(luamodule, text);    if (result) {        LuaResultItem *p;        while ((p = (LuaResultItem *)utarray_next(result, p))) {            AddToCandList(luamodule, text, p->result);        }        utarray_free(result);    }}
开发者ID:mylxiaoyi,项目名称:fcitx,代码行数:13,


示例27: AddToCandList

void AddToCandList(LuaModule *luamodule, const char *in, const char *out) {    FcitxCandidateWord candWord;    candWord.callback = LuaGetCandWord;    candWord.owner = luamodule;    candWord.priv = NULL;    candWord.wordType = MSG_TIPS;    candWord.strExtra = NULL;    candWord.strWord = strdup(out);    FcitxInputState* input = FcitxInstanceGetInputState(GetFcitx(luamodule));    FcitxCandidateWordList* candList = FcitxInputStateGetCandidateList(input);    FcitxCandidateWordInsert(candList, &candWord, 0);}
开发者ID:mylxiaoyi,项目名称:fcitx,代码行数:13,


示例28: IMSelectorGetCands

void IMSelectorGetCands(IMSelector* imselector){    FcitxInstance* instance = imselector->owner;    FcitxInputState *input = FcitxInstanceGetInputState(instance);    FcitxIM* pim;    UT_array* imes = FcitxInstanceGetIMEs(instance);    FcitxInstanceCleanInputWindow(instance);    FcitxCandidateWordSetPageSize(FcitxInputStateGetCandidateList(input), 10);    FcitxCandidateWordSetChoose(FcitxInputStateGetCandidateList(input), DIGIT_STR_CHOOSE);    FcitxInputStateSetShowCursor(input, false);    FcitxInputContext* ic = FcitxInstanceGetCurrentIC(instance);    FcitxInputContext2* ic2 = (FcitxInputContext2*) ic;    if (!ic)        return;    FcitxMessagesAddMessageStringsAtLast(FcitxInputStateGetAuxUp(input),                                         MSG_TIPS, imselector->global ?                                         _("Select global input method: ") :                                         _("Select local input method: "));    if (ic2->imname) {        int idx = FcitxInstanceGetIMIndexByName(instance, ic2->imname);        FcitxIM* im = (FcitxIM*) utarray_eltptr(imes, idx);        if (im) {            FcitxMessagesAddMessageAtLast(FcitxInputStateGetAuxUp(input), MSG_TIPS, _("Current local input method is %s"), im->strName);        }    }    else {        FcitxMessagesAddMessageStringsAtLast(FcitxInputStateGetAuxUp(input),                                             MSG_TIPS,                                             _("No local input method"));    }    for (pim = (FcitxIM *) utarray_front(imes);            pim != NULL;            pim = (FcitxIM *) utarray_next(imes, pim)) {        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);        }        candWord.wordType = MSG_OTHER;        FcitxCandidateWordAppend(FcitxInputStateGetCandidateList(input), &candWord);    }}
开发者ID:adaptee,项目名称:fcitx,代码行数:51,


示例29: QuickPhrasePreFilter

boolean QuickPhrasePreFilter(void *arg, FcitxKeySym sym,                             unsigned int state,                             INPUT_RETURN_VALUE *retval){    QuickPhraseState *qpstate = (QuickPhraseState*) arg;    FcitxInputState *input = FcitxInstanceGetInputState(qpstate->owner);    if (!qpstate->enabled)        return false;    char c[2];    QuickPhraseFillKeyString(qpstate, c);    FcitxKeySym keymain = FcitxHotkeyPadToMain(sym);    *retval = QuickPhraseDoInput(qpstate, keymain, state);    if (*retval != IRV_TO_PROCESS)        return true;    if (FcitxHotkeyIsHotKeySimple(keymain, state)) {        if (c[0] && strlen(qpstate->buffer) == 0 &&            ((qpstate->useDupKeyInput &&              FcitxHotkeyIsHotKey(keymain, state, qpstate->curTriggerKey)) ||             FcitxHotkeyIsHotKey(keymain, state, FCITX_SPACE))) {            int s = qpstate->curTriggerKey[0].sym;            char *strTemp = FcitxPuncGetPunc(qpstate->owner, &s);            strcpy(FcitxInputStateGetOutputString(input), strTemp ? strTemp : c);            *retval = IRV_COMMIT_STRING;        } else {            char buf[2];            buf[0] = keymain;            buf[1] = '/0';            if (strlen(qpstate->buffer) < MAX_USER_INPUT)                strcat(qpstate->buffer, buf);            ShowQuickPhraseMessage(qpstate);            *retval = QuickPhraseGetCandWords(qpstate);        }    } else if (FcitxHotkeyIsHotKey(sym, state, FCITX_BACKSPACE)) {        size_t len = strlen(qpstate->buffer);        if (len > 0)            qpstate->buffer[--len] = '/0';        if (len == 0) {            *retval = IRV_CLEAN;        } else {            ShowQuickPhraseMessage(qpstate);            *retval = QuickPhraseGetCandWords(qpstate);        }    } else if (FcitxHotkeyIsHotKey(sym, state, FCITX_ENTER)) {        size_t len = strlen(qpstate->buffer);        if (len > 0) {            if (qpstate->append) {                fcitx_utils_cat_str(FcitxInputStateGetOutputString(input),                                    2, (const char*[]){c, qpstate->buffer},                                    (size_t[]){strlen(c), len});            } else {
开发者ID:martyr-deepin,项目名称:fcitx,代码行数:50,



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


C++ FcitxLog函数代码示例
C++ FcPatternGetString函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。