remote_surface: changed to save the image file of the window even it has never been...
authorGwanglim Lee <gl77.lee@samsung.com>
Tue, 11 Jul 2017 12:29:10 +0000 (21:29 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Wed, 12 Jul 2017 03:03:04 +0000 (12:03 +0900)
Change-Id: Ie72d030f762caf6c078343794afb4e071d0a3fcf

src/bin/e_client.h
src/bin/e_comp_wl_rsm.c
src/bin/e_comp_wl_rsm.h
src/modules/wl_desktop_shell/e_mod_main.c

index 89c3a98222671d5403121bc7b72f2333b3b12384..274d84220722d1f21a411ef90ffc968fcfe16346 100644 (file)
@@ -935,6 +935,7 @@ struct E_Client
 
    int effect_type;
    Eina_Bool use_splash : 1;
+   Eina_Bool saved_img : 1; // indicates that window has been saved as the image file even once
 };
 
 #define e_client_focus_policy_click(ec) \
index 433c0e6855303dd51de994af265db729b42ca242..7a8064b4f28aa126bbebd793371ea43088471e97 100644 (file)
@@ -1189,6 +1189,8 @@ _remote_source_save_done(void *data, Ecore_Thread *th)
           }
         source->image_path = eina_stringshare_add(td->image_path);
         _remote_source_send_image_update(source);
+
+        ec->saved_img = EINA_TRUE;
      }
    else
      {
@@ -2998,6 +3000,50 @@ e_comp_wl_remote_surface_commit(E_Client *ec)
 #endif /* HAVE_REMOTE_SURFACE */
 }
 
+EAPI void
+e_comp_wl_remote_surface_image_save(E_Client *ec)
+{
+#ifdef HAVE_REMOTE_SURFACE
+   E_Comp_Wl_Remote_Source *src;
+
+   if (!e_config->save_win_buffer) return;
+   if (!e_config->hold_prev_win_img) return;
+   if (ec->saved_img) return;
+   if (ec->ignored) return;
+
+   if (e_policy_client_is_lockscreen(ec) ||
+       e_policy_client_is_home_screen(ec) ||
+       e_policy_client_is_quickpanel(ec) ||
+       e_policy_client_is_volume(ec) ||
+       e_policy_client_is_volume_tv(ec) ||
+       e_policy_client_is_floating(ec) ||
+       e_policy_client_is_cursor(ec) ||
+       e_policy_client_is_subsurface(ec) ||
+       e_policy_client_is_cbhm(ec) ||
+       e_policy_client_is_toast_popup(ec) ||
+       e_policy_client_is_keyboard(ec) ||
+       e_policy_client_is_keyboard_sub(ec) ||
+       e_policy_client_is_keyboard_magnifier(ec))
+     return;
+
+   src = _remote_source_find(ec);
+   if (!src)
+     {
+        src = E_NEW(E_Comp_Wl_Remote_Source, 1);
+        EINA_SAFETY_ON_NULL_GOTO(src, end);
+
+        src->common.ec = ec;
+        eina_hash_add(_rsm->source_hash, &ec, src);
+     }
+
+   _remote_source_save_start(src);
+
+end:
+   return;
+#endif /* HAVE_REMOTE_SURFACE */
+}
+
+
 EINTERN void
 e_comp_wl_remote_surface_debug_info_get(Eldbus_Message_Iter *iter)
 {
index 782a9533999760e0a1b5b1f3c7c1de944e4b2af0..fbe94cf89e983507e979222c58229b0645fdceb4 100644 (file)
@@ -7,6 +7,7 @@ typedef struct _E_Event_Remote_Surface_Provider E_Event_Remote_Surface_Provider;
 EINTERN void      e_comp_wl_remote_surface_init(void);
 EINTERN void      e_comp_wl_remote_surface_shutdown(void);
 EINTERN Eina_Bool e_comp_wl_remote_surface_commit(E_Client *ec);
+EAPI    void      e_comp_wl_remote_surface_image_save(E_Client *ec);
 EINTERN void      e_comp_wl_remote_surface_debug_info_get(Eldbus_Message_Iter *iter);
 
 E_API extern int E_EVENT_REMOTE_SURFACE_PROVIDER_VISIBILITY_CHANGE;
index fd62d614ec68a1f925ec775cdfc849e62cb13bbd..e7752cd560b599a792b7fda7102ec98aaea5e7a0 100644 (file)
@@ -561,6 +561,9 @@ _e_shell_surface_unmap(struct wl_resource *resource)
 
    if (ec->comp_data->mapped)
      {
+        /* need to save its last buffer to image file */
+        e_comp_wl_remote_surface_image_save(ec);
+
         ec->visible = EINA_FALSE;
         evas_object_hide(ec->frame);
         ec->comp_data->mapped = EINA_FALSE;
@@ -1285,6 +1288,9 @@ _e_xdg_shell_surface_unmap(struct wl_resource *resource)
 
    if (ec->comp_data->mapped)
      {
+        /* need to save its last buffer to image file */
+        e_comp_wl_remote_surface_image_save(ec);
+
         ec->visible = EINA_FALSE;
         evas_object_hide(ec->frame);
         ec->comp_data->mapped = EINA_FALSE;