Extracting pointer coordinates from RawMotion event #162
Comments
|
Extracting the coordinates with |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
|
Extracting the coordinates with |
Thanks for this wonderful library. I am writing a key and pointing device activity logger application for self-use to remind me of typing breaks and to eventually apply machine learning over my input device interaction patterns.
I find that unlike
KeyPressandKeyReleaseevents, when listening for events of the root of the screen viaDisplay().screen().root.xinput_select_events― motion events only return if the cursor is inside the window where my code is running but not when it is over other windows. So to get all cursor events only raw motion events can be used.Maybe that's because many/most applications remove motion events from the queue as they process them, whereas Key events aren't removed so often, or there's some other reason.
In any case, as opposed to this library's
xinput.Motionevent, thexinput.RawMotionevent does not seem to come with an API for extracting the cursor position: we cannotevent.data.root_xorevent.data.event_xthe event object coming from a RawMotion event.Am I missing something obvious in this? I couldn't figure how to nail adding this API feature insofar but am happy to give it a go with some help. I did find a way to get the position by making an extra API call:
However the numbers I am getting from this code snippet defer with those received on the event itself (and they also defer from those received on the (non-raw)
Motionevent.). So it's nice to have the equivalent API for the Raw events maybe. Or to learn how the coordinates supplied on the event defer from those received in querying the position while processing the event, maybe it is actually more accurate to believe the numbers coming back from the query.The text was updated successfully, but these errors were encountered: