return ret;
}
+static Eina_Bool
+_e_input_backend_libinput_event_evdev_process(struct libinput_event *event)
+{
+ E_Input_Evdev *evdev;
+ struct libinput_device *device;
+ Eina_Bool ret = EINA_TRUE;
+
+ device = libinput_event_get_device(event);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(device, EINA_FALSE);
+
+ evdev = libinput_device_get_user_data(device);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(evdev, EINA_FALSE);
+
+ switch (libinput_event_get_type(event))
+ {
+ case LIBINPUT_EVENT_KEYBOARD_KEY:
+ e_input_evdev_handle_key(evdev, libinput_event_get_keyboard_event(event));
+ break;
+ case LIBINPUT_EVENT_POINTER_MOTION:
+ e_input_evdev_handle_pointer_motion(evdev,
+ libinput_event_get_pointer_event(event));
+ break;
+ case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
+ e_input_evdev_handle_pointer_motion_absolute(evdev,
+ libinput_event_get_pointer_event(event));
+ break;
+ case LIBINPUT_EVENT_POINTER_BUTTON:
+ e_input_evdev_handle_button(evdev, libinput_event_get_pointer_event(event));
+ break;
+ case LIBINPUT_EVENT_POINTER_AXIS:
+#if !LIBINPUT_HAVE_SCROLL_VALUE_V120
+ e_input_evdev_handle_axis(evdev, libinput_event_get_pointer_event(event));
+#endif
+ break;
+#if LIBINPUT_HAVE_SCROLL_VALUE_V120
+ case LIBINPUT_EVENT_POINTER_SCROLL_WHEEL:
+ e_input_evdev_handle_axis_v120(evdev, libinput_event_get_pointer_event(event), E_INPUT_EVDEV_AXIS_SOURCE_WHEEL);
+ break;
+ case LIBINPUT_EVENT_POINTER_SCROLL_FINGER:
+ e_input_evdev_handle_axis_v120(evdev, libinput_event_get_pointer_event(event), E_INPUT_EVDEV_AXIS_SOURCE_FINGER);
+ break;
+ case LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS:
+ e_input_evdev_handle_axis_v120(evdev, libinput_event_get_pointer_event(event), E_INPUT_EVDEV_AXIS_SOURCE_CONTINUOUS);
+ break;
+#endif
+ case LIBINPUT_EVENT_TOUCH_DOWN:
+ e_input_evdev_handle_touch_down(evdev, libinput_event_get_touch_event(event));
+ break;
+ case LIBINPUT_EVENT_TOUCH_MOTION:
+ e_input_evdev_handle_touch_motion(evdev,
+ libinput_event_get_touch_event(event));
+ break;
+ case LIBINPUT_EVENT_TOUCH_UP:
+ e_input_evdev_handle_touch_up(evdev, libinput_event_get_touch_event(event));
+ break;
+ case LIBINPUT_EVENT_TOUCH_CANCEL:
+ e_input_evdev_handle_touch_cancel(evdev, libinput_event_get_touch_event(event));
+ break;
+ case LIBINPUT_EVENT_TOUCH_FRAME:
+ e_input_evdev_handle_touch_frame(evdev, libinput_event_get_touch_event(event));
+ break;
+ case LIBINPUT_EVENT_TOUCH_AUX_DATA:
+ e_input_edev_handle_touch_aux_data(evdev, libinput_event_get_touch_aux_data(event));
+ break;
+ default:
+ ret = EINA_FALSE;
+ break;
+ }
+
+ return ret;
+}
+
static void
_input_event_process(struct libinput_event *event)
{
if (_udev_event_process(event)) return;
- if (e_input_evdev_event_process(event)) return;
+ if (_e_input_backend_libinput_event_evdev_process(event)) return;
}
void
free(ev);
}
-static void
-_device_handle_key(struct libinput_device *device, struct libinput_event_keyboard *event)
+EINTERN void
+e_input_evdev_handle_key(E_Input_Evdev *evdev, struct libinput_event_keyboard *event)
{
- E_Input_Evdev *evdev;
E_Input_Backend *input;
uint32_t timestamp;
uint32_t code, nsyms;
const char *device_name = NULL;
Ecore_Device_Subclass device_subclas = ECORE_DEVICE_SUBCLASS_NONE;
- if (!(evdev = libinput_device_get_user_data(device)))
- {
- return;
- }
+ EINA_SAFETY_ON_NULL_RETURN(evdev);
if (!(input = evdev->seat->input))
{
}
}
-static void
-_device_handle_pointer_motion(struct libinput_device *device, struct libinput_event_pointer *event)
+EINTERN void
+e_input_evdev_handle_pointer_motion(E_Input_Evdev *evdev, struct libinput_event_pointer *event)
{
- E_Input_Evdev *evdev;
+ EINA_SAFETY_ON_NULL_RETURN(evdev);
+
double delta_x[2]; /* delta_x[0] for accelerated, delta_x[1] for unaccelerated */
double delta_y[2]; /* delta_y[0] for accelerated, delta_y[1] for unaccelerated */
- if (!(evdev = libinput_device_get_user_data(device)))
- {
- return;
- }
-
delta_x[0] = libinput_event_pointer_get_dx(event);
delta_x[1] = libinput_event_pointer_get_dx_unaccelerated(event);
delta_y[0] = libinput_event_pointer_get_dy(event);
_device_pointer_motion_send(evdev, event, &delta_x[0], &delta_y[0]);
}
-static void
-_device_handle_pointer_motion_absolute(struct libinput_device *device, struct libinput_event_pointer *event)
+EINTERN void
+e_input_evdev_handle_pointer_motion_absolute(E_Input_Evdev *evdev, struct libinput_event_pointer *event)
{
- E_Input_Evdev *evdev;
- int w = 0, h = 0;
E_Output *primary_output;
+ int w = 0, h = 0;
- if (!(evdev = libinput_device_get_user_data(device)))
- {
- return;
- }
+ EINA_SAFETY_ON_NULL_RETURN(evdev);
#ifdef E_DISPLAY
primary_output = e_display_primary_output_get();
#else
primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen);
-#endif
+#endif
e_output_size_get(primary_output, &w, &h);
_device_pointer_motion(evdev, event);
}
-static void
-_device_handle_button(struct libinput_device *device, struct libinput_event_pointer *event)
+EINTERN void
+e_input_evdev_handle_button(E_Input_Evdev *evdev, struct libinput_event_pointer *event)
{
- E_Input_Evdev *evdev;
E_Input_Backend *input;
Ecore_Event_Mouse_Button *ev;
enum libinput_button_state state;
E_Comp_Config *comp_conf = NULL;
const char *device_name = NULL;
- if (!(evdev = libinput_device_get_user_data(device)))
- {
- return;
- }
+ EINA_SAFETY_ON_NULL_RETURN(evdev);
+
if (!(input = evdev->seat->input))
{
return;
return ret;
}
-static void
-_device_handle_axis(struct libinput_device *device, struct libinput_event_pointer *event)
+EINTERN void
+e_input_evdev_handle_axis(E_Input_Evdev *evdev, struct libinput_event_pointer *event)
{
- E_Input_Evdev *evdev;
E_Input_Backend *input;
Ecore_Event_Mouse_Wheel *ev;
uint32_t timestamp;
int direction = 0, z = 0;
const char *device_name = NULL;
- if (!(evdev = libinput_device_get_user_data(device)))
- {
- return;
- }
+ EINA_SAFETY_ON_NULL_RETURN(evdev);
+
if (!(input = evdev->seat->input))
{
return;
{
double value = 0.0;
double value_v120 = 0.0;
- int ret;
+ int ret = 0;
E_Comp_Config *comp_conf = NULL;
comp_conf = e_comp_config_get();
return ret;
}
-static void
-_device_handle_axis_v120(struct libinput_device *device, struct libinput_event_pointer *event, E_Input_Evdev_Axis_Source source)
+EINTERN void
+e_input_evdev_handle_axis_v120(E_Input_Evdev *evdev, struct libinput_event_pointer *event, E_Input_Evdev_Axis_Source source)
{
- E_Input_Evdev *evdev;
E_Input_Backend *input;
Ecore_Event_Mouse_Wheel *ev;
uint32_t timestamp;
int direction = 0, z = 0;
const char *device_name = NULL;
- if (!(evdev = libinput_device_get_user_data(device)))
- {
- return;
- }
+ EINA_SAFETY_ON_NULL_RETURN(evdev);
+
if (!(input = evdev->seat->input))
{
return;
if (h) *h = evdev->mouse.maxh;
}
-static void
-_device_handle_touch_down(struct libinput_device *device, struct libinput_event_touch *event)
+EINTERN void
+e_input_evdev_handle_touch_down(E_Input_Evdev *evdev, struct libinput_event_touch *event)
{
- E_Input_Evdev *evdev;
- int x = 0, y = 0, w = 0, h = 0;
E_Comp_Config *comp_conf = NULL;
+ int x = 0, y = 0, w = 0, h = 0;
- if (!(evdev = libinput_device_get_user_data(device)))
- {
- return;
- }
+ EINA_SAFETY_ON_NULL_RETURN(evdev);
_device_configured_size_get(evdev, &x, &y, &w, &h);
_device_handle_touch_event_send(evdev, event, ECORE_EVENT_MOUSE_BUTTON_DOWN);
}
-static void
-_device_handle_touch_motion(struct libinput_device *device, struct libinput_event_touch *event)
+EINTERN void
+e_input_evdev_handle_touch_motion(E_Input_Evdev *evdev, struct libinput_event_touch *event)
{
- E_Input_Evdev *evdev;
int x = 0, y = 0, w = 0, h = 0;
- if (!(evdev = libinput_device_get_user_data(device)))
- {
- return;
- }
+ EINA_SAFETY_ON_NULL_RETURN(evdev);
_device_configured_size_get(evdev, &x, &y, &w, &h);
_device_handle_touch_motion_send(evdev, event);
}
-static void
-_device_handle_touch_up(struct libinput_device *device, struct libinput_event_touch *event)
+EINTERN void
+e_input_evdev_handle_touch_up(E_Input_Evdev *evdev, struct libinput_event_touch *event)
{
- E_Input_Evdev *evdev;
E_Comp_Config *comp_conf = NULL;
- if (!(evdev = libinput_device_get_user_data(device)))
- {
- return;
- }
+ EINA_SAFETY_ON_NULL_RETURN(evdev);
evdev->mt_slot = libinput_event_touch_get_slot(event);
if (evdev->mt_slot < 0)
_device_handle_touch_event_send(evdev, event, ECORE_EVENT_MOUSE_BUTTON_UP);
}
-static void
-_device_handle_touch_cancel(struct libinput_device *device, struct libinput_event_touch *event)
+EINTERN void
+e_input_evdev_handle_touch_cancel(E_Input_Evdev *evdev, struct libinput_event_touch *event)
{
- E_Input_Evdev *evdev;
E_Comp_Config *comp_conf = NULL;
- if (!(evdev = libinput_device_get_user_data(device)))
- {
- return;
- }
+ EINA_SAFETY_ON_NULL_RETURN(evdev);
evdev->mt_slot = libinput_event_touch_get_slot(event);
if (evdev->mt_slot < 0)
}
-static void
-_device_handle_touch_frame(struct libinput_device *device EINA_UNUSED, struct libinput_event_touch *event EINA_UNUSED)
+EINTERN void
+e_input_evdev_handle_touch_frame(E_Input_Evdev *evdev EINA_UNUSED, struct libinput_event_touch *event EINA_UNUSED)
{
/* DBG("Unhandled Touch Frame Event"); */
}
free(e);
}
-static void
-_device_handle_touch_aux_data(struct libinput_device *device, struct libinput_event_touch_aux_data *event)
+EINTERN void
+e_input_edev_handle_touch_aux_data(E_Input_Evdev *evdev, struct libinput_event_touch_aux_data *event)
{
- E_Input_Evdev *evdev;
E_Input_Backend *input;
Ecore_Event_Axis_Update *ev;
Ecore_Axis *axis;
uint32_t timestamp = 0;
int touch_value;
+ EINA_SAFETY_ON_NULL_RETURN(evdev);
+
if (libinput_event_touch_aux_data_get_type(event) != LIBINPUT_TOUCH_AUX_DATA_TYPE_PALM &&
libinput_event_touch_aux_data_get_value(event) > 0)
return;
- if (!(evdev = libinput_device_get_user_data(device))) return;
if (!(input = evdev->seat->input)) return;
timestamp = libinput_event_touch_aux_data_get_time(event);
return seat->devices;
}
-Eina_Bool
-e_input_evdev_event_process(struct libinput_event *event)
-{
- struct libinput_device *device;
- Eina_Bool ret = EINA_TRUE;
-
- device = libinput_event_get_device(event);
- switch (libinput_event_get_type(event))
- {
- case LIBINPUT_EVENT_KEYBOARD_KEY:
- _device_handle_key(device, libinput_event_get_keyboard_event(event));
- break;
- case LIBINPUT_EVENT_POINTER_MOTION:
- _device_handle_pointer_motion(device,
- libinput_event_get_pointer_event(event));
- break;
- case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
- _device_handle_pointer_motion_absolute(device,
- libinput_event_get_pointer_event(event));
- break;
- case LIBINPUT_EVENT_POINTER_BUTTON:
- _device_handle_button(device, libinput_event_get_pointer_event(event));
- break;
- case LIBINPUT_EVENT_POINTER_AXIS:
-#if !LIBINPUT_HAVE_SCROLL_VALUE_V120
- _device_handle_axis(device, libinput_event_get_pointer_event(event));
-#endif
- break;
-#if LIBINPUT_HAVE_SCROLL_VALUE_V120
- case LIBINPUT_EVENT_POINTER_SCROLL_WHEEL:
- _device_handle_axis_v120(device, libinput_event_get_pointer_event(event), E_INPUT_EVDEV_AXIS_SOURCE_WHEEL);
- break;
- case LIBINPUT_EVENT_POINTER_SCROLL_FINGER:
- _device_handle_axis_v120(device, libinput_event_get_pointer_event(event), E_INPUT_EVDEV_AXIS_SOURCE_FINGER);
- break;
- case LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS:
- _device_handle_axis_v120(device, libinput_event_get_pointer_event(event), E_INPUT_EVDEV_AXIS_SOURCE_CONTINUOUS);
- break;
-#endif
- case LIBINPUT_EVENT_TOUCH_DOWN:
- _device_handle_touch_down(device, libinput_event_get_touch_event(event));
- break;
- case LIBINPUT_EVENT_TOUCH_MOTION:
- _device_handle_touch_motion(device,
- libinput_event_get_touch_event(event));
- break;
- case LIBINPUT_EVENT_TOUCH_UP:
- _device_handle_touch_up(device, libinput_event_get_touch_event(event));
- break;
- case LIBINPUT_EVENT_TOUCH_CANCEL:
- _device_handle_touch_cancel(device, libinput_event_get_touch_event(event));
- break;
- case LIBINPUT_EVENT_TOUCH_FRAME:
- _device_handle_touch_frame(device, libinput_event_get_touch_event(event));
- break;
- case LIBINPUT_EVENT_TOUCH_AUX_DATA:
- _device_handle_touch_aux_data(device, libinput_event_get_touch_aux_data(event));
- break;
- default:
- ret = EINA_FALSE;
- break;
- }
-
- return ret;
-}
-
/**
* @brief Set the axis size of the given device.
*