diff options
Diffstat (limited to 'sway/input.c')
-rw-r--r-- | sway/input.c | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/sway/input.c b/sway/input.c deleted file mode 100644 index 6263f79f..00000000 --- a/sway/input.c +++ /dev/null | |||
@@ -1,69 +0,0 @@ | |||
1 | #define _XOPEN_SOURCE 700 | ||
2 | #include <ctype.h> | ||
3 | #include <float.h> | ||
4 | #include <limits.h> | ||
5 | #include <stdio.h> | ||
6 | #include <string.h> | ||
7 | #include <libinput.h> | ||
8 | #include "sway/config.h" | ||
9 | #include "sway/input.h" | ||
10 | #include "list.h" | ||
11 | #include "log.h" | ||
12 | |||
13 | struct input_config *new_input_config(const char* identifier) { | ||
14 | struct input_config *input = calloc(1, sizeof(struct input_config)); | ||
15 | if (!input) { | ||
16 | sway_log(L_DEBUG, "Unable to allocate input config"); | ||
17 | return NULL; | ||
18 | } | ||
19 | sway_log(L_DEBUG, "new_input_config(%s)", identifier); | ||
20 | if (!(input->identifier = strdup(identifier))) { | ||
21 | free(input); | ||
22 | sway_log(L_DEBUG, "Unable to allocate input config"); | ||
23 | return NULL; | ||
24 | } | ||
25 | |||
26 | input->tap = INT_MIN; | ||
27 | input->drag_lock = INT_MIN; | ||
28 | input->dwt = INT_MIN; | ||
29 | input->send_events = INT_MIN; | ||
30 | input->click_method = INT_MIN; | ||
31 | input->middle_emulation = INT_MIN; | ||
32 | input->natural_scroll = INT_MIN; | ||
33 | input->accel_profile = INT_MIN; | ||
34 | input->pointer_accel = FLT_MIN; | ||
35 | input->scroll_method = INT_MIN; | ||
36 | input->left_handed = INT_MIN; | ||
37 | |||
38 | return input; | ||
39 | } | ||
40 | |||
41 | char *libinput_dev_unique_id(struct libinput_device *device) { | ||
42 | int vendor = libinput_device_get_id_vendor(device); | ||
43 | int product = libinput_device_get_id_product(device); | ||
44 | char *name = strdup(libinput_device_get_name(device)); | ||
45 | |||
46 | char *p = name; | ||
47 | for (; *p; ++p) { | ||
48 | if (*p == ' ') { | ||
49 | *p = '_'; | ||
50 | } | ||
51 | } | ||
52 | |||
53 | sway_log(L_DEBUG, "rewritten name %s", name); | ||
54 | |||
55 | int len = strlen(name) + sizeof(char) * 6; | ||
56 | char *identifier = malloc(len); | ||
57 | if (!identifier) { | ||
58 | sway_log(L_ERROR, "Unable to allocate unique input device name"); | ||
59 | return NULL; | ||
60 | } | ||
61 | |||
62 | const char *fmt = "%d:%d:%s"; | ||
63 | snprintf(identifier, len, fmt, vendor, product, name); | ||
64 | free(name); | ||
65 | return identifier; | ||
66 | } | ||
67 | |||
68 | list_t *input_devices = NULL; | ||
69 | struct input_config *current_input_config = NULL; | ||