## TOUCH
```
-<touch deviceName="" mapToOutput="" />
+<touch deviceName="" mapToOutput="" mouseEmulation="no"/>
```
*<touch deviceName="" />*
Direct cursor movement to a specified output. If the compositor is
running in nested mode, this does not take effect.
+*<touch mouseEmulation="" />*
+ If mouseEmulation is enabled, all touch up/down/motion events are
+ translated to mouse button and motion events.
+
## TABLET
```
Direct cursor movement to a specified output. If the compositor is
running in nested mode, this does not take effect.
+
+ If mouseEmulation is enabled, all touch up/down/motion events are
+ translated to mouse button and motion events.
-->
- <touch deviceName="" mapToOutput="" />
+ <touch deviceName="" mapToOutput="" mouseEmulation="no"/>
<!--
The tablet cursor movement can be restricted to a single output.
struct touch_config_entry {
char *device_name;
char *output_name;
+ bool force_mouse_emulation;
struct wl_list link; /* struct rcxml.touch_configs */
};
current_touch->device_name = xstrdup(content);
} else if (!strcasecmp(nodename, "mapToOutput.touch")) {
current_touch->output_name = xstrdup(content);
+ } else if (!strcasecmp(nodename, "mouseEmulation.touch")) {
+ set_bool(content, ¤t_touch->force_mouse_emulation);
} else {
wlr_log(WLR_ERROR, "Unexpected data in touch parser: %s=\"%s\"",
nodename, content);
touch_get_coords(struct seat *seat, struct wlr_touch *touch, double x, double y,
double *x_offset, double *y_offset)
{
+ /*
+ * Do not return a surface when mouse emulation is enforced. Not
+ * having a surface will trigger the fallback to cursor move/button
+ * emulation in the touch signal handlers.
+ */
+ struct touch_config_entry *config_entry =
+ touch_find_config_for_device(touch->base.name);
+ if (config_entry && config_entry->force_mouse_emulation) {
+ return NULL;
+ }
+
/* Convert coordinates: first [0, 1] => layout, then layout => surface */
double lx, ly;
wlr_cursor_absolute_to_layout_coords(seat->cursor, &touch->base,
/* Compute layout => surface offset and save for this touch point */
struct touch_point *touch_point = znew(*touch_point);
- double x_offset, y_offset;
+ double x_offset = 0.0, y_offset = 0.0;
touch_point->surface = touch_get_coords(seat, event->touch,
event->x, event->y, &x_offset, &y_offset);
touch_point->touch_id = event->touch_id;