void* LightUICreate(FcitxInstance* instance) { FcitxModuleFunctionArg arg; FcitxLightUI* lightui = fcitx_utils_malloc0(sizeof(FcitxLightUI)); FcitxAddon* lightuiaddon = FcitxAddonsGetAddonByName(FcitxInstanceGetAddons(instance), FCITX_LIGHT_UI_NAME); lightui->owner = instance; if (!LoadLightUIConfig(lightui)) { free(lightui); return NULL; } lightui->dpy = InvokeFunction(instance, FCITX_X11, GETDISPLAY, arg); if (lightui->dpy == NULL) { free(lightui); return NULL; } lightui->isfallback = FcitxUIIsFallback(instance, lightuiaddon); lightui->iScreen = DefaultScreen(lightui->dpy); CreateFont(lightui); lightui->protocolAtom = XInternAtom (lightui->dpy, "WM_PROTOCOLS", False); lightui->killAtom = XInternAtom (lightui->dpy, "WM_DELETE_WINDOW", False); /* Main Menu Initial */ FcitxMenuInit(&lightui->mainMenu); FcitxUIMenu **menupp; UT_array* uimenus = FcitxInstanceGetUIMenus(instance); for (menupp = (FcitxUIMenu **) utarray_front(uimenus); menupp != NULL; menupp = (FcitxUIMenu **) utarray_next(uimenus, menupp) ) { FcitxUIMenu * menup = *menupp; if (!menup->isSubMenu) FcitxMenuAddMenuItem(&lightui->mainMenu, menup->name, MENUTYPE_SUBMENU, menup); } FcitxMenuAddMenuItem(&lightui->mainMenu, NULL, MENUTYPE_DIVLINE, NULL); FcitxMenuAddMenuItem(&lightui->mainMenu, _("Configure"), MENUTYPE_SIMPLE, NULL); FcitxMenuAddMenuItem(&lightui->mainMenu, _("Exit"), MENUTYPE_SIMPLE, NULL); lightui->mainMenu.MenuAction = MainMenuAction; lightui->mainMenu.priv = lightui; lightui->mainMenu.mark = -1; lightui->inputWindow = CreateInputWindow(lightui); lightui->mainWindow = CreateMainWindow(lightui); lightui->trayWindow = CreateTrayWindow(lightui); lightui->mainMenuWindow = CreateMainMenuWindow(lightui); FcitxIMEventHook resethk; resethk.arg = lightui; resethk.func = LightUIInputReset; FcitxInstanceRegisterResetInputHook(instance, resethk); return lightui; }
s3eResult s3eHidControllerInit_platform() { CreateInputWindow(); HRESULT hr = DirectDrawCreateEx( NULL, (LPVOID *)&idd7, IID_IDirectDraw7, NULL ); if (hr != DD_OK) { IwError(("Couldn't initialize DirectDraw() :( ErrCode=0x%X\n", (uint32)hr)); } return S3E_RESULT_SUCCESS; }
void* ClassicUICreate(FcitxInstance* instance) { FcitxAddon* classicuiaddon = FcitxAddonsGetAddonByName(FcitxInstanceGetAddons(instance), FCITX_CLASSIC_UI_NAME); FcitxModuleFunctionArg arg; FcitxClassicUI* classicui = fcitx_utils_malloc0(sizeof(FcitxClassicUI)); classicui->owner = instance; if (!LoadClassicUIConfig(classicui)) { free(classicui); return NULL; } if (GetSkinDesc() == NULL) { free(classicui); return NULL; } classicui->dpy = InvokeFunction(instance, FCITX_X11, GETDISPLAY, arg); if (classicui->dpy == NULL) { free(classicui); return NULL; } if (LoadSkinConfig(&classicui->skin, &classicui->skinType)) { free(classicui); return NULL; } classicui->isfallback = FcitxUIIsFallback(instance, classicuiaddon); classicui->iScreen = DefaultScreen(classicui->dpy); classicui->protocolAtom = XInternAtom(classicui->dpy, "WM_PROTOCOLS", False); classicui->killAtom = XInternAtom(classicui->dpy, "WM_DELETE_WINDOW", False); InitSkinMenu(classicui); FcitxUIRegisterMenu(instance, &classicui->skinMenu); /* Main Menu Initial */ FcitxMenuInit(&classicui->mainMenu); FcitxMenuAddMenuItem(&classicui->mainMenu, _("About Fcitx"), MENUTYPE_SIMPLE, NULL); FcitxMenuAddMenuItem(&classicui->mainMenu, _("Online Help"), MENUTYPE_SIMPLE, NULL); FcitxMenuAddMenuItem(&classicui->mainMenu, NULL, MENUTYPE_DIVLINE, NULL); FcitxUIMenu **menupp; UT_array* uimenus = FcitxInstanceGetUIMenus(instance); for (menupp = (FcitxUIMenu **) utarray_front(uimenus); menupp != NULL; menupp = (FcitxUIMenu **) utarray_next(uimenus, menupp) ) { FcitxUIMenu * menup = *menupp; if (!menup->isSubMenu) FcitxMenuAddMenuItem(&classicui->mainMenu, menup->name, MENUTYPE_SUBMENU, menup); } FcitxMenuAddMenuItem(&classicui->mainMenu, NULL, MENUTYPE_DIVLINE, NULL); FcitxMenuAddMenuItem(&classicui->mainMenu, _("Configure"), MENUTYPE_SIMPLE, NULL); FcitxMenuAddMenuItem(&classicui->mainMenu, _("Exit"), MENUTYPE_SIMPLE, NULL); classicui->mainMenu.MenuAction = MainMenuAction; classicui->mainMenu.priv = classicui; classicui->mainMenu.mark = -1; classicui->inputWindow = CreateInputWindow(classicui); classicui->mainWindow = CreateMainWindow(classicui); classicui->trayWindow = CreateTrayWindow(classicui); classicui->aboutWindow = CreateAboutWindow(classicui); classicui->messageWindow = CreateMessageWindow(classicui); classicui->mainMenuWindow = CreateMainMenuWindow(classicui); FcitxIMEventHook resethk; resethk.arg = classicui; resethk.func = ClassicUIInputReset; FcitxInstanceRegisterResetInputHook(instance, resethk); DisplaySkin(classicui, classicui->skinType); /* ensure order ! */ AddFunction(classicuiaddon, ClassicUILoadImage); AddFunction(classicuiaddon, ClassicUIGetKeyBoardFontColor); AddFunction(classicuiaddon, ClassicUIGetFont); return classicui; }
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; }
void* ClassicUICreate(FcitxInstance* instance) { FcitxAddon* classicuiaddon = FcitxAddonsGetAddonByName(FcitxInstanceGetAddons(instance), FCITX_CLASSIC_UI_NAME); FcitxClassicUI* classicui = fcitx_utils_malloc0(sizeof(FcitxClassicUI)); classicui->owner = instance; if (!LoadClassicUIConfig(classicui)) { free(classicui); return NULL; } if (GetSkinDesc() == NULL) { free(classicui); return NULL; } classicui->dpy = FcitxX11GetDisplay(instance); if (classicui->dpy == NULL) { free(classicui); return NULL; } FcitxX11GetDPI(instance, &classicui->dpi, NULL); if (classicui->dpi <= 0) classicui->dpi = 96; if (LoadSkinConfig(&classicui->skin, &classicui->skinType)) { free(classicui); return NULL; } classicui->isfallback = FcitxUIIsFallback(instance, classicuiaddon); classicui->iScreen = DefaultScreen(classicui->dpy); classicui->protocolAtom = XInternAtom(classicui->dpy, "WM_PROTOCOLS", False); classicui->killAtom = XInternAtom(classicui->dpy, "WM_DELETE_WINDOW", False); InitSkinMenu(classicui); FcitxUIRegisterMenu(instance, &classicui->skinMenu); /* Main Menu Initial */ FcitxMenuInit(&classicui->mainMenu); classicui->mainMenu.UpdateMenu = UpdateMainMenu; classicui->mainMenu.MenuAction = MainMenuAction; classicui->mainMenu.priv = classicui; classicui->mainMenu.mark = -1; classicui->inputWindow = CreateInputWindow(classicui); classicui->mainWindow = CreateMainWindow(classicui); classicui->trayWindow = CreateTrayWindow(classicui); classicui->messageWindow = CreateMessageWindow(classicui); classicui->mainMenuWindow = CreateMainMenuWindow(classicui); FcitxIMEventHook resethk; resethk.arg = classicui; resethk.func = ClassicUIInputReset; FcitxInstanceRegisterResetInputHook(instance, resethk); DisplaySkin(classicui, classicui->skinType); /* ensure order ! */ FcitxModuleAddFunction(classicuiaddon, ClassicUILoadImage); FcitxModuleAddFunction(classicuiaddon, ClassicUIGetKeyBoardFontColor); FcitxModuleAddFunction(classicuiaddon, ClassicUIGetFont); return classicui; }