Description
Problem
Currently, motion_notify_event generates a MouseEvent with a .button
attribute that is generated by dead-reckoning: it fills that value by tracking button_press_events and button_release_events. This means that the value can be wrong (if the user starts pressing a button (keeping it pressed), moves the mouse out of the canvas, presses another button, releases the first one, moves back over the canvas), and also this cannot represent the case of multiple buttons being pressed (for a motion_notify_event, the main thing that makes sense to report is really "what are all pressed buttons", not "what was the last pressed button").
Proposed solution
Similarly to #23473, one could add a .buttons
attribute (a frozenset of MouseButtons) to MouseEvents (well, at least to those generated by motion_notify_event) and fill that accordingly, as UI toolkits typically report that info (e.g. https://doc.qt.io/qt-6/qsinglepointevent.html#buttons, compare with https://doc.qt.io/qt-6/qsinglepointevent.html#button).
I think (assuming we can get #23473 in, which would mean we agree on this kind of API) we can tag this "good first issue"/"medium" as the new API would be well-defined but the work requires understanding various UI toolkits.