diff options
author | Jihoon Kim <jihoon48.kim@samsung.com> | 2017-09-15 16:18:15 +0900 |
---|---|---|
committer | Jihoon Kim <jihoon48.kim@samsung.com> | 2017-12-20 17:36:27 +0900 |
commit | 4262c33bfcf161769069d7ad32f018f565496565 (patch) | |
tree | e975297a9fe534e417daec96f51702abc609b683 /src/lib/ecore_imf/ecore_imf_context.c | |
parent | 9e8bd48e707e7855259f8480f76f85713406296a (diff) |
ecore_imf: Add prediction hint hash APIs
Change-Id: Id012fd172d3b15bfa3e9ea10c22216db10ba23b5
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
Diffstat (limited to 'src/lib/ecore_imf/ecore_imf_context.c')
-rw-r--r-- | src/lib/ecore_imf/ecore_imf_context.c | 63 |
1 files changed, 62 insertions, 1 deletions
diff --git a/src/lib/ecore_imf/ecore_imf_context.c b/src/lib/ecore_imf/ecore_imf_context.c index 1b34e0c01f..a04708fa8d 100644 --- a/src/lib/ecore_imf/ecore_imf_context.c +++ b/src/lib/ecore_imf/ecore_imf_context.c | |||
@@ -224,6 +224,9 @@ ecore_imf_context_del(Ecore_IMF_Context *ctx) | |||
224 | free(fn); | 224 | free(fn); |
225 | } | 225 | } |
226 | 226 | ||
227 | if (ctx->prediction_hint_hash) | ||
228 | eina_hash_free(ctx->prediction_hint_hash); | ||
229 | |||
227 | ECORE_MAGIC_SET(ctx, ECORE_MAGIC_NONE); | 230 | ECORE_MAGIC_SET(ctx, ECORE_MAGIC_NONE); |
228 | free(ctx); | 231 | free(ctx); |
229 | } | 232 | } |
@@ -1460,4 +1463,62 @@ ecore_imf_context_input_panel_position_set(Ecore_IMF_Context *ctx, int x, int y) | |||
1460 | 1463 | ||
1461 | if (ctx->klass->input_panel_position_set) | 1464 | if (ctx->klass->input_panel_position_set) |
1462 | ctx->klass->input_panel_position_set(ctx, x, y); | 1465 | ctx->klass->input_panel_position_set(ctx, x, y); |
1463 | } \ No newline at end of file | 1466 | } |
1467 | |||
1468 | static void | ||
1469 | _prediction_hint_hash_free_cb(void *data) | ||
1470 | { | ||
1471 | free(data); | ||
1472 | } | ||
1473 | |||
1474 | EAPI Eina_Bool | ||
1475 | ecore_imf_context_prediction_hint_hash_set(Ecore_IMF_Context *ctx, const char *key, const char *value) | ||
1476 | { | ||
1477 | if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) | ||
1478 | { | ||
1479 | ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, | ||
1480 | "ecore_imf_context_prediction_hint_hash_set"); | ||
1481 | return EINA_FALSE; | ||
1482 | } | ||
1483 | |||
1484 | if (!ctx->prediction_hint_hash) | ||
1485 | ctx->prediction_hint_hash = eina_hash_string_superfast_new(_prediction_hint_hash_free_cb); | ||
1486 | |||
1487 | if (!ctx->prediction_hint_hash) | ||
1488 | return EINA_FALSE; | ||
1489 | |||
1490 | char *old_value = eina_hash_set(ctx->prediction_hint_hash, key, value ? strdup(value) : strdup("")); | ||
1491 | if (old_value) | ||
1492 | free(old_value); | ||
1493 | |||
1494 | return EINA_TRUE; | ||
1495 | } | ||
1496 | |||
1497 | EAPI Eina_Bool | ||
1498 | ecore_imf_context_prediction_hint_hash_del(Ecore_IMF_Context *ctx, const char *key) | ||
1499 | { | ||
1500 | if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) | ||
1501 | { | ||
1502 | ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, | ||
1503 | "ecore_imf_context_prediction_hint_hash_del"); | ||
1504 | return EINA_FALSE; | ||
1505 | } | ||
1506 | |||
1507 | if (!ctx->prediction_hint_hash) | ||
1508 | return EINA_FALSE; | ||
1509 | |||
1510 | return eina_hash_del(ctx->prediction_hint_hash, key, NULL); | ||
1511 | } | ||
1512 | |||
1513 | EAPI const Eina_Hash * | ||
1514 | ecore_imf_context_prediction_hint_hash_get(Ecore_IMF_Context *ctx) | ||
1515 | { | ||
1516 | if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) | ||
1517 | { | ||
1518 | ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, | ||
1519 | "ecore_imf_context_prediction_hint_hash_get"); | ||
1520 | return NULL; | ||
1521 | } | ||
1522 | |||
1523 | return ctx->prediction_hint_hash; | ||
1524 | } | ||