forked from enlightenment/efl
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.
This commit is contained in:
parent
9d50d23e12
commit
000f5fee84
|
@ -332,6 +332,18 @@ enum
|
||||||
ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY_VARIATION_SIGNED_AND_DECIMAL /**< The number layout to allow decimal point and negative sign @since 1.8 */
|
ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY_VARIATION_SIGNED_AND_DECIMAL /**< The number layout to allow decimal point and negative sign @since 1.8 */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef Ecore_IMF_BiDi_Direction
|
||||||
|
* @brief Enumeration that defines the types of Ecore_IMF bidirectionality
|
||||||
|
* @since 1.12
|
||||||
|
*/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
ECORE_IMF_BIDI_DIRECTION_NEUTRAL, /**< The Neutral mode @since 1.12 */
|
||||||
|
ECORE_IMF_BIDI_DIRECTION_LTR, /**< The Left to Right mode @since 1.12 */
|
||||||
|
ECORE_IMF_BIDI_DIRECTION_RTL /**< The Right to Left mode @since 1.12 */
|
||||||
|
} Ecore_IMF_BiDi_Direction;
|
||||||
|
|
||||||
struct _Ecore_IMF_Event_Preedit_Start
|
struct _Ecore_IMF_Event_Preedit_Start
|
||||||
{
|
{
|
||||||
Ecore_IMF_Context *ctx;
|
Ecore_IMF_Context *ctx;
|
||||||
|
@ -535,6 +547,7 @@ struct _Ecore_IMF_Context_Class
|
||||||
void (*input_panel_language_locale_get) (Ecore_IMF_Context *ctx, char **lang);
|
void (*input_panel_language_locale_get) (Ecore_IMF_Context *ctx, char **lang);
|
||||||
void (*candidate_panel_geometry_get)(Ecore_IMF_Context *ctx, int *x, int *y, int *w, int *h);
|
void (*candidate_panel_geometry_get)(Ecore_IMF_Context *ctx, int *x, int *y, int *w, int *h);
|
||||||
void (*input_hint_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Hints input_hints);
|
void (*input_hint_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Hints input_hints);
|
||||||
|
void (*bidi_direction_set) (Ecore_IMF_Context *ctx, Ecore_IMF_BiDi_Direction direction);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Ecore_IMF_Context_Info
|
struct _Ecore_IMF_Context_Info
|
||||||
|
@ -1636,6 +1649,26 @@ EAPI void ecore_imf_context_input_panel_show_on_demand_
|
||||||
*/
|
*/
|
||||||
EAPI Eina_Bool ecore_imf_context_input_panel_show_on_demand_get(Ecore_IMF_Context *ctx);
|
EAPI Eina_Bool ecore_imf_context_input_panel_show_on_demand_get(Ecore_IMF_Context *ctx);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the bidirectionality at the current cursor position.
|
||||||
|
*
|
||||||
|
* @since 1.12.0
|
||||||
|
*
|
||||||
|
* @param[in] ctx An #Ecore_IMF_Context
|
||||||
|
* @param[in] direction the direction mode
|
||||||
|
*/
|
||||||
|
EAPI void ecore_imf_context_bidi_direction_set(Ecore_IMF_Context *ctx, Ecore_IMF_BiDi_Direction direction);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the bidirectionality at the current cursor position.
|
||||||
|
*
|
||||||
|
* @since 1.12.0
|
||||||
|
*
|
||||||
|
* @param[in] ctx An #Ecore_IMF_Context
|
||||||
|
* @return the direction mode
|
||||||
|
*/
|
||||||
|
EAPI Ecore_IMF_BiDi_Direction ecore_imf_context_bidi_direction_get(Ecore_IMF_Context *ctx);
|
||||||
|
|
||||||
/* The following entry points must be exported by each input method module
|
/* The following entry points must be exported by each input method module
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -167,6 +167,9 @@ ecore_imf_context_add(const char *id)
|
||||||
/* default input_mode is ECORE_IMF_INPUT_MODE_FULL, so let's make sure it's
|
/* default input_mode is ECORE_IMF_INPUT_MODE_FULL, so let's make sure it's
|
||||||
* set on the immodule */
|
* set on the immodule */
|
||||||
ecore_imf_context_input_mode_set(ctx, ECORE_IMF_INPUT_MODE_FULL);
|
ecore_imf_context_input_mode_set(ctx, ECORE_IMF_INPUT_MODE_FULL);
|
||||||
|
|
||||||
|
ecore_imf_context_bidi_direction_set(ctx, ECORE_IMF_BIDI_DIRECTION_NEUTRAL);
|
||||||
|
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1344,3 +1347,35 @@ ecore_imf_context_input_panel_show_on_demand_get(Ecore_IMF_Context *ctx)
|
||||||
return ctx->input_panel_show_on_demand;
|
return ctx->input_panel_show_on_demand;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
ecore_imf_context_bidi_direction_set(Ecore_IMF_Context *ctx, Ecore_IMF_BiDi_Direction direction)
|
||||||
|
{
|
||||||
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
||||||
|
"ecore_imf_context_bidi_direction_set");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctx->bidi_direction != direction)
|
||||||
|
{
|
||||||
|
if (ctx->klass->bidi_direction_set)
|
||||||
|
ctx->klass->bidi_direction_set(ctx, direction);
|
||||||
|
|
||||||
|
ctx->bidi_direction = direction;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI Ecore_IMF_BiDi_Direction
|
||||||
|
ecore_imf_context_bidi_direction_get(Ecore_IMF_Context *ctx)
|
||||||
|
{
|
||||||
|
if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
|
||||||
|
"ecore_imf_context_bidi_direction_get");
|
||||||
|
return ECORE_IMF_BIDI_DIRECTION_NEUTRAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ctx->bidi_direction;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ struct _Ecore_IMF_Context
|
||||||
Ecore_IMF_Input_Panel_Lang input_panel_lang;
|
Ecore_IMF_Input_Panel_Lang input_panel_lang;
|
||||||
Ecore_IMF_Input_Panel_Return_Key_Type input_panel_return_key_type;
|
Ecore_IMF_Input_Panel_Return_Key_Type input_panel_return_key_type;
|
||||||
Ecore_IMF_Input_Hints input_hints;
|
Ecore_IMF_Input_Hints input_hints;
|
||||||
|
Ecore_IMF_BiDi_Direction bidi_direction;
|
||||||
int input_panel_layout_variation;
|
int input_panel_layout_variation;
|
||||||
Eina_Bool (*retrieve_selection_func)(void *data, Ecore_IMF_Context *ctx, char **text);
|
Eina_Bool (*retrieve_selection_func)(void *data, Ecore_IMF_Context *ctx, char **text);
|
||||||
void *retrieve_selection_data;
|
void *retrieve_selection_data;
|
||||||
|
|
|
@ -2998,11 +2998,12 @@ _edje_entry_items_list(Edje_Real_Part *rp)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_edje_entry_cursor_geometry_get(Edje_Real_Part *rp, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch)
|
_edje_entry_cursor_geometry_get(Edje_Real_Part *rp, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch, Evas_BiDi_Direction *cdir)
|
||||||
{
|
{
|
||||||
Evas_Coord x, y, w, h, xx, yy, ww, hh;
|
Evas_Coord x, y, w, h, xx, yy, ww, hh;
|
||||||
Entry *en;
|
Entry *en;
|
||||||
Evas_Textblock_Cursor_Type cur_type;
|
Evas_Textblock_Cursor_Type cur_type;
|
||||||
|
Evas_BiDi_Direction dir;
|
||||||
|
|
||||||
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
||||||
(!rp->typedata.text)) return;
|
(!rp->typedata.text)) return;
|
||||||
|
@ -3022,7 +3023,7 @@ _edje_entry_cursor_geometry_get(Edje_Real_Part *rp, Evas_Coord *cx, Evas_Coord *
|
||||||
x = y = w = h = -1;
|
x = y = w = h = -1;
|
||||||
xx = yy = ww = hh = -1;
|
xx = yy = ww = hh = -1;
|
||||||
evas_object_geometry_get(rp->object, &x, &y, &w, &h);
|
evas_object_geometry_get(rp->object, &x, &y, &w, &h);
|
||||||
evas_textblock_cursor_geometry_get(en->cursor, &xx, &yy, &ww, &hh, NULL, cur_type);
|
evas_textblock_cursor_geometry_get(en->cursor, &xx, &yy, &ww, &hh, &dir, cur_type);
|
||||||
if (ww < 1) ww = 1;
|
if (ww < 1) ww = 1;
|
||||||
if (rp->part->cursor_mode == EDJE_ENTRY_CURSOR_MODE_BEFORE)
|
if (rp->part->cursor_mode == EDJE_ENTRY_CURSOR_MODE_BEFORE)
|
||||||
edje_object_size_min_restricted_calc(en->cursor_fg, &ww, NULL, ww, 0);
|
edje_object_size_min_restricted_calc(en->cursor_fg, &ww, NULL, ww, 0);
|
||||||
|
@ -3031,6 +3032,7 @@ _edje_entry_cursor_geometry_get(Edje_Real_Part *rp, Evas_Coord *cx, Evas_Coord *
|
||||||
if (cy) *cy = y + yy;
|
if (cy) *cy = y + yy;
|
||||||
if (cw) *cw = ww;
|
if (cw) *cw = ww;
|
||||||
if (ch) *ch = hh;
|
if (ch) *ch = hh;
|
||||||
|
if (cdir) *cdir = dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -3924,10 +3926,12 @@ _edje_entry_imf_cursor_location_set(Entry *en)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_ECORE_IMF
|
#ifdef HAVE_ECORE_IMF
|
||||||
Evas_Coord cx, cy, cw, ch;
|
Evas_Coord cx, cy, cw, ch;
|
||||||
|
Evas_BiDi_Direction dir;
|
||||||
if (!en || !en->rp || !en->imf_context) return;
|
if (!en || !en->rp || !en->imf_context) return;
|
||||||
|
|
||||||
_edje_entry_cursor_geometry_get(en->rp, &cx, &cy, &cw, &ch);
|
_edje_entry_cursor_geometry_get(en->rp, &cx, &cy, &cw, &ch, &dir);
|
||||||
ecore_imf_context_cursor_location_set(en->imf_context, cx, cy, cw, ch);
|
ecore_imf_context_cursor_location_set(en->imf_context, cx, cy, cw, ch);
|
||||||
|
ecore_imf_context_bidi_direction_set(en->imf_context, (Ecore_IMF_BiDi_Direction)dir);
|
||||||
#else
|
#else
|
||||||
(void) en;
|
(void) en;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2329,7 +2329,7 @@ const Eina_List *_edje_entry_anchor_geometry_get(Edje_Real_Part *rp, const char
|
||||||
const Eina_List *_edje_entry_anchors_list(Edje_Real_Part *rp);
|
const Eina_List *_edje_entry_anchors_list(Edje_Real_Part *rp);
|
||||||
Eina_Bool _edje_entry_item_geometry_get(Edje_Real_Part *rp, const char *item, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch);
|
Eina_Bool _edje_entry_item_geometry_get(Edje_Real_Part *rp, const char *item, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch);
|
||||||
const Eina_List *_edje_entry_items_list(Edje_Real_Part *rp);
|
const Eina_List *_edje_entry_items_list(Edje_Real_Part *rp);
|
||||||
void _edje_entry_cursor_geometry_get(Edje_Real_Part *rp, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch);
|
void _edje_entry_cursor_geometry_get(Edje_Real_Part *rp, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch, Evas_BiDi_Direction *cdir);
|
||||||
void _edje_entry_user_insert(Edje_Real_Part *rp, const char *text);
|
void _edje_entry_user_insert(Edje_Real_Part *rp, const char *text);
|
||||||
void _edje_entry_select_allow_set(Edje_Real_Part *rp, Eina_Bool allow);
|
void _edje_entry_select_allow_set(Edje_Real_Part *rp, Eina_Bool allow);
|
||||||
Eina_Bool _edje_entry_select_allow_get(const Edje_Real_Part *rp);
|
Eina_Bool _edje_entry_select_allow_get(const Edje_Real_Part *rp);
|
||||||
|
|
|
@ -1677,7 +1677,7 @@ _edje_object_part_text_cursor_geometry_get(Eo *obj EINA_UNUSED, Edje *ed, const
|
||||||
if (!rp) return;
|
if (!rp) return;
|
||||||
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
||||||
{
|
{
|
||||||
_edje_entry_cursor_geometry_get(rp, x, y, w, h);
|
_edje_entry_cursor_geometry_get(rp, x, y, w, h, NULL);
|
||||||
if (x) *x -= ed->x;
|
if (x) *x -= ed->x;
|
||||||
if (y) *y -= ed->y;
|
if (y) *y -= ed->y;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue