e_comp_wl_shell: code cleanup 67/168267/1
authorDoyoun Kang <doyoun.kang@samsung.com>
Thu, 25 Jan 2018 08:43:30 +0000 (17:43 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Thu, 25 Jan 2018 08:43:30 +0000 (17:43 +0900)
added internal fuctions to remove redundant code.

Change-Id: I1e4fbb851d73546d4c4920cb3cdd9164ecd38b55

src/bin/e_comp_wl_shell.c

index 680b4d3138934dbe5613c576a25182d54a93b933..5256518400329b4415ea591d609ad6a6fae468e7 100644 (file)
@@ -494,6 +494,57 @@ _e_shell_surface_ping(struct wl_resource *resource)
    wl_shell_surface_send_ping(ec->comp_data->shell.surface, serial);
 }
 
+static void
+_e_shell_client_map_common_pre(E_Client *ec)
+{
+   if (!ec) return;
+
+   if (ec->use_splash)
+     {
+        ELOGF("LAUNCH", "SHOW real win after splash effect", ec->pixmap, ec);
+        e_comp_object_signal_emit(ec->frame, "e,action,launch_real,done", "e");
+     }
+   ec->use_splash = EINA_FALSE;
+
+   /* unset previous content */
+   e_comp_object_content_unset(ec->frame);
+
+   /* map this surface if needed */
+   ec->visible = EINA_TRUE;
+   evas_object_show(ec->frame);
+   ec->comp_data->mapped = EINA_TRUE;
+}
+
+static void
+_e_shell_client_map_common_post(E_Client *ec)
+{
+   if (!ec) return;
+
+   if (!ec->first_mapped)
+     {
+        if ((!ec->iconic) && (!e_client_util_ignored_get(ec)))
+          {
+             if (!ec->comp_data->sub.data)
+               {
+                  if (ec->post_lower)
+                    evas_object_lower(ec->frame);
+                  else if (ec->post_raise)
+                    evas_object_raise(ec->frame);
+
+                  ec->post_lower = EINA_FALSE;
+                  ec->post_raise = EINA_FALSE;
+               }
+          }
+
+        ec->first_mapped = 1;
+     }
+
+   ELOGF("COMP", "Un-Set launching flag", ec->pixmap, ec);
+   ec->launching = EINA_FALSE;
+
+   EC_CHANGED(ec);
+}
+
 static void
 _e_shell_surface_map(struct wl_resource *resource)
 {
@@ -526,30 +577,8 @@ _e_shell_surface_map(struct wl_resource *resource)
               ec->use_splash, ec->first_mapped, ec->iconic, ec->exp_iconify.by_client,
               ec->post_raise, ec->post_lower, ec->ignored, ec->override, ec->input_only);
 
-
-        /* unset previous content */
-        e_comp_object_content_unset(ec->frame);
-
-        ec->visible = EINA_TRUE;
-        evas_object_geometry_set(ec->frame, ec->x, ec->y, ec->w, ec->h);
-        evas_object_show(ec->frame);
-        ec->comp_data->mapped = EINA_TRUE;
-
-        if ((!ec->first_mapped) && (!ec->iconic) && (!e_client_util_ignored_get(ec)))
-          {
-             if (!ec->comp_data->sub.data)
-               {
-                  if (ec->post_lower)
-                     evas_object_lower(ec->frame);
-                  else if (ec->post_raise)
-                     evas_object_raise(ec->frame);
-
-                  ec->post_lower = EINA_FALSE;
-                  ec->post_raise = EINA_FALSE;
-               }
-          }
-
-        ec->first_mapped = 1;
+        _e_shell_client_map_common_pre(ec);
+        _e_shell_client_map_common_post(ec);
      }
 }
 
@@ -1136,20 +1165,7 @@ _e_xdg_shell_surface_map_cb_timer(void *data)
               ec->use_splash, ec->first_mapped, ec->iconic, ec->exp_iconify.by_client,
               ec->post_raise, ec->post_lower, ec->ignored, ec->override, ec->input_only);
 
-        if (ec->use_splash)
-          {
-             ELOGF("LAUNCH", "SHOW real win after splash effect by map_timer", ec->pixmap, ec);
-             e_comp_object_signal_emit(ec->frame, "e,action,launch_real,done", "e");
-          }
-        ec->use_splash = EINA_FALSE;
-
-        /* unset previous content */
-        e_comp_object_content_unset(ec->frame);
-
-        /* map this surface if needed */
-        ec->visible = EINA_TRUE;
-        evas_object_show(ec->frame);
-        ec->comp_data->mapped = EINA_TRUE;
+        _e_shell_client_map_common_pre(ec);
 
         /* force update */
         e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h);
@@ -1158,29 +1174,7 @@ _e_xdg_shell_surface_map_cb_timer(void *data)
 
         e_comp_wl_surface_commit(ec);
 
-        /* FIXME: sometimes popup surfaces Do Not raise above their
-         * respective parents... */
-        /* if (ec->netwm.type == E_WINDOW_TYPE_POPUP_MENU) */
-        /*   e_client_raise_latest_set(ec); */
-
-        if ((!ec->first_mapped) && (!ec->iconic) && (!e_client_util_ignored_get(ec)))
-          {
-             if (!ec->comp_data->sub.data)
-               {
-                  if (ec->post_lower)
-                     evas_object_lower(ec->frame);
-                  else if (ec->post_raise)
-                     evas_object_raise(ec->frame);
-
-                  ec->post_lower = EINA_FALSE;
-                  ec->post_raise = EINA_FALSE;
-               }
-          }
-
-        ELOGF("COMP", "Un-Set launching flag", ec->pixmap, ec);
-        ec->launching = EINA_FALSE;
-        ec->first_mapped = 1;
-        EC_CHANGED(ec);
+        _e_shell_client_map_common_post(ec);
      }
    ec->map_timer = NULL;
    return ECORE_CALLBACK_CANCEL;
@@ -1252,44 +1246,8 @@ _e_xdg_shell_surface_map(struct wl_resource *resource)
               ec->use_splash, ec->first_mapped, ec->iconic, ec->exp_iconify.by_client,
               ec->post_raise, ec->post_lower, ec->ignored, ec->override, ec->input_only);
 
-        if (ec->use_splash)
-          {
-             ELOGF("LAUNCH", "SHOW real win after splash effect", ec->pixmap, ec);
-             e_comp_object_signal_emit(ec->frame, "e,action,launch_real,done", "e");
-          }
-        ec->use_splash = EINA_FALSE;
-
-        /* unset previous content */
-        e_comp_object_content_unset(ec->frame);
-
-        /* map this surface if needed */
-        ec->visible = EINA_TRUE;
-        evas_object_show(ec->frame);
-        ec->comp_data->mapped = EINA_TRUE;
-
-        /* FIXME: sometimes popup surfaces Do Not raise above their
-         * respective parents... */
-        /* if (ec->netwm.type == E_WINDOW_TYPE_POPUP_MENU) */
-        /*   e_client_raise_latest_set(ec); */
-
-        if ((!ec->first_mapped) && (!ec->iconic) && (!e_client_util_ignored_get(ec)))
-          {
-             if (!ec->comp_data->sub.data)
-               {
-                  if (ec->post_lower)
-                     evas_object_lower(ec->frame);
-                  else if (ec->post_raise)
-                     evas_object_raise(ec->frame);
-
-                  ec->post_lower = EINA_FALSE;
-                  ec->post_raise = EINA_FALSE;
-               }
-          }
-
-        ELOGF("COMP", "Un-Set launching flag..", ec->pixmap, ec);
-        ec->launching = EINA_FALSE;
-        ec->first_mapped = 1;
-        EC_CHANGED(ec);
+        _e_shell_client_map_common_pre(ec);
+        _e_shell_client_map_common_post(ec);
      }
 
    TRACE_DS_END();