e_info_server: replace e_comp_wl_screenshooter_dump to e_output_capture for screen... 43/146843/3
authorJunkyeong Kim <jk0430.kim@samsung.com>
Thu, 31 Aug 2017 00:45:56 +0000 (09:45 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Thu, 31 Aug 2017 06:15:41 +0000 (06:15 +0000)
Change-Id: Ie2a166ce34b6df5ed64794f9c28a220295d66be0
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
src/bin/e_info_server.c

index b55770b1de54a3af7bc5d181a6c0d90d1640a6fb..2cc9eeee8cabdaa100bc02870a0bd77abd5d2363 100644 (file)
@@ -3726,6 +3726,19 @@ _e_info_server_cb_selected_buffer_dump(const Eldbus_Service_Interface *iface EIN
    return reply;
 }
 
+static void
+_e_info_server_cb_screen_dump_cb(E_Output *eout, tbm_surface_h surface, void *user_data)
+{
+   char *path = (char *)user_data;
+
+   tdm_helper_dump_buffer(surface, path);
+
+   free(path);
+   tbm_surface_destroy(surface);
+
+   DBG("_e_info_server_cb_screen_dump_cb done");
+}
+
 static Eldbus_Message *
 _e_info_server_cb_screen_dump(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
 {
@@ -3734,6 +3747,8 @@ _e_info_server_cb_screen_dump(const Eldbus_Service_Interface *iface EINA_UNUSED,
    tbm_surface_h surface = NULL;
    E_Output *eout = NULL;
    int w = 0, h = 0;
+   Eina_Bool ret = EINA_FALSE;
+   char *path_backup = NULL;
 
    if (!eldbus_message_arguments_get(msg, "s", &path))
      {
@@ -3742,6 +3757,11 @@ _e_info_server_cb_screen_dump(const Eldbus_Service_Interface *iface EINA_UNUSED,
      }
 
    eout = e_output_find_by_index(0);
+   if (eout == NULL)
+     {
+        ERR("Error get main outpute.");
+        return reply;
+     }
    e_output_size_get(eout, &w, &h);
 
    surface = tbm_surface_create(w, h, TBM_FORMAT_ARGB8888);
@@ -3751,15 +3771,21 @@ _e_info_server_cb_screen_dump(const Eldbus_Service_Interface *iface EINA_UNUSED,
         return reply;
      }
 
-   if (!e_comp_wl_screenshooter_dump(surface))
+   path_backup = (char *)calloc(1, PATH_MAX * sizeof(char));
+   if (path_backup == NULL)
      {
-        ERR("Error dump fail.");
-        tbm_surface_destroy(surface);
+        ERR("Error alloc.");
         return reply;
      }
+   strncpy(path_backup, path, PATH_MAX);
 
-   tdm_helper_dump_buffer(surface, path);
+   ret = e_output_capture(eout, surface, EINA_FALSE, _e_info_server_cb_screen_dump_cb, path_backup);
+   if (ret)
+     return reply;
+   else
+     ERR("Error fail capture.");
 
+   free(path_backup);
    tbm_surface_destroy(surface);
 
    return reply;