]> git.mdlowis.com Git - proto/labwc.git/commitdiff
seat: re-map tablet to output on output change
authorJens Peters <jp7677@gmail.com>
Tue, 9 Jan 2024 05:58:35 +0000 (06:58 +0100)
committerJohan Malm <johanmalm@users.noreply.github.com>
Wed, 10 Jan 2024 21:10:11 +0000 (21:10 +0000)
include/labwc.h
src/output.c
src/seat.c

index 01f86b7368a27189f2f7a1f0b845ccfa229888c9..62b32cd1ac32c4e30eecfbb9bb8a7d985986c7c3 100644 (file)
@@ -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);
index 968e89ca5cf3ab3b9e9c0f6c33b697ad93048910..ed039545a322f66ce8caf9f30d260ca22011744e 100644 (file)
@@ -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
index 81f59bdade9ca273a6f0c7686143caaa49bbb5c8..df91a3963408d4c622584e505bc6709aaac70aa0 100644 (file)
@@ -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;
+               }
+       }
+}