ecore_wl2_input: support a touch max count event 61/250261/9
authorjeon <jhyuni.kang@samsung.com>
Tue, 22 Dec 2020 11:34:03 +0000 (20:34 +0900)
committerkim hosang <hosang12.kim@samsung.com>
Thu, 21 Jan 2021 04:54:50 +0000 (04:54 +0000)
Change-Id: I95e16e5378ddd9c73161c84854770561e626dba5

src/lib/ecore_wl2/ecore_wl2_input.c
src/lib/ecore_wl2/ecore_wl2_private.h

index 437dc56..cc20d98 100644 (file)
@@ -259,7 +259,7 @@ _ecore_wl2_input_touch_radius_calc(double x, double y)
 static void
 _ecore_wl2_input_touch_axis_process(Ecore_Wl2_Input *input, int id)
 {
-   if (id >= ECORE_WL2_TOUCH_MAX)
+   if (id >= input->touch.max_count)
       return;
 
    if (input->touch.last_touch_axis.radius_x)
@@ -475,7 +475,7 @@ _ecore_wl2_input_mouse_move_send(Ecore_Wl2_Input *input, Ecore_Wl2_Window *windo
    ev->multi.device = device;
 
    // TIZEN_ONLY(20171109): support a tizen_input_device_manager interface
-   if (device >= ECORE_WL2_TOUCH_MAX)
+   if (device >= input->touch.max_count)
      {
         ev->multi.radius = 1;
         ev->multi.radius_x = 1;
@@ -641,7 +641,7 @@ _ecore_wl2_input_mouse_down_send(Ecore_Wl2_Input *input, Ecore_Wl2_Window *windo
      }
 
    // TIZEN_ONLY(20171109): support a tizen_input_device_manager interface
-   if (device >= ECORE_WL2_TOUCH_MAX)
+   if (device >= input->touch.max_count)
      {
         ev->multi.radius = 1;
         ev->multi.radius_x = 1;
@@ -765,7 +765,7 @@ _ecore_wl2_input_mouse_up_send(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window,
 
 
    // TIZEN_ONLY(20171109): support a tizen_input_device_manager interface
-   if (device < ECORE_WL2_TOUCH_MAX)
+   if (device < input->touch.max_count)
      {
         input->touch.touch_axis[device].radius_x = 1.0;
         input->touch.touch_axis[device].radius_y = 1.0;
@@ -3590,19 +3590,44 @@ _ecore_wl2_input_device_manager_cb_block_expired(void *data EINA_UNUSED, struct
    ;
 }
 
+static void
+_ecore_wl2_input_device_manager_cb_max_touch_count(void *data, struct tizen_input_device_manager *tizen_input_device_manager EINA_UNUSED, uint32_t serial EINA_UNUSED, int32_t max_count, struct wl_seat *seat)
+{
+   Ecore_Wl2_Display *ewd = (Ecore_Wl2_Display *)data;
+   Ecore_Wl2_Input *input;
+
+   if (!ewd) return;
+
+   input = wl_seat_get_user_data(seat);
+
+   if (!input) return;
+
+   if (input->touch.max_count < max_count)
+     {
+        if (input->touch.touch_axis)
+          {
+             INF("Max touch value is changed %d to %d\n", input->touch.max_count, max_count);
+             free(input->touch.touch_axis);
+          }
+        input->touch.max_count = max_count;
+        input->touch.touch_axis = (Ecore_Wl2_Touch_Axis *)calloc(max_count, sizeof(Ecore_Wl2_Touch_Axis));
+     }
+}
+
 static const struct tizen_input_device_manager_listener _tz_input_device_mgr_listener =
 {
    _ecore_wl2_input_device_manager_cb_device_add,
    _ecore_wl2_input_device_manager_cb_device_remove,
    _ecore_wl2_input_device_manager_cb_error,
    _ecore_wl2_input_device_manager_cb_block_expired,
+   _ecore_wl2_input_device_manager_cb_max_touch_count,
 };
 
 void
 _ecore_wl2_input_device_manager_setup(Ecore_Wl2_Display *ewd, unsigned int id, unsigned int version EINA_UNUSED)
 {
    ewd->wl.tz_input_device_manager =
-   wl_registry_bind(ewd->wl.registry, id, &tizen_input_device_manager_interface, 2);
+   wl_registry_bind(ewd->wl.registry, id, &tizen_input_device_manager_interface, 4);
 
    tizen_input_device_manager_add_listener(ewd->wl.tz_input_device_manager,
                                        &_tz_input_device_mgr_listener, ewd);
index e9da70e..59c4dd5 100644 (file)
@@ -490,7 +490,6 @@ typedef struct _Ecore_Wl2_Touch_Axis
    double angle;
 } Ecore_Wl2_Touch_Axis;
 
-#define ECORE_WL2_TOUCH_MAX 10
 //
 
 /** TODO: Refactor ALL Input code :(
@@ -744,8 +743,9 @@ struct _Ecore_Wl2_Input
      } devmgr;
    struct
      {
-        Ecore_Wl2_Touch_Axis touch_axis[ECORE_WL2_TOUCH_MAX];
+        Ecore_Wl2_Touch_Axis *touch_axis;
         Ecore_Wl2_Touch_Axis last_touch_axis;
+        int max_count;
      } touch;
 //