diff options
Diffstat (limited to 'win/tkWinKey.c')
-rw-r--r-- | win/tkWinKey.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/win/tkWinKey.c b/win/tkWinKey.c index bb61d23..e2b67dd 100644 --- a/win/tkWinKey.c +++ b/win/tkWinKey.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinKey.c,v 1.12 2000/04/15 17:41:20 hobbs Exp $ + * RCS: @(#) $Id: tkWinKey.c,v 1.13 2001/03/30 23:50:17 hobbs Exp $ */ #include "tkWinInt.h" @@ -90,7 +90,29 @@ TkpGetString(winPtr, eventPtr, dsPtr) XKeyEvent* keyEv = &eventPtr->xkey; Tcl_DStringInit(dsPtr); - if (eventPtr->xkey.send_event != -1) { + if (eventPtr->xkey.send_event == -1) { + if (eventPtr->xkey.nbytes > 0) { + Tcl_ExternalToUtfDString(TkWinGetKeyInputEncoding(), + eventPtr->xkey.trans_chars, eventPtr->xkey.nbytes, dsPtr); + } + } else if (eventPtr->xkey.send_event == -2) { + /* + * Special case for win2000 multi-lingal IME input. + * xkey.trans_chars[] already contains a UNICODE char. + */ + + int unichar; + char buf[TCL_UTF_MAX]; + int len; + + unichar = (eventPtr->xkey.trans_chars[1] & 0xff); + unichar <<= 8; + unichar |= (eventPtr->xkey.trans_chars[0] & 0xff); + + len = Tcl_UniCharToUtf((Tcl_UniChar) unichar, buf); + + Tcl_DStringAppend(dsPtr, buf, len); + } else { /* * This is an event generated from generic code. It has no * nchars or trans_chars members. @@ -105,9 +127,6 @@ TkpGetString(winPtr, eventPtr, dsPtr) int len = Tcl_UniCharToUtf((Tcl_UniChar) (keysym & 255), buf); Tcl_DStringAppend(dsPtr, buf, len); } - } else if (eventPtr->xkey.nbytes > 0) { - Tcl_ExternalToUtfDString(NULL, eventPtr->xkey.trans_chars, - eventPtr->xkey.nbytes, dsPtr); } return Tcl_DStringValue(dsPtr); } |