devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=93f7639c0d23e752ad330ab6fb1cd02d5e5d3432

commit 93f7639c0d23e752ad330ab6fb1cd02d5e5d3432
Author: Chris Michael <[email protected]>
Date:   Wed Nov 2 09:44:13 2016 -0400

    elput: Add API to allow setting pointer acceleration profile
    
    This patch adds an API that can be used to set a pointer acceleration
    profile. This API should be used when addressing T4736
    
    ref T4736
    
    @feature
    
    Signed-off-by: Chris Michael <[email protected]>
---
 src/lib/elput/Elput.h       | 12 ++++++++++++
 src/lib/elput/elput_input.c | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)

diff --git a/src/lib/elput/Elput.h b/src/lib/elput/Elput.h
index a587b14..bd4fe7a 100644
--- a/src/lib/elput/Elput.h
+++ b/src/lib/elput/Elput.h
@@ -413,6 +413,18 @@ EAPI void 
elput_input_keyboard_cached_keymap_set(Elput_Manager *manager, void *k
  */
 EAPI Eina_Stringshare *elput_input_device_output_name_get(Elput_Device 
*device);
 
+/**
+ * Set the pointer acceleration profile
+ *
+ * @param manager
+ * @param seat
+ * @param profile
+ *
+ * @ingroup Elput_Input_Group
+ * @since 1.19
+ */
+EAPI void elput_input_pointer_accel_profile_set(Elput_Manager *manager, const 
char *seat, uint32_t profile);
+
 # endif
 
 # undef EAPI
diff --git a/src/lib/elput/elput_input.c b/src/lib/elput/elput_input.c
index daa3675..1dde85a 100644
--- a/src/lib/elput/elput_input.c
+++ b/src/lib/elput/elput_input.c
@@ -638,3 +638,38 @@ elput_input_device_output_name_get(Elput_Device *device)
    if (!device->output_name) return NULL;
    return eina_stringshare_ref(device->output_name);
 }
+
+EAPI void
+elput_input_pointer_accel_profile_set(Elput_Manager *manager, const char 
*seat, uint32_t profile)
+{
+   Elput_Seat *eseat;
+   Elput_Device *edev;
+   Eina_List *l, *ll;
+
+   EINA_SAFETY_ON_NULL_RETURN(manager);
+
+   /* if no seat name is passed in, just use default seat name */
+   if (!seat) seat = "seat0";
+
+   EINA_LIST_FOREACH(manager->input.seats, l, eseat)
+     {
+        if ((eseat->name) && (strcmp(eseat->name, seat)))
+          continue;
+
+        EINA_LIST_FOREACH(eseat->devices, ll, edev)
+          {
+             if (!libinput_device_has_capability(edev->device,
+                                                 LIBINPUT_DEVICE_CAP_POINTER))
+               continue;
+
+             if (libinput_device_config_accel_set_profile(edev->device,
+                                                          profile) !=
+                 LIBINPUT_CONFIG_STATUS_SUCCESS)
+               {
+                  WRN("Failed to set acceleration profile for device: %s",
+                      libinput_device_get_name(edev->device));
+                  continue;
+               }
+          }
+     }
+}

-- 


Reply via email to