Skip to content

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
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