From: Igor Olshevskyi Date: Fri, 13 May 2016 13:58:32 +0000 (+0300) Subject: TizenRefApp-6314 [Call] Implementation window handler X-Git-Tag: submit/tizen/20160603.124050~2^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eb77ba42280fff4ef129b5e083da9b05ff504961;p=profile%2Fmobile%2Fapps%2Fnative%2Fcall-ui.git TizenRefApp-6314 [Call] Implementation window handler Change-Id: Ia7ecbd47620626f913f6a93ff32b6b8d6931714f --- diff --git a/inc/callui-common.h b/inc/callui-common.h index 7e42600..c979030 100644 --- a/inc/callui-common.h +++ b/inc/callui-common.h @@ -58,15 +58,6 @@ callui_idle_lock_type_t _callui_common_get_idle_lock_type(void); int _callui_common_unlock_swipe_lock(void); /** - * @brief Set notification type - * - * @param[in] person_id Person id - * @param[in] win_noti defines if window must be notification type - * - */ -void _callui_common_win_set_noti_type(void *appdata, bool win_noti); - -/** * @brief Launch bluetooth application * * @param[in] appdata App data diff --git a/inc/callui-view-layout.h b/inc/callui-view-layout.h index 1731bcb..33b5e69 100755 --- a/inc/callui-view-layout.h +++ b/inc/callui-view-layout.h @@ -143,8 +143,6 @@ #define MTLOCK_REJECT_MSG_TOP_VISIBLE_AREA_W (MTLOCK_REJECT_MSG_TEXT_HEIGHT+MTLOCK_REJECT_MSG_ARW_HEIGHT) -#define MTLOCK_ACTIVE_NOTI_CALL_HEIGHT 350 - #define ITEM_SIZE_H 120 #define REJ_MSG_LIST_CREATE_MSG_BTN_H 150 @@ -600,4 +598,7 @@ #define ENDCALL_BTN_T REL_ENDCALL_BTN_BG_H(ENDCALL_BTN_T_OFFSET) #define ENDCALL_BTN_B REL_ENDCALL_BTN_BG_H(ENDCALL_BTN_T_OFFSET+ENDCALL_BTN_SIZE) +/* ACTIVE NOTIFICATION */ +#define ACTIVE_NOTI_L_PAD ELM_SCALE_SIZE(32) + #endif /*_CALLUI_VIEW_LAYOUT_H_*/ diff --git a/inc/callui-view-manager.h b/inc/callui-view-manager.h index fb41c9f..3ab81de 100644 --- a/inc/callui-view-manager.h +++ b/inc/callui-view-manager.h @@ -47,7 +47,7 @@ struct _view_data; typedef struct appdata callui_app_data_t; struct _view_data { - callui_result_e (*create) (struct _view_data *view_data, void *appdata); + callui_result_e (*create) (struct _view_data *view_data, Evas_Object *parent, void *appdata); callui_result_e (*update) (struct _view_data *view_data); callui_result_e (*destroy) (struct _view_data *view_data); callui_result_e (*pause) (struct _view_data *view_data); @@ -66,6 +66,8 @@ typedef struct _callui_vm *callui_vm_h; /** * @brief Create view manager * + * @param[in] ad application data + * * @return view manager handler */ callui_vm_h _callui_vm_create(callui_app_data_t *ad); @@ -78,6 +80,15 @@ callui_vm_h _callui_vm_create(callui_app_data_t *ad); void _callui_vm_destroy(callui_vm_h vm); /** + * @brief Returns application main layout + * + * @param[in] vm View manager handler + * + * @return application main layout or NULL on fail + */ +Evas_Object *_callui_vm_get_main_ly(callui_vm_h vm); + +/** * @brief Change view * * @param[in] vm View manager handler diff --git a/inc/callui-window.h b/inc/callui-window.h new file mode 100644 index 0000000..a9bcb66 --- /dev/null +++ b/inc/callui-window.h @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef __CALLUI_WINDOW_H__ +#define __CALLUI_WINDOW_H__ + +#include +#include + +#include "callui-common-types.h" + +typedef enum { + CALLUI_WIN_SIZE_FULLSCREEN, + CALLUI_WIN_SIZE_ACTIVE_NOTI +} callui_win_size_type_e; + +typedef enum { + CALLUI_WIN_SCREEN_MODE_DEFAULT, + CALLUI_WIN_SCREEN_MODE_ALWAYS_ON +} callui_win_screen_mode_e; + +typedef enum { + CALLUI_WIN_KEYGRAB_UNKNOWN, + CALLUI_WIN_KEYGRAB_SHARED, + CALLUI_WIN_KEYGRAB_TOPMOST, + CALLUI_WIN_KEYGRAB_EXCLUSIVE, + CALLUI_WIN_KEYGRAB_OVERRIDE_EXCLUSIVE +} callui_win_keygrab_mode_e; + +typedef struct __callui_window *callui_window_h; + +typedef struct appdata callui_app_data_t; + +/** + * @brief Creates window instance + * + * @param[in] ad Application data + * + * @return window handler + */ +callui_window_h _callui_window_create(callui_app_data_t *appdata); + +/** + * @brief Destroys window instance + * + * @param[in] win_handler Window handler + * + */ +void _callui_window_destroy(callui_window_h win_handler); + +/** + * @brief Gets window Evas_Object + * + * @param[in] win_handler window handler + * + * @return window Evas_Object on success or NULL otherwise + */ +Evas_Object *_callui_window_get_eo(callui_window_h win_handler); + +/** + * @brief Gets content parent Evas_Object + * + * @param[in] win_handler Window handler + * + * @return content parent Evas_Object on success or NULL otherwise + */ +Evas_Object *_callui_window_get_content_parent(callui_window_h win_handler); + +/** + * @brief Sets content to window + * + * @param[in] win_handler Window handler + * @param[in] content Content to set + */ +void _callui_window_set_content(callui_window_h win_handler, Evas_Object *content); + +/** + * @brief Sets window size type + * + * @param[in] win_handler Window handler + * @param[in] size_type Window size type + */ +void _callui_window_set_size_type(callui_window_h win_handler, callui_win_size_type_e size_type); + +/** + * @brief Sets rotation lock state + * + * @param[in] win_handler Window handler + * @param[in] is_locked Rotation lock state + */ +callui_result_e _callui_window_set_rotation_locked(callui_window_h win_handler, bool is_locked); + +/** + * @brief Gets window rotation + * + * @param[in] win_handler Window handler + * @param[in] is_locked Rotation lock enable state + * + * @return The rotation of the window, in degrees (0-360), counter-clockwise. + */ +int _callui_window_get_rotation(callui_window_h win_handler); + +/** + * @brief Sets window top level priority + * + * @param[in] win_handler Window handler + * @param[in] is_toplevel Top level priority enable state + * + * @return CALLUI_RESULT_OK on success or another result otherwise + */ +callui_result_e _callui_window_set_top_level_priority(callui_window_h win_handler, bool is_toplevel); + +/** + * @brief Sets window's screen mode. + * + * @param[in] win_handler Window handler + * @param[in] is_toplevel Top level priority enable state + * + * @return CALLUI_RESULT_OK on success or another result otherwise + */ +callui_result_e _callui_window_set_screen_mode(callui_window_h win_handler, + callui_win_screen_mode_e screen_mode); + +/** + * @brief Gets screen geometry details for the screen that a window is on. + * +* @param[in] win_handler Window handler + * @param[out] x Where to return the horizontal offset value. May be null. + * @param[out] y Where to return the vertical offset value. May be null. + * @param[out] w Where to return the width value. May be null. + * @param[out] h Where to return the height value. May be null. + */ +void _callui_window_get_screen_size(callui_window_h win_handler, int *x, int *y, int *w, int *h); + +/** + * @brief Activates window. + * + * @param[in] win_handler Window handler + */ +void _callui_window_activate(callui_window_h win_handler); + +/** + * @brief Lowers a window. + * + * @param[in] win_handler Window handler + */ +void _callui_window_minimize(callui_window_h win_handler); + +/** + * @brief Sets keygrab value of the window + * + * @param[in] win_handler Window handler + * @param[in] key Key to set grabbing + * @param[in] mode Window keygrab mode + * + * @return CALLUI_RESULT_OK on success or another result otherwise + */ +callui_result_e _callui_window_set_keygrab_mode(callui_window_h win_handler, + const char *key, + callui_win_keygrab_mode_e mode); + +/** + * @brief Unsets keygrab value of the window + * + * @param[in] win_handler Window handler + * @param[in] key Key to unset grabbing + * + * @return CALLUI_RESULT_OK on success or another result otherwise + */ +callui_result_e _callui_window_unset_keygrab_mode(callui_window_h win_handler, const char *key); + +#endif /* __CALLUI_WINDOW_H__ */ diff --git a/inc/callui.h b/inc/callui.h index f0a6644..c73e569 100755 --- a/inc/callui.h +++ b/inc/callui.h @@ -29,12 +29,12 @@ #include "callui-view-quickpanel.h" #include "callui-action-bar.h" #include "callui-display.h" +#include "callui-window.h" #define APP_HANDLERS_COUNT 1 struct appdata { - Evas_Object *win; - Evas_Object *main_ly; + callui_window_h window; callui_qp_mc_h qp_minicontrol; callui_display_h display; @@ -68,7 +68,6 @@ struct appdata { callui_call_data_t *end_call_data; app_event_handler_h app_event_handlers[APP_HANDLERS_COUNT]; - }; callui_app_data_t *_callui_get_app_data(); diff --git a/src/callui-action-bar.c b/src/callui-action-bar.c index ed3e42d..e9ff897 100644 --- a/src/callui-action-bar.c +++ b/src/callui-action-bar.c @@ -504,7 +504,6 @@ static callui_result_e __callui_action_bar_init(callui_action_bar_h action_bar, action_bar->ad = ad; action_bar->is_disabled = false; - Evas_Object *parent = ad->main_ly; _callui_sdm_add_audio_state_changed_cb(ad->sound_manager, __audio_state_changed_cb, action_bar); _callui_sdm_add_mute_state_changed_cb(ad->sound_manager, __mute_state_changed_cb, action_bar); @@ -512,7 +511,7 @@ static callui_result_e __callui_action_bar_init(callui_action_bar_h action_bar, __update_btns_state(action_bar); - action_bar->main_layout = __create_main_layout(action_bar, parent); + action_bar->main_layout = __create_main_layout(action_bar, _callui_vm_get_main_ly(ad->view_manager)); CALLUI_RETURN_VALUE_IF_FAIL(action_bar->main_layout, CALLUI_RESULT_ALLOCATION_FAIL); Evas_Object *btn; @@ -582,10 +581,8 @@ void _callui_action_bar_show(callui_action_bar_h action_bar) { CALLUI_RETURN_IF_FAIL(action_bar); - Evas_Object *parent = action_bar->ad->main_ly; - __update_btns_txt(action_bar); - elm_object_part_content_set(parent, PART_SWALLOW_ACTION_BAR, action_bar->main_layout); + elm_object_part_content_set(_callui_vm_get_main_ly(action_bar->ad->view_manager), PART_SWALLOW_ACTION_BAR, action_bar->main_layout); evas_object_show(action_bar->main_layout); } @@ -593,9 +590,7 @@ void _callui_action_bar_hide(callui_action_bar_h action_bar) { CALLUI_RETURN_IF_FAIL(action_bar); - Evas_Object *parent = action_bar->ad->main_ly; - - elm_object_part_content_unset(parent, PART_SWALLOW_ACTION_BAR); + elm_object_part_content_unset(_callui_vm_get_main_ly(action_bar->ad->view_manager), PART_SWALLOW_ACTION_BAR); evas_object_hide(action_bar->main_layout); } diff --git a/src/callui-common.c b/src/callui-common.c index 0fd6dde..6513025 100755 --- a/src/callui-common.c +++ b/src/callui-common.c @@ -150,26 +150,12 @@ int _callui_common_unlock_swipe_lock(void) return 0; } -void _callui_common_win_set_noti_type(void *appdata, bool win_noti) -{ - CALLUI_RETURN_IF_FAIL(appdata); - - callui_app_data_t *ad = appdata; - if (win_noti) { - dbg("window type: NOTIFICATION"); - efl_util_set_notification_window_level(ad->win, EFL_UTIL_NOTIFICATION_LEVEL_TOP); - } else { - dbg("window type: NORMAL"); - efl_util_set_notification_window_level(ad->win, EFL_UTIL_NOTIFICATION_LEVEL_NONE); - } -} - static void __reset_visibility_properties(callui_app_data_t *ad) { _callui_lock_manager_stop(ad->lock_handle); ad->start_lock_manager_on_resume = true; - _callui_common_win_set_noti_type(ad, false); + _callui_window_set_top_level_priority(ad->window, false); } void _callui_common_launch_setting_bluetooth(void *appdata) @@ -342,9 +328,9 @@ static void __callui_common_lock_state_cb (system_settings_key_e key, void *user { callui_app_data_t *ad = _callui_get_app_data(); if (_callui_common_get_idle_lock_type() == LOCK_TYPE_UNLOCK) { - _callui_common_win_set_noti_type(ad, false); + _callui_window_set_top_level_priority(ad->window, false); } else { - _callui_common_win_set_noti_type(ad, true); + _callui_window_set_top_level_priority(ad->window, true); } } diff --git a/src/callui-display.c b/src/callui-display.c index ff3d439..70eca86 100644 --- a/src/callui-display.c +++ b/src/callui-display.c @@ -221,22 +221,22 @@ callui_result_e _callui_display_set_control_state(callui_display_h display, call case CALLUI_DISPLAY_ON_LOCK: result = device_display_change_state(DISPLAY_STATE_NORMAL); CALLUI_RETURN_VALUE_IF_FAIL(result == DEVICE_ERROR_NONE, CALLUI_RESULT_FAIL); - result = efl_util_set_window_screen_mode(display->ad->win, EFL_UTIL_SCREEN_MODE_ALWAYS_ON); - CALLUI_RETURN_VALUE_IF_FAIL(result == EFL_UTIL_ERROR_NONE, CALLUI_RESULT_FAIL); + result = _callui_window_set_screen_mode(display->ad->window, CALLUI_WIN_SCREEN_MODE_ALWAYS_ON); + CALLUI_RETURN_VALUE_IF_FAIL(result == CALLUI_RESULT_OK, result); break; case CALLUI_DISPLAY_ON_UNLOCK: result = device_display_change_state(DISPLAY_STATE_NORMAL); CALLUI_RETURN_VALUE_IF_FAIL(result == DEVICE_ERROR_NONE, CALLUI_RESULT_FAIL); - result = efl_util_set_window_screen_mode(display->ad->win, EFL_UTIL_SCREEN_MODE_DEFAULT); - CALLUI_RETURN_VALUE_IF_FAIL(result == EFL_UTIL_ERROR_NONE, CALLUI_RESULT_FAIL); + result = _callui_window_set_screen_mode(display->ad->window, CALLUI_WIN_SCREEN_MODE_DEFAULT); + CALLUI_RETURN_VALUE_IF_FAIL(result == CALLUI_RESULT_OK, result); result = device_power_release_lock(POWER_LOCK_CPU); CALLUI_RETURN_VALUE_IF_FAIL(result == DEVICE_ERROR_NONE, CALLUI_RESULT_FAIL); break; case CALLUI_DISPLAY_UNLOCK: - result = efl_util_set_window_screen_mode(display->ad->win, EFL_UTIL_SCREEN_MODE_DEFAULT); - CALLUI_RETURN_VALUE_IF_FAIL(result == EFL_UTIL_ERROR_NONE, CALLUI_RESULT_FAIL); + result = _callui_window_set_screen_mode(display->ad->window, CALLUI_WIN_SCREEN_MODE_DEFAULT); + CALLUI_RETURN_VALUE_IF_FAIL(result == CALLUI_RESULT_OK, result); result = device_power_release_lock(POWER_LOCK_CPU); CALLUI_RETURN_VALUE_IF_FAIL(result == EFL_UTIL_ERROR_NONE, CALLUI_RESULT_FAIL); break; diff --git a/src/callui-keypad.c b/src/callui-keypad.c index 6d03e70..1a05669 100755 --- a/src/callui-keypad.c +++ b/src/callui-keypad.c @@ -75,9 +75,8 @@ typedef struct _callui_keypad _callui_keypad_t; static int __callui_keypad_init(callui_keypad_h keypad, callui_app_data_t *appdata) { keypad->ad = appdata; - Evas_Object *parent = appdata->main_ly; - keypad->main_layout = _callui_load_edj(parent, EDJ_NAME, "keypad_layout"); + keypad->main_layout = _callui_load_edj(_callui_vm_get_main_ly(appdata->view_manager), EDJ_NAME, "keypad_layout"); CALLUI_RETURN_VALUE_IF_FAIL(keypad->main_layout, CALLUI_RESULT_ALLOCATION_FAIL); elm_object_signal_callback_add(keypad->main_layout, "hide_completed", "*", __on_hide_completed, keypad); @@ -240,15 +239,15 @@ static void __on_hide_completed(void *data, Evas_Object *obj, const char *emissi callui_keypad_h keypad = (callui_keypad_h)data; callui_app_data_t *ad = keypad->ad; + Evas_Object *main_ly = _callui_vm_get_main_ly(ad->view_manager); _callui_lock_manager_start(ad->lock_handle); - Evas_Object *parent = ad->main_ly; - eext_object_event_callback_del(parent, EEXT_CALLBACK_BACK, __back_button_click_cb); + eext_object_event_callback_del(main_ly, EEXT_CALLBACK_BACK, __back_button_click_cb); DELETE_ECORE_TIMER(keypad->anim_timer); - keypad->main_layout = elm_object_part_content_unset(keypad->ad->main_ly, + keypad->main_layout = elm_object_part_content_unset(main_ly, PART_SWALLOW_KEYPAD_LAYOUT_AREA); evas_object_hide(keypad->main_layout); @@ -420,10 +419,11 @@ void _callui_keypad_show(callui_keypad_h keypad) { CALLUI_RETURN_IF_FAIL(keypad); callui_app_data_t *ad = keypad->ad; + Evas_Object *main_ly = _callui_vm_get_main_ly(ad->view_manager); __clear_entry(keypad); - elm_object_part_content_set(keypad->ad->main_ly, PART_SWALLOW_KEYPAD_LAYOUT_AREA, keypad->main_layout); + elm_object_part_content_set(main_ly, PART_SWALLOW_KEYPAD_LAYOUT_AREA, keypad->main_layout); evas_object_show(keypad->main_layout); elm_object_signal_emit(keypad->btns_layout, "SHOW", "KEYPADBTN"); @@ -437,8 +437,7 @@ void _callui_keypad_show(callui_keypad_h keypad) _callui_lock_manager_stop(ad->lock_handle); - Evas_Object *parent = ad->main_ly; - eext_object_event_callback_add(parent, EEXT_CALLBACK_BACK, __back_button_click_cb, keypad); + eext_object_event_callback_add(main_ly, EEXT_CALLBACK_BACK, __back_button_click_cb, keypad); ecore_timer_del(keypad->anim_timer); keypad->anim_timer = ecore_timer_add(2.0, __down_arrow_animation_timeout_cb, keypad); diff --git a/src/callui-view-callend.c b/src/callui-view-callend.c index 126df68..8a7b6b7 100644 --- a/src/callui-view-callend.c +++ b/src/callui-view-callend.c @@ -54,10 +54,10 @@ struct _callui_view_callend { }; typedef struct _callui_view_callend _callui_view_callend_t; -static callui_result_e __callui_view_callend_oncreate(call_view_data_base_t *view_data, void *appdata); +static callui_result_e __callui_view_callend_oncreate(call_view_data_base_t *view_data, Evas_Object *parent, void *appdata); static callui_result_e __callui_view_callend_ondestroy(call_view_data_base_t *view_data); -static callui_result_e __create_main_content(callui_view_callend_h vd); +static callui_result_e __create_main_content(callui_view_callend_h vd, Evas_Object *parent); static callui_result_e __update_displayed_data(callui_view_callend_h vd); static void __call_back_btn_click_cb(void *data, Evas_Object *obj, const char *emission, const char *source); @@ -120,9 +120,10 @@ static Eina_Bool __minimize_animation_idler_cb(void *data) return ECORE_CALLBACK_CANCEL; } -static callui_result_e __callui_view_callend_oncreate(call_view_data_base_t *view_data, void *appdata) +static callui_result_e __callui_view_callend_oncreate(call_view_data_base_t *view_data, Evas_Object *parent, void *appdata) { CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM); + CALLUI_RETURN_VALUE_IF_FAIL(parent, CALLUI_RESULT_INVALID_PARAM); CALLUI_RETURN_VALUE_IF_FAIL(appdata, CALLUI_RESULT_INVALID_PARAM); callui_view_callend_h vd = (callui_view_callend_h)view_data; @@ -130,9 +131,9 @@ static callui_result_e __callui_view_callend_oncreate(call_view_data_base_t *vie vd->base_view.ad = ad; - _callui_common_win_set_noti_type(vd->base_view.ad, true); + _callui_window_set_top_level_priority(ad->window, true); - callui_result_e res = __create_main_content(vd); + callui_result_e res = __create_main_content(vd, parent); CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res); res = __update_displayed_data(vd); @@ -174,14 +175,13 @@ static callui_result_e __callui_view_callend_ondestroy(call_view_data_base_t *vi return CALLUI_RESULT_OK; } -static callui_result_e __create_main_content(callui_view_callend_h vd) +static callui_result_e __create_main_content(callui_view_callend_h vd, Evas_Object *parent) { callui_app_data_t *ad = vd->base_view.ad; - CALLUI_RETURN_VALUE_IF_FAIL(ad->main_ly, CALLUI_RESULT_FAIL); - vd->base_view.contents = _callui_load_edj(ad->main_ly, EDJ_NAME, GRP_VIEW_MAIN_LY); + vd->base_view.contents = _callui_load_edj(parent, EDJ_NAME, GRP_VIEW_MAIN_LY); CALLUI_RETURN_VALUE_IF_FAIL(vd->base_view.contents, CALLUI_RESULT_ALLOCATION_FAIL); - elm_object_part_content_set(ad->main_ly, "elm.swallow.content", vd->base_view.contents); + elm_object_part_content_set(parent, "elm.swallow.content", vd->base_view.contents); elm_object_signal_callback_add(vd->base_view.contents, "mouse,down,*", "dim_bg", __bg_mouse_down_cb, vd); @@ -416,7 +416,7 @@ static void __run_minimize_animation(callui_view_callend_h vd) elm_object_signal_emit(vd->caller_info, "minimize", "caller_info"); elm_object_signal_emit(vd->base_view.contents, "minimize", "view_main_ly"); - elm_object_signal_emit(ad->main_ly, "minimize", "app_main_ly"); + elm_object_signal_emit(_callui_vm_get_main_ly(ad->view_manager), "minimize", "app_main_ly"); } static void __run_maximize_animation(callui_view_callend_h vd) @@ -435,7 +435,7 @@ static void __run_maximize_animation(callui_view_callend_h vd) elm_object_signal_emit(vd->caller_info, "maximize", "caller_info"); elm_object_signal_emit(vd->base_view.contents, "maximize", "view_main_ly"); - elm_object_signal_emit(ad->main_ly, "maximize", "app_main_ly"); + elm_object_signal_emit(_callui_vm_get_main_ly(ad->view_manager), "maximize", "app_main_ly"); } static callui_result_e __update_displayed_data(callui_view_callend_h vd) @@ -459,9 +459,6 @@ static callui_result_e __update_displayed_data(callui_view_callend_h vd) evas_object_show(vd->base_view.contents); - evas_object_hide(ad->main_ly); - evas_object_show(ad->main_ly); - return CALLUI_RESULT_OK; } diff --git a/src/callui-view-dialing.c b/src/callui-view-dialing.c index 5b9f7c3..899e65e 100644 --- a/src/callui-view-dialing.c +++ b/src/callui-view-dialing.c @@ -33,11 +33,11 @@ struct _callui_view_dialing { }; typedef struct _callui_view_dialing _callui_view_dialing_t; -static callui_result_e __callui_view_dialing_oncreate(call_view_data_base_t *view_data, void *appdata); +static callui_result_e __callui_view_dialing_oncreate(call_view_data_base_t *view_data, Evas_Object *parent, void *appdata); static callui_result_e __callui_view_dialing_onupdate(call_view_data_base_t *view_data); static callui_result_e __callui_view_dialing_ondestroy(call_view_data_base_t *view_data); -static callui_result_e __create_main_content(callui_view_dialing_h vd); +static callui_result_e __create_main_content(callui_view_dialing_h vd, Evas_Object *parent); static void __end_call_btn_click_cb(void *data, Evas_Object *obj, void *event_info); static callui_result_e __update_displayed_data(callui_view_dialing_h vd); @@ -55,9 +55,10 @@ callui_view_dialing_h _callui_dialing_view_dialing_new() return dialing_view; } -static callui_result_e __callui_view_dialing_oncreate(call_view_data_base_t *view_data, void *appdata) +static callui_result_e __callui_view_dialing_oncreate(call_view_data_base_t *view_data, Evas_Object *parent, void *appdata) { CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM); + CALLUI_RETURN_VALUE_IF_FAIL(parent, CALLUI_RESULT_INVALID_PARAM); CALLUI_RETURN_VALUE_IF_FAIL(appdata, CALLUI_RESULT_INVALID_PARAM); callui_view_dialing_h vd = (callui_view_dialing_h)view_data; @@ -65,7 +66,7 @@ static callui_result_e __callui_view_dialing_oncreate(call_view_data_base_t *vie vd->base_view.ad = ad; - callui_result_e res = __create_main_content(vd); + callui_result_e res = __create_main_content(vd, parent); CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, CALLUI_RESULT_FAIL); _callui_lock_manager_start(ad->lock_handle); @@ -73,13 +74,14 @@ static callui_result_e __callui_view_dialing_oncreate(call_view_data_base_t *vie return __update_displayed_data(vd); } -static callui_result_e __create_main_content(callui_view_dialing_h vd) +static callui_result_e __create_main_content(callui_view_dialing_h vd, Evas_Object *parent) { callui_app_data_t *ad = vd->base_view.ad; - vd->base_view.contents = _callui_load_edj(ad->main_ly, EDJ_NAME, GRP_VIEW_MAIN_LY); + vd->base_view.contents = _callui_load_edj(parent, EDJ_NAME, GRP_VIEW_MAIN_LY); + CALLUI_RETURN_VALUE_IF_FAIL(vd->base_view.contents, CALLUI_RESULT_ALLOCATION_FAIL); - elm_object_part_content_set(ad->main_ly, "elm.swallow.content", vd->base_view.contents); + elm_object_part_content_set(parent, "elm.swallow.content", vd->base_view.contents); vd->caller_info = _callui_load_edj(vd->base_view.contents, EDJ_NAME, GRP_CALLER_INFO); CALLUI_RETURN_VALUE_IF_FAIL(vd->caller_info, CALLUI_RESULT_ALLOCATION_FAIL); @@ -189,9 +191,6 @@ static callui_result_e __update_displayed_data(callui_view_dialing_h vd) evas_object_show(vd->base_view.contents); - evas_object_hide(ad->main_ly); - evas_object_show(ad->main_ly); - return CALLUI_RESULT_OK; } diff --git a/src/callui-view-elements.c b/src/callui-view-elements.c index fdfb833..8c4b15b 100755 --- a/src/callui-view-elements.c +++ b/src/callui-view-elements.c @@ -104,7 +104,7 @@ static Evas_Object *__callui_get_caller_info_layout(void *data) callui_app_data_t *ad = (callui_app_data_t *)data; CALLUI_RETURN_VALUE_IF_FAIL(ad, NULL); - layout = elm_object_part_content_get(ad->main_ly, "elm.swallow.content"); + layout = elm_object_part_content_get(_callui_vm_get_main_ly(ad->view_manager), "elm.swallow.content"); CALLUI_RETURN_VALUE_IF_FAIL(layout, NULL); caller_info = elm_object_part_content_get(layout, "caller_info"); @@ -185,7 +185,7 @@ void _callui_show_caller_info_number(void *data, const char *number) Evas_Object *_callui_show_caller_info_status(void *data, const char *status) { callui_app_data_t *ad = (callui_app_data_t *)data; - Evas_Object *layout = elm_object_part_content_get(ad->main_ly, "elm.swallow.content"); + Evas_Object *layout = elm_object_part_content_get(_callui_vm_get_main_ly(ad->view_manager), "elm.swallow.content"); elm_object_translatable_part_text_set(layout, "call_txt_status", status); return layout; @@ -235,8 +235,8 @@ static void __callui_move_more_option(callui_app_data_t *ad, Evas_Object *ctxpop Evas_Coord w = 0, h = 0; int pos = -1; - elm_win_screen_size_get(ad->win, NULL, NULL, &w, &h); - pos = elm_win_rotation_get(ad->win); + _callui_window_get_screen_size(ad->window, NULL, NULL, &w, &h); + pos = _callui_window_get_rotation(ad->window); dbg("w: %d, h: %d", w, h); switch (pos) { @@ -289,7 +289,7 @@ void _callui_load_more_option(void *data) } if (ad->ctxpopup == NULL) { - Evas_Object *ctxpopup = elm_ctxpopup_add(ad->main_ly); + Evas_Object *ctxpopup = elm_ctxpopup_add(_callui_vm_get_main_ly(ad->view_manager)); elm_object_style_set(ctxpopup, "more/default"); elm_ctxpopup_auto_hide_disabled_set(ctxpopup, EINA_TRUE); evas_object_smart_callback_add(ctxpopup, "dismissed", __callui_more_option_dismissed_cb, ad); @@ -452,7 +452,7 @@ void _callui_load_second_call_popup(callui_app_data_t *ad) __callui_unload_second_call_popup(ad); - ad->second_call_popup = elm_popup_add(ad->win); + ad->second_call_popup = elm_popup_add(_callui_window_get_eo(ad->window)); CALLUI_RETURN_IF_FAIL(ad->second_call_popup); elm_popup_align_set(ad->second_call_popup, ELM_NOTIFY_ALIGN_FILL, 1.0); elm_object_translatable_part_text_set(ad->second_call_popup, "title,text", "IDS_CALL_HEADER_ANSWER_CALL_ABB"); @@ -714,7 +714,7 @@ void _callui_load_bluetooth_popup(callui_app_data_t *ad) CALLUI_RETURN_IF_FAIL(ad); __callui_unload_bt_popup(ad); - ad->bt_popup = elm_popup_add(ad->win); + ad->bt_popup = elm_popup_add(_callui_window_get_eo(ad->window)); elm_popup_align_set(ad->bt_popup, ELM_NOTIFY_ALIGN_FILL, 1.0); evas_object_size_hint_weight_set(ad->bt_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); diff --git a/src/callui-view-incoming-call-noti.c b/src/callui-view-incoming-call-noti.c index 989d1c1..c997ee3 100644 --- a/src/callui-view-incoming-call-noti.c +++ b/src/callui-view-incoming-call-noti.c @@ -52,11 +52,11 @@ struct _callui_view_incoming_call_noti { typedef struct _callui_view_incoming_call_noti _callui_view_incoming_call_noti_t; -static callui_result_e __callui_view_incoming_call_noti_oncreate(call_view_data_base_t *view_data, void *appdata); +static callui_result_e __callui_view_incoming_call_noti_oncreate(call_view_data_base_t *view_data, Evas_Object *parent, void *appdata); static callui_result_e __callui_view_incoming_call_noti_onupdate(call_view_data_base_t *view_data); static callui_result_e __callui_view_incoming_call_noti_ondestroy(call_view_data_base_t *view_data); -static callui_result_e __create_main_content(callui_view_incoming_call_noti_h vd); +static callui_result_e __create_main_content(callui_view_incoming_call_noti_h vd, Evas_Object *parent); static callui_result_e __update_displayed_data(callui_view_incoming_call_noti_h vd); static void __reject_msg_genlist_item_click_cb(void *data, Evas_Object *obj, void *event_info); @@ -76,7 +76,6 @@ static void __destroy_reject_msg_content(callui_view_incoming_call_noti_h vd); static void __launch_btn_click_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info); -static callui_result_e __create_main_content(callui_view_incoming_call_noti_h vd); static callui_result_e __create_custom_button(char *icon_name, char *part, Evas_Object_Event_Cb func, void *data, void *data_bt_cb); callui_view_incoming_call_noti_h _callui_view_incoming_call_noti_new() @@ -91,9 +90,10 @@ callui_view_incoming_call_noti_h _callui_view_incoming_call_noti_new() return incoming_call_noti; } -static callui_result_e __callui_view_incoming_call_noti_oncreate(call_view_data_base_t *view_data, void *appdata) +static callui_result_e __callui_view_incoming_call_noti_oncreate(call_view_data_base_t *view_data, Evas_Object *parent, void *appdata) { CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM); + CALLUI_RETURN_VALUE_IF_FAIL(parent, CALLUI_RESULT_INVALID_PARAM); CALLUI_RETURN_VALUE_IF_FAIL(appdata, CALLUI_RESULT_INVALID_PARAM); callui_view_incoming_call_noti_h vd = (callui_view_incoming_call_noti_h)view_data; @@ -101,15 +101,15 @@ static callui_result_e __callui_view_incoming_call_noti_oncreate(call_view_data_ vd->base_view.ad = ad; - // TODO: need to remove this logic from here - evas_object_resize(ad->win, ad->root_w, ELM_SCALE_SIZE(MTLOCK_ACTIVE_NOTI_CALL_HEIGHT)); - _callui_common_win_set_noti_type(ad, true); + _callui_window_set_size_type(ad->window, CALLUI_WIN_SIZE_ACTIVE_NOTI); + _callui_window_set_rotation_locked(ad->window, false); + _callui_window_set_top_level_priority(ad->window, true); - if (!elm_win_keygrab_set(ad->win, CALLUI_KEY_SELECT, 0, 0, 0, ELM_WIN_KEYGRAB_TOPMOST)) { + if (_callui_window_set_keygrab_mode(ad->window, CALLUI_KEY_SELECT, CALLUI_WIN_KEYGRAB_TOPMOST) != CALLUI_RESULT_OK) { dbg("KEY_SELECT key grab failed"); } - callui_result_e res = __create_main_content(vd); + callui_result_e res = __create_main_content(vd, parent); CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res); return __update_displayed_data(vd); @@ -138,11 +138,11 @@ static callui_result_e __callui_view_incoming_call_noti_ondestroy(call_view_data DELETE_EVAS_OBJECT(vd->base_view.contents); - _callui_common_win_set_noti_type(ad, false); + _callui_window_set_size_type(ad->window, CALLUI_WIN_SIZE_FULLSCREEN); + _callui_window_set_rotation_locked(ad->window, true); + _callui_window_set_top_level_priority(ad->window, false); - evas_object_resize(ad->win, ad->root_w, ad->root_h); - - elm_win_keygrab_unset(ad->win, CALLUI_KEY_SELECT, 0, 0); + _callui_window_unset_keygrab_mode(ad->window, CALLUI_KEY_SELECT); free(vd); @@ -189,7 +189,8 @@ static void __swipe_layout_mouse_move_cb(void *data, Evas *evas, Evas_Object *ob ecore_idle_enterer_before_add(__reject_msg_close_effect_activated_cb, vd); - evas_object_resize(ad->win, 0, 0); +// evas_object_resize(ad->win, 0, 0); + _callui_window_minimize(ad->window); } static Eina_Bool __reject_msg_close_effect_activated_cb(void *data) @@ -228,11 +229,11 @@ static void __show_reject_msg_btn_click_cb(void *data, Evas *evas, Evas_Object * callui_app_data_t *ad = vd->base_view.ad; if (vd->rej_msg_list_visible) { - evas_object_resize(ad->win, ad->root_w, ELM_SCALE_SIZE(MTLOCK_ACTIVE_NOTI_CALL_HEIGHT)); + _callui_window_set_size_type(ad->window, CALLUI_WIN_SIZE_ACTIVE_NOTI); elm_object_signal_emit(vd->base_view.contents, "small_main_ly", "main_active_noti_call"); __destroy_reject_msg_content(vd); } else { - evas_object_resize(ad->win, ad->root_w, ad->root_h); + _callui_window_set_size_type(ad->window, CALLUI_WIN_SIZE_FULLSCREEN); elm_object_signal_emit(vd->base_view.contents, "big_main_ly", "main_active_noti_call"); __create_reject_msg_content(vd); } @@ -376,12 +377,11 @@ static void __launch_btn_click_cb(void *data, Evas *evas, Evas_Object *obj, void } } -static callui_result_e __create_main_content(callui_view_incoming_call_noti_h vd) +static callui_result_e __create_main_content(callui_view_incoming_call_noti_h vd, Evas_Object *parent) { - callui_app_data_t *ad = vd->base_view.ad; - - vd->base_view.contents = _callui_load_edj(ad->main_ly, EDJ_NAME, "main_active_noti_call"); - elm_object_part_content_set(ad->main_ly, "elm.swallow.content", vd->base_view.contents); + vd->base_view.contents = _callui_load_edj(parent, EDJ_NAME, "main_active_noti_call"); + CALLUI_RETURN_VALUE_IF_FAIL(vd->base_view.contents, CALLUI_RESULT_ALLOCATION_FAIL); + elm_object_part_content_set(parent, "elm.swallow.content", vd->base_view.contents); callui_result_e res = __create_custom_button(CALLUI_DURING_ICON, "swallow.call_button", __launch_btn_click_cb, vd, (void *)APP_CONTROL_OPERATION_DURING_CALL); @@ -468,8 +468,5 @@ static callui_result_e __update_displayed_data(callui_view_incoming_call_noti_h evas_object_show(vd->base_view.contents); - evas_object_hide(ad->main_ly); - evas_object_show(ad->main_ly); - return CALLUI_RESULT_OK; } diff --git a/src/callui-view-incoming-call.c b/src/callui-view-incoming-call.c index b3a74d8..a29b39d 100644 --- a/src/callui-view-incoming-call.c +++ b/src/callui-view-incoming-call.c @@ -61,11 +61,11 @@ struct _callui_view_incoming_call { }; typedef struct _callui_view_incoming_call _callui_view_incoming_call_t; -static callui_result_e __callui_view_incoming_call_oncreate(call_view_data_base_t *view_data, void *appdata); +static callui_result_e __callui_view_incoming_call_oncreate(call_view_data_base_t *view_data, Evas_Object *parent, void *appdata); static callui_result_e __callui_view_incoming_call_onupdate(call_view_data_base_t *view_data); static callui_result_e __callui_view_incoming_call_ondestroy(call_view_data_base_t *view_data); -static callui_result_e __create_main_content(callui_view_incoming_call_h vd); +static callui_result_e __create_main_content(callui_view_incoming_call_h vd, Evas_Object *parent); static callui_result_e __update_displayed_data(callui_view_incoming_call_h vd); static char *__callui_view_incoming_call_reject_msg_gl_label_get_msg(void *data, Evas_Object *obj, const char *part); @@ -109,9 +109,10 @@ callui_view_incoming_call_h _callui_view_incoming_call_new() return incoming_lock_view; } -static callui_result_e __callui_view_incoming_call_oncreate(call_view_data_base_t *view_data, void *appdata) +static callui_result_e __callui_view_incoming_call_oncreate(call_view_data_base_t *view_data, Evas_Object *parent, void *appdata) { CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM); + CALLUI_RETURN_VALUE_IF_FAIL(parent, CALLUI_RESULT_INVALID_PARAM); CALLUI_RETURN_VALUE_IF_FAIL(appdata, CALLUI_RESULT_INVALID_PARAM); callui_view_incoming_call_h vd = (callui_view_incoming_call_h)view_data; @@ -123,16 +124,17 @@ static callui_result_e __callui_view_incoming_call_oncreate(call_view_data_base_ _callui_lock_manager_force_stop(ad->lock_handle); } - evas_object_resize(ad->win, ad->root_w, ad->root_h); - _callui_common_win_set_noti_type(ad, true); + _callui_window_set_size_type(ad->window, CALLUI_WIN_SIZE_FULLSCREEN); + _callui_window_set_rotation_locked(ad->window, true); + _callui_window_set_top_level_priority(ad->window, true); - evas_object_pointer_mode_set(ad->win, EVAS_OBJECT_POINTER_MODE_NOGRAB); +// evas_object_pointer_mode_set(ad->win, EVAS_OBJECT_POINTER_MODE_NOGRAB); - if (!elm_win_keygrab_set(ad->win, CALLUI_KEY_SELECT, 0, 0, 0, ELM_WIN_KEYGRAB_TOPMOST)) { + if (_callui_window_set_keygrab_mode(ad->window, CALLUI_KEY_SELECT, CALLUI_WIN_KEYGRAB_TOPMOST) != CALLUI_RESULT_OK) { dbg("KEY_SELECT key grab failed"); } - callui_result_e res = __create_main_content(vd); + callui_result_e res = __create_main_content(vd, parent); CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res); return __update_displayed_data(vd); @@ -163,9 +165,9 @@ static callui_result_e __callui_view_incoming_call_ondestroy(call_view_data_base DELETE_EVAS_OBJECT(vd->base_view.contents); - _callui_common_win_set_noti_type(ad, false); + _callui_window_set_top_level_priority(ad->window, false); - elm_win_keygrab_unset(ad->win, CALLUI_KEY_SELECT, 0, 0); + _callui_window_unset_keygrab_mode(ad->window, CALLUI_KEY_SELECT); free(vd); @@ -644,7 +646,8 @@ static void __reject_msg_list_height_update(callui_view_incoming_call_h vd) int win_h = 0; callui_app_data_t *ad = vd->base_view.ad; - elm_win_screen_size_get(ad->win, NULL, NULL, NULL, &win_h); + + _callui_window_get_screen_size(ad->window, NULL, NULL, NULL, &win_h); vd->reject_msg_height = SCALE_SIZE((REJ_MSG_LIST_CREATE_MSG_BTN_H + ((ITEM_SIZE_H) * msg_cnt)), win_h);/* bottom btn height + (genlist item height * msg count) */ if (vd->reject_msg_height > (SCALE_SIZE((MTLOCK_REJECT_MSG_LIST_HEIGHT + REJ_MSG_LIST_CREATE_MSG_BTN_H), win_h))) { @@ -721,9 +724,6 @@ static callui_result_e __update_displayed_data(callui_view_incoming_call_h vd) evas_object_show(vd->base_view.contents); - evas_object_hide(ad->main_ly); - evas_object_show(ad->main_ly); - return CALLUI_RESULT_OK; } @@ -772,13 +772,13 @@ static void __create_reject_msg_layout(callui_view_incoming_call_h vd) evas_object_show(vd->reject_msg_layout); } -static callui_result_e __create_main_content(callui_view_incoming_call_h vd) +static callui_result_e __create_main_content(callui_view_incoming_call_h vd, Evas_Object *parent) { callui_app_data_t *ad = vd->base_view.ad; - vd->base_view.contents = _callui_load_edj(ad->main_ly, EDJ_NAME, GRP_VIEW_MAIN_LY); + vd->base_view.contents = _callui_load_edj(parent, EDJ_NAME, GRP_VIEW_MAIN_LY); CALLUI_RETURN_VALUE_IF_FAIL(vd->base_view.contents, CALLUI_RESULT_ALLOCATION_FAIL); - elm_object_part_content_set(ad->main_ly, "elm.swallow.content", vd->base_view.contents); + elm_object_part_content_set(parent, "elm.swallow.content", vd->base_view.contents); vd->caller_info = _callui_load_edj(vd->base_view.contents, EDJ_NAME, GRP_CALLER_INFO); CALLUI_RETURN_VALUE_IF_FAIL(vd->caller_info, CALLUI_RESULT_ALLOCATION_FAIL); diff --git a/src/callui-view-lock-screen.c b/src/callui-view-lock-screen.c index cb9df62..fea971b 100755 --- a/src/callui-view-lock-screen.c +++ b/src/callui-view-lock-screen.c @@ -205,7 +205,7 @@ static bool __callui_lock_screen_create_layout(lock_screen_data_t *priv) CALLUI_RETURN_VALUE_IF_FAIL(priv, false); /* Make Hit rectangle to refresh lock timer */ - hit_rect = evas_object_rectangle_add(evas_object_evas_get(ad->win)); + hit_rect = evas_object_rectangle_add(evas_object_evas_get(_callui_window_get_eo(ad->window))); evas_object_color_set(hit_rect, 0, 0, 0, 0); evas_object_resize(hit_rect, ad->root_w, ad->root_h); evas_object_move(hit_rect, 0, 0); @@ -215,7 +215,7 @@ static bool __callui_lock_screen_create_layout(lock_screen_data_t *priv) evas_object_show(hit_rect); priv->hit_rect = hit_rect; - layout = __callui_lock_screen_create_contents(ad->main_ly, "lock-screen"); + layout = __callui_lock_screen_create_contents(_callui_vm_get_main_ly(ad->view_manager), "lock-screen"); if (NULL == layout) { warn("layout NULL!!!"); } diff --git a/src/callui-view-manager.c b/src/callui-view-manager.c index dc29e00..1d9b9c5 100644 --- a/src/callui-view-manager.c +++ b/src/callui-view-manager.c @@ -20,6 +20,7 @@ #include "callui-view-dialing.h" #include "callui-view-single-call.h" #include "callui-view-callend.h" +#include "callui-view-elements.h" #include "callui-view-incoming-call-noti.h" #include "callui-view-incoming-call.h" #include "callui-view-multi-call-split.h" @@ -33,6 +34,9 @@ typedef call_view_data_base_t *(*new_view_data_cb) (); struct _callui_vm { + + Evas_Object *main_ly; + call_view_data_base_t *cur_view; callui_view_type_e cur_view_type; callui_app_data_t *ad; @@ -58,6 +62,7 @@ static void __call_state_event_cb(void *user_data, callui_sim_slot_type_e sim_type, void *event_info); static void __end_call_called_cb(void *user_data, unsigned int call_id, callui_call_release_type_e release_type); +static Evas_Object *__create_eo_layout(Evas_Object *parent); static call_view_data_base_t *__allocate_view(callui_view_type_e view_type) { @@ -191,7 +196,7 @@ static void __call_state_event_cb(void *user_data, dbg("Ignored. Already in end call view."); return; case CALLUI_CALL_EVENT_INCOMING: - elm_object_signal_emit(ad->main_ly, "maximize_no_anim", "app_main_ly"); + elm_object_signal_emit(_callui_vm_get_main_ly(ad->view_manager), "maximize_no_anim", "app_main_ly"); break; default: break; @@ -228,12 +233,24 @@ static void __end_call_called_cb(void *user_data, unsigned int call_id, callui_c } } +static Evas_Object *__create_eo_layout(Evas_Object *parent) +{ + Evas_Object *layout = _callui_load_edj(parent, EDJ_NAME, "app_main_ly"); + elm_object_content_set(parent, layout); + evas_object_show(layout); + + return layout; +} + static callui_result_e __callui_vm_init(callui_vm_h vm, callui_app_data_t *ad) { vm->cur_view_type = CALLUI_VIEW_UNDEFINED; vm->ad = ad; vm->paused = true; + vm->main_ly = __create_eo_layout(_callui_window_get_content_parent(ad->window)); + CALLUI_RETURN_VALUE_IF_FAIL(vm->main_ly, CALLUI_RESULT_FAIL); + callui_result_e res = _callui_stp_add_call_state_event_cb(ad->state_provider, __call_state_event_cb, vm); CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res); @@ -251,6 +268,8 @@ static void __callui_vm_deinit(callui_vm_h vm) _callui_manager_remove_end_call_called_cb(ad->call_manager, __end_call_called_cb, vm); __destroy_cur_view(vm); + + DELETE_EVAS_OBJECT(vm->main_ly); } callui_vm_h _callui_vm_create(callui_app_data_t *ad) @@ -277,6 +296,13 @@ void _callui_vm_destroy(callui_vm_h vm) free(vm); } +Evas_Object *_callui_vm_get_main_ly(callui_vm_h vm) +{ + CALLUI_RETURN_NULL_IF_FAIL(vm); + + return vm->main_ly; +} + callui_view_type_e _callui_vm_get_cur_view_type(callui_vm_h vm) { if (!vm) { @@ -325,7 +351,7 @@ static callui_result_e __create_update_view(callui_vm_h vm, callui_view_type_e t return CALLUI_RESULT_FAIL; } - res = view->create(view, vm->ad); + res = view->create(view, vm->main_ly, vm->ad); if (res != CALLUI_RESULT_OK) { err("create() failed! res[%d]", res); @@ -370,11 +396,9 @@ static callui_result_e __change_view(callui_vm_h vm, callui_view_type_e type) if (type == CALLUI_VIEW_DIALLING || type == CALLUI_VIEW_INCOMING_CALL || type == CALLUI_VIEW_INCOMING_CALL_NOTI) { - elm_win_activate(vm->ad->win); + _callui_window_activate(vm->ad->window); } - evas_object_show(vm->ad->win); - return res; } diff --git a/src/callui-view-multi-call-conf.c b/src/callui-view-multi-call-conf.c index 348a2ae..598e45c 100755 --- a/src/callui-view-multi-call-conf.c +++ b/src/callui-view-multi-call-conf.c @@ -39,11 +39,11 @@ struct _callui_view_mc_conf { typedef struct _callui_view_mc_conf _callui_view_mc_conf_t; -static callui_result_e __callui_view_multi_call_conf_oncreate(call_view_data_base_t *view_data, void *appdata); +static callui_result_e __callui_view_multi_call_conf_oncreate(call_view_data_base_t *view_data, Evas_Object *parent, void *appdata); static callui_result_e __callui_view_multi_call_conf_onupdate(call_view_data_base_t *view_data); static callui_result_e __callui_view_multi_call_conf_ondestroy(call_view_data_base_t *view_data); -static callui_result_e __create_main_content(callui_view_mc_conf_h vd); +static callui_result_e __create_main_content(callui_view_mc_conf_h vd, Evas_Object *parent); static callui_result_e __update_displayed_data(callui_view_mc_conf_h vd); static void __manage_calls_btn_clicked_cb(void *data, Evas_Object *o, const char *emission, const char *source); @@ -64,14 +64,14 @@ callui_view_mc_conf_h _callui_view_multi_call_conf_new() return mc_list_conf; } -static callui_result_e __create_main_content(callui_view_mc_conf_h vd) +static callui_result_e __create_main_content(callui_view_mc_conf_h vd, Evas_Object *parent) { callui_app_data_t *ad = vd->base_view.ad; /* Main Layout */ - vd->base_view.contents = _callui_load_edj(ad->main_ly, EDJ_NAME, GRP_VIEW_MAIN_LY); + vd->base_view.contents = _callui_load_edj(parent, EDJ_NAME, GRP_VIEW_MAIN_LY); CALLUI_RETURN_VALUE_IF_FAIL(vd->base_view.contents, CALLUI_RESULT_ALLOCATION_FAIL); - elm_object_part_content_set(ad->main_ly, "elm.swallow.content", vd->base_view.contents); + elm_object_part_content_set(parent, "elm.swallow.content", vd->base_view.contents); // TODO: replace this into view manager in nearest future eext_object_event_callback_add(vd->base_view.contents, EEXT_CALLBACK_MORE, __more_btn_click_cb, ad); @@ -99,15 +99,16 @@ static callui_result_e __create_main_content(callui_view_mc_conf_h vd) return CALLUI_RESULT_OK; } -static callui_result_e __callui_view_multi_call_conf_oncreate(call_view_data_base_t *view_data, void *appdata) +static callui_result_e __callui_view_multi_call_conf_oncreate(call_view_data_base_t *view_data, Evas_Object *parent, void *appdata) { CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM); + CALLUI_RETURN_VALUE_IF_FAIL(parent, CALLUI_RESULT_INVALID_PARAM); CALLUI_RETURN_VALUE_IF_FAIL(appdata, CALLUI_RESULT_INVALID_PARAM); callui_view_mc_conf_h vd = (callui_view_mc_conf_h)view_data; view_data->ad = (callui_app_data_t *)appdata; - callui_result_e res = __create_main_content(vd); + callui_result_e res = __create_main_content(vd, parent); CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res); return __update_displayed_data(vd); @@ -216,9 +217,6 @@ static callui_result_e __update_displayed_data(callui_view_mc_conf_h vd) evas_object_show(vd->base_view.contents); - evas_object_hide(ad->main_ly); - evas_object_show(ad->main_ly); - return CALLUI_RESULT_OK; } diff --git a/src/callui-view-multi-call-list.c b/src/callui-view-multi-call-list.c index 75a9009..ba1e209 100755 --- a/src/callui-view-multi-call-list.c +++ b/src/callui-view-multi-call-list.c @@ -37,11 +37,11 @@ struct _callui_view_mc_list { }; typedef struct _callui_view_mc_list _callui_view_mc_list_t; -static callui_result_e __callui_view_multi_call_list_oncreate(call_view_data_base_t *view_data, void *appdata); +static callui_result_e __callui_view_multi_call_list_oncreate(call_view_data_base_t *view_data, Evas_Object *parent, void *appdata); static callui_result_e __callui_view_multi_call_list_onupdate(call_view_data_base_t *view_data); static callui_result_e __callui_view_multi_call_list_ondestroy(call_view_data_base_t *view_data); -static callui_result_e __create_main_content(callui_view_mc_list_h vd); +static callui_result_e __create_main_content(callui_view_mc_list_h vd, Evas_Object *parent); static callui_result_e __update_displayed_data(callui_view_mc_list_h vd); static void __caller_genlist_init_item_class(callui_view_mc_list_h vd); @@ -72,15 +72,16 @@ callui_view_mc_list_h _callui_view_multi_call_list_new() return mc_list_view; } -static callui_result_e __callui_view_multi_call_list_oncreate(call_view_data_base_t *view_data, void *appdata) +static callui_result_e __callui_view_multi_call_list_oncreate(call_view_data_base_t *view_data, Evas_Object *parent, void *appdata) { CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM); + CALLUI_RETURN_VALUE_IF_FAIL(parent, CALLUI_RESULT_INVALID_PARAM); CALLUI_RETURN_VALUE_IF_FAIL(appdata, CALLUI_RESULT_INVALID_PARAM); callui_view_mc_list_h vd = (callui_view_mc_list_h)view_data; view_data->ad = (callui_app_data_t *)appdata; - callui_result_e res = __create_main_content(vd); + callui_result_e res = __create_main_content(vd, parent); CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res); return __update_displayed_data(vd); @@ -155,9 +156,6 @@ static callui_result_e __update_displayed_data(callui_view_mc_list_h vd) evas_object_show(vd->base_view.contents); - evas_object_hide(ad->main_ly); - evas_object_show(ad->main_ly); - return CALLUI_RESULT_OK; } @@ -179,13 +177,13 @@ static callui_result_e __callui_view_multi_call_list_ondestroy(call_view_data_ba return CALLUI_RESULT_OK; } -static callui_result_e __create_main_content(callui_view_mc_list_h vd) +static callui_result_e __create_main_content(callui_view_mc_list_h vd, Evas_Object *parent) { callui_app_data_t *ad = vd->base_view.ad; - vd->base_view.contents = _callui_load_edj(ad->main_ly, EDJ_NAME, GRP_MULTICALL); + vd->base_view.contents = _callui_load_edj(parent, EDJ_NAME, GRP_MULTICALL); CALLUI_RETURN_VALUE_IF_FAIL(vd->base_view.contents, CALLUI_RESULT_ALLOCATION_FAIL); - elm_object_part_content_set(ad->main_ly, "elm.swallow.content", vd->base_view.contents); + elm_object_part_content_set(parent, "elm.swallow.content", vd->base_view.contents); // TODO: replace this into view manager in nearest future eext_object_event_callback_add(vd->base_view.contents, EEXT_CALLBACK_BACK, __back_btn_click_cb, ad); diff --git a/src/callui-view-multi-call-split.c b/src/callui-view-multi-call-split.c index b3ed801..b36284c 100755 --- a/src/callui-view-multi-call-split.c +++ b/src/callui-view-multi-call-split.c @@ -38,13 +38,13 @@ struct _callui_view_mc_split { }; typedef struct _callui_view_mc_split _callui_view_mc_split_t; -static callui_result_e _callui_view_multi_call_split_oncreate(call_view_data_base_t *view_data, void *appdata); +static callui_result_e _callui_view_multi_call_split_oncreate(call_view_data_base_t *view_data, Evas_Object *parent, void *appdata); static callui_result_e _callui_view_multi_call_split_onupdate(call_view_data_base_t *view_data); static callui_result_e _callui_view_multi_call_split_ondestroy(call_view_data_base_t *view_data); static callui_result_e __update_nonetranslatable_elements(callui_view_mc_split_h vd); -static callui_result_e __create_main_content(callui_view_mc_split_h vd); +static callui_result_e __create_main_content(callui_view_mc_split_h vd, Evas_Object *parent); static callui_result_e __update_displayed_data(callui_view_mc_split_h vd); static Evas_Object *__create_merge_swap_btn(Evas_Object *parent, const char *name, const char *text); @@ -104,9 +104,10 @@ static callui_result_e __update_nonetranslatable_elements(callui_view_mc_split_h return CALLUI_RESULT_OK; } -static callui_result_e _callui_view_multi_call_split_oncreate(call_view_data_base_t *view_data, void *appdata) +static callui_result_e _callui_view_multi_call_split_oncreate(call_view_data_base_t *view_data, Evas_Object *parent, void *appdata) { CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM); + CALLUI_RETURN_VALUE_IF_FAIL(parent, CALLUI_RESULT_INVALID_PARAM); CALLUI_RETURN_VALUE_IF_FAIL(appdata, CALLUI_RESULT_INVALID_PARAM); callui_view_mc_split_h vd = (callui_view_mc_split_h)view_data; @@ -114,7 +115,7 @@ static callui_result_e _callui_view_multi_call_split_oncreate(call_view_data_bas vd->base_view.ad = ad; - callui_result_e res = __create_main_content(vd); + callui_result_e res = __create_main_content(vd, parent); CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res); _callui_lock_manager_start(ad->lock_handle); @@ -163,13 +164,13 @@ static callui_result_e _callui_view_multi_call_split_ondestroy(call_view_data_ba } -static callui_result_e __create_main_content(callui_view_mc_split_h vd) +static callui_result_e __create_main_content(callui_view_mc_split_h vd, Evas_Object *parent) { callui_app_data_t *ad = vd->base_view.ad; - vd->base_view.contents = _callui_load_edj(ad->main_ly, EDJ_NAME, GROUP_SPLIT); + vd->base_view.contents = _callui_load_edj(parent, EDJ_NAME, GROUP_SPLIT); CALLUI_RETURN_VALUE_IF_FAIL(vd->base_view.contents, CALLUI_RESULT_ALLOCATION_FAIL); - elm_object_part_content_set(ad->main_ly, "elm.swallow.content", vd->base_view.contents); + elm_object_part_content_set(parent, "elm.swallow.content", vd->base_view.contents); vd->caller_info = _callui_load_edj(vd->base_view.contents, EDJ_NAME, GROUP_ONE_HOLD_IN_CONFERENCE); CALLUI_RETURN_VALUE_IF_FAIL(vd->caller_info, CALLUI_RESULT_ALLOCATION_FAIL); @@ -379,9 +380,6 @@ static callui_result_e __update_displayed_data(callui_view_mc_split_h vd) evas_object_show(vd->base_view.contents); - evas_object_hide(ad->main_ly); - evas_object_show(ad->main_ly); - return res; } diff --git a/src/callui-view-quickpanel.c b/src/callui-view-quickpanel.c index 6272f69..9e60413 100755 --- a/src/callui-view-quickpanel.c +++ b/src/callui-view-quickpanel.c @@ -279,7 +279,7 @@ static void __caller_btn_click_cb(void *data, Evas_Object *obj, void *event_info /* if (_callui_get_idle_lock_type() == CALL_LOCK) vconf_set_int(VCONFKEY_IDLE_LOCK_STATE, VCONFKEY_IDLE_UNLOCK);*/ - elm_win_activate(ad->win); + _callui_window_activate(ad->window); } static void __main_layout_mouse_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) diff --git a/src/callui-view-single-call.c b/src/callui-view-single-call.c index 5ca78ee..ea45e0d 100644 --- a/src/callui-view-single-call.c +++ b/src/callui-view-single-call.c @@ -37,11 +37,11 @@ struct _call_view_single_call { }; typedef struct _call_view_single_call _call_view_single_call_t; -static callui_result_e __callui_view_single_call_oncreate(call_view_data_base_t *view_data, void *appdata); +static callui_result_e __callui_view_single_call_oncreate(call_view_data_base_t *view_data, Evas_Object *parent, void *appdata); static callui_result_e __callui_view_single_call_onupdate(call_view_data_base_t *view_data); static callui_result_e __callui_view_single_call_ondestroy(call_view_data_base_t *view_data); -static callui_result_e __create_main_content(call_view_single_call_h vd); +static callui_result_e __create_main_content(call_view_single_call_h vd, Evas_Object *parent); static callui_result_e __update_displayed_data(call_view_single_call_h vd); static void __more_btn_click_cb(void *data, Evas_Object *obj, void *event_info); @@ -61,9 +61,10 @@ call_view_single_call_h _callui_view_single_call_new() return single_call_view; } -static callui_result_e __callui_view_single_call_oncreate(call_view_data_base_t *view_data, void *appdata) +static callui_result_e __callui_view_single_call_oncreate(call_view_data_base_t *view_data, Evas_Object *parent, void *appdata) { CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM); + CALLUI_RETURN_VALUE_IF_FAIL(parent, CALLUI_RESULT_INVALID_PARAM); CALLUI_RETURN_VALUE_IF_FAIL(appdata, CALLUI_RESULT_INVALID_PARAM); call_view_single_call_h vd = (call_view_single_call_h)view_data; @@ -71,7 +72,7 @@ static callui_result_e __callui_view_single_call_oncreate(call_view_data_base_t vd->base_view.ad = ad; - callui_result_e res = __create_main_content(vd); + callui_result_e res = __create_main_content(vd, parent); CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res); _callui_lock_manager_start(ad->lock_handle); @@ -228,20 +229,16 @@ static callui_result_e __update_displayed_data(call_view_single_call_h vd) evas_object_show(vd->base_view.contents); - evas_object_hide(ad->main_ly); - evas_object_show(ad->main_ly); - return CALLUI_RESULT_OK; } -static callui_result_e __create_main_content(call_view_single_call_h vd) +static callui_result_e __create_main_content(call_view_single_call_h vd, Evas_Object *parent) { callui_app_data_t *ad = vd->base_view.ad; - CALLUI_RETURN_VALUE_IF_FAIL(ad->main_ly, CALLUI_RESULT_FAIL); - vd->base_view.contents = _callui_load_edj(ad->main_ly, EDJ_NAME, GRP_VIEW_MAIN_LY); + vd->base_view.contents = _callui_load_edj(parent, EDJ_NAME, GRP_VIEW_MAIN_LY); CALLUI_RETURN_VALUE_IF_FAIL(vd->base_view.contents, CALLUI_RESULT_ALLOCATION_FAIL); - elm_object_part_content_set(ad->main_ly, "elm.swallow.content", vd->base_view.contents); + elm_object_part_content_set(parent, "elm.swallow.content", vd->base_view.contents); // TODO: replace this into view manager in nearest future eext_object_event_callback_add(vd->base_view.contents, EEXT_CALLBACK_MORE, __more_btn_click_cb, ad); diff --git a/src/callui-window.c b/src/callui-window.c new file mode 100644 index 0000000..8be6233 --- /dev/null +++ b/src/callui-window.c @@ -0,0 +1,382 @@ +/* + * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include + +#include "callui-window.h" +#include "callui.h" +#include "callui-common-def.h" +#include "callui-debug.h" +#include "callui-view-layout.h" + +#define CALLUI_WIN_ACT_NOTI_HEIGHT ELM_SCALE_SIZE(350) +#define CALLUI_WIN_ACT_NOTI_ROTATION_COUNT 4 +#define CALLUI_WIN_NORM_ROTATION_COUNT 1 + +struct __callui_window { + + Evas_Object *win; + Evas_Object *conformant; + + callui_app_data_t *ad; + + int win_w; + int win_h; + bool rotation_locked; + callui_win_size_type_e size_type; +}; + +typedef struct __callui_window __callui_window_t; + +static Evas_Object *__create_eo_window(callui_window_h win_handler); +static Evas_Object *__create_eo_conformant(Evas_Object *win); + +static void __eo_win_rotation_changed_cb(void *data, Evas_Object *obj, void *event_info); + +static void __eo_win_update_size(callui_window_h win_handler, callui_win_size_type_e size_type); +static callui_result_e __eo_win_set_rotation_locked(callui_window_h win_handler, bool is_locked); +static void __eo_win_move_and_resize(callui_window_h win_handler, bool force_resize); +static Elm_Win_Keygrab_Mode __convert_app_keygrab_mode(callui_win_keygrab_mode_e mode); + +static Evas_Object *__create_eo_conformant(Evas_Object *win) +{ + Evas_Object *conf = elm_conformant_add(win); + CALLUI_RETURN_NULL_IF_FAIL(conf); + + elm_object_signal_emit(conf, "elm,state,indicator,overlap", "elm"); + evas_object_size_hint_weight_set(conf, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, conf); + evas_object_show(conf); + + return conf; +} + +static void __eo_win_move_and_resize(callui_window_h win_handler, bool force_resize) +{ + callui_app_data_t *ad = win_handler->ad; + + int angle = elm_win_rotation_get(win_handler->win); + dbg("Window orientation changed [%d]", angle); + + int win_h = win_handler->win_h; + int win_w = win_handler->win_w; + + if (win_handler->size_type == CALLUI_WIN_SIZE_FULLSCREEN) { + if (angle == 90 || angle == 270) { + int temp = win_h; + win_h = win_w; + win_w = temp; + } + } + if (force_resize) { + evas_object_resize(win_handler->win, 0, 0); + } + evas_object_resize(win_handler->win, win_w, win_h); + + int move_x = 0; + int move_y = 0; + + if (win_handler->size_type != CALLUI_WIN_SIZE_FULLSCREEN) { + switch (angle) { + case 90: + move_y = ACTIVE_NOTI_L_PAD; + break; + case 180: + move_y = ad->root_h - win_h; + break; + case 270: + move_x = ad->root_w - win_h; + move_y = ad->root_h - win_w - ACTIVE_NOTI_L_PAD; + break; + default: + break; + } + } + evas_object_move(win_handler->win, move_x, move_y); +} + +static void __eo_win_rotation_changed_cb(void *data, Evas_Object *obj, void *event_info) +{ + CALLUI_RETURN_IF_FAIL(data); + + __eo_win_move_and_resize(data, true); +} + +static Evas_Object *__create_eo_window(callui_window_h win_handler) +{ + Evas_Object *eo = elm_win_add(NULL, PACKAGE, ELM_WIN_NOTIFICATION); + CALLUI_RETURN_NULL_IF_FAIL(eo); + + elm_win_aux_hint_add(eo, "wm.policy.win.user.geometry", "1"); + elm_win_fullscreen_set(eo, EINA_FALSE); + elm_win_alpha_set(eo, EINA_TRUE); + + evas_object_smart_callback_add(eo, "wm,rotation,changed", __eo_win_rotation_changed_cb, win_handler); + + elm_win_center(eo, EINA_FALSE, EINA_FALSE); + elm_win_indicator_mode_set(eo, ELM_WIN_INDICATOR_SHOW); + elm_win_indicator_opacity_set(eo, ELM_WIN_INDICATOR_TRANSLUCENT); + elm_win_conformant_set(eo, EINA_TRUE); + + return eo; +} + +callui_result_e __callui_window_init(callui_window_h win_handler, callui_app_data_t *appdata) +{ + win_handler->ad = appdata; + win_handler->rotation_locked = false; + + win_handler->win = __create_eo_window(win_handler); + CALLUI_RETURN_VALUE_IF_FAIL(win_handler->win, CALLUI_RESULT_FAIL); + + win_handler->conformant = __create_eo_conformant(win_handler->win); + CALLUI_RETURN_VALUE_IF_FAIL(win_handler->conformant, CALLUI_RESULT_FAIL); + + __eo_win_update_size(win_handler, CALLUI_WIN_SIZE_ACTIVE_NOTI); + + return __eo_win_set_rotation_locked(win_handler, true); +} + +void __callui_window_deinit(callui_window_h win_handler) +{ + win_handler->conformant = NULL; + evas_object_smart_callback_del_full(win_handler->win, "wm,rotation,changed", __eo_win_rotation_changed_cb, win_handler); + DELETE_EVAS_OBJECT(win_handler->win); +} + +callui_window_h _callui_window_create(callui_app_data_t *appdata) +{ + CALLUI_RETURN_NULL_IF_FAIL(appdata); + + callui_window_h win_handler = (callui_window_h)calloc(1, sizeof(__callui_window_t)); + CALLUI_RETURN_NULL_IF_FAIL(win_handler); + + if (__callui_window_init(win_handler, appdata) != CALLUI_RESULT_OK) { + __callui_window_deinit(win_handler); + FREE(win_handler); + } + return win_handler; +} + +void _callui_window_destroy(callui_window_h win_handler) +{ + CALLUI_RETURN_IF_FAIL(win_handler); + + __callui_window_deinit(win_handler); + + free(win_handler); +} + +Evas_Object *_callui_window_get_eo(callui_window_h win_handler) +{ + CALLUI_RETURN_NULL_IF_FAIL(win_handler); + + return win_handler->win; +} + +Evas_Object *_callui_window_get_content_parent(callui_window_h win_handler) +{ + CALLUI_RETURN_NULL_IF_FAIL(win_handler); + + return win_handler->conformant; +} + +void _callui_window_set_content(callui_window_h win_handler, Evas_Object *content) +{ + CALLUI_RETURN_IF_FAIL(win_handler); + + elm_object_content_set(win_handler->conformant, content); +} + +static void __eo_win_update_size(callui_window_h win_handler, callui_win_size_type_e size_type) +{ + callui_app_data_t *ad = win_handler->ad; + + win_handler->size_type = size_type; + win_handler->win_w = ad->root_w; + + switch (size_type) { + case CALLUI_WIN_SIZE_FULLSCREEN: + win_handler->win_h = ad->root_h; + break; + case CALLUI_WIN_SIZE_ACTIVE_NOTI: + win_handler->win_h = CALLUI_WIN_ACT_NOTI_HEIGHT; + break; + default: + break; + } + __eo_win_move_and_resize(win_handler, false); +} + +void _callui_window_set_size_type(callui_window_h win_handler, callui_win_size_type_e size_type) +{ + CALLUI_RETURN_IF_FAIL(win_handler); + CALLUI_RETURN_IF_FAIL((size_type >= CALLUI_WIN_SIZE_FULLSCREEN && size_type <= CALLUI_WIN_SIZE_ACTIVE_NOTI)); + + __eo_win_update_size(win_handler, size_type); +} + +static callui_result_e __eo_win_set_rotation_locked(callui_window_h win_handler, bool is_locked) +{ + CALLUI_RETURN_VALUE_IF_FAIL(win_handler->rotation_locked != is_locked, + CALLUI_RESULT_ALREADY_REGISTERED); + + if (elm_win_wm_rotation_supported_get(win_handler->win)) { + //win_handler->rotation_locked = is_locked; + //TODO: Temporary solution as Active Notification is not ready to support rotation + win_handler->rotation_locked = true; + + if (win_handler->rotation_locked) { + int rotate_angles[CALLUI_WIN_NORM_ROTATION_COUNT] = { 0 }; + elm_win_wm_rotation_available_rotations_set(win_handler->win, + rotate_angles, + CALLUI_WIN_NORM_ROTATION_COUNT); + } else { + int rotate_angles[CALLUI_WIN_ACT_NOTI_ROTATION_COUNT] = { 0, 90, 180, 270 }; + elm_win_wm_rotation_available_rotations_set(win_handler->win, + rotate_angles, + CALLUI_WIN_ACT_NOTI_ROTATION_COUNT); + } + } else { + err("Window does not support rotation"); + return CALLUI_RESULT_FAIL; + } + + return CALLUI_RESULT_OK; +} + +callui_result_e _callui_window_set_rotation_locked(callui_window_h win_handler, bool is_locked) +{ + CALLUI_RETURN_VALUE_IF_FAIL(win_handler, CALLUI_RESULT_INVALID_PARAM); + + return __eo_win_set_rotation_locked(win_handler, is_locked); +} + +int _callui_window_get_rotation(callui_window_h win_handler) +{ + CALLUI_RETURN_VALUE_IF_FAIL(win_handler, -1); + + return elm_win_rotation_get(win_handler->win); +} + +callui_result_e _callui_window_set_top_level_priority(callui_window_h win_handler, bool is_toplevel) +{ + CALLUI_RETURN_VALUE_IF_FAIL(win_handler, CALLUI_RESULT_INVALID_PARAM); + + efl_util_notification_level_e efl_noti_level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; + if (is_toplevel) { + dbg("Window level [TOP]"); + efl_noti_level = EFL_UTIL_NOTIFICATION_LEVEL_TOP; + } else { + dbg("Window level [NORMAL]"); + } + int res = efl_util_set_notification_window_level(win_handler->win, efl_noti_level); + if (res != EFL_UTIL_ERROR_NONE) { + err("efl_util_set_notification_window_level() failed! res[%d]", res); + return CALLUI_RESULT_FAIL; + } + + return CALLUI_RESULT_OK; +} + +callui_result_e _callui_window_set_screen_mode(callui_window_h win_handler, callui_win_screen_mode_e screen_mode) +{ + CALLUI_RETURN_VALUE_IF_FAIL(win_handler, CALLUI_RESULT_INVALID_PARAM); + CALLUI_RETURN_VALUE_IF_FAIL((screen_mode >= CALLUI_WIN_SCREEN_MODE_DEFAULT && + screen_mode <= CALLUI_WIN_SCREEN_MODE_ALWAYS_ON), CALLUI_RESULT_INVALID_PARAM); + + efl_util_screen_mode_e efl_screen_mode = EFL_UTIL_SCREEN_MODE_DEFAULT; + if (screen_mode == CALLUI_WIN_SCREEN_MODE_ALWAYS_ON) { + dbg("Screen mode [Always on]"); + efl_screen_mode = EFL_UTIL_SCREEN_MODE_ALWAYS_ON; + } else { + dbg("Screen mode [Default]"); + } + int res = efl_util_set_window_screen_mode(win_handler->win, efl_screen_mode); + if (res != EFL_UTIL_ERROR_NONE) { + err("efl_util_set_window_screen_mode() failed! res[%d]", res); + return CALLUI_RESULT_FAIL; + } + + return CALLUI_RESULT_OK; +} + +void _callui_window_get_screen_size(callui_window_h win_handler, int *x, int *y, int *w, int *h) +{ + CALLUI_RETURN_IF_FAIL(win_handler); + + elm_win_screen_size_get(win_handler->win, x, y, w, h); +} + +void _callui_window_activate(callui_window_h win_handler) +{ + CALLUI_RETURN_IF_FAIL(win_handler); + + elm_win_activate(win_handler->win); + evas_object_show(win_handler->win); +} + +void _callui_window_minimize(callui_window_h win_handler) +{ + CALLUI_RETURN_IF_FAIL(win_handler); + + elm_win_lower(win_handler->win); +} + +static Elm_Win_Keygrab_Mode __convert_app_keygrab_mode(callui_win_keygrab_mode_e mode) +{ + switch (mode) { + case CALLUI_WIN_KEYGRAB_UNKNOWN: + return ELM_WIN_KEYGRAB_UNKNOWN; + case CALLUI_WIN_KEYGRAB_SHARED: + return ELM_WIN_KEYGRAB_SHARED; + case CALLUI_WIN_KEYGRAB_TOPMOST: + return ELM_WIN_KEYGRAB_TOPMOST; + case CALLUI_WIN_KEYGRAB_EXCLUSIVE: + return ELM_WIN_KEYGRAB_EXCLUSIVE; + case CALLUI_WIN_KEYGRAB_OVERRIDE_EXCLUSIVE: + return ELM_WIN_KEYGRAB_OVERRIDE_EXCLUSIVE; + default: + return ELM_WIN_KEYGRAB_UNKNOWN; + } +} + +callui_result_e _callui_window_set_keygrab_mode(callui_window_h win_handler, const char *key, callui_win_keygrab_mode_e mode) +{ + CALLUI_RETURN_VALUE_IF_FAIL(win_handler, CALLUI_RESULT_INVALID_PARAM); + CALLUI_RETURN_VALUE_IF_FAIL(key, CALLUI_RESULT_INVALID_PARAM); + CALLUI_RETURN_VALUE_IF_FAIL(mode >= CALLUI_WIN_KEYGRAB_UNKNOWN && + mode <= CALLUI_WIN_KEYGRAB_OVERRIDE_EXCLUSIVE, CALLUI_RESULT_INVALID_PARAM); + + if (!elm_win_keygrab_set(win_handler->win, key, 0, 0, 0, __convert_app_keygrab_mode(mode))) { + err("elm_win_keygrab_set() failed! key[%s] mode[%d]"); + return CALLUI_RESULT_FAIL; + } + return CALLUI_RESULT_OK; +} + +callui_result_e _callui_window_unset_keygrab_mode(callui_window_h win_handler, const char *key) +{ + CALLUI_RETURN_VALUE_IF_FAIL(win_handler, CALLUI_RESULT_INVALID_PARAM); + CALLUI_RETURN_VALUE_IF_FAIL(key, CALLUI_RESULT_INVALID_PARAM); + + if (!elm_win_keygrab_unset(win_handler->win, key, 0, 0)) { + err("elm_win_keygrab_unset() failed! key[%s]"); + return CALLUI_RESULT_FAIL; + } + return CALLUI_RESULT_OK; +} diff --git a/src/callui.c b/src/callui.c index dc2fc09..c1cc1bc 100755 --- a/src/callui.c +++ b/src/callui.c @@ -20,7 +20,6 @@ #include #include #include -#include #include "callui.h" #include "callui-debug.h" @@ -43,11 +42,6 @@ static void __app_lang_changed_cb(app_event_info_h event_info, void *user_data); static bool __app_init(callui_app_data_t *ad); static void __app_deinit(callui_app_data_t *ad); -static bool __create_main_gui_elem(callui_app_data_t *ad); -static Evas_Object *__create_main_window(callui_app_data_t *ad); -static Evas_Object *__create_conformant(Evas_Object *win); -static Evas_Object *__create_main_layout(Evas_Object *conf); - static void __init_app_event_handlers(callui_app_data_t *ad); static Eina_Bool __hard_key_down_cb(void *data, int type, void *event); @@ -75,26 +69,26 @@ static callui_app_data_t g_ad; static void __set_main_win_key_grab(callui_app_data_t *ad) { - int result = elm_win_keygrab_set(ad->win, CALLUI_KEY_MEDIA, 0, 0, 0, ELM_WIN_KEYGRAB_EXCLUSIVE); - if (!result) { + int res = _callui_window_set_keygrab_mode(ad->window, CALLUI_KEY_MEDIA, CALLUI_WIN_KEYGRAB_EXCLUSIVE); + if (res != CALLUI_RESULT_OK) { dbg("KEY_MEDIA key grab failed"); } if (_callui_common_is_powerkey_mode_on()) { - result = elm_win_keygrab_set(ad->win, CALLUI_KEY_POWER, 0, 0, 0, ELM_WIN_KEYGRAB_EXCLUSIVE); + res = _callui_window_set_keygrab_mode(ad->window, CALLUI_KEY_POWER, CALLUI_WIN_KEYGRAB_EXCLUSIVE); } else { - result = elm_win_keygrab_set(ad->win, CALLUI_KEY_POWER, 0, 0, 0, ELM_WIN_KEYGRAB_SHARED); + res = _callui_window_set_keygrab_mode(ad->window, CALLUI_KEY_POWER, CALLUI_WIN_KEYGRAB_SHARED); } - if (!result) { + if (!res) { dbg("KEY_POWER key grab failed"); } } static void __unset_main_win_key_grab(callui_app_data_t *ad) { - elm_win_keygrab_unset(ad->win, CALLUI_KEY_SELECT, 0, 0); - elm_win_keygrab_unset(ad->win, CALLUI_KEY_POWER, 0, 0); - elm_win_keygrab_unset(ad->win, CALLUI_KEY_MEDIA, 0, 0); + _callui_window_unset_keygrab_mode(ad->window, CALLUI_KEY_SELECT); + _callui_window_unset_keygrab_mode(ad->window, CALLUI_KEY_POWER); + _callui_window_unset_keygrab_mode(ad->window, CALLUI_KEY_MEDIA); } static void __add_ecore_event_key_handlers(callui_app_data_t *ad) @@ -311,6 +305,11 @@ static bool __app_init(callui_app_data_t *ad) __bt_init(); + elm_theme_extension_add(NULL, CALL_THEME); + + ad->window = _callui_window_create(ad); + CALLUI_RETURN_VALUE_IF_FAIL(ad->window, false); + ad->call_manager = _callui_manager_create(); CALLUI_RETURN_VALUE_IF_FAIL(ad->call_manager, false); @@ -321,11 +320,12 @@ static bool __app_init(callui_app_data_t *ad) _callui_stp_add_call_state_event_cb(ad->state_provider, __call_state_change_cb, ad); _callui_sdm_add_audio_state_changed_cb(ad->sound_manager, __audio_state_changed_cb, ad); - CALLUI_RETURN_VALUE_IF_FAIL(__create_main_gui_elem(ad), false); - ad->view_manager = _callui_vm_create(ad); CALLUI_RETURN_VALUE_IF_FAIL(ad->view_manager, false); + _callui_window_get_screen_size(ad->window, NULL, NULL, &ad->root_w, &ad->root_h); + _callui_window_set_content(ad->window, _callui_vm_get_main_ly(ad->view_manager)); + ad->action_bar = _callui_action_bar_create(ad); CALLUI_RETURN_VALUE_IF_FAIL(ad->action_bar, false); @@ -347,8 +347,6 @@ static bool __app_init(callui_app_data_t *ad) __set_text_classes_params(); - elm_theme_extension_add(NULL, CALL_THEME); - return true; } @@ -384,70 +382,6 @@ static void __app_lang_changed_cb(app_event_info_h event_info, void *user_data) _callui_vm_update_language(ad->view_manager); } -static void __main_win_screen_mode_error_cb(Evas_Object *window, int error_code, void *user_data) -{ - err("__main_win_screen_mode_error_cb() return res[%d]", error_code); -} - -static Evas_Object *__create_main_window(callui_app_data_t *ad) -{ - Evas_Object *eo = elm_win_add(NULL, PACKAGE, ELM_WIN_NOTIFICATION); - CALLUI_RETURN_NULL_IF_FAIL(eo); - - elm_win_aux_hint_add(eo, "wm.policy.win.user.geometry", "1"); - elm_win_fullscreen_set(eo, EINA_FALSE); - elm_win_alpha_set(eo, EINA_TRUE); - - efl_util_set_window_screen_mode_error_cb(eo, __main_win_screen_mode_error_cb, NULL); - - elm_win_screen_size_get(eo, NULL, NULL, &ad->root_w, &ad->root_h); - evas_object_resize(eo, ad->root_w, ELM_SCALE_SIZE(MTLOCK_ACTIVE_NOTI_CALL_HEIGHT)); - - elm_win_center(eo, EINA_FALSE, EINA_TRUE); - evas_object_move(eo, 0, 0); - elm_win_indicator_mode_set(eo, ELM_WIN_INDICATOR_SHOW); - elm_win_indicator_opacity_set(eo, ELM_WIN_INDICATOR_TRANSLUCENT); - elm_win_conformant_set(eo, EINA_TRUE); - - return eo; -} - -static Evas_Object *__create_conformant(Evas_Object *win) -{ - Evas_Object *win_conformant = elm_conformant_add(win); - CALLUI_RETURN_NULL_IF_FAIL(win_conformant); - - elm_object_signal_emit(win_conformant, "elm,state,indicator,overlap", "elm"); - evas_object_size_hint_weight_set(win_conformant, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_win_resize_object_add(win, win_conformant); - evas_object_show(win_conformant); - - return win_conformant; -} - -static Evas_Object *__create_main_layout(Evas_Object *conf) -{ - Evas_Object *layout = _callui_load_edj(conf, EDJ_NAME, "app_main_ly"); - elm_object_content_set(conf, layout); - evas_object_show(layout); - - return layout; -} - -static bool __create_main_gui_elem(callui_app_data_t *ad) -{ - ad->win = __create_main_window(ad); - CALLUI_RETURN_VALUE_IF_FAIL(ad->win, false) - - Evas_Object *conf = __create_conformant(ad->win); - CALLUI_RETURN_VALUE_IF_FAIL(conf, false); - - ad->main_ly = __create_main_layout(conf); - CALLUI_RETURN_VALUE_IF_FAIL(ad->main_ly, false); - - return true; -} - static void __app_deinit(callui_app_data_t *ad) { debug_enter(); @@ -496,14 +430,12 @@ static void __app_deinit(callui_app_data_t *ad) ad->sound_manager = NULL; } - if (ad->main_ly) { - evas_object_del(ad->main_ly); - ad->main_ly = NULL; + if (ad->window) { + _callui_window_destroy(ad->window); + ad->window = NULL; } - if (ad->win) { - efl_util_unset_window_screen_mode_error_cb(ad->win); - } + elm_theme_extension_del(NULL, CALL_THEME); free(ad->end_call_data); @@ -600,7 +532,8 @@ static void __app_service(app_control_h app_control, void *data) sec_dbg("number: [%s]", tmp); if (tmp) { sec_dbg("number: [%s]", tmp); - evas_object_resize(ad->win, ad->root_w, ad->root_h); + _callui_window_set_size_type(ad->window, CALLUI_WIN_SIZE_FULLSCREEN); + _callui_window_set_rotation_locked(ad->window, true); if (!ad->waiting_dialing) { __process_outgoing_call(ad, tmp); } @@ -704,11 +637,11 @@ static Eina_Bool __hard_key_up_cb(void *data, int type, void *event) } } else if (!strcmp(ev->keyname, CALLUI_KEY_SELECT) || !strcmp(ev->keyname, CALLUI_KEY_HOME)) { dbg("in KEY_SELECT"); - int result = 0; - result = elm_win_keygrab_unset(ad->win, CALLUI_KEY_SELECT, 0, 0); - if (!result) { + + if (_callui_window_unset_keygrab_mode(ad->window, CALLUI_KEY_SELECT) != CALLUI_RESULT_OK) { dbg("KEY_SELECT key ungrab failed"); } + if (view_type == CALLUI_VIEW_INCOMING_CALL || view_type == CALLUI_VIEW_INCOMING_CALL_NOTI) { @@ -733,7 +666,8 @@ static Eina_Bool __hard_key_up_cb(void *data, int type, void *event) _callui_load_second_call_popup(ad); } } else { - if (!elm_win_keygrab_set(ad->win, CALLUI_KEY_SELECT, 0, 0, 0, ELM_WIN_KEYGRAB_TOPMOST)) { + if (_callui_window_set_keygrab_mode(ad->window, + CALLUI_KEY_SELECT, CALLUI_WIN_KEYGRAB_TOPMOST) != CALLUI_RESULT_OK) { dbg("KEY_SELECT key ungrab failed"); } } @@ -742,7 +676,7 @@ static Eina_Bool __hard_key_up_cb(void *data, int type, void *event) //Ecore_X_Window focus_win = ecore_x_window_focus_get(); //if (ad->win != NULL && focus_win == elm_win_xwindow_get(ad->win)) { /* ToDo: Use lock-screen interface to raise the home screen */ - _callui_common_win_set_noti_type(ad, false); + _callui_window_set_top_level_priority(ad->window, false); _callui_lock_manager_stop(ad->lock_handle); ad->on_background = true; //}