Skip to content

SDL3 Pen: Confusing pen proximity api #12992

@deiflou

Description

@deiflou

(I tested what follows only in linux and x11).

I was going to use the pen capabilities that check for pen proximity and noticed that the concept is not what I expected (I'm used to qt pen api). I was expecting that SDL_EVENT_PEN_PROXIMITY_IN/OUT would be sent when the pen enters/leaves tablet proximity (when the pen is moved near or far from the tablet) but it seems that right now they are sent when the pen is connected/disconnected. No events are sent when the pen is moved near or far from the tablet, but it would be great that they were.

My proposal is to reuse SDL_EVENT_PEN_PROXIMITY_IN/OUT to notify that the pen went near/far away the tablet and add two new event types, SDL_EVENT_PEN_ADDED/REMOVED, and SDL_Event::pdevice (similar to other devices) to notify that the devide was (dis)connected.

I made a sample implementation for what I propose for x11: https://github.com/deiflou/SDL/tree/pen_proximity, I couldn't make it work using wayland though.
It is the first time I code any x11/xinput stuff and I don't know if that is the best way.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions