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

Properly block SDL IME results sent as multiple text events + upstream SDL fixes #5141

Merged
merged 4 commits into from
May 10, 2022

Conversation

Susko3
Copy link
Member

@Susko3 Susko3 commented Apr 29, 2022

Depends on:

Closes ppy/osu#17231.

SDL will now send multiple SDL_TEXTINPUT events when the result is over 32 bytes. Here that is handled by blocking all text events that come in the same event loop. But because valid non-IME text events can arrive in the same event loop, we must check the text matches.

Eg. on Korean IME, pressing t, h, then 1: (only "소" is part of the composition, "1" is just regular text input)

// first event poll, pressing 't'
INFO: SDL EVENT: SDL_TEXTEDITING (timestamp=78142 windowid=1 text='ㅅ' start=1 length=0)

// second, pressing 'h'
INFO: SDL EVENT: SDL_TEXTEDITING (timestamp=78208 windowid=1 text='소' start=1 length=0)

// third, pressing '1'
// notice the two SDL_TEXTINPUTs
INFO: SDL EVENT: SDL_TEXTEDITING (timestamp=78736 windowid=1 text='' start=0 length=0)
INFO: SDL EVENT: SDL_TEXTEDITING (timestamp=78737 windowid=1 text='' start=0 length=0)
INFO: SDL EVENT: SDL_TEXTINPUT (timestamp=78737 windowid=1 text='소')
INFO: SDL EVENT: SDL_KEYDOWN (timestamp=78737 windowid=1 state=pressed repeat=false scancode=30 keycode=49 mod=4096)
INFO: SDL EVENT: SDL_TEXTINPUT (timestamp=78737 windowid=1 text='1')

Copy link
Sponsor Member

@peppy peppy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not tested, but code looks fine so let's get this merged for user testing.

@peppy peppy enabled auto-merge May 10, 2022 11:21
@peppy peppy merged commit 423a8f8 into ppy:master May 10, 2022
@Susko3 Susko3 deleted the SDL-ime-changes branch May 10, 2022 13:54
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.

Pressing Enter key during IME composition may send message directly
2 participants