changeset 3465:0cbfec87e4f1

Support for UTF-8 text input has been added.
author Mike Gorchak <lestat@i.com.ua>
date Fri, 20 Nov 2009 14:42:40 +0000
parents 09136f534198
children a288892cd24c
files src/video/photon/SDL_photon.c
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/photon/SDL_photon.c	Fri Nov 20 07:11:29 2009 +0000
+++ b/src/video/photon/SDL_photon.c	Fri Nov 20 14:42:40 2009 +0000
@@ -2685,6 +2685,23 @@
                                 SDL_SendKeyboardKey(0, SDL_RELEASED,
                                                     scancode);
                             }
+
+                        }
+
+                        /* Handle UTF-8 text input if requested by caller */
+                        if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY))
+                        {
+                            char text[5];
+
+                            SDL_memset(text, 0x00, 5);
+                            if (PhKeyToMb(text, keyevent)!=-1)
+                            {
+                                SDL_SendKeyboardText(0, text);
+                            }
+                            else
+                            {
+                                /* Just do nothing if it is not a UTF-8 character */
+                            }
                         }
                     }
                     break;