e_devicemgr: create an input generator touch device has configurred touch count 66/251566/4 accepted/tizen/6.0/unified/20210120.224031 submit/tizen_6.0/20210120.082052
authorjeon <jhyuni.kang@samsung.com>
Fri, 15 Jan 2021 05:44:25 +0000 (14:44 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Wed, 20 Jan 2021 04:48:54 +0000 (04:48 +0000)
Change-Id: Ic4f9907a120c0844cfa24193bf4000bcf1c87bf6

src/bin/e_devicemgr_inputgen.c

index 4cb4275f30ee109c8080a0757efef1e58a37a1ff..066716698a4b59b32f66a0bf3e01b727b1a6b0a5 100644 (file)
@@ -754,23 +754,35 @@ _e_devicemgr_inputgen_hw_device_check(E_Devicemgr_Inputgen_Device_Data *device)
 static Eina_Bool
 _e_devicemgr_init_touch_coords_and_axis(E_Devicemgr_Inputgen_Device_Data *device)
 {
+   int touch_max = e_input_touch_max_count_get();
+   int i;
    if (device->touch.coords)
      free(device->touch.coords);
 
-   device->touch.coords = calloc(1, sizeof(E_Devicemgr_Coords)*e_input_touch_max_count_get());
+   if (e_config->configured_max_touch.use)
+     {
+        touch_max = e_config->configured_max_touch.count;
+     }
+   device->touch.coords = calloc(1, sizeof(E_Devicemgr_Coords)*touch_max);
    if (!device->touch.coords)
      {
-        DMWRN("Failed to allocate memory for coords ptr ! (finger=%d)\n", e_input_touch_max_count_get());
+        DMWRN("Failed to allocate memory for coords ptr ! (finger=%d)\n", touch_max);
         return EINA_FALSE;
      }
 
+   for (i = 0; i < touch_max; i++)
+     {
+        device->touch.coords[i].x = -1;
+        device->touch.coords[i].y = -1;
+     }
+
    if (device->touch.axis)
      free(device->touch.axis);
 
-   device->touch.axis = calloc(1, sizeof(E_Devicemgr_Inputgen_Touch_Axis)*e_input_touch_max_count_get());
+   device->touch.axis = calloc(1, sizeof(E_Devicemgr_Inputgen_Touch_Axis)*touch_max);
    if (!device->touch.axis)
      {
-        DMWRN("Failed to allocate memory for axis ptr ! (finger=%d)\n", e_input_touch_max_count_get());
+        DMWRN("Failed to allocate memory for axis ptr ! (finger=%d)\n", touch_max);
         free(device->touch.coords);
         return EINA_FALSE;
      }
@@ -850,12 +862,6 @@ _e_devicemgr_inputgen_create_device(Ecore_Device_Class clas, struct wl_client *c
         goto fail_create_device;
      }
 
-   for (i = 0; i < e_input_touch_max_count_get(); i++)
-     {
-        device->touch.coords[i].x = -1;
-        device->touch.coords[i].y = -1;
-     }
-
    return TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE;
 
 fail_create_device:
@@ -1258,7 +1264,10 @@ e_devicemgr_create_virtual_device(Ecore_Device_Class clas, const char *name)
        uinp.absmin[ABS_Y] = 0;
        uinp.absmax[ABS_Y] = 1000;
        uinp.absmin[ABS_MT_SLOT] = 0;
-       uinp.absmax[ABS_MT_SLOT] = e_input_touch_max_count_get() - 1;
+       if (e_config->configured_max_touch.use)
+         uinp.absmax[ABS_MT_SLOT] = e_config->configured_max_touch.count - 1;
+       else
+         uinp.absmax[ABS_MT_SLOT] = e_input_touch_max_count_get() - 1;
        uinp.absmin[ABS_MT_TOUCH_MAJOR] = 0;
        uinp.absmax[ABS_MT_TOUCH_MAJOR] = 255;
        uinp.absmin[ABS_MT_TOUCH_MINOR] = 0;