2009-01-31 10:33:39 -08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2007-11-19 10:27:11 -08:00
|
|
|
#include <stdlib.h>
|
2009-01-31 10:33:39 -08:00
|
|
|
#include <string.h>
|
|
|
|
#include <locale.h>
|
2007-11-19 10:27:11 -08:00
|
|
|
|
2009-01-31 10:33:39 -08:00
|
|
|
#include <Ecore.h>
|
2009-03-10 15:44:36 -07:00
|
|
|
#include <ecore_private.h>
|
2007-11-19 10:27:11 -08:00
|
|
|
|
|
|
|
#include "Ecore_IMF.h"
|
|
|
|
#include "ecore_imf_private.h"
|
|
|
|
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
EAPI Eina_List *
|
2007-11-19 10:27:11 -08:00
|
|
|
ecore_imf_context_available_ids_get(void)
|
|
|
|
{
|
|
|
|
return ecore_imf_module_context_ids_get();
|
|
|
|
}
|
|
|
|
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
EAPI Eina_List *
|
2007-11-21 14:20:16 -08:00
|
|
|
ecore_imf_context_available_ids_by_canvas_type_get(const char *canvas_type)
|
|
|
|
{
|
|
|
|
return ecore_imf_module_context_ids_by_canvas_type_get(canvas_type);
|
|
|
|
}
|
|
|
|
|
2007-11-19 10:27:11 -08:00
|
|
|
/*
|
|
|
|
* Match @locale against @against.
|
|
|
|
*
|
|
|
|
* 'en_US' against 'en_US' => 4
|
|
|
|
* 'en_US' against 'en' => 3
|
|
|
|
* 'en', 'en_UK' against 'en_US' => 2
|
|
|
|
* all locales, against '*' => 1
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
_ecore_imf_context_match_locale(const char *locale, const char *against, int against_len)
|
|
|
|
{
|
2011-04-11 04:31:55 -07:00
|
|
|
if (strcmp(against, "*") == 0)
|
|
|
|
return 1;
|
2007-11-19 10:27:11 -08:00
|
|
|
|
2011-04-11 04:31:55 -07:00
|
|
|
if (strcasecmp(locale, against) == 0)
|
|
|
|
return 4;
|
2007-11-19 10:27:11 -08:00
|
|
|
|
2011-04-11 04:31:55 -07:00
|
|
|
if (strncasecmp(locale, against, 2) == 0)
|
|
|
|
return (against_len == 2) ? 3 : 2;
|
2007-11-19 10:27:11 -08:00
|
|
|
|
2011-04-11 04:31:55 -07:00
|
|
|
return 0;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const char *
|
|
|
|
ecore_imf_context_default_id_get(void)
|
2007-11-21 14:20:16 -08:00
|
|
|
{
|
|
|
|
return ecore_imf_context_default_id_by_canvas_type_get(NULL);
|
|
|
|
}
|
|
|
|
|
2007-11-22 03:57:01 -08:00
|
|
|
EAPI const char *
|
|
|
|
ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type)
|
2007-11-19 10:27:11 -08:00
|
|
|
{
|
|
|
|
const char *id;
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
Eina_List *modules;
|
2007-11-19 10:27:11 -08:00
|
|
|
Ecore_IMF_Module *module;
|
|
|
|
char *locale;
|
|
|
|
char *tmp;
|
|
|
|
int best_goodness = 0;
|
|
|
|
|
|
|
|
id = getenv("ECORE_IMF_MODULE");
|
2008-04-24 08:28:53 -07:00
|
|
|
if (id)
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
if (strcmp(id, "none") == 0) return NULL;
|
|
|
|
if (ecore_imf_module_get(id)) return id;
|
2008-04-24 08:28:53 -07:00
|
|
|
}
|
2007-11-19 10:27:11 -08:00
|
|
|
|
|
|
|
modules = ecore_imf_module_available_get();
|
|
|
|
if (!modules) return NULL;
|
|
|
|
|
|
|
|
locale = setlocale(LC_CTYPE, NULL);
|
|
|
|
if (!locale) return NULL;
|
|
|
|
|
|
|
|
locale = strdup(locale);
|
|
|
|
|
|
|
|
tmp = strchr(locale, '.');
|
|
|
|
if (tmp) *tmp = '\0';
|
|
|
|
tmp = strchr(locale, '@');
|
|
|
|
if (tmp) *tmp = '\0';
|
|
|
|
|
|
|
|
id = NULL;
|
|
|
|
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
EINA_LIST_FREE(modules, module)
|
2007-11-19 10:27:11 -08:00
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
if (canvas_type &&
|
|
|
|
strcmp(module->info->canvas_type, canvas_type) == 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
const char *p = module->info->default_locales;
|
|
|
|
while (p)
|
|
|
|
{
|
|
|
|
const char *q = strchr(p, ':');
|
|
|
|
int goodness = _ecore_imf_context_match_locale(locale, p, q ? (size_t)(q - p) : strlen (p));
|
|
|
|
|
2011-04-11 04:31:55 -07:00
|
|
|
if (goodness > best_goodness)
|
|
|
|
{
|
|
|
|
id = module->info->id;
|
|
|
|
best_goodness = goodness;
|
|
|
|
}
|
2010-09-30 00:31:11 -07:00
|
|
|
|
2011-04-11 04:31:55 -07:00
|
|
|
p = q ? q + 1 : NULL;
|
2010-09-30 00:31:11 -07:00
|
|
|
}
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
free(locale);
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const Ecore_IMF_Context_Info *
|
|
|
|
ecore_imf_context_info_by_id_get(const char *id)
|
|
|
|
{
|
|
|
|
Ecore_IMF_Module *module;
|
|
|
|
|
|
|
|
if (!id) return NULL;
|
|
|
|
module = ecore_imf_module_get(id);
|
|
|
|
if (!module) return NULL;
|
|
|
|
return module->info;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Ecore_IMF_Context *
|
|
|
|
ecore_imf_context_add(const char *id)
|
|
|
|
{
|
|
|
|
Ecore_IMF_Context *ctx;
|
|
|
|
|
|
|
|
if (!id) return NULL;
|
|
|
|
ctx = ecore_imf_module_context_create(id);
|
|
|
|
if (!ctx || !ctx->klass) return NULL;
|
|
|
|
if (ctx->klass->add) ctx->klass->add(ctx);
|
2010-09-29 02:29:36 -07:00
|
|
|
/* default use_preedit is EINA_TRUE, so let's make sure it's
|
2007-11-19 10:27:11 -08:00
|
|
|
* set on the immodule */
|
2010-09-29 02:29:36 -07:00
|
|
|
ecore_imf_context_use_preedit_set(ctx, EINA_TRUE);
|
2011-04-28 22:16:51 -07:00
|
|
|
|
|
|
|
/* default prediction is EINA_TRUE, so let's make sure it's
|
|
|
|
* set on the immodule */
|
|
|
|
ecore_imf_context_prediction_allow_set(ctx, EINA_TRUE);
|
|
|
|
|
|
|
|
/* default autocapital type is SENTENCE type, so let's make sure it's
|
|
|
|
* set on the immodule */
|
|
|
|
ecore_imf_context_autocapital_type_set(ctx, ECORE_IMF_AUTOCAPITAL_TYPE_SENTENCE);
|
|
|
|
|
2011-06-20 00:17:24 -07:00
|
|
|
/* default input panel enabled status is EINA_TRUE, so let's make sure it's
|
|
|
|
* set on the immodule */
|
|
|
|
ecore_imf_context_input_panel_enabled_set(ctx, EINA_TRUE);
|
|
|
|
|
2012-02-06 00:05:58 -08:00
|
|
|
/* default input panel layout type is NORMAL type, so let's make sure it's
|
|
|
|
* set on the immodule */
|
|
|
|
ecore_imf_context_input_panel_layout_set(ctx, ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL);
|
|
|
|
|
2007-11-19 10:27:11 -08:00
|
|
|
/* default input_mode is ECORE_IMF_INPUT_MODE_FULL, so let's make sure it's
|
|
|
|
* set on the immodule */
|
|
|
|
ecore_imf_context_input_mode_set(ctx, ECORE_IMF_INPUT_MODE_FULL);
|
|
|
|
return ctx;
|
|
|
|
}
|
|
|
|
|
2007-11-21 14:20:16 -08:00
|
|
|
EAPI const Ecore_IMF_Context_Info *
|
|
|
|
ecore_imf_context_info_get(Ecore_IMF_Context *ctx)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_info_get");
|
|
|
|
return NULL;
|
2007-11-21 14:20:16 -08:00
|
|
|
}
|
|
|
|
return ctx->module->info;
|
|
|
|
}
|
|
|
|
|
2007-11-19 10:27:11 -08:00
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_del(Ecore_IMF_Context *ctx)
|
|
|
|
{
|
2012-01-17 20:38:04 -08:00
|
|
|
Ecore_IMF_Func_Node *fn;
|
|
|
|
|
2007-11-19 10:27:11 -08:00
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_del");
|
|
|
|
return;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
if (ctx->klass->del) ctx->klass->del(ctx);
|
2012-01-17 20:38:04 -08:00
|
|
|
|
|
|
|
if (ctx->callbacks)
|
|
|
|
{
|
|
|
|
EINA_LIST_FREE(ctx->callbacks, fn)
|
|
|
|
free(fn);
|
|
|
|
}
|
|
|
|
|
2007-11-19 10:27:11 -08:00
|
|
|
ECORE_MAGIC_SET(ctx, ECORE_MAGIC_NONE);
|
|
|
|
free(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2007-11-21 14:20:16 -08:00
|
|
|
ecore_imf_context_client_window_set(Ecore_IMF_Context *ctx, void *window)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_client_window_set");
|
|
|
|
return;
|
2007-11-21 14:20:16 -08:00
|
|
|
}
|
|
|
|
if (ctx->klass->client_window_set) ctx->klass->client_window_set(ctx, window);
|
2011-02-20 22:22:37 -08:00
|
|
|
ctx->window = window;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void *
|
|
|
|
ecore_imf_context_client_window_get(Ecore_IMF_Context *ctx)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_client_window_get");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return ctx->window;
|
2007-11-21 14:20:16 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas)
|
2007-11-19 10:27:11 -08:00
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_client_canvas_set");
|
|
|
|
return;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
2007-11-21 14:20:16 -08:00
|
|
|
if (ctx->klass->client_canvas_set) ctx->klass->client_canvas_set(ctx, canvas);
|
2011-02-20 22:22:37 -08:00
|
|
|
ctx->client_canvas = canvas;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void *
|
|
|
|
ecore_imf_context_client_canvas_get(Ecore_IMF_Context *ctx)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_client_canvas_get");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return ctx->client_canvas;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_show(Ecore_IMF_Context *ctx)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_show");
|
|
|
|
return;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
if (ctx->klass->show) ctx->klass->show(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_hide(Ecore_IMF_Context *ctx)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_hide");
|
|
|
|
return;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
if (ctx->klass->hide) ctx->klass->hide(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char **str, int *cursor_pos)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_preedit_string_get");
|
|
|
|
return;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
if (ctx->klass->preedit_string_get)
|
|
|
|
ctx->klass->preedit_string_get(ctx, str, cursor_pos);
|
|
|
|
else
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
if (str) *str = strdup("");
|
|
|
|
if (cursor_pos) *cursor_pos = 0;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-27 03:20:35 -08:00
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, char **str, Eina_List **attrs, int *cursor_pos)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_preedit_string_with_attributes_get");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (ctx->klass->preedit_string_with_attributes_get)
|
|
|
|
ctx->klass->preedit_string_with_attributes_get(ctx, str, attrs, cursor_pos);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (str) *str = strdup("");
|
|
|
|
if (attrs) *attrs = NULL;
|
|
|
|
if (cursor_pos) *cursor_pos = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-11-19 10:27:11 -08:00
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_focus_in(Ecore_IMF_Context *ctx)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_focus_in");
|
|
|
|
return;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
if (ctx->klass->focus_in) ctx->klass->focus_in(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_focus_out(Ecore_IMF_Context *ctx)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_focus_out");
|
|
|
|
return;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
if (ctx->klass->focus_out) ctx->klass->focus_out(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_reset(Ecore_IMF_Context *ctx)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_reset");
|
|
|
|
return;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
if (ctx->klass->reset) ctx->klass->reset(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_cursor_position_set");
|
|
|
|
return;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
if (ctx->klass->cursor_position_set) ctx->klass->cursor_position_set(ctx, cursor_pos);
|
|
|
|
}
|
|
|
|
|
2011-07-06 23:23:46 -07:00
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_cursor_location_set(Ecore_IMF_Context *ctx, int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
2011-07-07 02:37:55 -07:00
|
|
|
"ecore_imf_context_cursor_location_set");
|
2011-07-06 23:23:46 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (ctx->klass->cursor_location_set) ctx->klass->cursor_location_set(ctx, x, y, w, h);
|
|
|
|
}
|
|
|
|
|
2007-11-19 10:27:11 -08:00
|
|
|
EAPI void
|
2010-09-29 02:29:36 -07:00
|
|
|
ecore_imf_context_use_preedit_set(Ecore_IMF_Context *ctx, Eina_Bool use_preedit)
|
2007-11-19 10:27:11 -08:00
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_use_preedit_set");
|
|
|
|
return;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
if (ctx->klass->use_preedit_set) ctx->klass->use_preedit_set(ctx, use_preedit);
|
|
|
|
}
|
|
|
|
|
2011-04-28 22:16:51 -07:00
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_prediction_allow_set(Ecore_IMF_Context *ctx, Eina_Bool prediction)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_prediction_allow_set");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx->allow_prediction = prediction;
|
|
|
|
|
|
|
|
if (ctx->klass->prediction_allow_set)
|
|
|
|
ctx->klass->prediction_allow_set(ctx, prediction);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
ecore_imf_context_prediction_allow_get(Ecore_IMF_Context *ctx)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_prediction_allow_get");
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ctx->allow_prediction;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_autocapital_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Autocapital_Type autocapital_type)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_autocapital_type_set");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx->autocapital_type = autocapital_type;
|
|
|
|
|
|
|
|
if (ctx->klass->autocapital_type_set) ctx->klass->autocapital_type_set(ctx, autocapital_type);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Ecore_IMF_Autocapital_Type
|
|
|
|
ecore_imf_context_autocapital_type_get(Ecore_IMF_Context *ctx)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_autocapital_allow_get");
|
|
|
|
return ECORE_IMF_AUTOCAPITAL_TYPE_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ctx->autocapital_type;
|
|
|
|
}
|
|
|
|
|
2007-11-19 10:27:11 -08:00
|
|
|
EAPI void
|
2010-09-25 22:42:56 -07:00
|
|
|
ecore_imf_context_retrieve_surrounding_callback_set(Ecore_IMF_Context *ctx, Eina_Bool (*func)(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos), const void *data)
|
2007-11-19 10:27:11 -08:00
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_retrieve_surrounding_callback_set");
|
|
|
|
return;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
ctx->retrieve_surrounding_func = func;
|
|
|
|
ctx->retrieve_surrounding_data = (void *) data;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_input_mode_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_input_mode_set");
|
|
|
|
return;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
if (ctx->klass->input_mode_set) ctx->klass->input_mode_set(ctx, input_mode);
|
|
|
|
ctx->input_mode = input_mode;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Ecore_IMF_Input_Mode
|
|
|
|
ecore_imf_context_input_mode_get(Ecore_IMF_Context *ctx)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_input_mode_set");
|
|
|
|
return 0;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
return ctx->input_mode;
|
|
|
|
}
|
|
|
|
|
2010-09-25 22:42:56 -07:00
|
|
|
EAPI Eina_Bool
|
2007-11-21 14:20:16 -08:00
|
|
|
ecore_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event)
|
2007-11-19 10:27:11 -08:00
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_filter_event");
|
|
|
|
return EINA_FALSE;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
2007-11-21 14:20:16 -08:00
|
|
|
if (ctx->klass->filter_event) return ctx->klass->filter_event(ctx, type, event);
|
2010-09-25 22:42:56 -07:00
|
|
|
return EINA_FALSE;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Ecore_IMF_Context *
|
|
|
|
ecore_imf_context_new(const Ecore_IMF_Context_Class *ctxc)
|
|
|
|
{
|
|
|
|
Ecore_IMF_Context *ctx;
|
|
|
|
|
2008-05-02 08:33:50 -07:00
|
|
|
if (!ctxc) return NULL;
|
2010-09-29 03:55:40 -07:00
|
|
|
ctx = calloc(1, sizeof(Ecore_IMF_Context));
|
2007-11-19 10:27:11 -08:00
|
|
|
if (!ctx) return NULL;
|
|
|
|
ECORE_MAGIC_SET(ctx, ECORE_MAGIC_CONTEXT);
|
|
|
|
ctx->klass = ctxc;
|
|
|
|
ctx->data = NULL;
|
|
|
|
ctx->retrieve_surrounding_func = NULL;
|
|
|
|
ctx->retrieve_surrounding_data = NULL;
|
|
|
|
return ctx;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_data_set(Ecore_IMF_Context *ctx, void *data)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_data_set");
|
|
|
|
return;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
ctx->data = data;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void *ecore_imf_context_data_get(Ecore_IMF_Context *ctx)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_data_get");
|
|
|
|
return NULL;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
return ctx->data;
|
|
|
|
}
|
|
|
|
|
2010-09-25 22:42:56 -07:00
|
|
|
EAPI Eina_Bool
|
2007-11-19 10:27:11 -08:00
|
|
|
ecore_imf_context_surrounding_get(Ecore_IMF_Context *ctx, char **text, int *cursor_pos)
|
|
|
|
{
|
2010-09-25 22:42:56 -07:00
|
|
|
int result = EINA_FALSE;
|
2007-11-19 10:27:11 -08:00
|
|
|
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_surrounding_get");
|
|
|
|
return EINA_FALSE;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ctx->retrieve_surrounding_func)
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
result = ctx->retrieve_surrounding_func(ctx->retrieve_surrounding_data, ctx, text, cursor_pos);
|
|
|
|
if (!result)
|
|
|
|
{
|
|
|
|
if (text) *text = NULL;
|
|
|
|
if (cursor_pos) *cursor_pos = 0;
|
|
|
|
}
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-11-25 01:55:32 -08:00
|
|
|
_ecore_imf_event_free_preedit(void *data EINA_UNUSED, void *event)
|
2007-11-19 10:27:11 -08:00
|
|
|
{
|
|
|
|
free(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_preedit_start_event_add(Ecore_IMF_Context *ctx)
|
|
|
|
{
|
|
|
|
Ecore_IMF_Event_Commit *ev;
|
|
|
|
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_preedit_start_event_add");
|
|
|
|
return;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
ev = malloc(sizeof(Ecore_IMF_Event_Preedit_Start));
|
|
|
|
ev->ctx = ctx;
|
|
|
|
ecore_event_add(ECORE_IMF_EVENT_PREEDIT_START,
|
2010-09-30 00:31:11 -07:00
|
|
|
ev, _ecore_imf_event_free_preedit, NULL);
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_preedit_end_event_add(Ecore_IMF_Context *ctx)
|
|
|
|
{
|
|
|
|
Ecore_IMF_Event_Commit *ev;
|
|
|
|
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_preedit_end_event_add");
|
|
|
|
return;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
ev = malloc(sizeof(Ecore_IMF_Event_Preedit_End));
|
|
|
|
ev->ctx = ctx;
|
|
|
|
ecore_event_add(ECORE_IMF_EVENT_PREEDIT_END,
|
2010-09-30 00:31:11 -07:00
|
|
|
ev, _ecore_imf_event_free_preedit, NULL);
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_preedit_changed_event_add(Ecore_IMF_Context *ctx)
|
|
|
|
{
|
|
|
|
Ecore_IMF_Event_Commit *ev;
|
|
|
|
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_preedit_changed_event_add");
|
|
|
|
return;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
ev = malloc(sizeof(Ecore_IMF_Event_Preedit_Changed));
|
|
|
|
ev->ctx = ctx;
|
|
|
|
ecore_event_add(ECORE_IMF_EVENT_PREEDIT_CHANGED,
|
2010-09-30 00:31:11 -07:00
|
|
|
ev, _ecore_imf_event_free_preedit, NULL);
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-11-25 01:55:32 -08:00
|
|
|
_ecore_imf_event_free_commit(void *data EINA_UNUSED, void *event)
|
2007-11-19 10:27:11 -08:00
|
|
|
{
|
|
|
|
Ecore_IMF_Event_Commit *ev;
|
|
|
|
|
|
|
|
ev = event;
|
|
|
|
if (ev->str) free(ev->str);
|
|
|
|
free(ev);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_commit_event_add(Ecore_IMF_Context *ctx, const char *str)
|
|
|
|
{
|
|
|
|
Ecore_IMF_Event_Commit *ev;
|
|
|
|
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_commit_event_add");
|
|
|
|
return;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
ev = malloc(sizeof(Ecore_IMF_Event_Commit));
|
|
|
|
ev->ctx = ctx;
|
|
|
|
ev->str = str ? strdup(str) : NULL;
|
|
|
|
ecore_event_add(ECORE_IMF_EVENT_COMMIT,
|
2010-09-30 00:31:11 -07:00
|
|
|
ev, _ecore_imf_event_free_commit, NULL);
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-11-25 01:55:32 -08:00
|
|
|
_ecore_imf_event_free_delete_surrounding(void *data EINA_UNUSED, void *event)
|
2007-11-19 10:27:11 -08:00
|
|
|
{
|
|
|
|
free(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_delete_surrounding_event_add(Ecore_IMF_Context *ctx, int offset, int n_chars)
|
|
|
|
{
|
|
|
|
Ecore_IMF_Event_Delete_Surrounding *ev;
|
|
|
|
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
2010-09-30 00:31:11 -07:00
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_delete_surrounding_event_add");
|
|
|
|
return;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
ev = malloc(sizeof(Ecore_IMF_Event_Delete_Surrounding));
|
|
|
|
ev->ctx = ctx;
|
|
|
|
ev->offset = offset;
|
|
|
|
ev->n_chars = n_chars;
|
2007-12-12 11:00:48 -08:00
|
|
|
ecore_event_add(ECORE_IMF_EVENT_DELETE_SURROUNDING,
|
2010-09-30 00:31:11 -07:00
|
|
|
ev, _ecore_imf_event_free_delete_surrounding, NULL);
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
2011-06-02 00:56:58 -07:00
|
|
|
|
2012-01-17 20:38:04 -08:00
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_event_callback_add(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, Ecore_IMF_Event_Cb func, const void *data)
|
|
|
|
{
|
|
|
|
Ecore_IMF_Func_Node *fn = NULL;
|
|
|
|
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_event_callback_add");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!func) return;
|
|
|
|
|
|
|
|
fn = calloc(1, sizeof (Ecore_IMF_Func_Node));
|
|
|
|
if (!fn) return;
|
|
|
|
|
|
|
|
fn->func = func;
|
|
|
|
fn->data = data;
|
|
|
|
fn->type = type;
|
|
|
|
|
|
|
|
ctx->callbacks = eina_list_append(ctx->callbacks, fn);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void *
|
|
|
|
ecore_imf_context_event_callback_del(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, Ecore_IMF_Event_Cb func)
|
|
|
|
{
|
|
|
|
Eina_List *l = NULL;
|
|
|
|
Eina_List *l_next = NULL;
|
|
|
|
Ecore_IMF_Func_Node *fn = NULL;
|
|
|
|
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_event_callback_del");
|
2012-01-29 05:39:07 -08:00
|
|
|
return NULL;
|
2012-01-17 20:38:04 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!func) return NULL;
|
|
|
|
if (!ctx->callbacks) return NULL;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH_SAFE(ctx->callbacks, l, l_next, fn)
|
|
|
|
{
|
|
|
|
if ((fn) && (fn->func == func) && (fn->type == type))
|
|
|
|
{
|
2012-01-29 05:39:07 -08:00
|
|
|
void *tmp = (void *)fn->data;
|
2012-01-17 20:38:04 -08:00
|
|
|
free(fn);
|
|
|
|
ctx->callbacks = eina_list_remove_list(ctx->callbacks, l);
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_event_callback_call(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, void *event_info)
|
|
|
|
{
|
|
|
|
Ecore_IMF_Func_Node *fn = NULL;
|
|
|
|
Eina_List *l = NULL;
|
|
|
|
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_event_callback_call");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ctx->callbacks, l, fn)
|
|
|
|
{
|
|
|
|
if ((fn) && (fn->type == type) && (fn->func))
|
|
|
|
fn->func(fn->data, ctx, event_info);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-02 00:56:58 -07:00
|
|
|
EAPI void
|
2012-02-08 19:53:03 -08:00
|
|
|
ecore_imf_context_control_panel_show(Ecore_IMF_Context *ctx)
|
2011-06-02 00:56:58 -07:00
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_control_panel_show");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ctx->klass->control_panel_show) ctx->klass->control_panel_show(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-02-08 19:53:03 -08:00
|
|
|
ecore_imf_context_control_panel_hide(Ecore_IMF_Context *ctx)
|
2011-06-02 00:56:58 -07:00
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_control_panel_hide");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ctx->klass->control_panel_hide) ctx->klass->control_panel_hide(ctx);
|
|
|
|
}
|
|
|
|
|
2011-07-07 04:55:05 -07:00
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_input_panel_show(Ecore_IMF_Context *ctx)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_input_panel_show");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ctx->klass->show) ctx->klass->show(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_input_panel_hide(Ecore_IMF_Context *ctx)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_input_panel_hide");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ctx->klass->hide) ctx->klass->hide(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-02-08 19:53:03 -08:00
|
|
|
ecore_imf_context_input_panel_layout_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Layout layout)
|
2011-07-07 04:55:05 -07:00
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_input_panel_layout_set");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ctx->klass->input_panel_layout_set)
|
|
|
|
ctx->klass->input_panel_layout_set(ctx, layout);
|
|
|
|
|
|
|
|
ctx->input_panel_layout = layout;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Ecore_IMF_Input_Panel_Layout
|
2012-02-08 19:53:03 -08:00
|
|
|
ecore_imf_context_input_panel_layout_get(Ecore_IMF_Context *ctx)
|
2011-07-07 04:55:05 -07:00
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_input_panel_layout_get");
|
|
|
|
return ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ctx->klass->input_panel_layout_get)
|
2012-02-08 19:53:03 -08:00
|
|
|
return ctx->input_panel_layout;
|
2011-07-07 04:55:05 -07:00
|
|
|
else
|
|
|
|
return ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID;
|
|
|
|
}
|
|
|
|
|
2011-06-02 00:56:58 -07:00
|
|
|
EAPI void
|
2012-02-08 19:53:03 -08:00
|
|
|
ecore_imf_context_input_panel_language_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang)
|
2011-06-02 00:56:58 -07:00
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_input_panel_language_set");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ctx->klass->input_panel_language_set) ctx->klass->input_panel_language_set(ctx, lang);
|
|
|
|
ctx->input_panel_lang = lang;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Ecore_IMF_Input_Panel_Lang
|
2012-02-08 19:53:03 -08:00
|
|
|
ecore_imf_context_input_panel_language_get(Ecore_IMF_Context *ctx)
|
2011-06-02 00:56:58 -07:00
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_input_panel_language_get");
|
|
|
|
return ECORE_IMF_INPUT_PANEL_LANG_AUTOMATIC;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ctx->input_panel_lang;
|
|
|
|
}
|
|
|
|
|
2011-06-20 00:17:24 -07:00
|
|
|
EAPI void
|
2012-02-08 19:53:03 -08:00
|
|
|
ecore_imf_context_input_panel_enabled_set(Ecore_IMF_Context *ctx,
|
2011-06-20 00:17:24 -07:00
|
|
|
Eina_Bool enabled)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_input_panel_enabled_set");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx->input_panel_enabled = enabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2012-02-08 19:53:03 -08:00
|
|
|
ecore_imf_context_input_panel_enabled_get(Ecore_IMF_Context *ctx)
|
2011-06-20 00:17:24 -07:00
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_input_panel_enabled_get");
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ctx->input_panel_enabled;
|
|
|
|
}
|
|
|
|
|
2012-02-06 01:46:38 -08:00
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_input_panel_imdata_set(Ecore_IMF_Context *ctx, const void *data, int len)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_input_panel_imdata_set");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!data) return;
|
|
|
|
|
|
|
|
if (ctx->klass->input_panel_imdata_set)
|
|
|
|
ctx->klass->input_panel_imdata_set(ctx, data, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_input_panel_imdata_get(Ecore_IMF_Context *ctx, void *data, int *len)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_input_panel_imdata_get");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!data) return;
|
|
|
|
|
|
|
|
if (ctx->klass->input_panel_imdata_get)
|
|
|
|
ctx->klass->input_panel_imdata_get(ctx, data, len);
|
|
|
|
}
|
2012-02-14 17:22:28 -08:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_input_panel_return_key_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Return_Key_Type return_key_type)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_input_panel_return_key_type_set");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx->input_panel_return_key_type = return_key_type;
|
|
|
|
if (ctx->klass->input_panel_return_key_type_set) ctx->klass->input_panel_return_key_type_set(ctx, return_key_type);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Ecore_IMF_Input_Panel_Return_Key_Type
|
|
|
|
ecore_imf_context_input_panel_return_key_type_get(Ecore_IMF_Context *ctx)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_input_panel_return_key_type_get");
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ctx->input_panel_return_key_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_input_panel_return_key_disabled_set(Ecore_IMF_Context *ctx, Eina_Bool disabled)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_input_panel_return_key_disabled_set");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx->input_panel_return_key_disabled = disabled;
|
|
|
|
if (ctx->klass->input_panel_return_key_disabled_set) ctx->klass->input_panel_return_key_disabled_set(ctx, disabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
ecore_imf_context_input_panel_return_key_disabled_get(Ecore_IMF_Context *ctx)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_input_panel_return_key_disabled_get");
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ctx->input_panel_return_key_disabled;
|
|
|
|
}
|
2012-02-28 20:37:33 -08:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_input_panel_caps_lock_mode_set(Ecore_IMF_Context *ctx, Eina_Bool mode)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_input_panel_caps_lock_mode_set");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ctx->klass->input_panel_caps_lock_mode_set)
|
|
|
|
ctx->klass->input_panel_caps_lock_mode_set(ctx, mode);
|
|
|
|
|
|
|
|
ctx->input_panel_caps_lock_mode = mode;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
ecore_imf_context_input_panel_caps_lock_mode_get(Ecore_IMF_Context *ctx)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_input_panel_caps_lock_mode_get");
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ctx->input_panel_caps_lock_mode;
|
|
|
|
}
|
|
|
|
|
2012-07-03 00:39:08 -07:00
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_input_panel_geometry_get(Ecore_IMF_Context *ctx, int *x, int *y, int *w, int *h)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_input_panel_geometry_get");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ctx->klass->input_panel_geometry_get)
|
|
|
|
ctx->klass->input_panel_geometry_get(ctx, x, y, w, h);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Ecore_IMF_Input_Panel_State
|
|
|
|
ecore_imf_context_input_panel_state_get(Ecore_IMF_Context *ctx)
|
|
|
|
{
|
|
|
|
Ecore_IMF_Input_Panel_State state = ECORE_IMF_INPUT_PANEL_STATE_HIDE;
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_input_panel_state_get");
|
|
|
|
return ECORE_IMF_INPUT_PANEL_STATE_HIDE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ctx->klass->input_panel_state_get)
|
|
|
|
state = ctx->klass->input_panel_state_get(ctx);
|
|
|
|
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_input_panel_event_callback_add(Ecore_IMF_Context *ctx,
|
|
|
|
Ecore_IMF_Input_Panel_Event type,
|
|
|
|
void (*func) (void *data, Ecore_IMF_Context *ctx, int value),
|
|
|
|
const void *data)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_input_panel_event_callback_add");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ctx->klass->input_panel_event_callback_add)
|
|
|
|
ctx->klass->input_panel_event_callback_add(ctx, type, func, (void *)data);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_input_panel_event_callback_del(Ecore_IMF_Context *ctx,
|
|
|
|
Ecore_IMF_Input_Panel_Event type,
|
|
|
|
void (*func) (void *data, Ecore_IMF_Context *ctx, int value))
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_input_panel_event_callback_del");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ctx->klass->input_panel_event_callback_del)
|
|
|
|
ctx->klass->input_panel_event_callback_del(ctx, type, func);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_input_panel_language_locale_get(Ecore_IMF_Context *ctx, char **lang)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_input_panel_language_locale_get");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ctx->klass->input_panel_language_locale_get)
|
|
|
|
ctx->klass->input_panel_language_locale_get(ctx, lang);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (lang) *lang = strdup("");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_imf_context_candidate_panel_geometry_get(Ecore_IMF_Context *ctx, int *x, int *y, int *w, int *h)
|
|
|
|
{
|
|
|
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
|
|
|
{
|
|
|
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
|
|
|
"ecore_imf_context_candidate_panel_geometry_get");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ctx->klass->candidate_panel_geometry_get)
|
|
|
|
ctx->klass->candidate_panel_geometry_get(ctx, x, y, w, h);
|
|
|
|
}
|
|
|
|
|