+ return ret;
+}
+
+EAPI Eina_Bool
+e_border_rotation_set(E_Border *bd, int rotation)
+{
+ E_Zone *zone = bd->zone;
+ E_Border_Rotation_Info *info = NULL;
+ Eina_List *list, *l;
+ E_Border *child;
+
+ if (rotation < 0) return EINA_FALSE;
+
+ /* step 1. check if rotation */
+ if (!_e_border_rotatable_check(bd, rotation)) return EINA_FALSE;
+
+ /* step 2. add to async/sync list */
+ if ((!zone->rot.block_count) &&
+ ((!bd->visible) ||
+ (!E_INTERSECTS(bd->x, bd->y, bd->w, bd->h, zone->x, zone->y, zone->w, zone->h))))
+ {
+ // send rotation change request later.
+ // and no need to wait message of rotation done.
+
+ // async list add
+ info = E_NEW(E_Border_Rotation_Info, 1);
+ if (!info) return EINA_FALSE;
+ ELB(ELBT_ROT, "ADD ASYNC LIST", 0);
+ info->bd = bd;
+ info->ang = rotation;
+ rot.async_list = eina_list_append(rot.async_list, info);
+
+ // add job for sending event.
+ if (!rot.async_job)
+ {
+ ELB(ELBT_ROT, "ADD ASYNC_JOB", bd->client.win);
+ rot.async_job = ecore_job_add(_e_border_cb_rotation_async_job, zone);
+ }
+ }
+ else
+ {
+ // sync list add
+ info = E_NEW(E_Border_Rotation_Info, 1);
+ if (!info) return EINA_FALSE;
+ ELB(ELBT_ROT, "ADD SYNC LIST", 0);
+ info->bd = bd;
+ info->ang = rotation;
+ rot.list = eina_list_append(rot.list, info);
+
+ // add job for sending event.
+ if (!rot.sync_job)
+ {
+ ELB(ELBT_ROT, "ADD SYNC_JOB", bd->client.win);
+ rot.sync_job = ecore_job_add(_e_border_cb_rotation_sync_job, zone);
+ }
+
+ // if there is windows over 2 that has to be rotated or is existed window needs resizing,
+ // lock the screen.
+ // but, DO NOT lock the screen when rotation block state.
+ if ((!zone->rot.block_count) &&
+ ((eina_list_count(rot.list) == 2)))
+ e_manager_comp_screen_lock(e_manager_current_get());
+ }
+
+ /* step 3. search rotatable window in this window's child */
+ list = _e_border_sub_borders_new(bd);
+ EINA_LIST_FOREACH(list, l, child)
+ {
+ if (_e_border_rotatable_check(child, rotation))
+ {
+ ELBF(ELBT_ROT, 0, child->client.win, "ROT_SET(child) curr:%d != TOBE:%d",
+ bd->client.e.state.rot.curr, rotation);
+ e_border_rotation_set(child, rotation);
+ }
+ }
+
+ /* step 4. if there is vkbd window, send message to prepare rotation */
+ if (_e_border_is_vkbd(bd))
+ {
+ ELB(ELBT_ROT, "PENDING ROT_REQ UNTIL GET PREP_DONE", rot.vkbd_ctrl_win);
+ if (rot.prepare_timer)
+ ecore_timer_del(rot.prepare_timer);
+ rot.prepare_timer = NULL;
+
+ if (rot.done_timer)
+ ecore_timer_del(rot.done_timer);
+ rot.done_timer = NULL;
+
+ ELB(ELBT_ROT, "SEND ROT_CHANGE_PREPARE", rot.vkbd_ctrl_win);
+ ecore_x_e_window_rotation_change_prepare_send(rot.vkbd_ctrl_win,
+ zone->rot.curr,
+ EINA_FALSE, 1, 1);
+ rot.prepare_timer = ecore_timer_add(4.0f,
+ _e_border_rotation_change_prepare_timeout,
+ NULL);
+
+ rot.wait_prepare_done = EINA_TRUE;
+ }
+
+ bd->client.e.state.rot.prev = bd->client.e.state.rot.curr;
+ bd->client.e.state.rot.curr = rotation;
+
+ return EINA_TRUE;