return layout;
}
+static void __cal_device_orientation(void *data, Evas_Object *obj, void *event)
+{
+ CAL_FN_START;
+
+ c_retm_if(!data, "user_data is null.");
+
+ struct appdata *ad = data;
+ Eina_Bool is_landscape_mode = EINA_FALSE;
+
+ int rotation = elm_win_rotation_get(obj);
+ c_ret_if(rotation != CAL_WINDOW_ROTATION_0
+ && rotation != CAL_WINDOW_ROTATION_90
+ && rotation != CAL_WINDOW_ROTATION_180
+ && rotation != CAL_WINDOW_ROTATION_270);
+
+ if (ad->rotation == (cal_window_rotation)rotation)
+ return;
+
+ switch (rotation){
+ case CAL_WINDOW_ROTATION_0:
+ ug_send_event(UG_EVENT_ROTATE_PORTRAIT);
+ break;
+ case CAL_WINDOW_ROTATION_90:
+ is_landscape_mode = EINA_TRUE;
+ ug_send_event(UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN);
+ break;
+ case CAL_WINDOW_ROTATION_180:
+ ug_send_event(UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN);
+ break;
+ case CAL_WINDOW_ROTATION_270:
+ is_landscape_mode = EINA_TRUE;
+ ug_send_event(UG_EVENT_ROTATE_LANDSCAPE);
+ break;
+ default:
+ break;
+ }
+
+ ad->rotation = (cal_window_rotation)rotation;
+ ad->is_landscape_mode = is_landscape_mode;
+
+ int width = 0;
+ int height = 0;
+
+ ecore_x_window_size_get(ecore_x_window_root_first_get(), &width, &height);
+
+ if (ad->is_landscape_mode) {
+ ad->win_w = height;
+ ad->win_h = width;
+ } else {
+ ad->win_w = width;
+ ad->win_h = height;
+ }
+
+ cal_main_rotation(ad);
+}
+
static bool cal_create(void *data)
{
CAL_FN_START;
c_retv_if(!window, false);
evas_object_smart_callback_add(window, "profile,changed", __cal_main_win_profile_changed_callback, ad);
+ evas_object_smart_callback_add(window, "wm,rotation,changed", __cal_device_orientation, ad);
Evas_Object *bg = cal_util_add_bg(window, EINA_TRUE);
c_retv_if(!bg, false);
Evas_Object *layout = __cal_main_add_base_layout(conformant);
c_retv_if(!layout, false);
- evas_object_show(window);
-
ad->win = window;
ad->bg = bg;
ad->conform = conformant;
ad->base_tm = base_time;
- r = service_get_extra_data(service, CAL_APPCONTROL_ITEM_TYPE, &type);
+ r = service_get_extra_data(service, "itemType", &type);
c_warn_if(SERVICE_ERROR_NONE != r,"service_get_extra_data is failed(%d).", r);
if (!CAL_STRCMP(type, "todo")) {
CAL_FN_END;
}
-static void cal_device_orientation(app_device_orientation_e orientation, void *user_data)
-{
- c_retm_if(!user_data, "user_data is null.");
-
- struct appdata *ad = user_data;
- int rotate_val = 0;
- Eina_Bool is_landscape_mode = EINA_FALSE;
- int width = 0;
- int height = 0;
-
- ecore_x_window_size_get(ecore_x_window_root_first_get(), &width, &height);
-
- switch (orientation){
- case APP_DEVICE_ORIENTATION_0:
- rotate_val = 0;
- ug_send_event(UG_EVENT_ROTATE_PORTRAIT);
- break;
- case APP_DEVICE_ORIENTATION_90:
- rotate_val = 90;
- is_landscape_mode = EINA_TRUE;
- ug_send_event(UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN);
- break;
- case APP_DEVICE_ORIENTATION_180:
- rotate_val = 180;
- ug_send_event(UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN);
- break;
- case APP_DEVICE_ORIENTATION_270:
- rotate_val = 270;
- is_landscape_mode = EINA_TRUE;
- ug_send_event(UG_EVENT_ROTATE_LANDSCAPE);
- break;
- default:
- break;
- }
-
- if (ad->orientation == orientation)
- return;
-
- ad->orientation = orientation;
-
- ad->is_landscape_mode = is_landscape_mode;
-
- if (ad->is_landscape_mode) {
- ad->win_w = height;
- ad->win_h = width;
- } else {
- ad->win_w = width;
- ad->win_h = height;
- }
-
- elm_win_rotation_with_resize_set(ad->win, rotate_val);
-
- cal_main_rotation(ad);
-
-}
-
static void __cal_language_changed(void *user_data)
{
CAL_FN_START;
event_callback.service = cal_service;
event_callback.low_memory = NULL;
event_callback.low_battery = NULL;
- event_callback.device_orientation = cal_device_orientation;
+ event_callback.device_orientation = NULL;
event_callback.language_changed = __cal_language_changed;
event_callback.region_format_changed = __cal_region_format_changed;