Delay resuming time 12/127212/1 accepted/tizen/3.0/common/20170515.150333 accepted/tizen/3.0/ivi/20170515.064305 accepted/tizen/3.0/mobile/20170515.064257 accepted/tizen/3.0/tv/20170515.064301 accepted/tizen/3.0/wearable/20170515.064308 submit/tizen_3.0/20170515.034408
authorJunghoon Park <jh9216.park@samsung.com>
Wed, 26 Apr 2017 05:08:33 +0000 (14:08 +0900)
committerJunghoon Park <jh9216.park@samsung.com>
Wed, 26 Apr 2017 11:37:28 +0000 (11:37 +0000)
- This patch allows some widgets to postpone getting resuming callback
- If widgets change the visibility repeatedly, the performance will
  not be good
- Added API will help to adjust the delayed resuming time
- By default, the delayed resuming time is 0

Change-Id: I87edb61a7706bd0abf28fe63c9289c56635d64e5
Signed-off-by: Junghoon Park <jh9216.park@samsung.com>
(cherry picked from commit acf380a217578c085f28fa13b10f8cba00f5ae53)

screen_connector_watcher_evas/include/screen_connector_toolkit_evas.h
screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c

index d0d4a89..b1ae572 100644 (file)
@@ -65,6 +65,7 @@ int screen_connector_toolkit_evas_init(Evas_Object *win, screen_connector_screen
 int screen_connector_toolkit_evas_fini(screen_connector_screen_type_e type);
 screen_connector_toolkit_evas_h screen_connector_toolkit_evas_add(screen_connector_toolkit_evas_ops *ops, char *id,
                screen_connector_screen_type_e type, void *data);
+int screen_connector_toolkit_evas_set_delayed_resuming_time(int ms);
 int screen_connector_toolkit_evas_remove(screen_connector_toolkit_evas_h handle);
 int screen_connector_toolkit_evas_update(const char *appid, const char *instance_id);
 int screen_connector_toolkit_evas_start_visibility_notify(void);
index da62bf8..7af5c5c 100644 (file)
@@ -52,11 +52,13 @@ struct _screen_connector_toolkit_evas_h {
        uint32_t img_type;
        struct wl_buffer *pre_buffer;
        struct _screen_connector_type_evas_h *type_h;
+       guint resuming_timer;
        void *data;
 };
 
 static GHashTable *__type_table = NULL;
 static Ecore_Event_Handler *__visibility_listener;
+static int __delayed_resuming_time;
 
 static void __destroy_type_h(gpointer data)
 {
@@ -115,6 +117,9 @@ static void __destroy_toolkit_evas_h(gpointer data)
        if (toolkit_evas_h->ops)
                free(toolkit_evas_h->ops);
 
+       if (toolkit_evas_h->resuming_timer > 0)
+               g_source_remove(toolkit_evas_h->resuming_timer);
+
        free(toolkit_evas_h);
 }
 
@@ -165,6 +170,8 @@ EXPORT_API int screen_connector_toolkit_evas_fini(screen_connector_screen_type_e
                __type_table = NULL;
        }
 
+       __delayed_resuming_time = 0;
+
        return screen_connector_toolkit_fini(type);
 }
 
@@ -207,6 +214,22 @@ static bool __obj_is_visible(screen_connector_toolkit_evas_h toolkit_evas_h)
        return false;
 }
 
+static gboolean __resuming_timeout_cb(gpointer user_data)
+{
+       screen_connector_toolkit_evas_h toolkit_evas_h = user_data;
+       struct tizen_remote_surface *surface;
+
+       surface = screen_connector_toolkit_get_trs(toolkit_evas_h->toolkit_h);
+       if (surface) {
+               tizen_remote_surface_transfer_visibility(surface,
+                               TIZEN_REMOTE_SURFACE_VISIBILITY_TYPE_VISIBLE);
+       }
+
+       toolkit_evas_h->resuming_timer = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
 static int __set_visibility(screen_connector_toolkit_evas_h toolkit_evas_h, visibility_type type)
 {
        int obscured;
@@ -230,9 +253,28 @@ static int __set_visibility(screen_connector_toolkit_evas_h toolkit_evas_h, visi
        }
 
        surface = screen_connector_toolkit_get_trs(toolkit_evas_h->toolkit_h);
-       if (surface)
+       if (!surface)
+               return -1;
+
+       if (__delayed_resuming_time == 0) {
                tizen_remote_surface_transfer_visibility(surface, obscured);
 
+               return 0;
+       }
+
+       if (obscured == TIZEN_REMOTE_SURFACE_VISIBILITY_TYPE_INVISIBLE) {
+               if (toolkit_evas_h->resuming_timer > 0) {
+                       g_source_remove(toolkit_evas_h->resuming_timer);
+                       toolkit_evas_h->resuming_timer = 0;
+               }
+               tizen_remote_surface_transfer_visibility(surface, obscured);
+       } else {
+               if (toolkit_evas_h->resuming_timer == 0) {
+                       toolkit_evas_h->resuming_timer = g_timeout_add(__delayed_resuming_time,
+                                       __resuming_timeout_cb, toolkit_evas_h);
+               }
+       }
+
        return 0;
 }
 
@@ -596,6 +638,13 @@ static void __toolkit_removed_cb(const char *appid, const char *instance_id, con
        g_hash_table_remove(toolkit_evas_h->type_h->toolkit_table, instance_id);
 }
 
+EXPORT_API int screen_connector_toolkit_evas_set_delayed_resuming_time(int ms)
+{
+       __delayed_resuming_time = ms;
+
+       return 0;
+}
+
 EXPORT_API screen_connector_toolkit_evas_h screen_connector_toolkit_evas_add_with_win(screen_connector_toolkit_evas_ops *ops, char *id,
                screen_connector_screen_type_e type, Evas_Object *win, void *data)
 {