-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Changes to cursor position without mouse event #7581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Do any of the 'enter_*' events get triggered this way? We may need to add a 'gets focus' event? |
This would not help the case of switching to fullscreen. |
For full screen we have a |
Good point. I think hooking both resize_event and focus_event works better than refetching the cursor position before emitting any LocationEvents as the latter mechanism is probably(?) insufficient to update the status bar text. |
We had a similar problem with the pointer when changing tools by shortcut #3474 |
Another case is when an animation changes e.g. the x or y limits. To cover this case, as well as the previously mentioned ones, it looks like we could hook draw_event (which should get called upon resize too?) and focus_event. Another observation: when the window is resized or displaced, it is actually necessary to refetch the mouse position, as Qt reports it relative one of the window corners. So if one hooks draw_event hoping of covering resizes too, when the draw_event occurs, _lastx and _lasty will still be defined relative to the earlier window size (as that was the window size when the last mouse event occured), and thus will be incorrect (e.g. they will then be converted to xdata/ydata using the new window size). Also note that 1. Qt triggers an exit and an enter event upon un-maximizing window size, but the current implementation of |
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help! |
Triggering a cursor update on a resize_event seems easy enough to do and should hopefully(?) be uncontroversial. Adding a focus_event may be a bit more work (perhaps gain_focus_event/lose_focus_event? -- needs checking what most GUI toolkits offer)... |
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help! |
We have now deprecated |
Yes. I agree with your analysis above that fixing this probably needs having a gains_focus event. |
This both affects the current tool system and the MEP22 toolmanager.
The cursor position only gets updated when the canvas detects a cursor motion, which leads to problems 1) immediately after switching fullscreen and 2) if alt-tab'ing to change window focus, moving the cursor and alt-tab'ing back to the original canvas. With either case, the x-y position printed in the status bar is incorrect and it is possible for keyboard shortcuts (e.g.) "g" or "l" to end up affecting a "wrong" axes.
There is a length comment regarding this in the tkagg backend implementation (
_update_pointer_position
) but even that backend doesn't handle this properly.Ultimately I think(?) the correct way to solve this is to do away with
_lastx/_lasty
and just refetch the cursor position whenever a LocationEvent must be emitted.The text was updated successfully, but these errors were encountered: