diff options
author | Markus Ongyerth <ongy@ongy.net> | 2018-05-15 16:16:19 +0200 |
---|---|---|
committer | Markus Ongyerth <ongy@ongy.net> | 2018-07-14 09:43:17 +0200 |
commit | 0c9a26828a764ec2648fa1f72178d5df4dd7b36b (patch) | |
tree | 8f206642c0b068dc6b06ae8f71570e3dd4f17bd4 /backend | |
parent | adba68a3c1fb51771342512f570c552a7404cc93 (diff) |
Use wlr_list for paths, and improve inert resource handling
Diffstat (limited to 'backend')
-rw-r--r-- | backend/libinput/tablet_pad.c | 21 | ||||
-rw-r--r-- | backend/libinput/tablet_tool.c | 16 |
2 files changed, 4 insertions, 33 deletions
diff --git a/backend/libinput/tablet_pad.c b/backend/libinput/tablet_pad.c index f1fb6d7a..579a11cf 100644 --- a/backend/libinput/tablet_pad.c +++ b/backend/libinput/tablet_pad.c @@ -12,23 +12,6 @@ #include "backend/libinput.h" #include "util/signal.h" -//TODO: Move out -static void add_tablet_path(struct wl_list *list, const char *path) { - struct wlr_tablet_path *tablet_path = calloc(1, sizeof(struct wlr_tablet_path)); - - if (!tablet_path) { - return; - } - - tablet_path->path = strdup(path); - if (!tablet_path->path) { - free(tablet_path); - return; - } - - wl_list_insert(list, &tablet_path->link); -} - // FIXME: Decide on how to alloc/count here static void add_pad_group_from_libinput(struct wlr_tablet_pad *pad, struct libinput_device *device, unsigned int index) { @@ -99,9 +82,9 @@ struct wlr_tablet_pad *create_libinput_tablet_pad( wlr_tablet_pad->strip_count = libinput_device_tablet_pad_get_num_strips(libinput_dev); - wl_list_init(&wlr_tablet_pad->paths); + wlr_list_init(&wlr_tablet_pad->paths); struct udev_device *udev = libinput_device_get_udev_device(libinput_dev); - add_tablet_path(&wlr_tablet_pad->paths, udev_device_get_syspath(udev)); + wlr_list_push(&wlr_tablet_pad->paths, strdup(udev_device_get_syspath(udev))); wl_list_init(&wlr_tablet_pad->groups); int groups = libinput_device_tablet_pad_get_num_mode_groups(libinput_dev); diff --git a/backend/libinput/tablet_tool.c b/backend/libinput/tablet_tool.c index 7cecb091..5dc0584c 100644 --- a/backend/libinput/tablet_tool.c +++ b/backend/libinput/tablet_tool.c @@ -13,18 +13,6 @@ #include "backend/libinput.h" #include "util/signal.h" -//TODO: Move out -static void add_tablet_path(struct wl_list *list, const char *path) { - struct wlr_tablet_path *tablet_path = calloc(1, sizeof(struct wlr_tablet_path)); - - if (!tablet_path) { - return; - } - - tablet_path->path = strdup(path); - wl_list_insert(list, &tablet_path->link); -} - struct wlr_libinput_tablet_tool { struct wlr_tablet_tool_tool wlr_tool; @@ -91,9 +79,9 @@ struct wlr_tablet_tool *create_libinput_tablet_tool( } struct wlr_tablet_tool *wlr_tablet_tool = &libinput_tablet_tool->wlr_tool; - wl_list_init(&wlr_tablet_tool->paths); + wlr_list_init(&wlr_tablet_tool->paths); struct udev_device *udev = libinput_device_get_udev_device(libinput_dev); - add_tablet_path(&wlr_tablet_tool->paths, udev_device_get_syspath(udev)); + wlr_list_push(&wlr_tablet_tool->paths, strdup(udev_device_get_syspath(udev))); wlr_tablet_tool->name = strdup(libinput_device_get_name(libinput_dev)); wl_list_init(&libinput_tablet_tool->tools); |