void *data;
};
+GQueue *__pending_queue;
+
+static void __process_pending_status(int status, const char *instance_id)
+{
+ int r;
+
+ _D("send pending event(%d) to %s", status, instance_id);
+ r = aul_screen_connector_update_screen_viewer_status(status,
+ instance_id);
+ if (r < 0)
+ _E("Failed to update screen viewer status");
+}
+
+static void __flush_pending_queue(const char *instance_id)
+{
+ gpointer status_pointer;
+ int status;
+
+ if (!__pending_queue) {
+ _D("Pending queue is empty");
+ return;
+ }
+
+ while (!g_queue_is_empty(__pending_queue)) {
+ status_pointer = g_queue_pop_head(__pending_queue);
+ status = GPOINTER_TO_INT(status_pointer);
+ __process_pending_status(status, instance_id);
+ }
+
+ g_queue_free(__pending_queue);
+ __pending_queue = NULL;
+}
+
+static void __push_pending_queue(int status)
+{
+ if (!__pending_queue)
+ __pending_queue= g_queue_new();
+
+ if (!__pending_queue) {
+ _E("Out of memory");
+ return;
+ }
+
+ g_queue_push_tail(__pending_queue, GINT_TO_POINTER(status));
+ _D("status(%d)", status);
+}
+
static void __win_resized(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Object *win = obj;
__watch_instance_id = strdup(instance_id);
if (__watch_instance_id == NULL)
_W("Out of memory");
+
+ __flush_pending_queue(instance_id);
}
static void __screen_connector_toolkit_evas_removed_cb(const char *appid, const char *instance_id, int pid,
int status;
int r;
- if (__watch_appid == NULL || __watch_instance_id == NULL) {
- _E("watch is not added");
- return -1;
- }
-
if (visible)
status = AUL_SCREEN_STATUS_RESUME;
else
status = AUL_SCREEN_STATUS_PAUSE;
+ if (__watch_appid == NULL || __watch_instance_id == NULL) {
+ _E("watch is not added");
+ __push_pending_queue(status);
+ return 0;
+ }
+
r = aul_screen_connector_update_screen_viewer_status(status,
__watch_instance_id);
if (r < 0) {