aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/libinput/tablet_tool.c3
-rw-r--r--backend/libinput/touch.c3
-rw-r--r--examples/tablet.c12
-rw-r--r--include/wlr/types/wlr_input_device.h2
-rw-r--r--include/wlr/types/wlr_tablet_tool.h2
-rw-r--r--include/wlr/types/wlr_touch.h1
6 files changed, 15 insertions, 8 deletions
diff --git a/backend/libinput/tablet_tool.c b/backend/libinput/tablet_tool.c
index c778ccc2..0aa960ab 100644
--- a/backend/libinput/tablet_tool.c
+++ b/backend/libinput/tablet_tool.c
@@ -25,6 +25,9 @@ void init_device_tablet(struct wlr_libinput_input_device *dev) {
wlr_tablet->base.vendor = libinput_device_get_id_vendor(dev->handle);
wlr_tablet->base.product = libinput_device_get_id_product(dev->handle);
+ libinput_device_get_size(dev->handle, &wlr_tablet->width_mm,
+ &wlr_tablet->height_mm);
+
struct udev_device *udev = libinput_device_get_udev_device(dev->handle);
char **dst = wl_array_add(&wlr_tablet->paths, sizeof(char *));
*dst = strdup(udev_device_get_syspath(udev));
diff --git a/backend/libinput/touch.c b/backend/libinput/touch.c
index 481a5787..fba3d568 100644
--- a/backend/libinput/touch.c
+++ b/backend/libinput/touch.c
@@ -14,6 +14,9 @@ void init_device_touch(struct wlr_libinput_input_device *dev) {
wlr_touch_init(wlr_touch, &libinput_touch_impl, name);
wlr_touch->base.vendor = libinput_device_get_id_vendor(dev->handle);
wlr_touch->base.product = libinput_device_get_id_product(dev->handle);
+
+ libinput_device_get_size(dev->handle, &wlr_touch->width_mm,
+ &wlr_touch->height_mm);
}
struct wlr_libinput_input_device *device_from_touch(
diff --git a/examples/tablet.c b/examples/tablet.c
index 234bfb99..dd48983d 100644
--- a/examples/tablet.c
+++ b/examples/tablet.c
@@ -320,11 +320,12 @@ static void new_input_notify(struct wl_listener *listener, void *data) {
wl_signal_add(&device->tablet_pad->events.ring, &pstate->ring);
wl_list_insert(&sample->tablet_pads, &pstate->link);
break;
- case WLR_INPUT_DEVICE_TABLET_TOOL:
- sample->width_mm = device->width_mm == 0 ?
- 20 : device->width_mm;
- sample->height_mm = device->height_mm == 0 ?
- 10 : device->height_mm;
+ case WLR_INPUT_DEVICE_TABLET_TOOL:;
+ struct wlr_tablet *tablet = device->tablet;
+ sample->width_mm = tablet->width_mm == 0 ?
+ 20 : tablet->width_mm;
+ sample->height_mm = tablet->height_mm == 0 ?
+ 10 : tablet->height_mm;
struct tablet_tool_state *tstate = calloc(sizeof(struct tablet_tool_state), 1);
tstate->device = device;
@@ -344,7 +345,6 @@ static void new_input_notify(struct wl_listener *listener, void *data) {
}
}
-
int main(int argc, char *argv[]) {
wlr_log_init(WLR_DEBUG, NULL);
struct wl_display *display = wl_display_create();
diff --git a/include/wlr/types/wlr_input_device.h b/include/wlr/types/wlr_input_device.h
index 730912f7..8c360aab 100644
--- a/include/wlr/types/wlr_input_device.h
+++ b/include/wlr/types/wlr_input_device.h
@@ -29,8 +29,6 @@ struct wlr_input_device {
enum wlr_input_device_type type;
unsigned int vendor, product;
char *name;
- // Or 0 if not applicable to this device
- double width_mm, height_mm;
/* wlr_input_device.type determines which of these is valid */
union {
diff --git a/include/wlr/types/wlr_tablet_tool.h b/include/wlr/types/wlr_tablet_tool.h
index c7d612a3..2819bcc4 100644
--- a/include/wlr/types/wlr_tablet_tool.h
+++ b/include/wlr/types/wlr_tablet_tool.h
@@ -64,6 +64,8 @@ struct wlr_tablet {
const struct wlr_tablet_impl *impl;
+ double width_mm, height_mm;
+
struct {
struct wl_signal axis;
struct wl_signal proximity;
diff --git a/include/wlr/types/wlr_touch.h b/include/wlr/types/wlr_touch.h
index ed2f0033..ac256e08 100644
--- a/include/wlr/types/wlr_touch.h
+++ b/include/wlr/types/wlr_touch.h
@@ -21,6 +21,7 @@ struct wlr_touch {
const struct wlr_touch_impl *impl;
char *output_name;
+ double width_mm, height_mm;
struct {
struct wl_signal down; // struct wlr_event_touch_down