+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);
+}
+