rotation: added support for rotation rendering block and 'wm.policy.win.rot.render... 03/114003/2
authorGwanglim Lee <gl77.lee@samsung.com>
Thu, 9 Feb 2017 12:52:14 +0000 (21:52 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Thu, 9 Feb 2017 12:52:38 +0000 (04:52 -0800)
Change-Id: I5fc3668565e5b93874fc1f40ac0303cbd776a4e8

src/rotation/e_mod_rotation_wl.c

index b44159e..4db2fc1 100644 (file)
@@ -82,6 +82,7 @@ static Eina_Hash *rot_hash = NULL;
 static Eina_List *rot_cbs = NULL;
 static Eina_List *rot_ec_hooks = NULL;
 static Eina_List *rot_obj_hooks = NULL;
+static Eina_List *wl_hooks = NULL;
 static Ecore_Idle_Enterer *rot_idle_enterer = NULL;
 static E_Client *fg_ec = NULL;
 
@@ -937,7 +938,7 @@ _e_client_rotation_change_done(void)
    if (rot.screen_lock)
      {
         // do call comp_wl's screen unlock
-        DBG("RESUME Rendering");
+        ELOGF("ROTATION", "RENDERING resume", NULL, NULL);
         e_comp_canvas_norender_pop();
         rot.screen_lock = EINA_FALSE;
      }
@@ -1705,6 +1706,25 @@ _rot_cb_zone_rotation_change_begin(void *data EINA_UNUSED, int ev_type EINA_UNUS
    return ECORE_CALLBACK_RENEW;
 }
 
+static void
+_rot_cb_wl_buffer_change(void *d EINA_UNUSED, E_Client *ec)
+{
+   Policy_Ext_Rotation *rot;
+
+   rot = eina_hash_find(rot_hash, &ec);
+   if (!rot) return;
+   if (ec->e.state.rot.nopending_render) return;
+
+   if (!rot->angle_change_done)
+     {
+        DBG("Update Buffer in progress of rotation ec '%s'(%p) HOOK",
+            ec->icccm.name ? ec->icccm.name : "", ec);
+
+        e_pixmap_image_clear(ec->pixmap, EINA_TRUE);
+        e_pixmap_resource_set(ec->pixmap, NULL);
+     }
+}
+
 static Eina_Bool
 _rot_cb_buffer_change(void *data EINA_UNUSED, int ev_type EINA_UNUSED, E_Event_Client *ev)
 {
@@ -1726,7 +1746,7 @@ _rot_cb_buffer_change(void *data EINA_UNUSED, int ev_type EINA_UNUSED, E_Event_C
     */
    if ((!rot->angle_change_done) || (!e_pixmap_resource_get(ev->ec->pixmap)))
      {
-        DBG("Update Buffer in progress of rotation ec '%s'(%p)",
+        DBG("Update Buffer in progress of rotation ec '%s'(%p) EVENT",
             ev->ec->icccm.name ? ev->ec->icccm.name : "", ev->ec);
 
         e_pixmap_image_clear(ev->ec->pixmap, EINA_TRUE);
@@ -2102,6 +2122,10 @@ _rot_intercept_hook_hide(void *d EINA_UNUSED, E_Client *ec)
 static Eina_Bool
 _rot_cb_idle_enterer(void *data EINA_UNUSED)
 {
+   Eina_List *l;
+   E_Client *ec;
+   int n;
+
    if (rot.cancel.state)
      {
         /* there is no border which supports window manager rotation */
@@ -2112,15 +2136,37 @@ _rot_cb_idle_enterer(void *data EINA_UNUSED)
 
    if (rot.fetch)
      {
-        //TODO: consider rot.msgs , X WM use it for e_client message
+        n = eina_list_count(rot.list);
 
+        if (n == 1)
+          {
+             ec = eina_list_data_get(rot.list);
+             if (ec->e.state.rot.nopending_render == 0)
+               {
+                  if (!rot.screen_lock)
+                    {
+                       ELOGF("ROTATION", "RENDERING pause", NULL, NULL);
+
+                       e_pixmap_image_clear(ec->pixmap, 1);
+                       e_comp_canvas_norender_push();
+                       rot.screen_lock = EINA_TRUE;
+                    }
+               }
+             else
+               {
+                  if (rot.screen_lock)
+                    {
+                       ELOGF("ROTATION", "RENDERING resume", NULL, NULL);
+                       e_comp_canvas_norender_pop();
+                       rot.screen_lock = EINA_FALSE;
+                    }
+               }
+          }
         // 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 (eina_list_count(rot.list) > 1)
+        // but, DO NOT lock the screen when block state by E module
+        else if (n > 1)
           {
-             Eina_List *l;
-             E_Client *ec;
              Eina_Bool rot_block = EINA_FALSE;
 
              EINA_LIST_FOREACH(rot.list, l, ec)
@@ -2133,7 +2179,7 @@ _rot_cb_idle_enterer(void *data EINA_UNUSED)
                }
              if ((!rot.screen_lock) && (!rot_block))
                {
-                  DBG("STOP Rendering");
+                  ELOGF("ROTATION", "RENDERING pause", NULL, NULL);
 
                   EINA_LIST_FOREACH(rot.list, l, ec)
                      e_pixmap_image_clear(ec->pixmap, 1);
@@ -2142,11 +2188,10 @@ _rot_cb_idle_enterer(void *data EINA_UNUSED)
                   rot.screen_lock = EINA_TRUE;
                }
           }
-        else if (eina_list_count(rot.list) == 0)
+        else
           {
-             E_Client *ec;
+             /* n == 0 */
              Eina_List *zlist = NULL;
-             Eina_List *l = NULL;
              E_Zone *zone = NULL;
 
              if (rot.async_list)
@@ -2194,6 +2239,7 @@ e_mod_rot_wl_init(void)
    E_CLIENT_HOOK_APPEND(rot_ec_hooks, E_CLIENT_HOOK_EVAL_FETCH,           _rot_hook_eval_fetch,               NULL);
    E_COMP_OBJECT_INTERCEPT_HOOK_APPEND(rot_obj_hooks, E_COMP_OBJECT_INTERCEPT_HOOK_SHOW_HELPER, _rot_intercept_hook_show_helper, NULL);
    E_COMP_OBJECT_INTERCEPT_HOOK_APPEND(rot_obj_hooks, E_COMP_OBJECT_INTERCEPT_HOOK_HIDE,        _rot_intercept_hook_hide,        NULL);
+   E_COMP_WL_HOOK_APPEND(wl_hooks,                    E_COMP_WL_HOOK_BUFFER_CHANGE,             _rot_cb_wl_buffer_change,        NULL);
 
    rot_idle_enterer = ecore_idle_enterer_add(_rot_cb_idle_enterer, NULL);
 
@@ -2206,6 +2252,7 @@ e_mod_rot_wl_shutdown(void)
    E_FREE_FUNC(rot_hash, eina_hash_free);
    E_FREE_FUNC(rot.force_update_list, eina_list_free);
 
+   E_FREE_LIST(wl_hooks, e_comp_wl_hook_del);
    E_FREE_LIST(rot_ec_hooks, e_client_hook_del);
    E_FREE_LIST(rot_cbs, ecore_event_handler_del);
    E_FREE_LIST(rot_obj_hooks, e_comp_object_intercept_hook_del);