input: add tablet pad setup and button handler

Split pad initialization from tablet initialization to
avoid conflicting handler names.
Also reuse 'get_mapped_button'.
This commit is contained in:
Jens Peters 2024-01-02 18:26:25 +01:00 committed by Johan Malm
parent 28e7cd3006
commit c2687d9281
6 changed files with 90 additions and 29 deletions

View file

@ -10,6 +10,7 @@
#include <wlr/util/log.h>
#include "common/mem.h"
#include "input/tablet.h"
#include "input/tablet_pad.h"
#include "input/input.h"
#include "input/keyboard.h"
#include "input/key-state.h"
@ -283,7 +284,17 @@ new_tablet(struct seat *seat, struct wlr_input_device *dev)
{
struct input *input = znew(*input);
input->wlr_input_device = dev;
tablet_setup_handlers(seat, dev);
tablet_init(seat, dev);
return input;
}
static struct input *
new_tablet_pad(struct seat *seat, struct wlr_input_device *dev)
{
struct input *input = znew(*input);
input->wlr_input_device = dev;
tablet_pad_init(seat, dev);
return input;
}
@ -341,6 +352,8 @@ new_input_notify(struct wl_listener *listener, void *data)
input = new_touch(seat, device);
break;
case WLR_INPUT_DEVICE_TABLET_PAD:
input = new_tablet_pad(seat, device);
break;
case WLR_INPUT_DEVICE_TABLET_TOOL:
input = new_tablet(seat, device);
break;