Filtering the events if it is defined
authorSung-jae Park <nicesj.park@samsung.com>
Sat, 1 Nov 2014 07:49:42 +0000 (16:49 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Sat, 1 Nov 2014 07:49:42 +0000 (16:49 +0900)
[model] Redwood,Kiran,B3(Wearable)
[binary_type] AP
[customer] Docomo/Orange/ATT/Open
[issue#] N/A
[problem]
[cause]
[solution]
[team] HomeTF
[request]
[horizontal_expansion]

Change-Id: Idfb2ed1548d08186f05ca446c88e0f414248da40

src/virtual_window.c

index 90f97d6..a86f205 100644 (file)
@@ -77,6 +77,8 @@ typedef struct virtual_window_info {
     int resource_cnt;
 
     unsigned int front_resource_id;
+
+    int pressed;
 } *vwin_info_t;
 
 static inline Evas_Object *get_highlighted_object(Evas_Object *obj)
@@ -110,9 +112,32 @@ static int event_handler_cb(dynamicbox_buffer_h handler, struct dynamicbox_buffe
        return 0;
     }
 
-    timestamp = event_info->timestamp;
-    if (!DYNAMICBOX_CONF_USE_GETTIMEOFDAY) {
-       timestamp *= 1000;
+    if (DYNAMICBOX_CONF_USE_GETTIMEOFDAY) {
+       if (DYNAMICBOX_CONF_EVENT_FILTER > 0.0f && info->pressed == 0) {
+           struct timeval tv;
+
+           if (gettimeofday(&tv, NULL) < 0) {
+               ErrPrint("gettimeofday: %s\n", strerror(errno));
+           } else {
+               timestamp = (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0f;
+
+               if (timestamp - event_info->timestamp > DYNAMICBOX_CONF_EVENT_FILTER) {
+                   return 0;
+               }
+           }
+       }
+
+       timestamp = ecore_time_get() * 1000;
+    } else {
+       if (DYNAMICBOX_CONF_EVENT_FILTER > 0.0f && info->pressed == 0) {
+           timestamp = ecore_time_get();
+
+           if (timestamp - event_info->timestamp > DYNAMICBOX_CONF_EVENT_FILTER) {
+               return 0;
+           }
+       }
+
+       timestamp = event_info->timestamp * 1000;
     }
 
     /**
@@ -163,6 +188,7 @@ static int event_handler_cb(dynamicbox_buffer_h handler, struct dynamicbox_buffe
         */
        evas_event_feed_mouse_move(info->e, event_info->info.pointer.x, event_info->info.pointer.y, timestamp, NULL);
        evas_event_feed_mouse_down(info->e, 1, EVAS_BUTTON_NONE, timestamp, NULL); /* + 0.2f just for fake event */
+       info->pressed = 1;
        break;
     case DBOX_BUFFER_EVENT_MOVE:
        /**
@@ -174,6 +200,7 @@ static int event_handler_cb(dynamicbox_buffer_h handler, struct dynamicbox_buffe
     case DBOX_BUFFER_EVENT_UP:
        evas_event_feed_mouse_move(info->e, event_info->info.pointer.x, event_info->info.pointer.y, timestamp, NULL);
        evas_event_feed_mouse_up(info->e, 1, EVAS_BUTTON_NONE, timestamp, NULL);
+       info->pressed = 0;
        /**
         * @note
         * We have to keep the event flags, so we should not clear them from here.