[E_BORDER] Add missing code to delete timer when the window gets DEICONIFY_APPROVE...
[platform/core/uifw/e17.git] / src / bin / e_border.c
index d23bcc5..b1f5316 100644 (file)
@@ -180,6 +180,7 @@ static Eina_Bool _e_border_vkbd_show_prepare_timeout(void *data);
 static Eina_Bool _e_border_vkbd_hide_prepare_timeout(void *data);
 static void      _e_border_vkbd_show(E_Border *bd);
 static void      _e_border_vkbd_hide(E_Border *bd);
+static Eina_Bool _e_border_rotation_set_internal(E_Border *bd, int rotation, Eina_Bool *pending);
 #endif
 static void      _e_border_move_resize_internal(E_Border *bd,
                                                 int       x,
@@ -1386,11 +1387,19 @@ e_border_show(E_Border *bd)
    E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
    if (bd->visible) return;
 #ifdef _F_ZONE_WINDOW_ROTATION_
+   // newly created window that has to be rotated will be show after rotation done.
+   // so, skip at this time. it will be called again after GETTING ROT_DONE.
    if ((bd->new_client) &&
        (bd->client.e.state.rot.changes != -1))
      {
-        // newly created window that has to be rotated will be show after rotation done.
-        // so, skip at this time. it will be called again after GETTING ROT_DONE.
+        ELB(ELBT_BD, "PENDING SHOW UNTIL GETTING ROT_DONE", bd->client.win);
+        // if this window is in withdrawn state, set the normal state
+        // that's because the window in withdrawn state can't render its canvas.
+        // eventually, this window will not send the message of rotation done,
+        // even if e17 request to rotation this window.
+        if (bd->client.icccm.state != ECORE_X_WINDOW_STATE_HINT_NORMAL)
+          e_hints_window_visible_set(bd);
+
         bd->client.e.state.rot.pending_show = 1;
         return;
      }
@@ -2218,6 +2227,14 @@ e_border_resize(E_Border *bd,
    _e_border_move_resize_internal(bd, 0, 0, w, h, 0, 0);
 }
 
+#ifdef _F_ZONE_WINDOW_ROTATION_
+EAPI Eina_Bool
+e_border_rotation_set(E_Border *bd, int rotation)
+{
+   return _e_border_rotation_set_internal(bd, rotation, NULL);
+}
+#endif
+
 /**
  * Resize window to values that do not account border decorations yet.
  *
@@ -3744,7 +3761,39 @@ _e_border_uniconify_timeout(void *data)
 }
 
 static void
-_e_border_deiconify_approve_send(E_Border *bd, E_Border *bd_ancestor)
+_e_border_deiconify_approve_send_pending_end(void *data)
+{
+   E_Border *bd = (E_Border *)data;
+   E_Border *bd_ancestor;
+
+   if (e_config->deiconify_approve)
+     {
+        if (!e_object_is_del(E_OBJECT(bd)))
+          {
+             bd->client.e.state.deiconify_approve.pending_job = NULL;
+
+             ELBF(ELBT_BD, 0, bd->client.win,
+                  "SEND DEICONIFY_APPROVE. (PENDING_END) ancestor:%x",
+                  bd->client.win);
+
+             ecore_x_client_message32_send(bd->client.win,
+                                           ECORE_X_ATOM_E_DEICONIFY_APPROVE,
+                                           ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
+                                           bd->client.win, 0, 0, 0, 0);
+             bd_ancestor = bd->client.e.state.deiconify_approve.ancestor;
+             if (bd_ancestor)
+               {
+                  bd_ancestor->client.e.state.deiconify_approve.req_list = eina_list_append(bd_ancestor->client.e.state.deiconify_approve.req_list, bd);
+               }
+
+             if (!bd->client.e.state.deiconify_approve.wait_timer)
+               bd->client.e.state.deiconify_approve.wait_timer = ecore_timer_add(e_config->deiconify_timeout, _e_border_uniconify_timeout, bd);
+          }
+     }
+}
+
+static void
+_e_border_deiconify_approve_send(E_Border *bd, E_Border *bd_ancestor, Eina_Bool pending_ancestor)
 {
    if (!bd || !bd_ancestor) return;
 
@@ -3757,6 +3806,9 @@ _e_border_deiconify_approve_send(E_Border *bd, E_Border *bd_ancestor)
              Eina_List *list = _e_border_sub_borders_new(bd);
              EINA_LIST_FOREACH(list, l, child)
                {
+                  Eina_Bool pending = EINA_FALSE;
+                  Eina_Bool p = EINA_FALSE;
+
 #ifdef _F_ZONE_WINDOW_ROTATION_
                   if ((e_config->wm_win_rotation) &&
                       ((child->client.e.state.rot.support) ||
@@ -3764,21 +3816,37 @@ _e_border_deiconify_approve_send(E_Border *bd, E_Border *bd_ancestor)
                     {
                        ELB(ELBT_ROT, "CHECK_DEICONIFY CHILD", child->client.win);
                        int rotation = _e_border_rotation_angle_get(bd);
-                       if (rotation != -1) e_border_rotation_set(bd, rotation);
+                       if (rotation != -1) _e_border_rotation_set_internal(bd, rotation, &pending);
                     }
 #endif
-                  _e_border_deiconify_approve_send(child, bd_ancestor);
+                  if ((pending_ancestor) || (pending)) p = EINA_TRUE;
+
+                  _e_border_deiconify_approve_send(child, bd_ancestor, p);
                   if (child->client.e.state.deiconify_approve.support)
                     {
-                       ELBF(ELBT_BD, 0, child->client.win,
-                            "SEND DEICONIFY_APPROVE. ancestor:%x", bd_ancestor->client.win);
-
-                       ecore_x_client_message32_send(child->client.win,
-                                                     ECORE_X_ATOM_E_DEICONIFY_APPROVE,
-                                                     ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
-                                                     child->client.win, 0, 0, 0, 0);
-                       child->client.e.state.deiconify_approve.ancestor = bd_ancestor;
-                       bd_ancestor->client.e.state.deiconify_approve.req_list = eina_list_append(bd_ancestor->client.e.state.deiconify_approve.req_list, child);
+                       if (!p)
+                         {
+                            ELBF(ELBT_BD, 0, child->client.win,
+                                 "SEND DEICONIFY_APPROVE. ancestor:%x pending(%d,%d)",
+                                 bd_ancestor->client.win,
+                                 pending_ancestor, pending);
+
+                            ecore_x_client_message32_send(child->client.win,
+                                                          ECORE_X_ATOM_E_DEICONIFY_APPROVE,
+                                                          ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
+                                                          child->client.win, 0, 0, 0, 0);
+                            child->client.e.state.deiconify_approve.ancestor = bd_ancestor;
+                            bd_ancestor->client.e.state.deiconify_approve.req_list = eina_list_append(bd_ancestor->client.e.state.deiconify_approve.req_list, child);
+                         }
+                       else
+                         {
+                            /* queue a deiconify send job to give the chance to other jobs */
+                            ELBF(ELBT_BD, 0, child->client.win,
+                                 "SEND DEICONIFY_APPROVE. (PENDING) ancestor:%x",
+                                 bd_ancestor->client.win);
+                            child->client.e.state.deiconify_approve.ancestor = bd_ancestor;
+                            child->client.e.state.deiconify_approve.pending_job = ecore_job_add(_e_border_deiconify_approve_send_pending_end, child);
+                         }
                     }
                }
              eina_list_free(list);
@@ -3789,8 +3857,7 @@ _e_border_deiconify_approve_send(E_Border *bd, E_Border *bd_ancestor)
 static void
 _e_border_deiconify_approve_send_all_transient(E_Border *bd)
 {
-   E_Border *bd_ancestor;
-   bd_ancestor = bd;
+   Eina_Bool pending = EINA_FALSE;
 
    if (e_config->deiconify_approve)
      {
@@ -3801,25 +3868,32 @@ _e_border_deiconify_approve_send_all_transient(E_Border *bd)
           {
              ELB(ELBT_ROT, "CHECK_DEICONIFY", bd->client.win);
              int rotation = _e_border_rotation_angle_get(bd);
-             if (rotation != -1) e_border_rotation_set(bd, rotation);
+             if (rotation != -1) _e_border_rotation_set_internal(bd, rotation, &pending);
           }
 #endif
 
         if (e_config->transient.iconify)
           {
-             _e_border_deiconify_approve_send(bd, bd_ancestor);
+             _e_border_deiconify_approve_send(bd, bd, pending);
           }
 
         if (bd->client.e.state.deiconify_approve.support)
           {
-             ELBF(ELBT_BD, 0, bd->client.win,
-                  "SEND DEICONIFY_APPROVE.. ancestor:%x", bd_ancestor->client.win);
-
-             ecore_x_client_message32_send(bd->client.win,
-                                           ECORE_X_ATOM_E_DEICONIFY_APPROVE,
-                                           ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
-                                           bd->client.win, 0, 0, 0, 0);
-             bd->client.e.state.deiconify_approve.wait_timer = ecore_timer_add(e_config->deiconify_timeout, _e_border_uniconify_timeout, bd);
+             if (!pending)
+               {
+                  ELBF(ELBT_BD, 0, bd->client.win, "SEND DEICONIFY_APPROVE.");
+                  ecore_x_client_message32_send(bd->client.win,
+                                                ECORE_X_ATOM_E_DEICONIFY_APPROVE,
+                                                ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
+                                                bd->client.win, 0, 0, 0, 0);
+                  bd->client.e.state.deiconify_approve.wait_timer = ecore_timer_add(e_config->deiconify_timeout, _e_border_uniconify_timeout, bd);
+               }
+             else
+               {
+                  /* queue a deiconify send job to give the chance to other jobs */
+                  ELBF(ELBT_BD, 0, bd->client.win, "SEND DEICONIFY_APPROVE. (PENDING)");
+                  bd->client.e.state.deiconify_approve.pending_job = ecore_job_add(_e_border_deiconify_approve_send_pending_end, bd);
+               }
           }
      }
 }
@@ -3845,6 +3919,13 @@ e_border_uniconify(E_Border *bd)
                   ELB(ELBT_BD, "DEICONIFY_APPROVE WAIT_TIMER is already running", bd->client.win);
                   return;
                }
+
+             if (bd->client.e.state.deiconify_approve.pending_job)
+               {
+                  ELB(ELBT_BD, "DEICONIFY_APPROVE PENDING_JOB is already running", bd->client.win);
+                  return;
+               }
+
              if (bd->client.e.state.deiconify_approve.render_done == 0)
                {
                   ELB(ELBT_BD, "DEICONIFY_APPROVE to all transient", bd->client.win);
@@ -4321,14 +4402,16 @@ e_border_idler_before(void)
                        if ((zone) && (rot.wait_prepare_done))
                          {
                             if (rot.list)
+                              _e_border_rotation_change_request(zone);
+                            else if (rot.async_list)
                               {
-                                 _e_border_rotation_change_request(zone);
-                                 if (rot.prepare_timer)
-                                   ecore_timer_del(rot.prepare_timer);
-                                 rot.prepare_timer = NULL;
-                                 rot.wait_prepare_done = EINA_FALSE;
-
+                                 _e_border_rotation_list_flush(rot.async_list, EINA_TRUE);
+                                 rot.async_list = NULL;
                               }
+                            if (rot.prepare_timer)
+                              ecore_timer_del(rot.prepare_timer);
+                            rot.prepare_timer = NULL;
+                            rot.wait_prepare_done = EINA_FALSE;
                          }
                     }
                }
@@ -5659,6 +5742,13 @@ _e_border_free(E_Border *bd)
           rot.vkbd_prediction = NULL;
      }
 #endif
+#ifdef _F_DEICONIFY_APPROVE_
+   if (bd->client.e.state.deiconify_approve.pending_job)
+     {
+        ecore_job_del(bd->client.e.state.deiconify_approve.pending_job);
+        bd->client.e.state.deiconify_approve.pending_job = NULL;
+     }
+#endif
    evas_object_del(bd->bg_object);
    e_canvas_del(bd->bg_ecore_evas);
    ecore_evas_free(bd->bg_ecore_evas);
@@ -5822,6 +5912,12 @@ _e_border_del(E_Border *bd)
         bd->client.e.state.deiconify_approve.wait_timer = NULL;
      }
 
+   if (bd->client.e.state.deiconify_approve.pending_job)
+     {
+        ecore_job_del(bd->client.e.state.deiconify_approve.pending_job);
+        bd->client.e.state.deiconify_approve.pending_job = NULL;
+     }
+
    if (bd->client.e.state.deiconify_approve.req_list)
      {
         EINA_LIST_FREE(bd->client.e.state.deiconify_approve.req_list, child)
@@ -6990,6 +7086,13 @@ _e_border_cb_client_message(void *data  __UNUSED__,
                          {
                             ecore_timer_del(ancestor_bd->client.e.state.deiconify_approve.wait_timer);
                             ancestor_bd->client.e.state.deiconify_approve.wait_timer = NULL;
+
+                            if (bd->client.e.state.deiconify_approve.wait_timer)
+                              {
+                                 ecore_timer_del(bd->client.e.state.deiconify_approve.wait_timer);
+                                 bd->client.e.state.deiconify_approve.wait_timer = NULL;
+                              }
+
                             e_border_uniconify(ancestor_bd);
                          }
                        else
@@ -6998,6 +7101,15 @@ _e_border_cb_client_message(void *data  __UNUSED__,
                             ancestor_bd->client.e.state.deiconify_approve.render_done = 0;
                          }
                     }
+
+                  if (bd != ancestor_bd)
+                    {
+                       if (bd->client.e.state.deiconify_approve.wait_timer)
+                         {
+                            ecore_timer_del(bd->client.e.state.deiconify_approve.wait_timer);
+                            bd->client.e.state.deiconify_approve.wait_timer = NULL;
+                         }
+                    }
                }
           }
         return ECORE_CALLBACK_PASS_ON;
@@ -7051,6 +7163,10 @@ _e_border_cb_client_message(void *data  __UNUSED__,
                     {
                        ELB(ELBT_BD, "SHOW_BD (PEND)", bd->client.win);
                        e_border_show(bd);
+#ifdef _F_FOCUS_WINDOW_IF_TOP_STACK_
+                       if (e_config->focus_setting == E_FOCUS_NEW_WINDOW_IF_TOP_STACK)
+                         _e_border_check_stack(bd);
+#endif
                        bd->client.e.state.rot.pending_show = 0;
                     }
                }
@@ -7985,8 +8101,11 @@ _e_border_cb_rotation_async_job(void *data)
 
    ELB(ELBT_ROT, "FLUSH ASYNC LIST TO ROT_CHANGE_REQ", zone->id);
 
-   _e_border_rotation_list_flush(rot.async_list, EINA_TRUE);
-   rot.async_list = NULL;
+   if (!rot.wait_prepare_done)
+     {
+        _e_border_rotation_list_flush(rot.async_list, EINA_TRUE);
+        rot.async_list = NULL;
+     }
 
 end:
    // clear async job
@@ -8186,6 +8305,10 @@ _e_border_rotation_change_done(void)
                {
                   ELB(ELBT_ROT, "SHOW PEND(TIMEOUT)", info->bd->client.win);
                   e_border_show(info->bd);
+#ifdef _F_FOCUS_WINDOW_IF_TOP_STACK_
+                  if (e_config->focus_setting == E_FOCUS_NEW_WINDOW_IF_TOP_STACK)
+                    _e_border_check_stack(info->bd);
+#endif
                   info->bd->client.e.state.rot.pending_show = 0;
                }
              info->bd->client.e.state.rot.wait_for_done = 0;
@@ -8291,7 +8414,11 @@ _e_border_rotation_angle_get(E_Border *bd)
 
    ELB(ELBT_ROT, "CHECK ROT", bd->client.win);
 
-   if (bd->parent) will_ang = bd->parent->client.e.state.rot.curr;
+   // the window with "ECORE_X_WINDOW_TYPE_NORMAL" type
+   // should follow the state of rotation of zone.
+   if ((bd->parent) &&
+       (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_NORMAL))
+     will_ang = bd->parent->client.e.state.rot.curr;
    else will_ang = zone->rot.curr;
 
    if (bd->client.vkbd.win_type != E_VIRTUAL_KEYBOARD_WINDOW_TYPE_NONE)
@@ -8399,12 +8526,14 @@ _e_border_rotation_zone_set(E_Zone *zone)
      {
         if (!bd) continue;
 
-        // if this window have parent,
+        // if this window has parent and window type isn't "ECORE_X_WINDOW_TYPE_NORMAL",
         // it will be rotated when parent do rotate itself.
         // so skip here.
-        if (bd->parent) continue;
+        if ((bd->parent) &&
+            (bd->client.netwm.type != ECORE_X_WINDOW_TYPE_NORMAL)) continue;
 
-        // this type is set by illume.
+        // default type is "E_BORDER_ROTATION_TYPE_NORMAL",
+        // but it can be changed to "E_BORDER_ROTATION_TYPE_DEPENDENT" by illume according to its policy.
         // if it's not normal type window, will be rotated by illume.
         // so skip here.
         if (bd->client.e.state.rot.type != E_BORDER_ROTATION_TYPE_NORMAL) continue;
@@ -8426,8 +8555,8 @@ _e_border_rotation_zone_set(E_Zone *zone)
    return ret;
 }
 
-EAPI Eina_Bool
-e_border_rotation_set(E_Border *bd, int rotation)
+static Eina_Bool
+_e_border_rotation_set_internal(E_Border *bd, int rotation, Eina_Bool *pending)
 {
    E_Zone *zone = bd->zone;
    E_Border_Rotation_Info *info = NULL;
@@ -8435,6 +8564,7 @@ e_border_rotation_set(E_Border *bd, int rotation)
    E_Border *child;
 
    if (rotation < 0) return EINA_FALSE;
+   if (pending) *pending = EINA_FALSE;
 
    /* step 1. check if rotation */
    if (!_e_border_rotatable_check(bd, rotation)) return EINA_FALSE;
@@ -8487,10 +8617,15 @@ e_border_rotation_set(E_Border *bd, int rotation)
           e_manager_comp_screen_lock(e_manager_current_get());
      }
 
+   if (pending) *pending = EINA_TRUE;
+
    /* step 3. search rotatable window in this window's child */
    list = _e_border_sub_borders_new(bd);
    EINA_LIST_FOREACH(list, l, child)
      {
+        // the window which type is "ECORE_X_WINDOW_TYPE_NORMAL" will be rotated itself.
+        // it shouldn't be rotated by rotation state of parent window.
+        if (child->client.netwm.type == ECORE_X_WINDOW_TYPE_NORMAL) continue;
         if (_e_border_rotatable_check(child, rotation))
           {
              ELBF(ELBT_ROT, 0, child->client.win, "ROT_SET(child) curr:%d != TOBE:%d",
@@ -8586,7 +8721,6 @@ _e_border_is_vkbd(E_Border *bd)
    if ((rot.vkbd_ctrl_win) &&
        (rot.vkbd == bd) &&
        (!e_object_is_del(E_OBJECT(rot.vkbd))) &&
-       (rot.vkbd->visible) &&
        (rot.vkbd->zone == bd->zone) &&
        (E_INTERSECTS(bd->zone->x, bd->zone->y,
                      bd->zone->w, bd->zone->h,
@@ -8598,6 +8732,151 @@ _e_border_is_vkbd(E_Border *bd)
    return EINA_FALSE;
 }
 
+static Eina_Bool
+_e_border_rotation_change_floating_pos(E_Border *bd, int *x, int *y)
+{
+   int new_x, new_y;
+   int min_title_width=96;
+
+   if (!bd) return EINA_FALSE;
+   if (!x || !y) return EINA_FALSE;
+
+   new_x = bd->x;
+   new_y = bd->y;
+
+   // Portrait -> Landscape,  x= pre_x*2, y=pre_y/2
+   // Landscape -> Portrait,  x= pre_x/2, y=pre_y*2
+   // guaranteeing the minimum size of titlebar shown, min_title_width
+   // so user can initiate drag&drop action after rotation changed.
+   if (bd->client.e.state.rot.curr == 0)
+     {
+        if (bd->client.e.state.rot.prev == 90)
+          {
+             new_x = (bd->zone->h - bd->h - bd->y) / 2;
+             new_y = 2 * bd->x;
+          }
+        else if (bd->client.e.state.rot.prev == 270)
+          {
+             new_x = bd->y / 2;
+             new_y = (bd->zone->w - bd->w - bd->x) * 2;
+          }
+        else if (bd->client.e.state.rot.prev == 180)
+          {
+             new_x = bd->zone->w - bd->x - bd->w;
+             new_y = bd->zone->h - bd->y - bd->h;
+          }
+
+        if(new_x + bd->w < min_title_width)
+          {
+             new_x = min_title_width - bd->w;
+          }
+        else if(new_x > bd->zone->w - min_title_width)
+          {
+             new_x = bd->zone->w - min_title_width;
+          }
+     }
+   else if (bd->client.e.state.rot.curr == 90)
+     {
+        if (bd->client.e.state.rot.prev == 0)
+          {
+             new_x = bd->y / 2;
+             new_y = bd->zone->h - (2 * bd->x) - bd->w;
+          }
+        else if (bd->client.e.state.rot.prev == 270)
+          {
+             new_x = bd->zone->w - bd->x - bd->w;
+             new_y = bd->zone->h - bd->y - bd->h;
+          }
+        else if (bd->client.e.state.rot.prev == 180)
+          {
+             new_x = (bd->zone->h - bd->y - bd->h) / 2;
+             new_y = bd->zone->h - (2 * (bd->zone->w - bd->x - bd->w)) - bd->w;
+          }
+
+        if(new_y > bd->zone->h - min_title_width)
+          {
+             new_y = bd->zone->h - min_title_width;
+          }
+        else if(new_y < min_title_width - bd->w)
+          {
+             new_y = min_title_width - bd->w;
+          }
+     }
+   else if (bd->client.e.state.rot.curr == 270)
+     {
+        if (bd->client.e.state.rot.prev == 0)
+          {
+             new_x = bd->zone->w - bd->h - (bd->y / 2);
+             new_y = bd->x * 2;
+          }
+        else if (bd->client.e.state.rot.prev == 90)
+          {
+             new_x = bd->zone->w - bd->x - bd->w;
+             new_y = bd->zone->h - bd->y - bd->h;
+          }
+        else if (bd->client.e.state.rot.prev == 180)
+          {
+             new_x = bd->zone->w - bd->x - bd->w;
+             new_y = bd->zone->h - bd->y - bd->h;
+
+             new_x = bd->zone->w - bd->h - ((bd->zone->h - bd->y - bd->h) / 2);
+             new_y = (bd->zone->w - bd->x - bd->w) * 2;
+          }
+
+        if(new_y >  bd->zone->h - min_title_width)
+          {
+             new_y = bd->zone->h - min_title_width;
+          }
+        else if( new_y + bd->w < min_title_width)
+          {
+             new_y = min_title_width - bd->w ;
+          }
+     }
+   else if (bd->client.e.state.rot.curr == 180)
+     {
+        if (bd->client.e.state.rot.prev == 0)
+          {
+             new_x = bd->zone->w - bd->x - bd->w;
+             new_y = bd->zone->h - bd->y - bd->h;
+          }
+        else if (bd->client.e.state.rot.prev == 90)
+          {
+             new_x = bd->zone->w - ((bd->zone->h - bd->h - bd->y) / 2) - bd->h;
+             new_y = bd->zone->h - (2 * bd->x) - bd->w;
+          }
+        else if (bd->client.e.state.rot.prev == 270)
+          {
+             new_x = bd->zone->w - (bd->y / 2) - bd->h;
+             new_y = bd->zone->h - ((bd->zone->w - bd->w - bd->x) * 2) - bd->w;
+          }
+
+        if(new_x + bd->w < min_title_width)
+          {
+             new_x = min_title_width - bd->w;
+          }
+        else if(new_x > bd->zone->w - min_title_width)
+          {
+             new_x = bd->zone->w - min_title_width;
+          }
+     }
+
+   ELBF(ELBT_ROT, 0, bd->client.win,
+        "Floating Mode. ANGLE (%d->%d), POS (%d,%d) -> (%d,%d)",
+        bd->client.e.state.rot.prev, bd->client.e.state.rot.curr,
+        bd->x, bd->y, new_x, new_y);
+
+   if ((new_x == *x) &&
+       (new_y == *y))
+     {
+        return EINA_FALSE;
+     }
+
+   *x = new_x;
+   *y = new_y;
+
+   return EINA_TRUE;
+}
+
 #define SIZE_EQUAL_TO_ZONE(a, z) \
    ((((a)->w) == ((z)->w)) &&    \
     (((a)->h) == ((z)->h)))
@@ -8636,11 +8915,16 @@ _e_border_rotation_pre_resize(E_Border *bd, int rotation, int *x, int *y, int *w
         _x = bd->x; _y = bd->y;
         _w = bd->w; _h = bd->h;
 
+        if (bd->client.illume.win_state.state == ECORE_X_ILLUME_WINDOW_STATE_FLOATING)
+          move = _e_border_rotation_change_floating_pos(bd, &_x, &_y);
+        else
+          move = EINA_FALSE;
+
         rot_dif = bd->client.e.state.rot.prev - rotation;
         if (rot_dif < 0) rot_dif = -rot_dif;
         if (rot_dif != 180)
           {
-             if (w != h)
+             if (_w != _h)
                {
                   _w = bd->h;
                   _h = bd->w;
@@ -8653,6 +8937,9 @@ _e_border_rotation_pre_resize(E_Border *bd, int rotation, int *x, int *y, int *w
 
                }
           }
+
+        if (!resize && move)
+          _e_border_move_internal(bd, _x, _y, EINA_TRUE);
      }
 
    if (resize)
@@ -10072,32 +10359,30 @@ _e_border_eval0(E_Border *bd)
 #ifdef _F_ZONE_WINDOW_ROTATION_
    if (e_config->wm_win_rotation)
      {
-        if (need_rotation_set)
-          {
-             ELB(ELBT_ROT, "NEED ROT", bd->client.win);
-             bd->client.e.state.rot.changes = _e_border_rotation_angle_get(bd);
-             if (bd->client.e.state.rot.changes != -1) bd->changed = 1;
-          }
-
-        if (bd->new_client)
+        if ((need_rotation_set) &&
+            (bd->client.e.state.rot.type == E_BORDER_ROTATION_TYPE_NORMAL))
           {
              Eina_Bool hint = EINA_FALSE;
              int ang = 0;
              int x, y, w, h, move;
 
-             if (bd->client.e.state.rot.changes != -1)
-               ang = bd->client.e.state.rot.changes;
-             else ang = bd->client.e.state.rot.curr;
+             ELB(ELBT_ROT, "NEED ROT", bd->client.win);
+             bd->client.e.state.rot.changes = _e_border_rotation_angle_get(bd);
 
-             hint = _e_border_rotation_geom_get(bd, bd->zone, ang, &x, &y, &w, &h, &move);
-             if (hint)
+             if (bd->client.e.state.rot.changes == -1)
                {
-                  _e_border_move_resize_internal(bd, x, y, w, h, EINA_TRUE, move);
-                  ELBF(ELBT_ROT, 0, bd->client.win, "RESIZE_BY_HINT name:%s (%d,%d) %dx%d",
-                       bd->client.icccm.name, x, y, w, h);
+                  ang = bd->client.e.state.rot.curr;
+
+                  hint = _e_border_rotation_geom_get(bd, bd->zone, ang, &x, &y, &w, &h, &move);
+                  if (hint)
+                    {
+                       _e_border_move_resize_internal(bd, x, y, w, h, EINA_TRUE, move);
+                       ELBF(ELBT_ROT, 0, bd->client.win, "RESIZE_BY_HINT name:%s (%d,%d) %dx%d",
+                            bd->client.icccm.name, x, y, w, h);
+                    }
                }
+             else bd->changed = 1;
           }
-
      }
 #endif
 
@@ -11939,6 +12224,8 @@ _e_border_zone_update(E_Border *bd)
 static int
 _e_border_resize_begin(E_Border *bd)
 {
+   int ret;
+
    if (!bd->lock_user_stacking)
      {
         if (e_config->border_raise_on_mouse_action)
@@ -11948,7 +12235,12 @@ _e_border_resize_begin(E_Border *bd)
        (bd->fullscreen) || (bd->lock_user_size))
      return 0;
 
-   if (grabbed && !e_grabinput_get(bd->win, 0, bd->win))
+   if (bd->client.icccm.accepts_focus || bd->client.icccm.take_focus)
+     ret = e_grabinput_get(bd->win, 0, bd->win);
+   else
+     ret = e_grabinput_get(bd->win, 0, 0);
+
+   if (grabbed && !ret)
      {
         grabbed = 0;
         return 0;
@@ -12016,6 +12308,7 @@ _e_border_resize_update(E_Border *bd)
 static int
 _e_border_move_begin(E_Border *bd)
 {
+   int ret;
    if (!bd->lock_user_stacking)
      {
         if (e_config->border_raise_on_mouse_action)
@@ -12024,7 +12317,12 @@ _e_border_move_begin(E_Border *bd)
    if ((bd->fullscreen) || (bd->lock_user_location))
      return 0;
 
-   if (grabbed && !e_grabinput_get(bd->win, 0, bd->win))
+   if (bd->client.icccm.accepts_focus || bd->client.icccm.take_focus)
+     ret = e_grabinput_get(bd->win, 0, bd->win);
+   else
+     ret = e_grabinput_get(bd->win, 0, 0);
+
+   if (grabbed && !ret)
      {
         grabbed = 0;
         return 0;