]> git.mdlowis.com Git - proto/labwc.git/commitdiff
seat: map touch to configured output name
authorJens Peters <jp7677@gmail.com>
Fri, 12 Jan 2024 23:25:08 +0000 (00:25 +0100)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sat, 13 Jan 2024 22:18:20 +0000 (22:18 +0000)
The output name linked to the touch device
has preference when set. This happens when
the compositor runs in nested mode.

src/seat.c

index df91a3963408d4c622584e505bc6709aaac70aa0..79a49354834d85ea0cc327332b2438257824bc12 100644 (file)
@@ -263,6 +263,15 @@ new_keyboard(struct seat *seat, struct wlr_input_device *device, bool virtual)
        return (struct input *)keyboard;
 }
 
+static void
+map_touch_to_output(struct seat *seat, struct wlr_input_device *dev)
+{
+       struct wlr_touch *touch = wlr_touch_from_input_device(dev);
+       char *output_name = touch->output_name ? touch->output_name : rc.touch.output_name;
+       wlr_log(WLR_INFO, "map touch to output %s\n", output_name);
+       map_input_to_output(seat, dev, output_name);
+}
+
 static struct input *
 new_touch(struct seat *seat, struct wlr_input_device *dev)
 {
@@ -273,9 +282,7 @@ new_touch(struct seat *seat, struct wlr_input_device *dev)
 
        /* In support of running with WLR_WL_OUTPUTS set to >=2 */
        if (dev->type == WLR_INPUT_DEVICE_TOUCH) {
-               struct wlr_touch *touch = wlr_touch_from_input_device(dev);
-               wlr_log(WLR_INFO, "map touch to output %s\n", touch->output_name);
-               map_input_to_output(seat, dev, touch->output_name);
+               map_touch_to_output(seat, dev);
        }
        return input;
 }