e_input: add e_input_evdev_mouse_accel_enable api 61/275561/1
authorJunkyeong, Kim <jk0430.kim@samsung.com>
Thu, 26 May 2022 05:34:40 +0000 (14:34 +0900)
committerJunseok Kim <juns.kim@samsung.com>
Thu, 26 May 2022 08:12:10 +0000 (17:12 +0900)
input system uses pointer acceleration by default.
so make an api to get raw pointer data without acceleration.

Change-Id: Ibd6e30b8ba342b448c6d17f7eb2f8dd5245fd2dd
Signed-off-by: Junkyeong, Kim <jk0430.kim@samsung.com>
src/bin/e_input.h
src/bin/e_input_evdev.c
src/bin/e_input_private.h

index a9bc77b..16ae632 100644 (file)
@@ -97,6 +97,7 @@ EINTERN Eina_Bool e_input_evdev_key_remap_enable(E_Input_Evdev *edev, Eina_Bool
 EINTERN Eina_Bool e_input_evdev_key_remap_set(E_Input_Evdev *edev, int *from_keys, int *to_keys, int num);
 EINTERN Eina_Bool e_input_evdev_touch_calibration_set(E_Input_Evdev *edev, float matrix[6]);
 EINTERN Eina_Bool e_input_evdev_mouse_accel_speed_set(E_Input_Evdev *edev, double speed);
+EINTERN Eina_Bool e_input_evdev_mouse_accel_enable(E_Input_Evdev *edev, Eina_Bool enable);
 EINTERN unsigned int e_input_evdev_touch_pressed_get(E_Input_Evdev *edev);
 
 E_API const Eina_List *e_input_devices_get(void);
index 2e74f1d..027b554 100644 (file)
@@ -782,8 +782,16 @@ _device_handle_pointer_motion(struct libinput_device *device, struct libinput_ev
         return;
      }
 
-   dx = libinput_event_pointer_get_dx(event);
-   dy = libinput_event_pointer_get_dy(event);
+   if (edev->disable_acceleration)
+     {
+        dx = libinput_event_pointer_get_dx_unaccelerated(event);
+        dy = libinput_event_pointer_get_dy_unaccelerated(event);
+     }
+   else
+     {
+        dx = libinput_event_pointer_get_dx(event);
+        dy = libinput_event_pointer_get_dy(event);
+     }
 
    if (edev->seat->ptr.swap)
      {
@@ -2138,4 +2146,13 @@ e_input_evdev_seatname_set(E_Input_Evdev *evdev, const char *seatname)
      }
 
    return res;
-}
\ No newline at end of file
+}
+
+EINTERN Eina_Bool
+e_input_evdev_mouse_accel_enable(E_Input_Evdev *edev, Eina_Bool enable)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(edev, EINA_FALSE);
+   edev->disable_acceleration = !enable;
+
+   return EINA_TRUE;
+}
index 89b9b8d..f5cf49c 100644 (file)
@@ -125,6 +125,8 @@ struct _E_Input_Evdev
 
    const char *output_name;
    Eina_Bool output_configured;
+
+   Eina_Bool disable_acceleration;
 };
 
 void _input_events_process(E_Input_Backend *input);