Closed denilsonsa closed 4 months ago
The check that tries to correct the pressure for the "mouse" type is probably breaking the pressure-sensitive mouse that Firefox is reporting.
I'm sure the Firefox behavior isn't correct (it should report as a pen), so feel free to add a comment in that Mozilla bug, if you think that's relevant. After all, it's a bug that is affecting a web application and forcing developers to write workarounds for specific browsers on specific systems.
Thanks for the detailed report and even finding the relevant section in code.
I gave it a try on Ubuntu with a Wacom One tablet. As you said the pressure works on Chrome, but not on Firefox. I disabled resetting pressure to 1 in the code section, but then the pressure was just 0.5, always. Firefox does the same when I use a mouse. (btw on Windows and Mac it works fine)
Also on other websites I got no pressure, or only 0.5. This is in line with the bug report which you've linked. Pen input is registered as type=mouse with pressure=0.5.
As it stands I see no workaround. And 0.5 pressure is not desirable. If a user with a mouse sets 10 as the brush size, but then the line has a thickness of 5, that is probably not what they want.
If the bug is resolved by Firefox I think it should automatically work in Kleki/Klecks.
It is interesting that you seem to get proper pressure in your second video, but indeed, it's complicated by mouse input also having 0.5 pressure.
0.5 pressure for mouse input is in line with the spec: https://w3c.github.io/pointerevents/#dom-pointerevent-pressure
For hardware and platforms that do not support pressure, the value MUST be 0.5 when in the [active buttons state] and 0 otherwise.
I'll think if there is a workaround.
Oh, pressure requires MOZ_USE_XINPUT2=1
environment variable on Firefox. (bug 1207700)
I can think about two workarounds:
But both sound like a lot of work for a workaround, and they may fail at some corner-cases.
The alternative could be just wait and hope for bug 1501744 to be fixed and the patch to be applied.
I implemented option 2. Did it without memory because it seems very unlikely for a floating point to hit exactly 0.5. If you observe jumps I'll fix that.
Meanwhile, folks have fixed the Firefox bug in the latest nightly. I don't know how long until it hits stable.
That's great news!
small update: as of firefox-129.0, though it's now correctly identifying the stylus, it still requires MOZ_USE_XINPUT2=1
environment variable in X11 sessions.
in wayland sessions it's working out of the box.
it still requires
MOZ_USE_XINPUT2=1
environment variable in X11 sessions.
That is being tracked in https://bugzilla.mozilla.org/show_bug.cgi?id=1207700
See also this summary of the current state of pen input among the two major browsers: https://stackoverflow.com/a/78764151
https://github.com/bitbof/klecks/assets/121676/980fb675-f4e9-42e1-a45d-969d8f9a5291
My system:
Related:
5
4
Further testing:
https://github.com/bitbof/klecks/assets/121676/7431a914-0cb4-4a5c-b212-12c4146e2f9c