summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung-jae Park <nicesj.park@samsung.com>2013-10-18 13:53:58 +0900
committerSung-jae Park <nicesj.park@samsung.com>2013-10-18 13:53:58 +0900
commitb607ed3450b16d6af94808a61c84242b2bc2699e (patch)
tree9be90ed24581ccbfc9180725e3207e59d6723a52
parente701068bf53df44478a9110dd2afeba63c40a0e6 (diff)
downloadlivebox-edje-b607ed3450b16d6af94808a61c84242b2bc2699e.tar.gz
livebox-edje-b607ed3450b16d6af94808a61c84242b2bc2699e.tar.bz2
livebox-edje-b607ed3450b16d6af94808a61c84242b2bc2699e.zip
Discard too lately arrived events.
Delayed event should be discarded. Time of delievering event is depends on the system performance, So if it arrived to lately, system is in low performance states. Don't processing the late events just discarding them. Change-Id: Ibd50d22033acc9780db24498d3ddab02e601614e
-rw-r--r--packaging/liblivebox-edje.spec2
-rw-r--r--src/script_port.c34
2 files changed, 31 insertions, 5 deletions
diff --git a/packaging/liblivebox-edje.spec b/packaging/liblivebox-edje.spec
index 335292e..29d4621 100644
--- a/packaging/liblivebox-edje.spec
+++ b/packaging/liblivebox-edje.spec
@@ -1,6 +1,6 @@
Name: liblivebox-edje
Summary: EDJE Script loader for the data provider master
-Version: 0.5.19
+Version: 0.5.20
Release: 1
Group: HomeTF/Livebox
License: Flora License
diff --git a/src/script_port.c b/src/script_port.c
index e245898..8c6f675 100644
--- a/src/script_port.c
+++ b/src/script_port.c
@@ -64,6 +64,8 @@ struct info {
int w;
int h;
+ int is_mouse_down;
+
Evas *e;
Eina_List *obj_list;
@@ -1186,17 +1188,41 @@ PUBLIC int script_feed_event(void *h, Evas *e, int event_type, int x, int y, int
}
} else if (event_type & LB_SCRIPT_MOUSE_EVENT) {
+ double cur_timestamp;
+
+#if defined(_USE_ECORE_TIME_GET)
+ cur_timestamp = ecore_time_get();
+#else
+ struct timeval tv;
+ if (gettimeofday(&tv, NULL) < 0) {
+ ErrPrint("Failed to get time\n");
+ cur_timestamp = 0.0f;
+ } else {
+ cur_timestamp = (double)tv.tv_sec + ((double)tv.tv_usec / 1000000.0f);
+ }
+#endif
+ if (cur_timestamp - timestamp > 0.1f && handle->is_mouse_down == 0) {
+ DbgPrint("Discard lazy event : %lf\n", cur_timestamp - timestamp);
+ return LB_STATUS_SUCCESS;
+ }
+
switch (event_type) {
case LB_SCRIPT_MOUSE_DOWN:
- evas_event_feed_mouse_move(e, x, y, timestamp * 1000, NULL);
- evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, (timestamp + 0.01f) * 1000, NULL);
+ if (handle->is_mouse_down == 0) {
+ evas_event_feed_mouse_move(e, x, y, timestamp * 1000, NULL);
+ evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, (timestamp + 0.01f) * 1000, NULL);
+ handle->is_mouse_down = 1;
+ }
break;
case LB_SCRIPT_MOUSE_MOVE:
evas_event_feed_mouse_move(e, x, y, timestamp * 1000, NULL);
break;
case LB_SCRIPT_MOUSE_UP:
- evas_event_feed_mouse_move(e, x, y, timestamp * 1000, NULL);
- evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, (timestamp + 0.01f) * 1000, NULL);
+ if (handle->is_mouse_down == 1) {
+ evas_event_feed_mouse_move(e, x, y, timestamp * 1000, NULL);
+ evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, (timestamp + 0.01f) * 1000, NULL);
+ handle->is_mouse_down = 0;
+ }
break;
case LB_SCRIPT_MOUSE_IN:
evas_event_feed_mouse_in(e, timestamp * 1000, NULL);