From fa5abb2967ca1a14770c5270b13200412a0fd345 Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Tue, 10 May 2016 15:12:53 -0400 Subject: [PATCH] elput: Add API function to set max allowed pointer position This patch adds an API function that can be used to restrict mouse movement from going outside a screen @feature Signed-off-by: Chris Michael --- src/lib/elput/Elput.h | 12 ++++++++++++ src/lib/elput/elput_input.c | 17 +++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/src/lib/elput/Elput.h b/src/lib/elput/Elput.h index 87d3462..dfddf78 100644 --- a/src/lib/elput/Elput.h +++ b/src/lib/elput/Elput.h @@ -298,6 +298,18 @@ EAPI void elput_input_pointer_xy_set(Elput_Manager *manager, const char *seat, i EAPI const Eina_List *elput_input_devices_get(Elput_Seat *seat); /** + * Set the maximum position of any existing mouse pointers + * + * @param manager + * @param maxw + * @param maxh + * + * @ingroup Elput_Input_Group + * @since 1.18 + */ +EAPI void elput_input_pointer_max_set(Elput_Manager *manager, int maxw, int maxh); + +/** * @defgroup Elput_Device_Group * * Functions that deal with input devices. diff --git a/src/lib/elput/elput_input.c b/src/lib/elput/elput_input.c index f90b4ed..2dd5607 100644 --- a/src/lib/elput/elput_input.c +++ b/src/lib/elput/elput_input.c @@ -338,3 +338,20 @@ elput_input_devices_get(Elput_Seat *seat) EINA_SAFETY_ON_NULL_RETURN_VAL(seat, NULL); return seat->devices; } + +EAPI void +elput_input_pointer_max_set(Elput_Manager *manager, int maxw, int maxh) +{ + Eina_List *l; + Elput_Seat *eseat; + + EINA_SAFETY_ON_NULL_RETURN(manager); + + EINA_LIST_FOREACH(manager->input.seats, l, eseat) + { + if (!eseat->ptr) continue; + + eseat->ptr->maxw = maxw; + eseat->ptr->maxh = maxh; + } +} -- 2.7.4