From: SooChan Lim Date: Tue, 14 May 2024 00:45:15 +0000 (+0900) Subject: e_input_evdev: make e_input_evdev_intern header file X-Git-Tag: accepted/tizen/unified/20240517.164220~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F32%2F311132%2F1;p=platform%2Fupstream%2Fenlightenment.git e_input_evdev: make e_input_evdev_intern header file e_input_evdev_intern header provides the information and functionalities of the E_Input_Evdev resource. Change-Id: I247ae2e49b5788a1c0e984b1a69bbb567de5fd4d --- diff --git a/src/bin/inputmgr/e_devicemgr_inputgen.c b/src/bin/inputmgr/e_devicemgr_inputgen.c index c47ada7..08c427a 100644 --- a/src/bin/inputmgr/e_devicemgr_inputgen.c +++ b/src/bin/inputmgr/e_devicemgr_inputgen.c @@ -1,6 +1,6 @@ #include "e_devicemgr_intern.h" #include "e_keyrouter_intern.h" -#include "e_input_intern.h" +#include "e_input_evdev_intern.h" #include "e_comp_wl_input_intern.h" #include "e_utils_intern.h" #include "e_comp_input_intern.h" @@ -138,12 +138,12 @@ e_devicemgr_inputgen_key_event_add(const char *key, Eina_Bool pressed, char *ide if (e_input_thread_mode_get()) { - dev = e_input_evdev_get_e_device(identifier, ECORE_DEVICE_CLASS_KEYBOARD); + dev = e_input_evdev_e_device_get(identifier, ECORE_DEVICE_CLASS_KEYBOARD); e->dev = (Eo *)g_object_ref(dev); } else { - e->dev = ecore_device_ref(e_input_evdev_get_ecore_device(identifier, ECORE_DEVICE_CLASS_KEYBOARD)); + e->dev = ecore_device_ref(e_input_evdev_ecore_device_get(identifier, ECORE_DEVICE_CLASS_KEYBOARD)); } DMDBG("Generate key event: key: %s, keycode: %d, iden: %s\n", e->key, e->keycode, identifier); @@ -207,7 +207,7 @@ _e_devicemgr_inputgen_mouse_button_event(Eina_Bool state, int x, int y, int butt e->multi.root.y = e->y; ecore_thread_main_loop_begin(); - e->dev = ecore_device_ref(e_input_evdev_get_ecore_device(identifier, ECORE_DEVICE_CLASS_MOUSE)); + e->dev = ecore_device_ref(e_input_evdev_ecore_device_get(identifier, ECORE_DEVICE_CLASS_MOUSE)); e->buttons = buttons; DMDBG("Generate mouse button event: button: %d (state: %d)\n", buttons, state); @@ -264,7 +264,7 @@ _e_devicemgr_inputgen_mouse_move_event(int x, int y, char *identifier) e->multi.root.y = e->y; ecore_thread_main_loop_begin(); - e->dev = ecore_device_ref(e_input_evdev_get_ecore_device(identifier, ECORE_DEVICE_CLASS_MOUSE)); + e->dev = ecore_device_ref(e_input_evdev_ecore_device_get(identifier, ECORE_DEVICE_CLASS_MOUSE)); DMDBG("Generate mouse move event: (%d, %d)\n", e->x, e->y); @@ -317,7 +317,7 @@ _e_devicemgr_inputgen_mouse_wheel_event(unsigned int type, int value, E_Devicemg { if (!e_devicemgr_detent_is_detent(device->name)) clas = device->clas; - e->dev = ecore_device_ref(e_input_evdev_get_ecore_device(device->identifier, clas)); + e->dev = ecore_device_ref(e_input_evdev_ecore_device_get(device->identifier, clas)); } DMDBG("Generate mouse wheel event: direction: %s, value: %d\n", e->direction?"HWHEEL":"WHEEL", e->z); @@ -450,7 +450,7 @@ _e_devicemgr_inputgen_touch_event(uint32_t type, uint32_t x, uint32_t y, uint32_ e->multi.root.y = e->y; ecore_thread_main_loop_begin(); - e->dev = ecore_device_ref(e_input_evdev_get_ecore_device(device?device->identifier:NULL, ECORE_DEVICE_CLASS_TOUCH)); + e->dev = ecore_device_ref(e_input_evdev_ecore_device_get(device?device->identifier:NULL, ECORE_DEVICE_CLASS_TOUCH)); e->buttons = 1; DMDBG("Generate touch event: device: %d (%d, %d)\n", e->multi.device, e->x, e->y); @@ -512,7 +512,7 @@ _e_devicemgr_inputgen_touch_update_event(uint32_t x, uint32_t y, uint32_t finger ecore_thread_main_loop_begin(); - e->dev = ecore_device_ref(e_input_evdev_get_ecore_device(device?device->identifier:NULL, ECORE_DEVICE_CLASS_TOUCH)); + e->dev = ecore_device_ref(e_input_evdev_ecore_device_get(device?device->identifier:NULL, ECORE_DEVICE_CLASS_TOUCH)); DMDBG("Generate touch move event: device: %d (%d, %d)\n", e->multi.device, e->x, e->y); diff --git a/src/bin/inputmgr/e_input_device.c b/src/bin/inputmgr/e_input_device.c index b7c33ab..ad7a61f 100644 --- a/src/bin/inputmgr/e_input_device.c +++ b/src/bin/inputmgr/e_input_device.c @@ -1,6 +1,7 @@ #include "e_input_device_intern.h" #include "e_input_log.h" #include "e_input_intern.h" +#include "e_input_evdev_intern.h" #include "e_comp_screen_intern.h" #include "e_output_intern.h" #include "e_utils_intern.h" @@ -172,7 +173,7 @@ e_input_device_destroy(E_Input_Device *dev) { libinput_device_config_send_events_set_mode(edev->device, LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); - _e_input_evdev_device_destroy(edev); + e_input_evdev_device_destroy(edev); } if (seat->name) @@ -371,7 +372,7 @@ e_input_device_pointer_warp(E_Input_Device *dev, int x, int y) seat->ptr.dx = seat->ptr.ix = x; seat->ptr.dy = seat->ptr.iy = y; - _e_input_pointer_motion_post(warp_dev); + e_input_evdev_pointer_motion_post(warp_dev); } found = EINA_TRUE; } @@ -1232,7 +1233,7 @@ e_input_device_output_changed(E_Input_Device *dev) { EINA_LIST_FOREACH(e_input_seat_evdev_list_get(seat), l2, edev) { - _device_calibration_set(edev); + e_input_evdev_device_calibration_set(edev); } } } @@ -1546,7 +1547,7 @@ e_input_device_subtype_set(E_Input_Device *dev, const char *input, const char *s //right now, subclas is only used with keyboard type. if (!e_input_thread_mode_get()) { - ecore_dev = e_input_evdev_get_ecore_device(input, ECORE_DEVICE_CLASS_KEYBOARD); + ecore_dev = e_input_evdev_ecore_device_get(input, ECORE_DEVICE_CLASS_KEYBOARD); if (!ecore_dev) { ERR("Failed to find input device: %s", input); @@ -1577,7 +1578,7 @@ e_input_device_subtype_set(E_Input_Device *dev, const char *input, const char *s } else { - e_dev = e_input_evdev_get_e_device(input, ECORE_DEVICE_CLASS_KEYBOARD); + e_dev = e_input_evdev_e_device_get(input, ECORE_DEVICE_CLASS_KEYBOARD); if (!e_dev) { ERR("Failed to find input device: %s", input); @@ -1708,7 +1709,7 @@ e_input_device_is_virtual(E_Input_Device *dev, const char *device_path, Ecore_De if (!e_input_thread_mode_get()) { - ecore_dev = e_input_evdev_get_ecore_device(device_path, clas); + ecore_dev = e_input_evdev_ecore_device_get(device_path, clas); if (!ecore_dev) { ERR("Failed to find input device: %s", device_path); @@ -1718,7 +1719,7 @@ e_input_device_is_virtual(E_Input_Device *dev, const char *device_path, Ecore_De } else { - e_dev = e_input_evdev_get_e_device(device_path, clas); + e_dev = e_input_evdev_e_device_get(device_path, clas); if (!e_dev) { ERR("Failed to find input device: %s", device_path); diff --git a/src/bin/inputmgr/e_input_evdev.c b/src/bin/inputmgr/e_input_evdev.c index 4536e40..71a703b 100644 --- a/src/bin/inputmgr/e_input_evdev.c +++ b/src/bin/inputmgr/e_input_evdev.c @@ -1,4 +1,4 @@ -#include "e_input_intern.h" +#include "e_input_evdev_intern.h" #include "e_input_log.h" #include "e_input_device_intern.h" #include "e_input_event.h" @@ -13,13 +13,15 @@ #include #define G_LIST_GET_DATA(list) ((list) ? (((GList *)(list))->data) : NULL) +#define E_INPUT_POINTER_AXIS_DISCRETE_STEP 120 +#define E_INPUT_FINGER_SCROLL_THRESHOLD 1 static void _device_modifiers_update(E_Input_Evdev *edev); static void _device_configured_size_get(E_Input_Evdev *edev, int *x, int *y, int *w, int *h); static void _device_output_assign(E_Input_Evdev *edev, E_Input_Seat_Capabilities cap); void -_device_calibration_set(E_Input_Evdev *edev) +e_input_evdev_device_calibration_set(E_Input_Evdev *edev) { E_Output *output; int w = 0, h = 0; @@ -202,7 +204,7 @@ _device_configure(E_Input_Evdev *edev) libinput_device_config_tap_set_enabled(edev->device, tap); } - _device_calibration_set(edev); + e_input_evdev_device_calibration_set(edev); } static void @@ -395,7 +397,7 @@ _device_remapped_key_get(E_Input_Evdev *edev, int code) } EINTERN E_Device * -e_input_evdev_get_e_device(const char *path, Ecore_Device_Class clas) +e_input_evdev_e_device_get(const char *path, Ecore_Device_Class clas) { const GList *dev_list = NULL; const GList *l; @@ -424,7 +426,7 @@ e_input_evdev_get_e_device(const char *path, Ecore_Device_Class clas) } EINTERN Ecore_Device * -e_input_evdev_get_ecore_device(const char *path, Ecore_Device_Class clas) +e_input_evdev_ecore_device_get(const char *path, Ecore_Device_Class clas) { const Eina_List *dev_list = NULL; const Eina_List *l; @@ -556,7 +558,7 @@ _device_handle_key(struct libinput_device *device, struct libinput_event_keyboar } else { - edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_KEYBOARD); + edev->ecore_dev = e_input_evdev_ecore_device_get(edev->path, ECORE_DEVICE_CLASS_KEYBOARD); ecore_dev = edev->ecore_dev; } @@ -589,7 +591,7 @@ _device_handle_key(struct libinput_device *device, struct libinput_event_keyboar } else { - edev->e_dev = e_input_evdev_get_e_device(edev->path, ECORE_DEVICE_CLASS_KEYBOARD); + edev->e_dev = e_input_evdev_e_device_get(edev->path, ECORE_DEVICE_CLASS_KEYBOARD); e_dev = edev->e_dev; } @@ -841,7 +843,7 @@ _device_pointer_motion(E_Input_Evdev *edev, struct libinput_event_pointer *event } else { - edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_MOUSE); + edev->ecore_dev = e_input_evdev_ecore_device_get(edev->path, ECORE_DEVICE_CLASS_MOUSE); ecore_dev = edev->ecore_dev; } @@ -917,7 +919,7 @@ end: } void -_e_input_pointer_motion_post(E_Input_Evdev *edev) +e_input_evdev_pointer_motion_post(E_Input_Evdev *edev) { _device_pointer_motion(edev, NULL); } @@ -957,7 +959,7 @@ _device_pointer_relative_motion(E_Input_Evdev *edev, struct libinput_event_point } else { - edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_MOUSE); + edev->ecore_dev = e_input_evdev_ecore_device_get(edev->path, ECORE_DEVICE_CLASS_MOUSE); ecore_dev = edev->ecore_dev; } @@ -1157,7 +1159,7 @@ _device_handle_button(struct libinput_device *device, struct libinput_event_poin } else { - edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_MOUSE); + edev->ecore_dev = e_input_evdev_ecore_device_get(edev->path, ECORE_DEVICE_CLASS_MOUSE); ecore_dev = edev->ecore_dev; } @@ -1373,7 +1375,7 @@ _device_handle_axis(struct libinput_device *device, struct libinput_event_pointe } else { - edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_MOUSE); + edev->ecore_dev = e_input_evdev_ecore_device_get(edev->path, ECORE_DEVICE_CLASS_MOUSE); ecore_dev = edev->ecore_dev; } @@ -1463,7 +1465,7 @@ end: #if LIBINPUT_HAVE_SCROLL_VALUE_V120 static int -_scroll_value_get(struct libinput_event_pointer *pointer_event, enum libinput_pointer_axis axis, E_Input_Axis_Source source) +_scroll_value_get(struct libinput_event_pointer *pointer_event, enum libinput_pointer_axis axis, E_Input_Evdev_Axis_Source source) { double value = 0.0; double value_v120 = 0.0; @@ -1473,7 +1475,7 @@ _scroll_value_get(struct libinput_event_pointer *pointer_event, enum libinput_po comp_conf = e_comp_config_get(); switch (source) { - case E_INPUT_AXIS_SOURCE_WHEEL: + case E_INPUT_EVDEV_AXIS_SOURCE_WHEEL: value_v120 = libinput_event_pointer_get_scroll_value_v120(pointer_event, axis); value = libinput_event_pointer_get_scroll_value(pointer_event, axis); if (comp_conf && comp_conf->input_log_enable) @@ -1490,8 +1492,8 @@ _scroll_value_get(struct libinput_event_pointer *pointer_event, enum libinput_po ret = value_v120 / E_INPUT_POINTER_AXIS_DISCRETE_STEP; } break; - case E_INPUT_AXIS_SOURCE_FINGER: - case E_INPUT_AXIS_SOURCE_CONTINUOUS: + case E_INPUT_EVDEV_AXIS_SOURCE_FINGER: + case E_INPUT_EVDEV_AXIS_SOURCE_CONTINUOUS: value = libinput_event_pointer_get_scroll_value(pointer_event, axis); if (comp_conf && comp_conf->input_log_enable) { @@ -1512,7 +1514,7 @@ _scroll_value_get(struct libinput_event_pointer *pointer_event, enum libinput_po } static void -_device_handle_axis_v120(struct libinput_device *device, struct libinput_event_pointer *event, E_Input_Axis_Source source) +_device_handle_axis_v120(struct libinput_device *device, struct libinput_event_pointer *event, E_Input_Evdev_Axis_Source source) { E_Input_Evdev *edev; E_Input_Backend *input; @@ -1557,7 +1559,7 @@ _device_handle_axis_v120(struct libinput_device *device, struct libinput_event_p } else { - edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_MOUSE); + edev->ecore_dev = e_input_evdev_ecore_device_get(edev->path, ECORE_DEVICE_CLASS_MOUSE); ecore_dev = edev->ecore_dev; } @@ -1671,7 +1673,7 @@ _device_handle_touch_event_send(E_Input_Evdev *edev, struct libinput_event_touch } else { - edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_TOUCH); + edev->ecore_dev = e_input_evdev_ecore_device_get(edev->path, ECORE_DEVICE_CLASS_TOUCH); ecore_dev = edev->ecore_dev; } @@ -1798,7 +1800,7 @@ _device_handle_touch_motion_send(E_Input_Evdev *edev, struct libinput_event_touc } else { - edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_TOUCH); + edev->ecore_dev = e_input_evdev_ecore_device_get(edev->path, ECORE_DEVICE_CLASS_TOUCH); ecore_dev = edev->ecore_dev; } @@ -1880,7 +1882,7 @@ _device_handle_touch_cancel_send(E_Input_Evdev *edev, struct libinput_event_touc } else { - edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_TOUCH); + edev->ecore_dev = e_input_evdev_ecore_device_get(edev->path, ECORE_DEVICE_CLASS_TOUCH); ecore_dev = edev->ecore_dev; } @@ -2238,7 +2240,7 @@ _device_handle_touch_aux_data(struct libinput_device *device, struct libinput_ev } else { - edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_TOUCH); + edev->ecore_dev = e_input_evdev_ecore_device_get(edev->path, ECORE_DEVICE_CLASS_TOUCH); ecore_dev = edev->ecore_dev; } @@ -2277,7 +2279,7 @@ end: } E_Input_Evdev * -_e_input_evdev_device_create(E_Input_Seat *seat, struct libinput_device *device) +e_input_evdev_device_create(E_Input_Seat *seat, struct libinput_device *device) { E_Input_Evdev *edev; E_Input_Backend *b_input; @@ -2352,7 +2354,7 @@ _e_input_evdev_device_create(E_Input_Seat *seat, struct libinput_device *device) } void -_e_input_evdev_device_destroy(E_Input_Evdev *edev) +e_input_evdev_device_destroy(E_Input_Evdev *edev) { Ecore_Device *dev; EINA_SAFETY_ON_NULL_RETURN(edev); @@ -2401,8 +2403,15 @@ _e_input_evdev_device_destroy(E_Input_Evdev *edev) free(edev); } +EINTERN Eina_List * +e_input_seat_evdev_list_get(E_Input_Seat *seat) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(seat, NULL); + return seat->devices; +} + Eina_Bool -_e_input_evdev_event_process(struct libinput_event *event) +e_input_evdev_event_process(struct libinput_event *event) { struct libinput_device *device; Eina_Bool ret = EINA_TRUE; @@ -2431,13 +2440,13 @@ _e_input_evdev_event_process(struct libinput_event *event) 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_AXIS_SOURCE_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_AXIS_SOURCE_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_AXIS_SOURCE_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: @@ -2598,7 +2607,7 @@ e_input_evdev_key_remap_set(E_Input_Evdev *edev, int *from_keys, int *to_keys, i } EINTERN int -e_input_evdev_wheel_click_angle_get(E_Input_Evdev *dev) +e_input_evdev_mouse_wheel_click_angle_get(E_Input_Evdev *dev) { EINA_SAFETY_ON_NULL_RETURN_VAL(dev, -1); return libinput_device_config_scroll_get_wheel_click_angle(dev->device); diff --git a/src/bin/inputmgr/e_input_evdev_intern.h b/src/bin/inputmgr/e_input_evdev_intern.h new file mode 100644 index 0000000..fac13a6 --- /dev/null +++ b/src/bin/inputmgr/e_input_evdev_intern.h @@ -0,0 +1,144 @@ +#ifndef E_INPUT_EVDEV_INTERN_H +#define E_INPUT_EVDEV_INTERN_H + +#include "e_intern.h" +#include "e_input_intern.h" + +typedef struct _E_Input_Evdev E_Input_Evdev; +typedef struct _E_Input_Seat E_Input_Seat; +typedef struct _E_Input_Coord E_Input_Coord; + +typedef enum _E_Input_Evdev_Axis_Source { + E_INPUT_EVDEV_AXIS_SOURCE_WHEEL = 1, + E_INPUT_EVDEV_AXIS_SOURCE_FINGER, + E_INPUT_EVDEV_AXIS_SOURCE_CONTINUOUS, +} E_Input_Evdev_Axis_Source; + +struct _E_Input_Evdev +{ + E_Input_Seat *seat; + struct libinput_device *device; + + const char *path; + Ecore_Device *ecore_dev; + Eina_List *ecore_dev_list; + E_Device *e_dev; + GList *e_dev_list; + + int mt_slot; + + struct + { + int minx, miny, maxw, maxh; + double dx, dy; + unsigned int last, prev; + uint32_t threshold; + Eina_Bool did_double : 1; + Eina_Bool did_triple : 1; + uint32_t prev_button, last_button; + unsigned int pressed_button; + } mouse; + + struct + { + struct xkb_keymap *keymap; + struct xkb_state *state; + xkb_mod_mask_t ctrl_mask; + xkb_mod_mask_t alt_mask; + xkb_mod_mask_t shift_mask; + xkb_mod_mask_t win_mask; + xkb_mod_mask_t scroll_mask; + xkb_mod_mask_t num_mask; + xkb_mod_mask_t caps_mask; + xkb_mod_mask_t altgr_mask; + unsigned int modifiers; + unsigned int depressed, latched, locked, group; + + Eina_List *pressed_keys; + EINA_DEPRECATED GMutex keymap_mutex; + EINA_DEPRECATED GMutex state_mutex; + } xkb; + + Eina_Hash *key_remap_hash; + Eina_Bool key_remap_enabled; + + E_Input_Seat_Capabilities caps; + + struct + { + struct + { + int rotation; + int x, y; + int w, h; + } transform; + + E_Input_Coord *coords; + unsigned int pressed; + atomic_uint raw_pressed; + atomic_bool blocked; + } touch; + + const char *output_name; + Eina_Bool output_configured; + + Eina_Bool disable_acceleration; +}; + +struct _E_Input_Seat +{ + const char *name; + E_Input_Backend *input; + E_Input_Device *dev; + Eina_List *devices; + struct libinput_seat *seat; + Ecore_Device *ecore_dev; + + struct + { + int ix, iy; + double dx, dy; + Eina_Bool swap; + Eina_Bool invert_x; + Eina_Bool invert_y; + } ptr; + + E_Device *e_dev; +}; + +struct _E_Input_Coord +{ + int x; + int y; +}; + + +EINTERN E_Input_Evdev *e_input_evdev_device_create(E_Input_Seat *seat, struct libinput_device *device); +EINTERN void e_input_evdev_device_destroy(E_Input_Evdev *evdev); + +EINTERN Eina_List *e_input_seat_evdev_list_get(E_Input_Seat *seat); + +EINTERN const char *e_input_evdev_name_get(E_Input_Evdev *evdev); +EINTERN const char *e_input_evdev_sysname_get(E_Input_Evdev *evdev); +EINTERN Ecore_Device *e_input_evdev_ecore_device_get(const char *path, Ecore_Device_Class clas); +EINTERN E_Device *e_input_evdev_e_device_get(const char *path, Ecore_Device_Class clas); +EINTERN void e_input_evdev_axis_size_set(E_Input_Evdev *edev, int w, int h); + +EINTERN void e_input_evdev_pointer_motion_post(E_Input_Evdev *edev); +EINTERN void e_input_evdev_device_calibration_set(E_Input_Evdev *edev); +EINTERN Eina_Bool e_input_evdev_event_process(struct libinput_event *event); + +EINTERN Eina_Bool e_input_evdev_key_remap_enable(E_Input_Evdev *edev, Eina_Bool enable); +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_mouse_accel_speed_set(E_Input_Evdev *edev, double speed); +EINTERN int e_input_evdev_mouse_wheel_click_angle_get(E_Input_Evdev *dev); + +EINTERN Eina_Bool e_input_evdev_touch_calibration_set(E_Input_Evdev *edev, float matrix[6]); +EINTERN unsigned int e_input_evdev_touch_pressed_get(E_Input_Evdev *edev); + +EINTERN const char *e_input_evdev_seatname_get(E_Input_Evdev *evdev); +EINTERN Eina_Bool e_input_evdev_seatname_set(E_Input_Evdev *evdev, const char *seatname); + + +#endif diff --git a/src/bin/inputmgr/e_input_inputs.c b/src/bin/inputmgr/e_input_inputs.c index 2172a9c..7513956 100644 --- a/src/bin/inputmgr/e_input_inputs.c +++ b/src/bin/inputmgr/e_input_inputs.c @@ -1,6 +1,7 @@ #include "e_devicemgr_intern.h" #include "e_input_intern.h" #include "e_input_log.h" +#include "e_input_evdev_intern.h" #include "e_input_device_intern.h" #include "e_input_event_intern.h" #include "e_keyrouter_intern.h" @@ -573,7 +574,7 @@ _device_added(E_Input_Backend *input, struct libinput_device *device) } /* try to create a new evdev device */ - if (!(edev = _e_input_evdev_device_create(seat, device))) + if (!(edev = e_input_evdev_device_create(seat, device))) { ERR("Failed to create new evdev device"); ecore_thread_main_loop_end(); @@ -613,7 +614,7 @@ _device_removed(E_Input_Backend *input, struct libinput_device *device) edev->seat->devices = eina_list_remove(edev->seat->devices, edev); /* destroy this evdev */ - _e_input_evdev_device_destroy(edev); + e_input_evdev_device_destroy(edev); ecore_thread_main_loop_end(); } @@ -673,7 +674,7 @@ 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_evdev_event_process(event)) return; } void @@ -1148,13 +1149,6 @@ e_input_disable_input(E_Input_Backend *input) } } -EINTERN Eina_List * -e_input_seat_evdev_list_get(E_Input_Seat *seat) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(seat, NULL); - return seat->devices; -} - E_API E_Input_Event_Source * e_input_event_source_get() { diff --git a/src/bin/inputmgr/e_input_intern.h b/src/bin/inputmgr/e_input_intern.h index 77737d4..33bbd09 100644 --- a/src/bin/inputmgr/e_input_intern.h +++ b/src/bin/inputmgr/e_input_intern.h @@ -7,25 +7,13 @@ #include -#define E_INPUT_POINTER_AXIS_DISCRETE_STEP 120 -#define E_INPUT_FINGER_SCROLL_THRESHOLD 1 - typedef struct _E_Input E_Input; typedef struct _E_Input_Backend E_Input_Backend; -typedef struct _E_Input_Evdev E_Input_Evdev; -typedef struct _E_Input_Seat E_Input_Seat; -typedef struct _E_Input_Coord E_Input_Coord; typedef void (*e_input_relative_motion_cb)(double dx[2], double dy[2], uint64_t time_us); typedef void (*e_input_keyboard_grab_key_cb)(uint32_t keycode, uint32_t state, uint32_t timestamp, void *dev); typedef void (*E_Input_Thread_Safe_Call_Cb)(void *data); -typedef enum _E_Input_Axis_Source { - E_INPUT_AXIS_SOURCE_WHEEL = 1, - E_INPUT_AXIS_SOURCE_FINGER, - E_INPUT_AXIS_SOURCE_CONTINUOUS, -} E_Input_Axis_Source; - typedef struct { E_Input_Thread_Safe_Call_Cb safe_call_cb; unsigned int data_length; @@ -46,33 +34,6 @@ struct _E_Input e_input_keyboard_grab_key_cb keyboard_grab_key_handler; }; -struct _E_Input_Coord -{ - int x; - int y; -}; - -struct _E_Input_Seat -{ - const char *name; - E_Input_Backend *input; - E_Input_Device *dev; - Eina_List *devices; - struct libinput_seat *seat; - Ecore_Device *ecore_dev; - - struct - { - int ix, iy; - double dx, dy; - Eina_Bool swap; - Eina_Bool invert_x; - Eina_Bool invert_y; - } ptr; - - E_Device *e_dev; -}; - struct _E_Input_Backend { int fd; @@ -100,77 +61,6 @@ struct _E_Input_Backend int main_to_input_thread_pipe_fd[2]; }; -struct _E_Input_Evdev -{ - E_Input_Seat *seat; - struct libinput_device *device; - - const char *path; - Ecore_Device *ecore_dev; - Eina_List *ecore_dev_list; - E_Device *e_dev; - GList *e_dev_list; - - int mt_slot; - - struct - { - int minx, miny, maxw, maxh; - double dx, dy; - unsigned int last, prev; - uint32_t threshold; - Eina_Bool did_double : 1; - Eina_Bool did_triple : 1; - uint32_t prev_button, last_button; - unsigned int pressed_button; - } mouse; - - struct - { - struct xkb_keymap *keymap; - struct xkb_state *state; - xkb_mod_mask_t ctrl_mask; - xkb_mod_mask_t alt_mask; - xkb_mod_mask_t shift_mask; - xkb_mod_mask_t win_mask; - xkb_mod_mask_t scroll_mask; - xkb_mod_mask_t num_mask; - xkb_mod_mask_t caps_mask; - xkb_mod_mask_t altgr_mask; - unsigned int modifiers; - unsigned int depressed, latched, locked, group; - - Eina_List *pressed_keys; - EINA_DEPRECATED GMutex keymap_mutex; - EINA_DEPRECATED GMutex state_mutex; - } xkb; - - Eina_Hash *key_remap_hash; - Eina_Bool key_remap_enabled; - - E_Input_Seat_Capabilities caps; - - struct - { - struct - { - int rotation; - int x, y; - int w, h; - } transform; - - E_Input_Coord *coords; - unsigned int pressed; - atomic_uint raw_pressed; - atomic_bool blocked; - } touch; - - const char *output_name; - Eina_Bool output_configured; - - Eina_Bool disable_acceleration; -}; - struct _E_Input_Hook { EINA_INLIST; @@ -195,18 +85,6 @@ EINTERN Ecore_Evas *e_input_ecore_evas_get(E_Input *ei); EINTERN Eina_Bool e_input_enable_input(E_Input_Backend *input); EINTERN void e_input_disable_input(E_Input_Backend *input); -EINTERN void e_input_evdev_axis_size_set(E_Input_Evdev *edev, int w, int h); -EINTERN const char *e_input_evdev_sysname_get(E_Input_Evdev *evdev); -EINTERN Eina_Bool e_input_evdev_key_remap_enable(E_Input_Evdev *edev, Eina_Bool enable); -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 unsigned int e_input_evdev_touch_pressed_get(E_Input_Evdev *edev); -EINTERN const char *e_input_evdev_name_get(E_Input_Evdev *evdev); -EINTERN int e_input_evdev_wheel_click_angle_get(E_Input_Evdev *dev); -EINTERN Ecore_Device *e_input_evdev_get_ecore_device(const char *path, Ecore_Device_Class clas); -EINTERN E_Device *e_input_evdev_get_e_device(const char *path, Ecore_Device_Class clas); - EINTERN Eina_Bool e_input_relative_motion_handler_set(e_input_relative_motion_cb handler); EINTERN e_input_relative_motion_cb e_input_relative_motion_handler_get(void); @@ -216,8 +94,6 @@ EINTERN e_input_keyboard_grab_key_cb e_input_keyboard_grab_key_handler_get(void) EINTERN void e_input_touch_max_count_set(unsigned int max_count); -EINTERN Eina_List *e_input_seat_evdev_list_get(E_Input_Seat *seat); - EINTERN void e_input_create_event_source(E_Input_Backend *input); EINTERN void e_input_flush_keyboard_share_events(void); EINTERN void e_input_main_thread_id_set(pid_t tid); @@ -235,15 +111,6 @@ EINTERN void e_input_thread_shutdown(); EINTERN Eina_Bool e_input_libinput_context_create(E_Input_Backend *input); EINTERN void _input_events_process(E_Input_Backend *input); -EINTERN E_Input_Evdev *_e_input_evdev_device_create(E_Input_Seat *seat, struct libinput_device *device); - -EINTERN Eina_Bool _e_input_evdev_event_process(struct libinput_event *event); -EINTERN void _e_input_evdev_device_destroy(E_Input_Evdev *evdev); -EINTERN const char *e_input_evdev_seatname_get(E_Input_Evdev *evdev); -EINTERN Eina_Bool e_input_evdev_seatname_set(E_Input_Evdev *evdev, const char *seatname); -EINTERN void _device_calibration_set(E_Input_Evdev *edev); -EINTERN void _e_input_pointer_motion_post(E_Input_Evdev *edev); - EINTERN void _e_input_hook_call(E_Input_Hook_Point hookpoint, const char *device_name); EINTERN void _e_input_key_event_list_add(Ecore_Event_Key *key);