Also it adds and extra commit that synthesizes a FocusIn event if ever the window receives a keyboard event while unfocused, that should not happen, but it does happen sometimes.
Feel free to comment on those two commits separately, if you prefer that.
I think adding two unrelated "fixes" to the focus was a mistake. I'm rewriting the PR to just include the fix for #2841, that should be easier to merge.
This PR fixes #2841.
Also it adds and extra commit that synthesizes a FocusIn event if ever the window receives a keyboard event while unfocused, that should not happen, but it does happen sometimes.
Feel free to comment on those two commits separately, if you prefer that.