summaryrefslogtreecommitdiffstats
path: root/win/tkWinKey.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-09-08 08:03:58 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-09-08 08:03:58 (GMT)
commit54d082b5c348c688eae446436c0077684686e610 (patch)
tree6957f3a17d7f62d0261409847c98242481ba0588 /win/tkWinKey.c
parent571a9ffc9dec8cbd9963a3c826b1467dc3997b77 (diff)
parentb9e7a10e1ce61e6cdcf964487e5ecacfeb531311 (diff)
downloadtk-54d082b5c348c688eae446436c0077684686e610.zip
tk-54d082b5c348c688eae446436c0077684686e610.tar.gz
tk-54d082b5c348c688eae446436c0077684686e610.tar.bz2
Fix [6c0d7aec6713ab6a7c3e12dff7f26bff4679bc9d|6c0d7aec67]: unicode text input Windows 8
Diffstat (limited to 'win/tkWinKey.c')
-rw-r--r--win/tkWinKey.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/win/tkWinKey.c b/win/tkWinKey.c
index 3d2a16a..2698c4d 100644
--- a/win/tkWinKey.c
+++ b/win/tkWinKey.c
@@ -113,12 +113,23 @@ TkpGetString(
Tcl_DStringAppend(dsPtr, buf, len);
} else if (keyEv->send_event == -3) {
+
+ char buf[XMaxTransChars];
+ int len;
+
/*
- * Special case for WM_UNICHAR. xkey.trans_chars[] already contains a
- * UTF-8 char.
+ * Special case for WM_UNICHAR.
*/
- Tcl_DStringAppend(dsPtr, keyEv->trans_chars, keyEv->nbytes);
+ 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);
+ }
} else {
/*
* This is an event generated from generic code. It has no nchars or