Mercurial > projects > dwt-linux
diff dwt/widgets/Widget.d @ 178:285aa0c31277
Fix: utf8 problem in key event
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 02 Mar 2008 18:12:27 +0100 |
parents | de2578a843a7 |
children | 380bad9f6852 |
line wrap: on
line diff
--- a/dwt/widgets/Widget.d Sun Mar 02 18:09:32 2008 +0100 +++ b/dwt/widgets/Widget.d Sun Mar 02 18:12:27 2008 +0100 @@ -1283,12 +1283,15 @@ } while (index < chars.length) { Event event = new Event (); - if (keyEvent !is null && chars.length <= 1) { + //PORTING take care of utf8 + if (keyEvent !is null && chars.codepointCount() <= 1) { setKeyState (event, keyEvent); } else { setInputState (event, state); } - event.character = chars [index]; + //PORTING take care of utf8 + int incr; + event.character = firstCodePoint( chars [index..$], incr ); sendEvent (type, event); /* @@ -1301,8 +1304,15 @@ if (ptr !is null) OS.gdk_event_free (ptr); return null; } - if (event.doit) chars [count++] = chars [index]; - index++; + + //PORTING take care of utf8 + if (event.doit) { + for( int i = 0; i < incr; i++ ){ + chars [count+i] = chars [index+i]; + } + count+=incr; + } + index+=incr; } if (ptr !is null) OS.gdk_event_free (ptr); if (count is 0) return null;