HumbleUI/JWM

Pen input

TheMode opened this issue · 2 comments

I am currently experimenting with a drawing app, and the seemingly lack of API for pen inputs make it harder than it can be (should at least allow the software to differentiate touch from pen).

I suggest adding support for these APIs:

tonsky commented

I’d be happy to have these. PRs are welcome!

I have at least found on macos (the platform I am mostly interested in), pen inputs are sent as mouse with additional metadata
Mouse down:

NSEvent: type=LMouseDown loc=(175.711,206.383) time=37530.5 flags=0 win=0x154e06e30 winNum=5683 ctxt=0x0 evNum=4888 click=1 buttonNumber=0 pressure=1 deviceID:0x200000000000027 subtype=NSEventSubtypeTouch

Pen down:

NSEvent: type=LMouseDown loc=(364,130.52) time=37534.2 flags=0 win=0x154e06e30 winNum=5683 ctxt=0x0 evNum=1 click=1 buttonNumber=0 pressure=0.0784314 deviceID:0x250b subtype=NSEventSubtypeTabletPoint deviceID=9483 x=-578 y=518 z=0 buttons=0x1 pressure=0.078431 tilt={0.43333231604968414, -0.077761162144840842} rotation=0.000000 tangentialPressure=0.000000 vendor1-3=(0, 0, 0)

I assume that the best way to include it in the current API would be to take a similar approach and append optional metadata to the mouse events, like a StylusMeta/TabletMeta structure.

I am however not familiar enough with the code base to do such change.