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

C++ FcitxLog函数代码示例

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

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



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

示例1: FcitxNotificationItemEnable

boolean FcitxNotificationItemEnable(FcitxNotificationItem* notificationitem, FcitxNotificationItemAvailableCallback callback, void* data)
{
    if (!callback || notificationitem->callback)
        return false;
    if (notificationitem->serviceName) {
        FcitxLog(ERROR, "This should not happen, please report bug.");
        return false;
    }
    notificationitem->callback = callback;
    notificationitem->data = data;
    asprintf(&notificationitem->serviceName, "org.kde.StatusNotifierItem-%u-%d", getpid(), ++notificationitem->index);

    /* once we have name, request it first */
    DBusError err;
    dbus_error_init(&err);
    dbus_bus_request_name(notificationitem->conn, notificationitem->serviceName,
                                    DBUS_NAME_FLAG_DO_NOT_QUEUE,
                                    &err);
    if (dbus_error_is_set(&err)) {
        FcitxLog(WARNING, "NotificationItem Name Error (%s)", err.message);
    }
    dbus_error_free(&err);

    if (notificationitem->available) {
        if (notificationitem->callback) {
            FcitxNotificationItemRegister(notificationitem);
        }
    }
    return true;
}
开发者ID:martyr-deepin,项目名称:fcitx,代码行数:30,代码来源:notificationitem.c


示例2: FcitxXkbDBusCreate

void* FcitxXkbDBusCreate(FcitxInstance* instance)
{
    FcitxXkbDBus* xkbdbus = fcitx_utils_new(FcitxXkbDBus);
    xkbdbus->owner = instance;
    do {
        FcitxModuleFunctionArg arg;
        DBusConnection* conn = InvokeFunction(instance, FCITX_DBUS, GETCONNECTION, arg);
        if (conn == NULL) {
            FcitxLog(ERROR, "DBus Not initialized");
            break;
        }

        DBusObjectPathVTable fcitxIPCVTable = {NULL, &FcitxXkbDBusEventHandler, NULL, NULL, NULL, NULL };

        if (!dbus_connection_register_object_path(conn,  FCITX_XKB_PATH,
                &fcitxIPCVTable, xkbdbus)) {
            FcitxLog(ERROR, "No memory");
            break;
        }
        FcitxModuleFunctionArg args;
        FcitxXkbRules* rules = InvokeFunction(instance, FCITX_XKB, GETRULES, args);

        if (!rules)
            break;

        xkbdbus->rules = rules;
        xkbdbus->isocodes = FcitxXkbReadIsoCodes(ISOCODES_ISO639_XML, ISOCODES_ISO3166_XML);
        return xkbdbus;
    } while(0);

    free(xkbdbus);

    return NULL;
}
开发者ID:mylxiaoyi,项目名称:fcitx,代码行数:34,代码来源:xkbdbus.c


示例3: LoadLuaConfig

static int LoadLuaConfig(LuaModule *luamodule) {
    int count = 0;
    FcitxStringHashSet *sset = FcitxXDGGetFiles("lua", NULL, ".lua");
    FcitxStringHashSet *str;
    for (str = sset; str != NULL;) {
        FcitxStringHashSet *tmp = str->hh.next;
        char *path;
        FILE *f = FcitxXDGGetFileWithPrefix("lua", str->name, "r", &path);
        if (f && path) {
            if (LoadExtension(luamodule, path)) {
                FcitxLog(INFO, "lua load extension file:%s", path);
                ++count;
            } else {
                FcitxLog(ERROR, "LoadExtension() failed");
            }
        }
        if (f) {
            fclose(f);
        }
        if (path) {
            free(path);
        }
        HASH_DEL(sset, str);
        free(str->name);
        free(str);
        str = tmp;
    }
    return count;
}
开发者ID:mylxiaoyi,项目名称:fcitx,代码行数:29,代码来源:lua.c


示例4: LoadAutoEng

void LoadAutoEng(FcitxAutoEngState* autoEngState)
{
    FILE    *fp;
    char    *buf = NULL;
    size_t   length = 0;

    LoadAutoEngConfig(&autoEngState->config);
    fp = FcitxXDGGetFileWithPrefix("data", "AutoEngNg.dat", "r", NULL);
    if (!fp)
	{
		FcitxLog(WARNING, "Load AutoEngNg.dat failed");
        return;
	}
    utarray_new(autoEngState->autoEng, &autoeng_icd);
    AUTO_ENG autoeng;

    while (getline(&buf, &length, fp) != -1) {
        char* line = fcitx_utils_trim(buf);
        if (strlen(line) > MAX_AUTO_TO_ENG)
            FcitxLog(WARNING, _("Too long item for AutoEngNg"));
        strncpy(autoeng.str, line, MAX_AUTO_TO_ENG);
        free(line);
        autoeng.str[MAX_AUTO_TO_ENG] = '\0';
        utarray_push_back(autoEngState->autoEng, &autoeng);
    }

    free(buf);

    fclose(fp);
}
开发者ID:lenky0401,项目名称:fcitx-autoeng-ng,代码行数:30,代码来源:AutoEng.c


示例5: 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


示例6: PushCoordinate

// Adds a new coordinate to the stroke buffer, enlarging if necessary
static void PushCoordinate(FcitxTablet* tablet, pt_t newpt) {
	*tablet->strokesPtr++ = newpt;
	if(tablet->strokesPtr == &tablet->strokesBuffer[tablet->strokesBufferSize]) { // if we overflow the buffer, increase it
		FcitxLog(WARNING, "Resizing stroke buffer");
		int newsize = tablet->strokesBufferSize + 1024;
		pt_t* newbuf = (pt_t*) realloc(tablet->strokesBuffer, sizeof(pt_t)*newsize);
		if(newbuf == NULL)
			FcitxLog(ERROR, "Failed to allocate more stroke memory");
		tablet->strokesBuffer = newbuf;
		tablet->strokesPtr = &tablet->strokesBuffer[tablet->strokesBufferSize];
		tablet->strokesBufferSize = newsize;
	}
}
开发者ID:kingctan,项目名称:fcitx-tablet,代码行数:14,代码来源:tablet.c


示例7: LuaCreate

void* LuaCreate(FcitxInstance* instance) {
    LuaModule *luamodule = LuaModuleAlloc(instance);
    if (luamodule == NULL) {
        FcitxLog(ERROR, "LuaModule alloc failed");
        goto err;
    }
    LoadLuaConfig(luamodule);

    FcitxIMEventHook hook = {.arg = luamodule,
                             .func = LuaUpdateCandidateWordHookCallback};

    FcitxInstanceRegisterUpdateCandidateWordHook(instance, hook);

    FcitxAddon* luaAddon = FcitxAddonsGetAddonByName(
            FcitxInstanceGetAddons(instance),
            FCITX_LUA_NAME);
    AddFunction(luaAddon, LuaCallCommand);

    return luamodule;
err:
    if (luamodule) {
        LuaModuleFree(luamodule);
    }
    return NULL;
}
开发者ID:mylxiaoyi,项目名称:fcitx,代码行数:25,代码来源:lua.c


示例8: _changed_cb

static void _changed_cb(DBusGProxy* proxy, char* service, char* old_owner, char* new_owner, gpointer user_data)
{
    FcitxLog(LOG_LEVEL, "_changed_cb");
    FcitxIMClient* client = (FcitxIMClient*) user_data;
    if (g_str_equal(service, client->servicename))
    {
        gboolean new_owner_good = new_owner && (new_owner[0] != '\0');
        if (new_owner_good)
        {
            if (client->proxy)
            {
                g_object_unref(client->proxy);
                client->proxy = NULL;
            }

            if (client->icproxy)
            {
                g_object_unref(client->icproxy);
                client->icproxy = NULL;
            }

            FcitxIMClientCreateIC(client);
        }
    }
}
开发者ID:lilydjwg,项目名称:fcitx-fbterm,代码行数:25,代码来源:client.c


示例9: 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


示例10: LoadQuickPhraseConfig

boolean LoadQuickPhraseConfig(QuickPhraseState* qpstate)
{
    FcitxConfigFileDesc* configDesc = GetQuickPhraseConfigDesc();
    if (configDesc == NULL)
        return false;

    FILE *fp;
    char *file;
    fp = FcitxXDGGetFileUserWithPrefix("conf", "fcitx-quickphrase.config", "r", &file);
    FcitxLog(DEBUG, "Load Config File %s", file);
    free(file);
    if (!fp) {
        if (errno == ENOENT)
            SaveQuickPhraseConfig(qpstate);
    }

    FcitxConfigFile *cfile = FcitxConfigParseConfigFileFp(fp, configDesc);

    QuickPhraseStateConfigBind(qpstate, cfile, configDesc);
    FcitxConfigBindSync((FcitxGenericConfig*)qpstate);

    if (fp)
        fclose(fp);

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


示例11: fcitx_im_context_focus_out

static void
fcitx_im_context_focus_out(GtkIMContext *context)
{
    FcitxLog(LOG_LEVEL, "fcitx_im_context_focus_out");
    FcitxIMContext *fcitxcontext = FCITX_IM_CONTEXT(context);

    if (!fcitxcontext->has_focus) {
        return;
    }

    g_assert (context == _focus_im_context);
    g_object_remove_weak_pointer ((GObject *) context,
                                  (gpointer *) &_focus_im_context);
    _focus_im_context = NULL;

    fcitxcontext->has_focus = false;

    if (fcitx_client_is_valid(fcitxcontext->client)) {
        fcitx_client_focus_out(fcitxcontext->client);
    }

    fcitxcontext->cursor_pos = 0;
    if (fcitxcontext->preedit_string != NULL) {
        g_free(fcitxcontext->preedit_string);
        fcitxcontext->preedit_string = NULL;
        g_signal_emit(fcitxcontext, _signal_preedit_changed_id, 0);
        g_signal_emit(fcitxcontext, _signal_preedit_end_id, 0);
    }

    gtk_im_context_focus_out(fcitxcontext->slave);

    return;
}
开发者ID:eguopt,项目名称:fcitx,代码行数:33,代码来源:fcitximcontext-gio.c


示例12: fcitx_im_context_finalize

static void
fcitx_im_context_finalize(GObject *obj)
{
    FcitxLog(LOG_LEVEL, "fcitx_im_context_finalize");
    FcitxIMContext *context = FCITX_IM_CONTEXT(obj);

    fcitx_im_context_set_client_window(GTK_IM_CONTEXT(context), NULL);

    g_object_unref(context->client);
    context->client = NULL;

    if (context->slave) {
        g_object_unref(context->slave);
        context->slave = NULL;
    }

    if (context->preedit_string)
        g_free(context->preedit_string);
    context->preedit_string = NULL;

    if (context->attrlist)
        pango_attr_list_unref(context->attrlist);
    context->attrlist = NULL;

    G_OBJECT_CLASS(parent_class)->finalize (obj);
}
开发者ID:eguopt,项目名称:fcitx,代码行数:26,代码来源:fcitximcontext-gio.c


示例13: FcitxInitThread

void FcitxInitThread(FcitxInstance* inst)
{
    int rc;
    rc = pthread_mutex_init(&inst->fcitxMutex, NULL);
    if (rc != 0)
        FcitxLog(ERROR, _("pthread mutex init failed"));
}
开发者ID:vx13,项目名称:fcitx,代码行数:7,代码来源:instance.c


示例14: FcitxNotificationItemRegister

void FcitxNotificationItemRegister(FcitxNotificationItem* notificationitem)
{
    if (!notificationitem->serviceName) {
        FcitxLog(ERROR, "This should not happen, please report bug.");
        return;
    }

    DBusMessage *message =
        dbus_message_new_method_call(NOTIFICATION_WATCHER_DBUS_ADDR,
                                     NOTIFICATION_WATCHER_DBUS_OBJ,
                                     NOTIFICATION_WATCHER_DBUS_IFACE,
                                     "RegisterStatusNotifierItem");
    dbus_message_append_args(message,
                             DBUS_TYPE_STRING, &notificationitem->serviceName,
                             DBUS_TYPE_INVALID);

    DBusPendingCall *call = NULL;
    dbus_bool_t reply =
        dbus_connection_send_with_reply(notificationitem->conn, message,
                                        &call, DBUS_TIMEOUT_USE_DEFAULT);
    dbus_message_unref(message);
    if (reply == TRUE) {
        dbus_pending_call_set_notify(call,
                                     FcitxNotificationItemRegisterSuccess,
                                     notificationitem,
                                     NULL);
        dbus_pending_call_unref(call);
    }
}
开发者ID:Nervengift,项目名称:fcitx,代码行数:29,代码来源:notificationitem.c


示例15: LoadIMSelectorConfig

boolean LoadIMSelectorConfig(IMSelector* imselector)
{
    FcitxConfigFileDesc* configDesc = GetIMSelectorConfig();
    if (configDesc == NULL)
        return false;

    FILE *fp;
    char *file;
    fp = FcitxXDGGetFileUserWithPrefix("conf", "fcitx-imselector.config", "r", &file);
    FcitxLog(DEBUG, "Load Config File %s", file);
    free(file);
    if (!fp) {
        if (errno == ENOENT)
            SaveIMSelectorConfig(imselector);
    }

    FcitxConfigFile *cfile = FcitxConfigParseConfigFileFp(fp, configDesc);

    IMSelectorConfigBind(imselector, cfile, configDesc);
    FcitxConfigBindSync((FcitxGenericConfig*)imselector);

    if (fp)
        fclose(fp);

    return true;
}
开发者ID:hiroshiyui,项目名称:fcitx,代码行数:26,代码来源:imselector.c


示例16: LoadChttransConfig

boolean LoadChttransConfig(FcitxChttrans* transState)
{
    FcitxConfigFileDesc* configDesc = GetChttransConfigDesc();
    if (configDesc == NULL)
        return false;

    FILE *fp;
    char *file;
    fp = FcitxXDGGetFileUserWithPrefix("conf", "fcitx-chttrans.config",
                                       "r", &file);
    FcitxLog(DEBUG, "Load Config File %s", file);
    free(file);
    if (!fp) {
        if (errno == ENOENT)
            SaveChttransConfig(transState);
    }

    FcitxConfigFile *cfile = FcitxConfigParseConfigFileFp(fp, configDesc);

    FcitxChttransConfigBind(transState, cfile, configDesc);
    FcitxConfigBindSync((FcitxGenericConfig*)transState);

    if (fp)
        fclose(fp);

    return true;
}
开发者ID:haobug,项目名称:fcitx,代码行数:27,代码来源:chttrans.c


示例17: FcitxUIUpdateStatus

FCITX_EXPORT_API
void FcitxUIUpdateStatus(FcitxInstance* instance, const char* name)
{
    FcitxLog(DEBUG, "Update Status for %s", name);

    FcitxUIStatus *status = FcitxUIGetStatusByName(instance, name);

    if (status != NULL) {
        if (status->toggleStatus)
            status->toggleStatus(status->arg);

        if (UI_FUNC_IS_VALID(UpdateStatus))
            instance->ui->ui->UpdateStatus(instance->ui->addonInstance , status);
    }
    else {
        FcitxUIComplexStatus *compstatus = FcitxUIGetComplexStatusByName(instance, name);
        if (!compstatus)
            return;

        if (compstatus->toggleStatus)
            compstatus->toggleStatus(compstatus->arg);
        if (UI_FUNC_IS_VALID(UpdateComplexStatus))
            instance->ui->ui->UpdateComplexStatus(instance->ui->addonInstance , compstatus);
    }
}
开发者ID:hiroshiyui,项目名称:fcitx,代码行数:25,代码来源:ui.c


示例18: X11GetWindowProperty

static unsigned char*
X11GetWindowProperty(FcitxX11 *x11priv, Window win, Atom prop, Atom *ret_type,
                     int *ret_format, unsigned long *nitems)
{
    unsigned char *buff = NULL;
    int res;
    unsigned long bytes_left = 0;
    if (prop == None)
        goto fail;
    res = XGetWindowProperty(x11priv->dpy, win, prop, 0, 0x6400, // 100k / 4
                             False, AnyPropertyType, ret_type,
                             ret_format, nitems, &bytes_left, &buff);
    if (res != Success || *ret_type == None || !buff)
        goto fail;
    switch (*ret_format) {
    case 8:
    case 16:
    case 32:
        break;
    default:
        goto fail;
    }
    if (bytes_left)
        FcitxLog(WARNING, "Selection is too long.");
    return buff;
fail:
    if (buff)
        XFree(buff);
    *nitems = 0;
    *ret_format = 0;
    *ret_type = None;
    return NULL;
}
开发者ID:farseerfc,项目名称:fcitx,代码行数:33,代码来源:x11selection.c


示例19: _fcitx_im_context_forward_key_cb

void _fcitx_im_context_forward_key_cb(DBusGProxy* proxy, guint keyval, guint state, gint type, void* user_data)
{
    FcitxLog(LOG_LEVEL, "_fcitx_im_context_forward_key_cb");
    ClutterIMContext* context =  CLUTTER_IM_CONTEXT(user_data);
    const char* signal_name;
    gboolean consumed = FALSE;
    FcitxKeyEventType tp = (FcitxKeyEventType) type;
    ClutterKeyEvent clutter_key_event;
    clutter_key_event.flags = 0;
    clutter_key_event.source = NULL;
    clutter_key_event.keyval = keyval;
    clutter_key_event.hardware_keycode = 0;
    clutter_key_event.unicode_value = 0;
    clutter_key_event.modifier_state = state;
    clutter_key_event.device = NULL;
    
    struct timeval current_time;
    gettimeofday(&current_time, NULL);
    clutter_key_event.time = current_time.tv_sec * 1000 + current_time.tv_usec / 1000;
    
    if (tp == FCITX_PRESS_KEY) {
        clutter_key_event.type = CLUTTER_KEY_PRESS;
        signal_name = "key-press-event";
    }
    else {
        clutter_key_event.type = CLUTTER_KEY_RELEASE;
        clutter_key_event.modifier_state |= CLUTTER_RELEASE_MASK;
        signal_name = "key-release-event";
    }
    clutter_key_event.modifier_state |= FcitxKeyState_IgnoredMask;
    clutter_key_event.stage = CLUTTER_STAGE (clutter_actor_get_stage(context->actor));
    
    g_signal_emit_by_name(context->actor, signal_name, &clutter_key_event, &consumed);
    
}
开发者ID:fcitx,项目名称:fcitx-clutter,代码行数:35,代码来源:fcitximcontext.c


示例20: FcitxUILoad

FCITX_EXPORT_API
void FcitxUILoad(FcitxInstance* instance)
{
    UT_array* addons = &instance->addons;
    FcitxAddon *addon;

    for (addon = (FcitxAddon *) utarray_front(addons);
            addon != NULL;
            addon = (FcitxAddon *) utarray_next(addons, addon)) {
        if (addon->bEnabled && addon->category == AC_UI) {
            if (FcitxUILoadInternal(instance, addon))
                instance->uinormal = addon;

            if (instance->uinormal != NULL)
                break;
        }
    }

    instance->ui = instance->uinormal;

    if (instance->ui == NULL) {
        FcitxLog(ERROR, "no usable user interface.");
        return;
    }

    if (addon->uifallback)
        instance->fallbackuiName = strdup(addon->uifallback);
}
开发者ID:hiroshiyui,项目名称:fcitx,代码行数:28,代码来源:ui.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ Fclose函数代码示例发布时间:2022-05-30
下一篇:
C++ FcitxInstanceGetInputState函数代码示例发布时间: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