summaryrefslogtreecommitdiffstats
path: root/win/tkWinKey.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2001-03-30 23:50:17 (GMT)
committerhobbs <hobbs>2001-03-30 23:50:17 (GMT)
commit739d4321a3b8dd6e1073ecb19aa5b09eb5893571 (patch)
treeaf9d10c78323c178cd299b0ebd3b034ee96b1b25 /win/tkWinKey.c
parent0dcaafd32b3ba64d04c60046ecbc7d774e60de66 (diff)
downloadtk-739d4321a3b8dd6e1073ecb19aa5b09eb5893571.zip
tk-739d4321a3b8dd6e1073ecb19aa5b09eb5893571.tar.gz
tk-739d4321a3b8dd6e1073ecb19aa5b09eb5893571.tar.bz2
* win/makefile.vc:
* win/configure: * win/tcl.m4: added imm32.lib to LIBS_GUI for Tk IME support. * win/tkWinInt.h: * win/tkWinKey.c: * win/tkWinX.c: added support for changing IME on the fly in Windows (2000). (lam) [Patch #402993]
Diffstat (limited to 'win/tkWinKey.c')
-rw-r--r--win/tkWinKey.c29
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);
}