Esempio n. 1
0
void * QuickPhraseCreate(FcitxInstance *instance)
{
    QuickPhraseState *qpstate = fcitx_utils_malloc0(sizeof(QuickPhraseState));
    qpstate->owner = instance;
    qpstate->enabled = false;

    if (!LoadQuickPhraseConfig(&qpstate->config)) {
        free(qpstate);
        return NULL;
    }

    LoadQuickPhrase(qpstate);

    FcitxKeyFilterHook hk;
    hk.arg = qpstate;
    hk.func = QuickPhrasePostFilter;
    FcitxInstanceRegisterPostInputFilter(instance, hk);

    hk.func = QuickPhrasePreFilter;
    FcitxInstanceRegisterPreInputFilter(instance, hk);

    FcitxIMEventHook resethk;
    resethk.arg = qpstate;
    resethk.func = QuickPhraseReset;
    FcitxInstanceRegisterResetInputHook(instance, resethk);

    FcitxInstanceRegisterWatchableContext(instance, CONTEXT_DISABLE_QUICKPHRASE, FCT_Boolean, FCF_ResetOnInputMethodChange);

    FcitxAddon* addon = FcitxAddonsGetAddonByName(
        FcitxInstanceGetAddons(instance),
        FCITX_QUICKPHRASE_NAME);
    FcitxModuleAddFunction(addon, QuickPhraseLaunch);

    return qpstate;
}
Esempio n. 2
0
void *QuickPhraseCreate(FcitxInstance *instance)
{
    QuickPhraseState *qpstate = fcitx_utils_new(QuickPhraseState);
    qpstate->owner = instance;
    qpstate->enabled = false;

    if (!LoadQuickPhraseConfig(&qpstate->config)) {
        free(qpstate);
        return NULL;
    }

    LoadQuickPhrase(qpstate);

    FcitxKeyFilterHook hk;
    hk.arg = qpstate;
    hk.func = QuickPhrasePostFilter;
    FcitxInstanceRegisterPostInputFilter(instance, hk);

    hk.func = QuickPhrasePreFilter;
    FcitxInstanceRegisterPreInputFilter(instance, hk);

    FcitxIMEventHook resethk;
    resethk.arg = qpstate;
    resethk.func = QuickPhraseReset;
    FcitxInstanceRegisterResetInputHook(instance, resethk);

    FcitxInstanceRegisterWatchableContext(instance, CONTEXT_DISABLE_QUICKPHRASE,
                                          FCT_Boolean,
                                          FCF_ResetOnInputMethodChange);

    FcitxQuickPhraseAddFunctions(instance);
    return qpstate;
}
Esempio n. 3
0
void ReloadQuickPhrase(void* arg)
{
    QuickPhraseState *qpstate = (QuickPhraseState*) arg;
    LoadQuickPhraseConfig(qpstate);
    FreeQuickPhrase(arg);
    LoadQuickPhrase(qpstate);
}
Esempio n. 4
0
int main_PY()
{
//    int             c;     //用于保存用户输入的参数
//   Bool            bBackground = True;
//   char        *imname=(char *)NULL;
    extern  Bool            bPYBaseDictLoaded;
    extern Bool            bPYOtherDictLoaded;
    initConfig();  //szj
    initConfig2();  //szj

    if (!InitX ()){};
    //exit (1);

    /*加载用户配置文件,通常是“~/.fcitx/config”,如果该文件不存在就从安装目录中拷贝
     * “/data/config”到“~/.fcitx/config”
     */

    LoadConfig (True);

    /*创建字体。实际上,就是根据用户的设置,使用xft读取字体的相关信息。
     * xft是x11提供的处理字体的相关函数集
     */
    CreateFont ();

    //根据字体计算输入窗口的高度
    CalculateInputWindowHeight ();

    /*加载配置文件,这个配置文件不是用户配置的,而是用于记录fctix的运行状态的,
     * 比如是全角还是半角等等。通常是“~/.fcitx/profile”,如果该文件不存在就从安装
     * 目录中拷贝“/data/profile”到“~/.fcitx/profile”
     */
    LoadProfile ();

    //加载标点字典文件
    LoadPuncDict ();
    //加载成语
    LoadQuickPhrase ();
    /*从 ~/.fcitx/AutoEng.dat (如果不存在,
     * 则从 /usr/local/share/fcitx/data/AutoEng.dat)
     * 读取需要自动转换到英文输入状态的情况的数据
     */
    LoadAutoEng ();

    //以下是界面的处理

    CreateMainWindow ();    //创建主窗口,即输入法状态窗口
    CreateVKWindow ();        //创建候选词窗口
    CreateInputWindow ();    //创建输入窗口
//szj    CreateAboutWindow ();    //创建关于窗口

    //处理颜色,即候选词窗口的颜色,也就是我们在“~/.fcitx/config”定义的那些颜色信息
    InitGC (inputWindow);

    //将本程序加入到输入法组,告诉系统,使用我输入字符
    SetIM ();

    //处理主窗口的显示
    if (hideMainWindow != HM_HIDE) {
    DisplayMainWindow ();
    DrawMainWindow ();
    }
    if (!bPYBaseDictLoaded)
    LoadPYBaseDict ();
    if (!bPYOtherDictLoaded)
    LoadPYOtherDict ();

    //以后台方式运行

#ifdef _ENABLE_TRAY
    CreateTrayWindow ();        //创建系统托盘窗口
    DrawTrayWindow (INACTIVE_ICON);    //显示托盘图标
#endif

    return 0;
}