summaryrefslogtreecommitdiff
path: root/src/lib/ecore_imf
diff options
context:
space:
mode:
authorJihoon Kim <jihoon48.kim@samsung.com>2014-09-23 10:18:35 +0900
committerJihoon Kim <jihoon48.kim@samsung.com>2014-09-23 10:18:35 +0900
commit000f5fee84384423712cbb706d6da6aa2cd06007 (patch)
tree9e29623b6020296ebc696042ad56fd3d60da3c95 /src/lib/ecore_imf
parent9d50d23e12d3abc0a7ed96708f023f2d06531418 (diff)
ecore_imf: Add ecore_imf_context_bidi_direction_set/get API
Some Input Methods want to know the bidi direction (LTR/RTL) at the current cursor position.
Diffstat (limited to 'src/lib/ecore_imf')
-rw-r--r--src/lib/ecore_imf/Ecore_IMF.h33
-rw-r--r--src/lib/ecore_imf/ecore_imf_context.c35
-rw-r--r--src/lib/ecore_imf/ecore_imf_private.h1
3 files changed, 69 insertions, 0 deletions
diff --git a/src/lib/ecore_imf/Ecore_IMF.h b/src/lib/ecore_imf/Ecore_IMF.h
index 6d0719e667..1e4d276898 100644
--- a/src/lib/ecore_imf/Ecore_IMF.h
+++ b/src/lib/ecore_imf/Ecore_IMF.h
@@ -332,6 +332,18 @@ enum
332 ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY_VARIATION_SIGNED_AND_DECIMAL /**< The number layout to allow decimal point and negative sign @since 1.8 */ 332 ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY_VARIATION_SIGNED_AND_DECIMAL /**< The number layout to allow decimal point and negative sign @since 1.8 */
333}; 333};
334 334
335/**
336 * @typedef Ecore_IMF_BiDi_Direction
337 * @brief Enumeration that defines the types of Ecore_IMF bidirectionality
338 * @since 1.12
339 */
340typedef enum
341{
342 ECORE_IMF_BIDI_DIRECTION_NEUTRAL, /**< The Neutral mode @since 1.12 */
343 ECORE_IMF_BIDI_DIRECTION_LTR, /**< The Left to Right mode @since 1.12 */
344 ECORE_IMF_BIDI_DIRECTION_RTL /**< The Right to Left mode @since 1.12 */
345} Ecore_IMF_BiDi_Direction;
346
335struct _Ecore_IMF_Event_Preedit_Start 347struct _Ecore_IMF_Event_Preedit_Start
336{ 348{
337 Ecore_IMF_Context *ctx; 349 Ecore_IMF_Context *ctx;
@@ -535,6 +547,7 @@ struct _Ecore_IMF_Context_Class
535 void (*input_panel_language_locale_get) (Ecore_IMF_Context *ctx, char **lang); 547 void (*input_panel_language_locale_get) (Ecore_IMF_Context *ctx, char **lang);
536 void (*candidate_panel_geometry_get)(Ecore_IMF_Context *ctx, int *x, int *y, int *w, int *h); 548 void (*candidate_panel_geometry_get)(Ecore_IMF_Context *ctx, int *x, int *y, int *w, int *h);
537 void (*input_hint_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Hints input_hints); 549 void (*input_hint_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Hints input_hints);
550 void (*bidi_direction_set) (Ecore_IMF_Context *ctx, Ecore_IMF_BiDi_Direction direction);
538}; 551};
539 552
540struct _Ecore_IMF_Context_Info 553struct _Ecore_IMF_Context_Info
@@ -1636,6 +1649,26 @@ EAPI void ecore_imf_context_input_panel_show_on_demand_
1636 */ 1649 */
1637EAPI Eina_Bool ecore_imf_context_input_panel_show_on_demand_get(Ecore_IMF_Context *ctx); 1650EAPI Eina_Bool ecore_imf_context_input_panel_show_on_demand_get(Ecore_IMF_Context *ctx);
1638 1651
1652/**
1653 * @brief Sets the bidirectionality at the current cursor position.
1654 *
1655 * @since 1.12.0
1656 *
1657 * @param[in] ctx An #Ecore_IMF_Context
1658 * @param[in] direction the direction mode
1659 */
1660EAPI void ecore_imf_context_bidi_direction_set(Ecore_IMF_Context *ctx, Ecore_IMF_BiDi_Direction direction);
1661
1662/**
1663 * @brief Gets the bidirectionality at the current cursor position.
1664 *
1665 * @since 1.12.0
1666 *
1667 * @param[in] ctx An #Ecore_IMF_Context
1668 * @return the direction mode
1669 */
1670EAPI Ecore_IMF_BiDi_Direction ecore_imf_context_bidi_direction_get(Ecore_IMF_Context *ctx);
1671
1639/* The following entry points must be exported by each input method module 1672/* The following entry points must be exported by each input method module
1640 */ 1673 */
1641 1674
diff --git a/src/lib/ecore_imf/ecore_imf_context.c b/src/lib/ecore_imf/ecore_imf_context.c
index b301f3457e..b7142b19f4 100644
--- a/src/lib/ecore_imf/ecore_imf_context.c
+++ b/src/lib/ecore_imf/ecore_imf_context.c
@@ -167,6 +167,9 @@ ecore_imf_context_add(const char *id)
167 /* default input_mode is ECORE_IMF_INPUT_MODE_FULL, so let's make sure it's 167 /* default input_mode is ECORE_IMF_INPUT_MODE_FULL, so let's make sure it's
168 * set on the immodule */ 168 * set on the immodule */
169 ecore_imf_context_input_mode_set(ctx, ECORE_IMF_INPUT_MODE_FULL); 169 ecore_imf_context_input_mode_set(ctx, ECORE_IMF_INPUT_MODE_FULL);
170
171 ecore_imf_context_bidi_direction_set(ctx, ECORE_IMF_BIDI_DIRECTION_NEUTRAL);
172
170 return ctx; 173 return ctx;
171} 174}
172 175
@@ -1344,3 +1347,35 @@ ecore_imf_context_input_panel_show_on_demand_get(Ecore_IMF_Context *ctx)
1344 return ctx->input_panel_show_on_demand; 1347 return ctx->input_panel_show_on_demand;
1345} 1348}
1346 1349
1350EAPI void
1351ecore_imf_context_bidi_direction_set(Ecore_IMF_Context *ctx, Ecore_IMF_BiDi_Direction direction)
1352{
1353 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1354 {
1355 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1356 "ecore_imf_context_bidi_direction_set");
1357 return;
1358 }
1359
1360 if (ctx->bidi_direction != direction)
1361 {
1362 if (ctx->klass->bidi_direction_set)
1363 ctx->klass->bidi_direction_set(ctx, direction);
1364
1365 ctx->bidi_direction = direction;
1366 }
1367}
1368
1369EAPI Ecore_IMF_BiDi_Direction
1370ecore_imf_context_bidi_direction_get(Ecore_IMF_Context *ctx)
1371{
1372 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1373 {
1374 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1375 "ecore_imf_context_bidi_direction_get");
1376 return ECORE_IMF_BIDI_DIRECTION_NEUTRAL;
1377 }
1378
1379 return ctx->bidi_direction;
1380}
1381
diff --git a/src/lib/ecore_imf/ecore_imf_private.h b/src/lib/ecore_imf/ecore_imf_private.h
index b61d6b7b87..611db426e7 100644
--- a/src/lib/ecore_imf/ecore_imf_private.h
+++ b/src/lib/ecore_imf/ecore_imf_private.h
@@ -56,6 +56,7 @@ struct _Ecore_IMF_Context
56 Ecore_IMF_Input_Panel_Lang input_panel_lang; 56 Ecore_IMF_Input_Panel_Lang input_panel_lang;
57 Ecore_IMF_Input_Panel_Return_Key_Type input_panel_return_key_type; 57 Ecore_IMF_Input_Panel_Return_Key_Type input_panel_return_key_type;
58 Ecore_IMF_Input_Hints input_hints; 58 Ecore_IMF_Input_Hints input_hints;
59 Ecore_IMF_BiDi_Direction bidi_direction;
59 int input_panel_layout_variation; 60 int input_panel_layout_variation;
60 Eina_Bool (*retrieve_selection_func)(void *data, Ecore_IMF_Context *ctx, char **text); 61 Eina_Bool (*retrieve_selection_func)(void *data, Ecore_IMF_Context *ctx, char **text);
61 void *retrieve_selection_data; 62 void *retrieve_selection_data;