ecore_wl2_input: update a timestamp whenever possible 90/198890/1
authorWonki Kim <wonki_.kim@samsung.com>
Tue, 29 Jan 2019 12:06:33 +0000 (07:06 -0500)
committerWonki Kim <wonki_.kim@samsung.com>
Thu, 31 Jan 2019 00:35:44 +0000 (09:35 +0900)
Summary:
gettimeofday function returns a accumulated timestamp since around 1970 by the way,
a argument from server looks like a system uptime based timestamp
in some distribution such as tizen.

so that this patch appends a logic that updates a timestamp
inside Ecore_Wl2_Input* whenever possible to
prevent gettimeofday function from being called.

Reviewers: #reviewers, cedric, devilhorns

Reviewed By: #reviewers, devilhorns

Subscribers: devilhorns, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7766

Change-Id: I6a74972c326a6484580fed3ab94264ec6f635192

src/lib/ecore_wl2/ecore_wl2_input.c

index 0c592917ff328dc5bbcba073caf6fb113ae7e954..306275f95bdaf858197e990ffa4a79c47e94ef06 100644 (file)
@@ -1115,6 +1115,7 @@ _pointer_cb_button(void *data, struct wl_pointer *pointer EINA_UNUSED, unsigned
    if (!input) return;
 
    input->display->serial = serial;
+   input->timestamp = timestamp;
 
    if (state == WL_POINTER_BUTTON_STATE_PRESSED)
      {
@@ -1152,6 +1153,8 @@ _pointer_cb_axis(void *data, struct wl_pointer *pointer EINA_UNUSED, unsigned in
    input = data;
    if (!input) return;
 
+   input->timestamp = timestamp;
+
    _ecore_wl2_input_mouse_wheel_send(input, axis, wl_fixed_to_int(value),
                                      timestamp);
 }
@@ -1453,6 +1456,7 @@ _keyboard_cb_key(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigned
    //
 
    input->display->serial = serial;
+   input->timestamp = timestamp;
 
    /* xkb rules reflect X broken keycodes, so offset by 8 */
    code = keycode + 8;
@@ -1625,6 +1629,8 @@ _touch_cb_down(void *data, struct wl_touch *touch EINA_UNUSED, unsigned int seri
    if (!window) return;
 
    input->focus.touch = window;
+   input->timestamp = timestamp;
+
    // TIZEN_ONLY(20171109): support a tizen_input_device_manager interface
    _ecore_wl2_input_touch_axis_process(input, id);
    //