From: Jihoon Kim Date: Wed, 19 May 2010 07:05:04 +0000 (+0900) Subject: merge entry related to input framework X-Git-Tag: beat-winset-test_0.1.1-40~300^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8cbdb39ffb7dcbd0269ef0f6aec87b23d4c8275e;p=framework%2Fuifw%2Felementary.git merge entry related to input framework --- diff --git a/configure.ac b/configure.ac index 26748a7..253742a 100644 --- a/configure.ac +++ b/configure.ac @@ -391,6 +391,35 @@ if test "x$want_elementary_ethumb" = "xyes" -a "x$have_elementary_ethumb" = "xno fi AC_SUBST(ELM_ETHUMB_DEF) +ELM_IMF_DEF="#undef" +have_elementary_imf="no" +want_elementary_imf="auto" +AC_ARG_ENABLE([imf], + [AC_HELP_STRING([--disable-imf], [disable imf support. @<:@default=detect@:>@])], + [want_elementary_imf=$enableval], []) + +if test "x$want_elementary_imf" != "xno"; then + PKG_CHECK_MODULES([ELEMENTARY_IMF], + [ + ecore-imf + ], + [ + AC_DEFINE(HAVE_ELEMENTARY_IMF, 1, [Input Method Framework support for Elementary]) + have_elementary_imf="yes" + ELM_IMF_DEF="#define" + requirement_elm="ecore-imf ${requirement_elm}" + ], + [have_elementary_imf="no"] + ) +else + have_elementary_imf="no" +fi +if test "x$want_elementary_imf" = "xyes" -a "x$have_elementary_imf" = "xno"; then + AC_MSG_ERROR([IMF support requested, but no ecore-imf found by pkg-config.]) +fi +AC_SUBST(ELM_IMF_DEF) + + ELM_ALLOCA_H_DEF="#undef" AC_CHECK_HEADER(alloca.h, [ELM_ALLOCA_H_DEF="#define"]) AC_SUBST(ELM_ALLOCA_H_DEF) @@ -465,6 +494,7 @@ echo " EDBus..............: ${have_elementary_edbus}" echo " EFreet.............: ${have_elementary_efreet}" echo " EWeather...........: ${have_elementary_eweather}" echo " Ethumb.............: ${have_elementary_ethumb}" +echo " IMF................: ${have_elementary_imf}" echo echo " edje_cc..............: ${edje_cc}" echo diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index 05fdec5..643e7d3 100755 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -18,6 +18,7 @@ @ELM_EDBUS_DEF@ ELM_EDBUS @ELM_EFREET_DEF@ ELM_EFREET @ELM_ETHUMB_DEF@ ELM_ETHUMB +@ELM_IMF_DEF@ ELM_IMF @ELM_ALLOCA_H_DEF@ ELM_ALLOCA_H @ELM_LIBINTL_H_DEF@ ELM_LIBINTL_H @@ -86,6 +87,11 @@ # include #endif +#ifdef ELM_IMF +# include +#endif + + #ifdef EAPI # undef EAPI #endif @@ -738,6 +744,15 @@ extern "C" { EAPI void elm_entry_item_provider_remove(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item), void *data); EAPI char *elm_entry_markup_to_utf8(const char *s); EAPI char *elm_entry_utf8_to_markup(const char *s); + + EAPI void elm_entry_autocapitalization_set(Evas_Object *obj, Eina_Bool on); + EAPI void elm_entry_autoenable_returnkey_set(Evas_Object *obj, Eina_Bool on); +#ifdef ELM_IMF + EAPI const Ecore_IMF_Context *elm_entry_imf_context_get(Evas_Object *obj); +#else + EAPI void *elm_entry_imf_context_get(Evas_Object *obj); +#endif + /* smart callbacks called: * "changed" - the text content changed * "selection,start" - the user started selecting text diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 1539ad0..d2536f5 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -17,7 +17,8 @@ AM_CPPFLAGS = \ @ELEMENTARY_WINCE_CFLAGS@ \ @ELEMENTARY_EDBUS_CFLAGS@ \ @ELEMENTARY_EFREET_CFLAGS@ \ -@ELEMENTARY_ETHUMB_CFLAGS@ +@ELEMENTARY_ETHUMB_CFLAGS@ \ +@ELEMENTARY_IMF_CFLAGS@ if ELEMENTARY_WINDOWS_BUILD AM_CPPFLAGS += -DELEMENTARY_BUILD @@ -107,5 +108,5 @@ els_icon.h libelementary_la_CFLAGS = -libelementary_la_LIBADD = @my_libs@ @dlopen_libs@ @ELEMENTARY_LIBS@ @ELEMENTARY_X_LIBS@ @ELEMENTARY_FB_LIBS@ @ELEMENTARY_SDL_LIBS@ @ELEMENTARY_WIN32_LIBS@ @ELEMENTARY_WINCE_LIBS@ @ELEMENTARY_EDBUS_LIBS@ @ELEMENTARY_EFREET_LIBS@ @ELEMENTARY_ETHUMB_LIBS@ +libelementary_la_LIBADD = @my_libs@ @dlopen_libs@ @ELEMENTARY_LIBS@ @ELEMENTARY_X_LIBS@ @ELEMENTARY_FB_LIBS@ @ELEMENTARY_SDL_LIBS@ @ELEMENTARY_WIN32_LIBS@ @ELEMENTARY_WINCE_LIBS@ @ELEMENTARY_EDBUS_LIBS@ @ELEMENTARY_EFREET_LIBS@ @ELEMENTARY_ETHUMB_LIBS@ @ELEMENTARY_IMF_LIBS@ libelementary_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c index fba911b..3a227b8 100644 --- a/src/lib/elm_entry.c +++ b/src/lib/elm_entry.c @@ -119,6 +119,7 @@ struct _Widget_Data Eina_Bool deferred_cur : 1; Eina_Bool disabled : 1; Eina_Bool context_menu : 1; + Eina_Bool autoreturnkey : 1; }; struct _Elm_Entry_Context_Menu_Item @@ -333,6 +334,31 @@ _sizing_eval(Evas_Object *obj) } static void +_check_enable_returnkey(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + +#ifdef HAVE_ELEMENTARY_IMF + Ecore_IMF_Context *ic = elm_entry_imf_context_get(obj); + if (!ic) return; + + if (!wd->autoreturnkey) + { + ecore_imf_context_ise_set_disable_key(ic, 1, ISE_KEY_ENTER, EINA_FALSE); + return; + } + + if (_entry_length_get(obj) == 0) { + ecore_imf_context_ise_set_disable_key(ic, 1, ISE_KEY_ENTER, EINA_TRUE); + } + else { + ecore_imf_context_ise_set_disable_key(ic, 1, ISE_KEY_ENTER, EINA_FALSE); + } +#endif +} + +static void _on_focus_hook(void *data __UNUSED__, Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); @@ -345,6 +371,7 @@ _on_focus_hook(void *data __UNUSED__, Evas_Object *obj) edje_object_signal_emit(wd->ent, "elm,action,focus", "elm"); if (top) elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON); evas_object_smart_callback_call(obj, SIG_FOCUSED, NULL); + _check_enable_returnkey(obj); } else { @@ -846,6 +873,22 @@ _mkup_to_text(const char *mkup) return str; } +int +_entry_length_get(Evas_Object *obj) +{ + int len; + char *str = elm_entry_entry_get(obj); + if (!str) return 0; + + char *plain_str = _mkup_to_text(str); + if (!plain_str) return 0; + + len = strlen(plain_str); + free(plain_str); + + return len; +} + static char * _text_to_mkup(const char *text) { @@ -2161,3 +2204,40 @@ elm_entry_utf8_to_markup(const char *s) if (!ss) ss = strdup(""); return ss; } + +#ifdef HAVE_ELEMENTARY_IMF +EAPI const Ecore_IMF_Context *elm_entry_imf_context_get(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd || !wd->ent) return NULL; + + return edje_object_part_text_imf_context_get(wd->ent, "elm.text"); +} +#else +EAPI const Ecore_IMF_Context *elm_entry_imf_context_get(Evas_Object *obj) +{ + return NULL; +} +#endif + +EAPI void +elm_entry_autoenable_returnkey_set(Evas_Object *obj, Eina_Bool on) +{ + Widget_Data *wd = elm_widget_data_get(obj); + wd->autoreturnkey = on; + _check_enable_returnkey(obj); +} + +EAPI void +elm_entry_autocapitalization_set(Evas_Object *obj, Eina_Bool on) +{ + Eina_Bool autocap = on; + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd->password) + autocap = EINA_FALSE; + else + autocap = on; + + edje_object_part_text_autocapitalization_set(wd->ent, "elm.text", autocap); +}