Skip to content
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

Fix using arrow keys to move object when move tool is selected causes changed of focus #71856

Conversation

EricEzaM
Copy link
Contributor

@EricEzaM EricEzaM commented Jan 22, 2023

Fixes #70789

What a goose chase this was. Turns out inside the _gui_input handling, we call _update_cursor(), which in turn pushes a mouse motion event to the viewport. This RESETS the gui.key_event_accepted to false, when the move tool already accepted the event and set it to true!

So the fix here is actually to ensure viewport->set_default_cursor_shape(c); (at the bottom of _update_cursor()) never gets called because the new cursor is same as current.

This might need to be looked into as this was quite a hard bug to find due to that interaction. Simplfied, this was happening:

  • _gui_input
  • handle move tool
  • move calls accept_event()
  • viewport sets gui.key_event_accepted to true
  • move calls update_cursor()
  • update_cursor() dispatches an event to the viewport via viewport->set_default_cursor_shape(c);
  • viewport sets gui.key_event_accepted to false
  • handling move tool finished
  • viewport checks gui.key_event_accepted - it is now false! When it should be true since move tool handled the event

@Sauermann
Copy link
Contributor

Sauermann commented Jan 22, 2023

I believe that a better way would be to get rid of the set_default_cursor_shape call for every Mouse-Move.
Please see #59081

@EricEzaM
Copy link
Contributor Author

Yes you are probably right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using arrow keys with "move mode" tool selected causes 2D editor to lose focus
2 participants