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

Clear pressed keys after loosing input focus (#3532) #4388

Closed
wants to merge 1 commit into from

Conversation

thedmd
Copy link
Contributor

@thedmd thedmd commented Aug 2, 2021

This PR address #3532.

Implemented on all backends. Exceptions:
glut - no explicit API available to handle focus
marmalade - not supported (SDK is no longer available anywhere)
iOS - backend is very basic and handle only touches, not relevant to this PR
Android - focus event appears to not event be fully exposed in native API, not a single example was found; this is usually handled in onPause/onResume, can be considered out of the scope of this PR; using hardware keyboard isn't usual use case

@ocornut
Copy link
Owner

ocornut commented Aug 17, 2021

Thank you! Should merge soon

For future readers, note that #3532 was only reopened following changes #2445, #2696, #3751, #4377 where backends now report mouse position for unfocused window.

As thus, old backends won't be affected.
New backends which for whichever reason don't/can't use io.AddFocusEvent() can still set io.MousePos when not focused for the same results.

@ocornut
Copy link
Owner

ocornut commented Aug 17, 2021

Merged with amends: 2f40be6

  • Added add changelog entries. Documented new GLFW callback as potentially breaking change.
  • GLFW: added window == bd->Window test for reduce drift with docking branch.
  • Made a change to NavUpdateWindowing() as following today's Pressing Alt+Shift (or Shift+Alt) will clear the focus when using NavEnableKeyboard #4439 change to use io.KeyAlt/io.KeyMods directly instead of NavInputIsPressed wrapper, we needed the equivalent of a IsReleased() (now testing old mods).
  • For SDL and Allegro5 backends I changed the return value to match others. For the simple/weird reason that this return value has in fact been not defined/clarified and never used (more or less: it never worked and was never useful). So rather than pretending to have it half-work for now it's keep consistently useless.

Thanks a lot again! Amazing help.

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

Successfully merging this pull request may close these issues.

2 participants