Skip to content

Commit

Permalink
Move initialization of wlr_tablet_pad into types/wlr_tablet_pad
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Ongyerth authored and emersion committed Sep 26, 2019
1 parent 020a33e commit 57babd2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 1 addition & 3 deletions backend/libinput/tablet_pad.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ struct wlr_tablet_pad *create_libinput_tablet_pad(
wlr_log(WLR_ERROR, "Unable to allocate wlr_tablet_pad");
return NULL;
}
wlr_tablet_pad_init(wlr_tablet_pad, NULL);

wlr_tablet_pad->button_count =
libinput_device_tablet_pad_get_num_buttons(libinput_dev);
Expand All @@ -83,17 +84,14 @@ struct wlr_tablet_pad *create_libinput_tablet_pad(
wlr_tablet_pad->strip_count =
libinput_device_tablet_pad_get_num_strips(libinput_dev);

wlr_list_init(&wlr_tablet_pad->paths);
struct udev_device *udev = libinput_device_get_udev_device(libinput_dev);
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);
for (int i = 0; i < groups; ++i) {
add_pad_group_from_libinput(wlr_tablet_pad, libinput_dev, i);
}

wlr_tablet_pad_init(wlr_tablet_pad, NULL);
return wlr_tablet_pad;
}

Expand Down
6 changes: 4 additions & 2 deletions types/tablet_v2/wlr_tablet_v2_pad.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,10 @@ uint32_t wlr_send_tablet_v2_tablet_pad_enter(
uint32_t time = now.tv_nsec / 1000;

for (size_t i = 0; i < pad->group_count; ++i) {
zwp_tablet_pad_group_v2_send_mode_switch(
pad_client->groups[i], time, serial, pad->groups[i]);
if (pad_client->groups[i]) {
zwp_tablet_pad_group_v2_send_mode_switch(
pad_client->groups[i], time, serial, pad->groups[i]);
}
}

return serial;
Expand Down
3 changes: 3 additions & 0 deletions types/wlr_tablet_pad.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ void wlr_tablet_pad_init(struct wlr_tablet_pad *pad,
wl_signal_init(&pad->events.ring);
wl_signal_init(&pad->events.strip);
wl_signal_init(&pad->events.attach_tablet);

wl_list_init(&pad->groups);
wlr_list_init(&pad->paths);
}

void wlr_tablet_pad_destroy(struct wlr_tablet_pad *pad) {
Expand Down

0 comments on commit 57babd2

Please sign in to comment.