ecore: add support for rotary event 13/64113/2 accepted/tizen/ivi/20160330.100902 accepted/tizen/mobile/20160330.100717 accepted/tizen/tv/20160330.100741 accepted/tizen/wearable/20160330.100847 submit/tizen/20160330.065726
authorThiep Ha <thiep.ha@samsung.com>
Wed, 30 Mar 2016 06:30:33 +0000 (15:30 +0900)
committerThiep Ha <thiep.ha@samsung.com>
Wed, 30 Mar 2016 06:45:46 +0000 (15:45 +0900)
@tizen_feature

Change-Id: I6e79e58c49860dcaa33a683f74d19ed105a1fe00
Signed-off-by: Thiep Ha <thiep.ha@samsung.com>
src/lib/ecore_input/Ecore_Input.h
src/lib/ecore_input/ecore_input.c
src/lib/ecore_wayland/ecore_wl_input.c

index 6175827..c7482ab 100644 (file)
@@ -57,6 +57,7 @@ extern "C" {
    EAPI extern int ECORE_EVENT_MOUSE_BUTTON_CANCEL; /**< @since 1.15 */
    EAPI extern int ECORE_EVENT_DEVICE_ADD;
    EAPI extern int ECORE_EVENT_DEVICE_DEL;
+   EAPI extern int ECORE_EVENT_DETENT_ROTATE; //TIZEN ONLY
 
 #define ECORE_EVENT_MODIFIER_SHIFT      0x0001
 #define ECORE_EVENT_MODIFIER_CTRL       0x0002
@@ -85,6 +86,7 @@ extern "C" {
    typedef struct _Ecore_Event_Axis_Update  Ecore_Event_Axis_Update; /**< @since 1.13 */
    typedef struct _Ecore_Axis               Ecore_Axis; /**< @since 1.13 */
    typedef struct _Ecore_Event_Device_Info  Ecore_Event_Device_Info;
+   typedef struct _Ecore_Event_Detent_Rotate Ecore_Event_Detent_Rotate; //TIZEN ONLY
 
    /**
     * @typedef Ecore_Event_Modifier
@@ -309,6 +311,18 @@ extern "C" {
         const char *seatname;
         unsigned int caps;
      };
+   // TIZEN ONLY
+   typedef enum _Ecore_Detent_Direction
+     {
+        ECORE_DETENT_DIRECTION_CLOCKWISE,
+        ECORE_DETENT_DIRECTION_COUNTER_CLOCKWISE
+     } Ecore_Detent_Direction;
+   struct _Ecore_Event_Detent_Rotate
+     {
+        Ecore_Detent_Direction direction;
+        unsigned int timestamp;
+     };
+   // TIZEN ONLY - END
 
    /**
     * @struct _Ecore_Event_Mouse_IO
index 4a16611..e08267f 100644 (file)
@@ -26,6 +26,7 @@ EAPI int ECORE_EVENT_AXIS_UPDATE = 0;
 EAPI int ECORE_EVENT_MOUSE_BUTTON_CANCEL = 0;
 EAPI int ECORE_EVENT_DEVICE_ADD = 0;
 EAPI int ECORE_EVENT_DEVICE_DEL = 0;
+EAPI int ECORE_EVENT_DETENT_ROTATE = 0; //TIZEN ONLY
 
 static int _ecore_event_init_count = 0;
 
@@ -60,6 +61,7 @@ ecore_event_init(void)
    ECORE_EVENT_MOUSE_BUTTON_CANCEL = ecore_event_type_new();
    ECORE_EVENT_DEVICE_ADD = ecore_event_type_new();
    ECORE_EVENT_DEVICE_DEL = ecore_event_type_new();
+   ECORE_EVENT_DETENT_ROTATE = ecore_event_type_new(); //TIZEN ONLY
 
    return _ecore_event_init_count;
 }
@@ -82,6 +84,7 @@ ecore_event_shutdown(void)
    ECORE_EVENT_MOUSE_BUTTON_CANCEL = 0;
    ECORE_EVENT_DEVICE_ADD = 0;
    ECORE_EVENT_DEVICE_DEL = 0;
+   ECORE_EVENT_DETENT_ROTATE = 0; //TIZEN ONLY
    eina_log_domain_unregister(_ecore_input_log_dom);
    _ecore_input_log_dom = -1;
    ecore_shutdown();
index c88cc22..aa774ac 100644 (file)
@@ -2017,10 +2017,18 @@ _ecore_wl_input_device_cb_event_device(void *data, struct tizen_input_device *ti
 }
 
 static void
+_ecore_wl_input_detent_rotate_free(void *data EINA_UNUSED, void *ev)
+{
+   Ecore_Event_Detent_Rotate *e = ev;
+   free(e);
+}
+
+static void
 _ecore_wl_input_device_cb_axis(void *data EINA_UNUSED, struct tizen_input_device *tizen_input_device EINA_UNUSED, uint32_t axis_type, wl_fixed_t value)
 {
    Ecore_Wl_Input *input = _ecore_wl_disp->input;
    double dvalue = wl_fixed_to_double(value);
+   Ecore_Event_Detent_Rotate *e;
 
    switch (axis_type)
      {
@@ -2041,6 +2049,18 @@ _ecore_wl_input_device_cb_axis(void *data EINA_UNUSED, struct tizen_input_device
             * value 1 is clockwise,
             * value -1 is counterclockwise,
             */
+           if (!(e = calloc(1, sizeof(Ecore_Event_Detent_Rotate))))
+             {
+                ERR("detent: cannot allocate memory");
+                return;
+             }
+           if (dvalue == 1)
+             e->direction = ECORE_DETENT_DIRECTION_CLOCKWISE;
+           else
+             e->direction = ECORE_DETENT_DIRECTION_COUNTER_CLOCKWISE;
+           e->timestamp = (unsigned int)ecore_time_get();
+           DBG("detent: dir: %d, time: %d", e->direction, e->timestamp);
+           ecore_event_add(ECORE_EVENT_DETENT_ROTATE, e, _ecore_wl_input_detent_rotate_free, NULL);
            break;
         default:
            WRN("Invalid type(%d) is ignored.\n", axis_type);