Some Input Methods want to know the bidi direction (LTR/RTL) at the current cursor position.
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
{
Ecore_IMF_Context *ctx;
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 (*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
*/
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
*/
/* 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);
+
+ ecore_imf_context_bidi_direction_set(ctx, ECORE_IMF_BIDI_DIRECTION_NEUTRAL);
+
return ctx;
}
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;
+}
+
Ecore_IMF_Input_Panel_Lang input_panel_lang;
Ecore_IMF_Input_Panel_Return_Key_Type input_panel_return_key_type;
Ecore_IMF_Input_Hints input_hints;
+ Ecore_IMF_BiDi_Direction bidi_direction;
int input_panel_layout_variation;
Eina_Bool (*retrieve_selection_func)(void *data, Ecore_IMF_Context *ctx, char **text);
void *retrieve_selection_data;
}
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;
Entry *en;
Evas_Textblock_Cursor_Type cur_type;
+ Evas_BiDi_Direction dir;
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
(!rp->typedata.text)) return;
x = y = w = h = -1;
xx = yy = ww = hh = -1;
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 (rp->part->cursor_mode == EDJE_ENTRY_CURSOR_MODE_BEFORE)
edje_object_size_min_restricted_calc(en->cursor_fg, &ww, NULL, ww, 0);
if (cy) *cy = y + yy;
if (cw) *cw = ww;
if (ch) *ch = hh;
+ if (cdir) *cdir = dir;
}
void
{
#ifdef HAVE_ECORE_IMF
Evas_Coord cx, cy, cw, ch;
+ Evas_BiDi_Direction dir;
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_bidi_direction_set(en->imf_context, (Ecore_IMF_BiDi_Direction)dir);
#else
(void) en;
#endif
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);
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_select_allow_set(Edje_Real_Part *rp, Eina_Bool allow);
Eina_Bool _edje_entry_select_allow_get(const Edje_Real_Part *rp);
if (!rp) return;
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 (y) *y -= ed->y;
}