We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2203

Summary: SDL_TEXTEDITING is sent unnecessarily when window focus changes
Product: SDL Reporter: Vladimir <dead.futurist>
Component: eventsAssignee: Sam Lantinga <slouken>
Status: WAITING --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: adam, bugzilla-sdl
Version: 2.0.1   
Hardware: x86_64   
OS: Windows 7   

Description Vladimir 2013-11-02 20:37:25 UTC
I try to use http://hg.libsdl.org/SDL/file/cc2289c332eb/test/testime.c
SDL_TEXTINPUT work fine,
SDL_TEXTEDITING only works when the focus window changing

LOG
INFO: Using font: consola.ttf
INFO: text editing "", selected range (0, 0)
INFO: Keyboard: text input "1"
INFO: text inputed: 1
INFO: Keyboard: text input "2"
INFO: text inputed: 12
INFO: Keyboard: text input "3"
INFO: text inputed: 123
INFO: text editing "", selected range (0, 0)
INFO: text editing "", selected range (0, 0)

Bug? or What am I doing wrong.
Comment 1 Andreas Ertelt 2014-02-20 12:06:16 UTC
SDL_TEXTEDITING is only generated for languages using composed characters (e.g. Japanese). With it you receive the new sequence the previous one (if any) has to be replaced with.

The reason why you receive it (with an empty string) when switching focus is to cancel a possibly ongoing composition.
Comment 2 Adam M. 2014-05-09 00:14:34 UTC
I consider this a bug. SDL_TEXTEDITING should not be sent when the user changes window focus just because there's a possibility that there was an ongoing composition. SDL should keep track of whether there actually was an ongoing composition, and only send the event in that case.
Comment 3 Sam Lantinga 2014-06-25 09:13:46 UTC
That's certainly probably the better behavior. I don't have a good IME test setup here. Feel free to submit a tested patch.