summaryrefslogtreecommitdiffstats
path: root/win/tkWinKey.c
diff options
context:
space:
mode:
Diffstat (limited to 'win/tkWinKey.c')
-rw-r--r--win/tkWinKey.c38
1 files changed, 5 insertions, 33 deletions
diff --git a/win/tkWinKey.c b/win/tkWinKey.c
index 2698c4d..7fee101 100644
--- a/win/tkWinKey.c
+++ b/win/tkWinKey.c
@@ -88,6 +88,8 @@ TkpGetString(
* result. */
{
XKeyEvent *keyEv = &eventPtr->xkey;
+ int len;
+ char buf[6];
Tcl_DStringInit(dsPtr);
if (keyEv->send_event == -1) {
@@ -95,41 +97,14 @@ TkpGetString(
Tcl_ExternalToUtfDString(TkWinGetKeyInputEncoding(),
keyEv->trans_chars, keyEv->nbytes, dsPtr);
}
- } else if (keyEv->send_event == -2) {
- /*
- * Special case for win2000 multi-lingal IME input. xkey.trans_chars[]
- * already contains a UNICODE char.
- */
-
- int unichar;
- char buf[XMaxTransChars];
- int len;
-
- unichar = keyEv->trans_chars[1] & 0xff;
- unichar <<= 8;
- unichar |= keyEv->trans_chars[0] & 0xff;
-
- len = Tcl_UniCharToUtf((Tcl_UniChar) unichar, buf);
-
- Tcl_DStringAppend(dsPtr, buf, len);
} else if (keyEv->send_event == -3) {
- char buf[XMaxTransChars];
- int len;
-
/*
- * Special case for WM_UNICHAR.
+ * Special case for WM_UNICHAR and win2000 multi-lingal IME input
*/
- len = Tcl_UniCharToUtf(keyEv->keycode, buf);
- if ((keyEv->keycode <= 0xffff) || (len == XMaxTransChars)) {
- Tcl_DStringAppend(dsPtr, buf, len);
- } else {
- Tcl_UniCharToUtf(((keyEv->keycode - 0x10000) >> 10) | 0xd800, buf);
- Tcl_DStringAppend(dsPtr, buf, 3);
- Tcl_UniCharToUtf(((keyEv->keycode - 0x10000) & 0x3ff) | 0xdc00, buf);
- Tcl_DStringAppend(dsPtr, buf, 3);
- }
+ len = TkUniCharToUtf(keyEv->keycode, buf);
+ Tcl_DStringAppend(dsPtr, buf, len);
} else {
/*
* This is an event generated from generic code. It has no nchars or
@@ -140,9 +115,6 @@ TkpGetString(
if (((keysym != NoSymbol) && (keysym > 0) && (keysym < 256))
|| (keysym == XK_Return) || (keysym == XK_Tab)) {
- char buf[XMaxTransChars];
- int len;
-
len = Tcl_UniCharToUtf((Tcl_UniChar) (keysym & 255), buf);
Tcl_DStringAppend(dsPtr, buf, len);
}