summaryrefslogtreecommitdiffstats
path: root/win/tkWinX.c
diff options
context:
space:
mode:
authorjan.nijtmans <jan.nijtmans@noemail.net>2016-09-01 13:21:49 (GMT)
committerjan.nijtmans <jan.nijtmans@noemail.net>2016-09-01 13:21:49 (GMT)
commit3996ac42e2a2ab1255456e6931a91dcc314e02e9 (patch)
treef277aed8334f7eb42ec11d0dea0c75d747cd0cde /win/tkWinX.c
parent812b81e33f1524497899bc7c49c965b638d6072e (diff)
downloadtk-3996ac42e2a2ab1255456e6931a91dcc314e02e9.zip
tk-3996ac42e2a2ab1255456e6931a91dcc314e02e9.tar.gz
tk-3996ac42e2a2ab1255456e6931a91dcc314e02e9.tar.bz2
(experiment) don't fill trans_chars any more when send_event == -3. Results in many simplifications while it still should work the same
FossilOrigin-Name: 64509821eb7643494337c5b79834c0f96ba6a941
Diffstat (limited to 'win/tkWinX.c')
-rw-r--r--win/tkWinX.c64
1 files changed, 4 insertions, 60 deletions
diff --git a/win/tkWinX.c b/win/tkWinX.c
index e8715b3..ccccf56 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -1210,8 +1210,7 @@ GenerateXEvent(
event.xany.send_event = -1;
event.xkey.keycode = 0;
if ((int)wParam & 0xff00) {
- int i, ch1 = wParam & 0xffff;
- char buffer[XMaxTransChars];
+ int ch1 = wParam & 0xffff;
if ((ch1 & 0xfc00) == 0xd800) {
tsdPtr->surrogateBuffer = ch1;
@@ -1223,32 +1222,8 @@ GenerateXEvent(
tsdPtr->surrogateBuffer = 0;
}
event.xany.send_event = -3;
- event.xkey.nbytes = Tcl_UniCharToUtf(ch1, buffer);
- if ((ch1 <= 0xffff) || (event.xkey.nbytes == XMaxTransChars)) {
- event.xkey.keycode = ch1;
- for (i=0; i<event.xkey.nbytes && i<XMaxTransChars; ++i) {
- event.xkey.trans_chars[i] = buffer[i];
- }
- } else {
-#ifdef USE_EXTRA_EVENTS
- event.xkey.keycode = ((int)(ch1 - 0x10000)>>10) | 0xd800;
- event.xkey.nbytes = Tcl_UniCharToUtf(event.xkey.keycode, buffer);
- for (i=0; i<event.xkey.nbytes && i<XMaxTransChars; ++i) {
- event.xkey.trans_chars[i] = buffer[i];
- }
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
- event.type = KeyRelease;
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
- event.type = KeyPress;
- event.xkey.keycode = ((int)(ch1 - 0x10000)&0x3ff) | 0xdc00;
- event.xkey.nbytes = Tcl_UniCharToUtf(event.xkey.keycode, buffer);
- for (i=0; i<event.xkey.nbytes && i<XMaxTransChars; ++i) {
- event.xkey.trans_chars[i] = buffer[i];
- }
-#else
- event.xkey.nbytes = 0;
-#endif
- }
+ event.xkey.nbytes = 0;
+ event.xkey.keycode = ch1;
} else {
event.xkey.nbytes = 1;
event.xkey.trans_chars[0] = (char) wParam;
@@ -1269,41 +1244,10 @@ GenerateXEvent(
break;
case WM_UNICHAR: {
- char buffer[XMaxTransChars];
- int i;
event.type = KeyPress;
event.xany.send_event = -3;
event.xkey.keycode = wParam;
- event.xkey.nbytes = Tcl_UniCharToUtf((int)wParam, buffer);
- if(((int)wParam > 0xffff) && (event.xkey.nbytes < XMaxTransChars)) {
-#if USE_EXTRA_EVENTS
- /* trans_chars buffer is not big enough to hold 2 surrogate
- characters, so split it in two separate events */
-
- event.xkey.keycode = ((int)(wParam - 0x10000)>>10) | 0xd800;
- event.xkey.nbytes = Tcl_UniCharToUtf(event.xkey.keycode, buffer);
- for (i=0; i<event.xkey.nbytes && i<XMaxTransChars; ++i) {
- event.xkey.trans_chars[i] = buffer[i];
- }
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
- event.type = KeyRelease;
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
- event.type = KeyPress;
- event.xkey.keycode = ((int)(wParam - 0x10000)&0x3ff) | 0xdc00;
- event.xkey.nbytes = Tcl_UniCharToUtf(event.xkey.keycode, buffer);
- for (i=0; i<event.xkey.nbytes && i<XMaxTransChars; ++i) {
- event.xkey.trans_chars[i] = buffer[i];
- }
-#else
- /* trans_chars buffer is not big enough to hold 2 surrogate
- characters, so don't store anything redundant anyway. */
- event.xkey.nbytes = 0;
-#endif
- } else {
- for (i=0; i<event.xkey.nbytes && i<XMaxTransChars; ++i) {
- event.xkey.trans_chars[i] = buffer[i];
- }
- }
+ event.xkey.nbytes = 0;
Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
event.type = KeyRelease;
break;