mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-06-06 03:01:52 -04:00
also fix tabletpad create
This commit is contained in:
parent
133ebc76d9
commit
6204ac49ec
1 changed files with 11 additions and 7 deletions
|
|
@ -39,6 +39,7 @@ struct TabletTool {
|
||||||
|
|
||||||
struct TabletPad {
|
struct TabletPad {
|
||||||
struct wlr_tablet_v2_tablet_pad *pad_v2;
|
struct wlr_tablet_v2_tablet_pad *pad_v2;
|
||||||
|
struct wlr_input_device *device;
|
||||||
struct Tablet *tablet;
|
struct Tablet *tablet;
|
||||||
struct wl_listener tablet_destroy;
|
struct wl_listener tablet_destroy;
|
||||||
struct wl_listener attach;
|
struct wl_listener attach;
|
||||||
|
|
@ -98,7 +99,7 @@ void createtablet(struct wlr_input_device *device) {
|
||||||
wlr_libinput_get_device_handle(device));
|
wlr_libinput_get_device_handle(device));
|
||||||
struct TabletPad *tablet_pad;
|
struct TabletPad *tablet_pad;
|
||||||
wl_list_for_each(tablet_pad, &tablet_pads, link) {
|
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)) {
|
if (!wlr_input_device_is_libinput(pad_device)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -159,6 +160,8 @@ void createtabletpad(struct wlr_input_device *device) {
|
||||||
wlr_log(WLR_ERROR, "could not allocate tablet_pad");
|
wlr_log(WLR_ERROR, "could not allocate tablet_pad");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tablet_pad->device = device;
|
||||||
tablet_pad->pad_v2 = wlr_tablet_pad_create(tablet_mgr, seat, device);
|
tablet_pad->pad_v2 = wlr_tablet_pad_create(tablet_mgr, seat, device);
|
||||||
|
|
||||||
if (!tablet_pad->pad_v2) {
|
if (!tablet_pad->pad_v2) {
|
||||||
|
|
@ -178,16 +181,17 @@ void createtabletpad(struct wlr_input_device *device) {
|
||||||
wl_list_insert(&tablet_pads, &tablet_pad->link);
|
wl_list_insert(&tablet_pads, &tablet_pad->link);
|
||||||
|
|
||||||
/* Search for a sibling tablet */
|
/* 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 */
|
/* We can only do this on libinput devices */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct libinput_device_group *group = libinput_device_get_device_group(
|
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;
|
struct Tablet *tablet;
|
||||||
wl_list_for_each(tablet, &tablets, link) {
|
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)) {
|
if (!wlr_input_device_is_libinput(tablet_device)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -264,11 +268,11 @@ void tablettoolmotion(struct TabletTool *tool, bool change_x, bool change_y,
|
||||||
switch (tool->tool_v2->wlr_tool->type) {
|
switch (tool->tool_v2->wlr_tool->type) {
|
||||||
case WLR_TABLET_TOOL_TYPE_LENS:
|
case WLR_TABLET_TOOL_TYPE_LENS:
|
||||||
case WLR_TABLET_TOOL_TYPE_MOUSE:
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
wlr_cursor_warp_absolute(cursor, tablet->tablet_v2->wlr_device,
|
wlr_cursor_warp_absolute(cursor, tablet->device, change_x ? x : NAN,
|
||||||
change_x ? x : NAN, change_y ? y : NAN);
|
change_y ? y : NAN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue