e_mod_rotation_wl: code cleanup - use _rot_fg_set 94/239494/1
authorDoyoun Kang <doyoun.kang@samsung.com>
Mon, 27 Jul 2020 06:47:42 +0000 (15:47 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Mon, 27 Jul 2020 06:47:42 +0000 (15:47 +0900)
there are redundant code between _rot_hook_fg_set() and _rot_intercept_hook_show_helper().
so we make and use _rot_fg_set() to remove redundancy

Change-Id: I6b3a48a0e32171300b7ee52aca5806bdd1fb5387

src/rotation/e_mod_rotation_wl.c

index 9052444..314442f 100644 (file)
@@ -2666,7 +2666,7 @@ end_fetch_rot:
  * hook and given ec has always mapped state.
  */
 static Eina_Bool
-_rot_hook_fg_set(void *d EINA_UNUSED, E_Client *ec)
+_rot_fg_set(E_Client *ec, Eina_Bool check_obscured)
 {
    Policy_Ext_Rotation *rot;
 
@@ -2693,11 +2693,22 @@ _rot_hook_fg_set(void *d EINA_UNUSED, E_Client *ec)
         EDBG(ec, "Check ec %x to set fg_ec", e_client_util_win_get(ec));
         if (_no_active_lockscreen_check(ec))
           {
-             /* don't need to check visibility of given foreground ec
-              * it will have E_VISIBILITY_UNOBSCURED soon
-              */
-             EDBG(ec, "Set the fg_ec to %x", e_client_util_win_get(ec));
-             fg_ec = ec;
+             if (check_obscured)
+               {
+                  if (ec->visibility.obscured != E_VISIBILITY_FULLY_OBSCURED)
+                    {
+                       EDBG(ec, "Set the fg_ec to %x", e_client_util_win_get(ec));
+                       fg_ec = ec;
+                    }
+               }
+             else
+               {
+                  /* don't need to check visibility of given foreground ec
+                   * it will have E_VISIBILITY_UNOBSCURED soon
+                   */
+                  EDBG(ec, "Set the fg_ec to %x", e_client_util_win_get(ec));
+                  fg_ec = ec;
+               }
 
              if (_camera_check(ec))
                _unlock_rot_for_fg_app(ec->zone);
@@ -2721,58 +2732,15 @@ _rot_hook_fg_set(void *d EINA_UNUSED, E_Client *ec)
 }
 
 static Eina_Bool
-_rot_intercept_hook_show_helper(void *d EINA_UNUSED, E_Client *ec)
+_rot_hook_fg_set(void *d EINA_UNUSED, E_Client *ec)
 {
-   Policy_Ext_Rotation *rot;
-
-   rot = eina_hash_find(rot_hash, &ec);
-   if (!rot)
-     return EINA_TRUE;
-
-   if (e_pixmap_type_get(ec->pixmap) == E_PIXMAP_TYPE_EXT_OBJECT)
-     return EINA_TRUE;
-
-   if (!rot->hint_fetch)
-     {
-        /* need to fetch rotation hint. */
-        ec->e.state.rot.pending_show = 1;
-        EC_CHANGED(ec);
-        return EINA_FALSE;
-     }
-
-   if (ec->e.state.rot.pending_show)
-     return EINA_FALSE;
-
-   if (e_policy_visibility_client_is_activity(ec))
-     {
-        EDBG(ec, "Check ec %x to set fg_ec", e_client_util_win_get(ec));
-        if (_no_active_lockscreen_check(ec))
-          {
-             if (ec->visibility.obscured != E_VISIBILITY_FULLY_OBSCURED)
-               {
-                  EDBG(ec, "Set the fg_ec to %x", e_client_util_win_get(ec));
-                  fg_ec = ec;
-               }
-
-             if (_camera_check(ec))
-               _unlock_rot_for_fg_app(ec->zone);
-             else
-               _try_lock_rot_for_fg_app(ec->zone);
-          }
-     }
-
-   _e_client_rotation_zone_set(ec->zone, ec, NULL);
-   if (ec->changes.rotation)
-     {
-        EDBG(ec, "Postpone show: ang %d", ec->e.state.rot.ang.next);
-        e_pixmap_image_clear(ec->pixmap, 1);
-        ec->e.state.rot.pending_show = 1;
-        /* to be invoked 'eval_end' */
-        EC_CHANGED(ec);
-        return EINA_FALSE;
-     }
+   return _rot_fg_set(ec, EINA_FALSE);
+}
 
-    return EINA_TRUE;
+static Eina_Bool
+_rot_intercept_hook_show_helper(void *d EINA_UNUSED, E_Client *ec)
+{
+   return _rot_fg_set(ec, EINA_TRUE);
 }
 
 static Eina_Bool