diff options
author | Stanislav Radomskiy <Stanislavx.Radomskiy@intel.com> | 2013-04-29 08:50:50 +0300 |
---|---|---|
committer | Gerrit Code Review <gerrit2@kim11> | 2013-05-02 11:18:52 +0900 |
commit | 76916d513bc5ddef014412deadc15412f6fde1b8 (patch) | |
tree | b78b1e4161df1aa0fed6f94aba550647c5ece4dc | |
parent | d654de2c10841807ef8d24e42481befdf117fa06 (diff) | |
download | smartsearch-76916d513bc5ddef014412deadc15412f6fde1b8.tar.gz smartsearch-76916d513bc5ddef014412deadc15412f6fde1b8.tar.bz2 smartsearch-76916d513bc5ddef014412deadc15412f6fde1b8.zip |
Fixing TREL-202 bug
-rwxr-xr-x | src/smartsearch.cpp | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/src/smartsearch.cpp b/src/smartsearch.cpp index dbd6cea..a993b2a 100755 --- a/src/smartsearch.cpp +++ b/src/smartsearch.cpp @@ -70,6 +70,8 @@ static struct search_content_object_default def_obj[SEARCH_CONT_MAX] = { SEARCH_CONT_PHONE_BROWSER, SEARCH_OBJ_PHONE_CONTENTS, "org.tizen.browser"}, }; +static void __search_app_device_orientation_cb(void *data, Evas_Object *obj, void *event); + static struct search_category_info_default def_category[SEARCH_CATE_MAX] = { { "B10_btn_icon_Phone.png", "B10_btn_icon_Phone_press.png" }, }; @@ -423,6 +425,19 @@ static Evas_Object *__search_create_win(const char *name, void *data) __search_win_delete_cb, ad); ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h); evas_object_resize(eo, w, h); + + if (elm_win_wm_rotation_supported_get(eo)) { + const int rots[4] = { APP_DEVICE_ORIENTATION_0, + APP_DEVICE_ORIENTATION_90, + APP_DEVICE_ORIENTATION_180, + APP_DEVICE_ORIENTATION_270 }; + elm_win_wm_rotation_available_rotations_set(eo, rots, 4); + } + /* pass '-1' value to this API then it will unset + * preferred rotation angle */ + elm_win_wm_rotation_preferred_rotation_set(eo, -1); + evas_object_smart_callback_add(eo, "wm,rotation,changed", + __search_app_device_orientation_cb, ad); } SEARCH_FUNC_END; @@ -761,17 +776,38 @@ static void __search_app_service(service_h service, void *data) SEARCH_FUNC_END; } -static void __search_app_device_orientation_cb(app_device_orientation_e orientation, void *data) +static void __search_app_device_orientation_cb(void *data, Evas_Object *obj, void *event) { SEARCH_FUNC_START; struct appdata *ad = (struct appdata *)data; + enum ug_event rotation_mode; + int m = 0; SEARCH_RET_IF(ad == NULL); SEARCH_RET_IF(ad->win_main == NULL); - if (orientation >= 0) { - elm_win_rotation_with_resize_set(ad->win_main, orientation); + m = elm_win_rotation_get(ad->win_main); + + switch (m) { + case APP_DEVICE_ORIENTATION_180: + rotation_mode = UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN; + break; + + case APP_DEVICE_ORIENTATION_270: + rotation_mode = UG_EVENT_ROTATE_LANDSCAPE; + break; + + case APP_DEVICE_ORIENTATION_90: + rotation_mode = UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN; + break; + + case APP_DEVICE_ORIENTATION_0: + default: + rotation_mode = UG_EVENT_ROTATE_PORTRAIT; + break; } + ug_send_event(rotation_mode); + SEARCH_FUNC_END; } @@ -802,7 +838,7 @@ int main(int argc, char *argv[]) event_callback.service = __search_app_service; event_callback.low_memory = NULL; event_callback.low_battery = NULL; - event_callback.device_orientation = __search_app_device_orientation_cb; + event_callback.device_orientation = NULL; event_callback.language_changed = __search_app_lang_change; event_callback.region_format_changed = search_region_format_cb; |