From: MyungJoo Ham Date: Tue, 22 Nov 2016 04:30:02 +0000 (+0900) Subject: Remove Profile Build Dependencis: do it at runtime X-Git-Tag: accepted/tizen/common/20161229.135941~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e4137f9cad960c53a1a607aecef07ae7433e4987;p=platform%2Fcore%2Fuifw%2Fe-mod-tizen-wl-textinput.git Remove Profile Build Dependencis: do it at runtime - This is for Tizen 4.0. : Tizen 4.0 Configurability and Build Blocks require to remove all profile-depending build options in spec files. (No More profile macros) - It is recommended to distinguish features/profiles at runtime. unless it incurs too much overhead, which requires you to create multiple binaries and subpackages. Change-Id: Icaa34a008377114ca81757c9d73746e9dc0ca92e Signed-off-by: MyungJoo Ham --- diff --git a/configure.ac b/configure.ac index 3b71017..b489437 100644 --- a/configure.ac +++ b/configure.ac @@ -32,6 +32,7 @@ PKG_CHECK_MODULES(ENLIGHTENMENT, [enlightenment]) PKG_CHECK_MODULES(EEZE, [eeze]) PKG_CHECK_MODULES(VCONF, [vconf]) PKG_CHECK_MODULES(DLOG, [dlog]) +PKG_CHECK_MODULES(CAPI_SYSTEM_INFO, [capi-system-info]) AC_SUBST(ENLIGHTENMENT_CFLAGS) AC_SUBST(ENLIGHTENMENT_LIBS) diff --git a/packaging/e-mod-tizen-wl-textinput.spec b/packaging/e-mod-tizen-wl-textinput.spec index 571c3cb..51f8851 100644 --- a/packaging/e-mod-tizen-wl-textinput.spec +++ b/packaging/e-mod-tizen-wl-textinput.spec @@ -13,6 +13,7 @@ BuildRequires: pkgconfig(enlightenment) BuildRequires: pkgconfig(eeze) BuildRequires: pkgconfig(vconf) BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(capi-system-info) %if !%{with wayland} ExclusiveArch: %endif @@ -26,10 +27,6 @@ The Enlightenment WM Wayland Text Input Module for Tizen %build CFLAGS+=" -Werror"; CXXFLAGS+=" -Werror"; -%if "%{profile}" == "tv" -CFLAGS+=" -D_TV"; -CXXFLAGS+=" -D_TV"; -%endif %autogen %configure diff --git a/src/Makefile.am b/src/Makefile.am index 49cf309..882e4cb 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -10,6 +10,6 @@ module_la_SOURCES = e_mod_main.c \ e_mod_input_panel.c \ wti_log.c module_la_LIBADD = -module_la_CFLAGS = @WAYLAND_CFLAGS@ @ENLIGHTENMENT_CFLAGS@ @EEZE_CFLAGS@ @VCONF_CFLAGS@ -DHAVE_WAYLAND_ONLY -DHAVE_WAYLAND -module_la_LDFLAGS = -module -avoid-version @WAYLAND_LIBS@ @ENLIGHTENMENT_LIBS@ @EEZE_LIBS@ @VCONF_LIBS@ +module_la_CFLAGS = @WAYLAND_CFLAGS@ @ENLIGHTENMENT_CFLAGS@ @EEZE_CFLAGS@ @VCONF_CFLAGS@ @CAPI_SYSTEM_INFO_CFLAGS@ -DHAVE_WAYLAND_ONLY -DHAVE_WAYLAND +module_la_LDFLAGS = -module -avoid-version @WAYLAND_LIBS@ @ENLIGHTENMENT_LIBS@ @EEZE_LIBS@ @VCONF_LIBS@ @CAPI_SYSTEM_INFO_LIBS@ module_la_DEPENDENCIES = $(top_builddir)/config.h diff --git a/src/e_mod_input_panel.c b/src/e_mod_input_panel.c index 1a8a454..3532e28 100644 --- a/src/e_mod_input_panel.c +++ b/src/e_mod_input_panel.c @@ -187,7 +187,6 @@ _e_input_panel_position_set(E_Client *ec, int w, int h) e_client_util_move_without_frame(ec, nx, ny); } -#ifndef _TV static void _ips_show(E_Client *ec) { @@ -231,7 +230,6 @@ clean: end: return ECORE_CALLBACK_PASS_ON; } -#endif static void _e_input_panel_surface_visible_update(E_Input_Panel_Surface *ips) @@ -246,25 +244,28 @@ _e_input_panel_surface_visible_update(E_Input_Panel_Surface *ips) if ((ips->showing) && (e_pixmap_usable_get(ec->pixmap))) { -#ifdef _TV - _e_input_panel_position_set(ec, ec->client.w, ec->client.h); - ec->visible = EINA_TRUE; - evas_object_geometry_set(ec->frame, ec->x, ec->y, ec->w, ec->h); - evas_object_show(ec->frame); - e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h); -#else - if (ec->visible) - return; - - WTI_LOG("IPS::DEFER_SHOW::ADD"); - ips->wait_update = EINA_TRUE; - if (!ips->eh.buf_change) + if (_TV) { - ips->eh.buf_change = - ecore_event_handler_add(E_EVENT_CLIENT_BUFFER_CHANGE, - _ips_cb_buffer_change, ips); + _e_input_panel_position_set(ec, ec->client.w, ec->client.h); + ec->visible = EINA_TRUE; + evas_object_geometry_set(ec->frame, ec->x, ec->y, ec->w, ec->h); + evas_object_show(ec->frame); + e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h); + } + else + { + if (ec->visible) + return; + + WTI_LOG("IPS::DEFER_SHOW::ADD"); + ips->wait_update = EINA_TRUE; + if (!ips->eh.buf_change) + { + ips->eh.buf_change = + ecore_event_handler_add(E_EVENT_CLIENT_BUFFER_CHANGE, + _ips_cb_buffer_change, ips); + } } -#endif } else { @@ -658,7 +659,6 @@ e_input_panel_shutdown(void) } } -#ifndef _TV static void _ips_client_frame_flush(E_Input_Panel_Surface *ips) { @@ -695,39 +695,39 @@ _ip_cb_e_buf_change(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event end: return ECORE_CALLBACK_PASS_ON; } -#endif EINTERN void e_input_panel_wait_update_set(Eina_Bool wait_update) { -#ifndef _TV - E_Input_Panel_Surface *ips; - Eina_List *l; + if (!_TV) + { + E_Input_Panel_Surface *ips; + Eina_List *l; - if (!g_input_panel) - return; + if (!g_input_panel) + return; - g_input_panel->wait_update = wait_update; + g_input_panel->wait_update = wait_update; - /* If we are in wait_update mode, the input panel surfaces have to be updated forcibly */ - if (wait_update) - { - EINA_LIST_FOREACH(g_input_panel->surfaces, l, ips) + /* If we are in wait_update mode, the input panel surfaces have to be updated forcibly */ + if (wait_update) { - if (!ips->ec) continue; - _ips_client_frame_flush(ips); - } + EINA_LIST_FOREACH(g_input_panel->surfaces, l, ips) + { + if (!ips->ec) continue; + _ips_client_frame_flush(ips); + } - if (!g_input_panel->buf_change_handler) - { - WTI_LOG("IPS::WAIT::UPDATE::SET (add buf change handler)\n"); - g_input_panel->buf_change_handler = ecore_event_handler_add(E_EVENT_CLIENT_BUFFER_CHANGE, - _ip_cb_e_buf_change, NULL); + if (!g_input_panel->buf_change_handler) + { + WTI_LOG("IPS::WAIT::UPDATE::SET (add buf change handler)\n"); + g_input_panel->buf_change_handler = ecore_event_handler_add(E_EVENT_CLIENT_BUFFER_CHANGE, + _ip_cb_e_buf_change, NULL); + } } + else + E_FREE_FUNC(g_input_panel->buf_change_handler, ecore_event_handler_del); } - else - E_FREE_FUNC(g_input_panel->buf_change_handler, ecore_event_handler_del); -#endif } EINTERN void diff --git a/src/e_mod_main.c b/src/e_mod_main.c index af4604a..5ea7bf3 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -8,12 +8,48 @@ #include #include #include +#include +#include #ifdef LOG_TAG #undef LOG_TAG #endif #define LOG_TAG "WL_TEXTINPUT" +tizen_profile_t _get_tizen_profile() +{ + static tizen_profile_t profile = TIZEN_PROFILE_UNKNOWN; + if (__builtin_expect(profile != TIZEN_PROFILE_UNKNOWN, 1)) + return profile; + + char *profileName; + system_info_get_platform_string("http://tizen.org/feature/profile", &profileName); + switch (*profileName) + { + case 'm': + case 'M': + profile = TIZEN_PROFILE_MOBILE; + break; + case 'w': + case 'W': + profile = TIZEN_PROFILE_WEARABLE; + break; + case 't': + case 'T': + profile = TIZEN_PROFILE_TV; + break; + case 'i': + case 'I': + profile = TIZEN_PROFILE_IVI; + break; + default: // common or unknown ==> ALL ARE COMMON. + profile = TIZEN_PROFILE_COMMON; + } + free(profileName); + + return profile; +} + static Eina_Bool _e_text_input_method_context_cb_client_resize(void *data EINA_UNUSED, int type, void *event); static void set_soft_keyboard_mode(); @@ -247,11 +283,12 @@ _display_language_changed_cb(keynode_t *key, void* data) free(language); } /* We do not want to change the current keymap related behavior in TV profile for now */ -#ifndef _TV - /* Resetting the H/W keyboard language mode to English, would be more appropriate when the - * display language gets changed, such as the cases like changing from French to Russian, for example */ - e_comp_wl_input_keymap_set(g_keymap_info[0].rules, g_keymap_info[0].models, g_keymap_info[0].layout, NULL, NULL, NULL, NULL); -#endif + if (!_TV) + { + /* Resetting the H/W keyboard language mode to English, would be more appropriate when the + * display language gets changed, such as the cases like changing from French to Russian, for example */ + e_comp_wl_input_keymap_set(g_keymap_info[0].rules, g_keymap_info[0].models, g_keymap_info[0].layout, NULL, NULL, NULL, NULL); + } g_keyboard_mode_engligh = EINA_TRUE; } @@ -323,20 +360,21 @@ _e_text_input_method_context_filter_hotkeys(E_Input_Method_Context *context, Eco if (!context) return EINA_FALSE; /* We do not want to change the current keymap related behavior in TV profile for now */ -#ifndef _TV - const char *keyname_space = "space"; - if ((strncmp(ev->keyname, keyname_space, strlen(keyname_space)) == 0) && (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)) + if (!_TV) { - int keymap_index; - keymap_index = g_keyboard_mode_engligh ? g_keymap_index : 0; - e_comp_wl_input_keymap_set(g_keymap_info[keymap_index].rules, g_keymap_info[keymap_index].models, g_keymap_info[keymap_index].layout, NULL, NULL, NULL, NULL); - wl_keyboard_send_keymap(context->kbd.resource, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, - e_comp_wl->xkb.fd, e_comp_wl->xkb.size); - g_keyboard_mode_engligh = !g_keyboard_mode_engligh; - - return EINA_TRUE; + const char *keyname_space = "space"; + if ((strncmp(ev->keyname, keyname_space, strlen(keyname_space)) == 0) && (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)) + { + int keymap_index; + keymap_index = g_keyboard_mode_engligh ? g_keymap_index : 0; + e_comp_wl_input_keymap_set(g_keymap_info[keymap_index].rules, g_keymap_info[keymap_index].models, g_keymap_info[keymap_index].layout, NULL, NULL, NULL, NULL); + wl_keyboard_send_keymap(context->kbd.resource, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, + e_comp_wl->xkb.fd, e_comp_wl->xkb.size); + g_keyboard_mode_engligh = !g_keyboard_mode_engligh; + + return EINA_TRUE; + } } -#endif return EINA_FALSE; } @@ -999,9 +1037,8 @@ _e_text_input_deactivate(E_Text_Input *text_input, E_Input_Method *input_method) if (text_input->resource) wl_text_input_send_leave(text_input->resource); -#ifdef _TV - g_disable_show_panel = EINA_FALSE; -#endif + if (_TV) + g_disable_show_panel = EINA_FALSE; } } @@ -1076,9 +1113,8 @@ _e_text_input_cb_activate(struct wl_client *client, struct wl_resource *resource wl_input_method_send_activate(input_method->resource, context->resource, text_input->id); } -#ifdef _TV - set_soft_keyboard_mode(); -#endif + if (_TV) + set_soft_keyboard_mode(); if (text_input->resource) wl_text_input_send_enter(text_input->resource, surface); @@ -1213,9 +1249,8 @@ _e_text_input_cb_input_panel_show(struct wl_client *client, struct wl_resource * e_input_panel_wait_update_set(EINA_TRUE); } -#ifdef _TV - e_input_panel_visibility_change(EINA_TRUE); -#endif + if (_TV) + e_input_panel_visibility_change(EINA_TRUE); /* If the input panel state was WILL_HIDE, it means that the conformant area information needs to be restored */ if (g_input_panel_state == E_INPUT_PANEL_STATE_WILL_HIDE) diff --git a/src/e_mod_main.h b/src/e_mod_main.h index 2f1e687..3fe262c 100644 --- a/src/e_mod_main.h +++ b/src/e_mod_main.h @@ -10,4 +10,14 @@ Eina_Bool e_input_panel_client_find(E_Client *ec); EINTERN void e_input_panel_wait_update_set(Eina_Bool wait_update); EINTERN void e_input_panel_transient_for_set(E_Client *parent); +typedef enum { + TIZEN_PROFILE_UNKNOWN = 0, + TIZEN_PROFILE_MOBILE = 0x1, + TIZEN_PROFILE_WEARABLE = 0x2, + TIZEN_PROFILE_TV = 0x4, + TIZEN_PROFILE_IVI = 0x8, + TIZEN_PROFILE_COMMON = 0x10, +} tizen_profile_t; +extern tizen_profile_t _get_tizen_profile(); +#define _TV (_get_tizen_profile() == TIZEN_PROFILE_TV) #endif