From 17e15ed9878bbe09a305eb65c93795272db468be Mon Sep 17 00:00:00 2001 From: Jens Peters Date: Tue, 9 Jan 2024 06:58:35 +0100 Subject: [PATCH] seat: re-map tablet to output on output change --- include/labwc.h | 1 + src/output.c | 2 ++ src/seat.c | 15 +++++++++++++++ 3 files changed, 18 insertions(+) diff --git a/include/labwc.h b/include/labwc.h index 01f86b73..62b32cd1 100644 --- a/include/labwc.h +++ b/include/labwc.h @@ -460,6 +460,7 @@ void seat_set_pressed(struct seat *seat, struct view *view, struct wlr_scene_node *node, struct wlr_surface *surface, struct wlr_surface *toplevel, uint32_t resize_edges); void seat_reset_pressed(struct seat *seat); +void seat_output_layout_changed(struct seat *seat); void interactive_begin(struct view *view, enum input_mode mode, uint32_t edges); void interactive_finish(struct view *view); diff --git a/src/output.c b/src/output.c index 968e89ca..ed039545 100644 --- a/src/output.c +++ b/src/output.c @@ -106,6 +106,7 @@ output_destroy_notify(struct wl_listener *listener, void *data) wl_list_remove(&output->frame.link); wl_list_remove(&output->destroy.link); wl_list_remove(&output->request_state.link); + seat_output_layout_changed(&output->server->seat); for (size_t i = 0; i < ARRAY_SIZE(output->layer_tree); i++) { wlr_scene_node_destroy(&output->layer_tree[i]->node); @@ -350,6 +351,7 @@ new_output_notify(struct wl_listener *listener, void *data) server->pending_output_layout_change--; do_output_layout_change(server); + seat_output_layout_changed(&output->server->seat); } void diff --git a/src/seat.c b/src/seat.c index 81f59bda..df91a396 100644 --- a/src/seat.c +++ b/src/seat.c @@ -643,3 +643,18 @@ seat_reset_pressed(struct seat *seat) seat->pressed.toplevel = NULL; seat->pressed.resize_edges = 0; } + +void +seat_output_layout_changed(struct seat *seat) +{ + struct input *input = NULL; + wl_list_for_each(input, &seat->inputs, link) { + switch (input->wlr_input_device->type) { + case WLR_INPUT_DEVICE_TABLET_TOOL: + map_input_to_output(seat, input->wlr_input_device, rc.tablet.output_name); + break; + default: + break; + } + } +} -- 2.52.0