SDL IME support question |
SDL IME support question |
Sik
|
SDL_TEXTEDITING indicates composition is in progress (and provides the
current text so far), SDL_TEXTINPUT indicates composition has just finished (and provides the resulting text). Maybe you can do something with these two? Note that you can get SDL_TEXTINPUT alone if it's a system without composition, e.g. letters get entered directly. 2015-03-28 14:15 GMT-03:00, Alexey Petruchik:
SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
SDL IME support question |
Ryan C. Gordon
Guest
|
Does the SDL_TEXTEDITING event fire in any useful way here?
--ryan.
SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
SDL IME support question |
Alexey Petruchik
Guest
|
SDL_TEXEDITING seems to be not enough for me. Here is an example (I use Japanese IME) I press Ctrl+Caps to start IME than I write "waruso" and hit enter. Here is a dump of sdl events:
SDL_KEYDOWN: 224 1073742048 SDL_KEYDOWN: 57 1073741881 SDL_KEYUP: 224 1073742048 SDL_KEYUP: 57 1073741881 SDL_KEYDOWN: 26 119 SDL_TEXTEDITING: "ï½—" SDL_KEYUP: 26 119 SDL_KEYDOWN: 4 97 SDL_TEXTEDITING: "ã‚" SDL_KEYUP: 4 97 SDL_KEYDOWN: 21 114 SDL_TEXTEDITING: "ã‚ï½’" SDL_KEYUP: 21 114 SDL_KEYDOWN: 24 117 SDL_TEXTEDITING: "ã‚ã‚‹" SDL_KEYUP: 24 117 SDL_KEYDOWN: 22 115 SDL_TEXTEDITING: "ã‚るs" SDL_KEYUP: 22 115 SDL_KEYDOWN: 18 111 SDL_TEXTEDITING: "ã‚ã‚‹ã" SDL_KEYUP: 18 111 SDL_KEYDOWN: 40 13 SDL_TEXTINPUT: "ã‚ã‚‹ã" SDL_TEXTEDITING: "" SDL_KEYUP: 40 13 As you see when SDL_KEYDOWN for "w" letter comes I'm already in IME mode (Ctrl+Caps pressed) but SDL_TEXEDITING event hadn't yet come so I can't filter this keydown. Same comes for SDL_KEYUP for Enter after i received textediting with empty string which seems to mean that IME composition is completed. On 28 March 2015 at 22:10, Ryan C. Gordon wrote:
|
|||||||||||||||||
|
SDL IME support question |
Alexey Petruchik
Guest
|
Here is more detailed log. I've marked keydown events that have wParam equal to VK_PROCESSKEY
SDL_KEYDOWN: 224 1073742048 SDL_KEYDOWN: 57 1073741881 - VK_PROCESSKEY SDL_KEYUP: 224 1073742048 SDL_KEYUP: 57 1073741881 SDL_KEYDOWN: 26 119 - VK_PROCESSKEY WM_IME_STARTCOMPOSITION SDL_TEXTEDITING: "ï½—" SDL_KEYUP: 26 119 SDL_KEYDOWN: 4 97 - VK_PROCESSKEY SDL_TEXTEDITING: "ã‚" SDL_KEYUP: 4 97 SDL_KEYDOWN: 21 114 - VK_PROCESSKEY SDL_TEXTEDITING: "ã‚ï½’" SDL_KEYUP: 21 114 SDL_KEYDOWN: 24 117 - VK_PROCESSKEY SDL_TEXTEDITING: "ã‚ã‚‹" SDL_KEYUP: 24 117 SDL_KEYDOWN: 22 115 - VK_PROCESSKEY SDL_TEXTEDITING: "ã‚るs" SDL_KEYUP: 22 115 SDL_KEYDOWN: 18 111 - VK_PROCESSKEY SDL_TEXTEDITING: "ã‚ã‚‹ã" SDL_KEYUP: 18 111 SDL_KEYDOWN: 40 13 - VK_PROCESSKEY SDL_TEXTINPUT: "ã‚ã‚‹ã" WM_IME_ENDCOMPOSITION SDL_TEXTEDITING: "" SDL_KEYUP: 40 13 On 30 March 2015 at 00:21, Alexey Petruchik wrote:
|
|||||||||||||||||||
|
SDL IME support question |
eric.w
|
Hi,Not sure if this helps, but to implement the text fields in Quakespasm (the console, chat prompt, etc.), Â what we did is:
- when the user focuses a text field, we call SDL_StartTextInput() and set a flag in our code that indicates we're in text editing mode - when in text editing mode, we ignore all SDL_KEYDOWN/SDL_KEYUP events, except keys that manipulate the cursor, like backspace, delete, and the arrow keys - any text that comes in via SDL_TEXTINPUT is pasted into the text field. After experimenting a bit, I think this is the "right" design for doing a text field in a game with SDL2. Trying to match key and text input/text editing events on a per-character basis is fragile and bound to fail, in my experience. On Sun, Mar 29, 2015 at 4:13 PM, Alexey Petruchik wrote:
|
|||||||||||||||||||||
|