Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey there,
This is a proposal to start addressing #6360.
It removes the string manipulations and decodes each UTF8 characters individually and sends them to the event handler.
It also skips the event processing if there is no event handler attached to
GameWindow.TextInput
.This should:
TextInput
isn't used when pressing keys (which I believe is the most important fix here)TextInput
There is still some garbage generated from this line when attaching an handler to
TextInput
:MonoGame/MonoGame.Framework/SDL/SDLGameWindow.cs
Line 302 in b1a49e4
We will have to figure out (in another PR?) what to do with event args types.
Also, it should be noted that this PR comes with a limitation (note that the original code also has this limitation): it doesn't support UTF8 characters that are encoded on more than 2 bytes (because
TextInputEventArgs
is limited by thechar
type). Chinese, Japanese, and Korean won't be supported.This should be addressed in another PR I guess (at the same time as addressing the event args type?).
Partly fixes #6360