Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Wayland] Add support for tablet-unstable-v2 protocol #5344

Closed
sp1ritCS opened this issue Feb 12, 2022 · 13 comments
Closed

[Wayland] Add support for tablet-unstable-v2 protocol #5344

sp1ritCS opened this issue Feb 12, 2022 · 13 comments
Labels
enhancement New feature or request
Milestone

Comments

@sp1ritCS
Copy link
Contributor

This is somewhat a regression that happened due to #4306.

Previously, XWayland would make use of this tablet-unstable-v2 API and expose it as a "normal" xcursor, to provide compatibility for X applications written with xf86-input-wacom in mind. This worked for SDL with X videodriver, too, since that was just the "normal" xcursor, and the special digitizer data (pressure, tilt, etc) was seperate.

However with the switch to Wayland by default, I've noticed my tablet not working anymore in osu!lazer because GNOMEs Mutter compositor only exposes pen tablets under this separate tablet-unstable-v2 API (wlroots/sway still works, they probably don't or just for applications also supporting it).

I've already tried hacking a (somewhat working) tablet-unstable-v2 support together: sp1ritCS@fd2edf0
Because sdl doesn't have a native "tablet/pen input" interface, I made it send absolute mouse input events instead.

but it's still far from ready (and since I've never written SDL code before, I doubt it meets your quality expectations 🙃 ):

  • some kind of cursor graphic to highlight the position of the pen for applications not implementing a custom cursor thingy
  • on applications utilizing a hardware cursor: the hardware cursor is locked to the mouse pointer (obviously), however when one moves the pen over the surface and then clicks the mouse (without moving it), one can trigger a click event at the position of the pen, even tho the hw cursor of the mouse is located somewhere else.
  • one cannot trigger the libdecoration events (close/max/min & resize) with a pen (but that also doesn't work with touch)

all of those are irrelevant to osu!lazer (since it's fullscreen and has a custom cursor thingy), but they are clearly noticeable in other applications, like the sdl2-demo I've been testing against.

@flibitijibibo
Copy link
Collaborator

Implementing enough to fill the X11 gap would be a good start, I think - wiring up the whole thing could be done as a bigger feature later if it's a lot more work on top of getting the critical events.

@flibitijibibo
Copy link
Collaborator

Looks like we're in the last couple weeks before tagging... did this end up moving at all? I don't have the hardware to check this out myself.

@sp1ritCS
Copy link
Contributor Author

Sorry, I'm not familiar with the SDL development process. Could you elaborate on

did this end up moving at all?

@flibitijibibo
Copy link
Collaborator

I hadn't checked the WIP branches (I'm mostly on a phone this weekend) so I wasn't sure if there was still being work done on the support. FWIW the code seemed fine from what I remember, so if there's a bare minimum that gets osu!lazer back up and running that will be more than enough for us to work with, we can patch things up during the PR process super quickly.

@sp1ritCS
Copy link
Contributor Author

sure, I'll rebase and create a MR

@flibitijibibo
Copy link
Collaborator

The initial integration is in via #5424 - it's not super thorough support but it gets us past the major regression from moving to Wayland.

Will unmark the milestone but leave this open as a long-term thing for someone to poke at!

@creichen
Copy link
Contributor

creichen commented Apr 2, 2022

The internal pen API in #5481 could prevent pen motion events from updating the cached mouse cursor position. Would that help?

Is the libdecoration issue still current and easily reproducible?

@flibitijibibo flibitijibibo self-assigned this Apr 6, 2022
@flibitijibibo
Copy link
Collaborator

Is the libdecoration issue still current and easily reproducible?

I would think so - I think libdecor gets its inputs separately from us, though: https://gitlab.gnome.org/jadahl/libdecor/-/blob/master/src/plugins/cairo/libdecor-cairo.c#L2485

Also, self-assigning just to have it in the Wayland tracker, not actively looking at this myself since I don't have any hardware to check against.

@creichen
Copy link
Contributor

I've attempted to add Wayland support to #5481 . However, running my distribution's weston (version 9.0.0) inside my Xorg setup doesn't seem to report tablet events, so I can't test. If someone who is familiar with this space wants to give it a go and send some feedback, I'd be grateful!

(I tried building weston from scratch, but between not knowing whether that would actually help and not getting the dependency checker for wayland-protocols to use the wayland-scannerfrom $PATH instead of /usr/bin (or maybe that's a pkg-config thing, which I don't really know how to deal with?) I couldn't convince myself that it's worth the effort for me to do that at this point.)

@sp1ritCS
Copy link
Contributor Author

However, running my distribution's weston (version 9.0.0) inside my Xorg setup doesn't seem to report tablet events, so I can't test. If someone who is familiar with this space wants to give it a go and send some feedback, I'd be grateful!

while it seems like weston builds the tablet v2 wayland api (https://gitlab.freedesktop.org/wayland/weston/-/blob/main/protocol/meson.build#L28) but doesn't actually seem to implement it. See (https://lists.freedesktop.org/archives/wayland-devel/2020-January/041184.html and https://gitlab.freedesktop.org/wayland/weston/-/issues/359)

you could try on of the wlroots distros (I've tested with swaywm and wayfire), KWin or GNOMEs Mutter.

I'm not quite sure what issue you try to address in the second paragraph (is the wayland scanner in /usr/bin outdated?) - but you need general docs, I can recommend the Wayland section of Wacoms developer docs https://developer-docs.wacom.com/intuos-cintiq-business-tablets/docs/wayland-overview if you haven't seen it already.

@sp1ritCS
Copy link
Contributor Author

But your wayland support works for me on GNOME at least. The only big issue I see is that is somehow considers the pen to have infinite pressure?

Screencast from 04-29-2022 11:52:05 PM.webm.gz

@creichen
Copy link
Contributor

Thank you very much!

The bug was lack of normalisation of the tilt angles. Could you check if the tilt fix helps, please? One thing I am a bit concerned about is that the Wayland spec states that it reports tilt angles (rather than vectors, which is what Xinput2 seems to be doing). For now I've left in what I believe to be a buggy implementation-- the bug would show up by the tilt vector pointing a bit to the side unless you are pointing straight north/south/east/west.

I'm not quite sure what issue you try to address in the second paragraph (is the wayland scanner in /usr/bin outdated?) -

This was more of a "and if weston is what I should be using, here's where I'm currently stuck" kind of thing, but you already made clear that weston was the wrong path to take. :-)
I have now been able to reproduce Wayland pen pressure measurement (fixing some smaller bugs along the way) via kwin, but unfortunately it seems that running Wayland on my travel laptop clashes with my work-related needs (thanks to some i915 kernel driver issues), so I think I'll have to rely on external feedback for the time being.

but you need general docs, I can recommend the Wayland section of Wacoms developer docs https://developer-docs.wacom.com/intuos-cintiq-business-tablets/docs/wayland-overview if you haven't seen it already.

Thank you for the pointer, too! I had been checking the general Wacom docs but completely missed that they have a Wayland section. This answers some of my questions.

@flibitijibibo flibitijibibo removed their assignment Jul 18, 2022
@flibitijibibo flibitijibibo added this to the 3.0 milestone Oct 30, 2022
@flibitijibibo flibitijibibo changed the title Wayland: support for tablet-unstable-v2? [Wayland] Add support for tablet-unstable-v2 Oct 30, 2022
@flibitijibibo flibitijibibo changed the title [Wayland] Add support for tablet-unstable-v2 [Wayland] Add support for tablet-unstable-v2 protocol Oct 30, 2022
@Kontrabant
Copy link
Contributor

Completed via #8058

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants