diff --git a/src/ext-protocol/tablet.h b/src/ext-protocol/tablet.h index 9c89138e..34c82dbf 100644 --- a/src/ext-protocol/tablet.h +++ b/src/ext-protocol/tablet.h @@ -39,6 +39,7 @@ struct TabletTool { struct TabletPad { struct wlr_tablet_v2_tablet_pad *pad_v2; + struct wlr_input_device *device; struct Tablet *tablet; struct wl_listener tablet_destroy; struct wl_listener attach; @@ -98,7 +99,7 @@ void createtablet(struct wlr_input_device *device) { wlr_libinput_get_device_handle(device)); struct TabletPad *tablet_pad; wl_list_for_each(tablet_pad, &tablet_pads, link) { - struct wlr_input_device *pad_device = tablet_pad->pad_v2->wlr_device; + struct wlr_input_device *pad_device = tablet_pad->device; if (!wlr_input_device_is_libinput(pad_device)) { continue; } @@ -159,6 +160,8 @@ void createtabletpad(struct wlr_input_device *device) { wlr_log(WLR_ERROR, "could not allocate tablet_pad"); return; } + + tablet_pad->device = device; tablet_pad->pad_v2 = wlr_tablet_pad_create(tablet_mgr, seat, device); if (!tablet_pad->pad_v2) { @@ -178,16 +181,17 @@ void createtabletpad(struct wlr_input_device *device) { wl_list_insert(&tablet_pads, &tablet_pad->link); /* Search for a sibling tablet */ - if (!wlr_input_device_is_libinput(tablet_pad->pad_v2->wlr_device)) { + if (!wlr_input_device_is_libinput(device)) { /* We can only do this on libinput devices */ return; } struct libinput_device_group *group = libinput_device_get_device_group( - wlr_libinput_get_device_handle(tablet_pad->pad_v2->wlr_device)); + wlr_libinput_get_device_handle(device)); + struct Tablet *tablet; wl_list_for_each(tablet, &tablets, link) { - struct wlr_input_device *tablet_device = tablet->tablet_v2->wlr_device; + struct wlr_input_device *tablet_device = tablet->device; if (!wlr_input_device_is_libinput(tablet_device)) { continue; } @@ -264,11 +268,11 @@ void tablettoolmotion(struct TabletTool *tool, bool change_x, bool change_y, switch (tool->tool_v2->wlr_tool->type) { case WLR_TABLET_TOOL_TYPE_LENS: case WLR_TABLET_TOOL_TYPE_MOUSE: - wlr_cursor_move(cursor, tablet->tablet_v2->wlr_device, dx, dy); + wlr_cursor_move(cursor, tablet->device, dx, dy); break; default: - wlr_cursor_warp_absolute(cursor, tablet->tablet_v2->wlr_device, - change_x ? x : NAN, change_y ? y : NAN); + wlr_cursor_warp_absolute(cursor, tablet->device, change_x ? x : NAN, + change_y ? y : NAN); break; }