diff options
-rw-r--r-- | generic/tkEntry.c | 8 | ||||
-rw-r--r-- | generic/tkFont.c | 2 | ||||
-rw-r--r-- | generic/tkFrame.c | 1 | ||||
-rw-r--r-- | generic/tkWindow.c | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXFont.c | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXSubwindows.c | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXXStubs.c | 2 | ||||
-rw-r--r-- | unix/tkUnixRFont.c | 4 | ||||
-rw-r--r-- | win/tkWinFont.c | 2 | ||||
-rw-r--r-- | win/tkWinX.c | 38 |
10 files changed, 36 insertions, 27 deletions
diff --git a/generic/tkEntry.c b/generic/tkEntry.c index ff3f134..9e25bed 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -3412,7 +3412,7 @@ ExpandPercents( * list element. */ int number, length; register const char *string; - Tcl_UniChar ch; + int ch; char numStorage[2*TCL_INTEGER_SPACE]; while (1) { @@ -3445,7 +3445,7 @@ ExpandPercents( before++; /* skip over % */ if (*before != '\0') { - before += Tcl_UtfToUniChar(before, &ch); + before += TkUtfToUniChar(before, &ch); } else { ch = '%'; } @@ -3465,7 +3465,7 @@ ExpandPercents( string = Tk_PathName(entryPtr->tkwin); break; default: - length = Tcl_UniCharToUtf(ch, numStorage); + length = TkUniCharToUtf(ch, numStorage); numStorage[length] = '\0'; string = numStorage; break; @@ -3525,7 +3525,7 @@ ExpandPercents( string = Tk_PathName(entryPtr->tkwin); break; default: - length = Tcl_UniCharToUtf(ch, numStorage); + length = TkUniCharToUtf(ch, numStorage); numStorage[length] = '\0'; string = numStorage; break; diff --git a/generic/tkFont.c b/generic/tkFont.c index ca7b34e..7f2715b 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -1721,7 +1721,7 @@ Tk_PostscriptFontName( } else { ch = Tcl_UniCharToLower(ch); } - dest += Tcl_UniCharToUtf(ch, dest); + dest += TkUniCharToUtf(ch, dest); } *dest = '\0'; Tcl_DStringSetLength(dsPtr, dest - Tcl_DStringValue(dsPtr)); diff --git a/generic/tkFrame.c b/generic/tkFrame.c index f6edfb0..0f1a1b3 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -458,7 +458,6 @@ TkListCreateFrame( * window associated with the interpreter. * Gives the base name to use for the new * application. */ - { int objc; Tcl_Obj **objv; diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 0c60321..5855b7c 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -3101,7 +3101,7 @@ Initialize( Tcl_ListObjAppendElement(NULL, cmd, Tcl_NewStringObj("::safe::TkInit", -1)); Tcl_ListObjAppendElement(NULL, cmd, Tcl_GetObjResult(master)); - + /* * Step 2 : Eval in the master. The argument is the *reversed* interp * path of the slave. diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c index 5b2f28c..d3e0e41 100644 --- a/macosx/tkMacOSXFont.c +++ b/macosx/tkMacOSXFont.c @@ -672,7 +672,7 @@ void TkpGetFontAttrsForChar( Tk_Window tkwin, /* Window on the font's display */ Tk_Font tkfont, /* Font to query */ - int c, /* Character of interest */ + int c, /* Character of interest */ TkFontAttributes* faPtr) /* Output: Font attributes */ { MacFont *fontPtr = (MacFont *) tkfont; diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index 9851474..f92d260 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -365,7 +365,7 @@ XMoveResizeWindow( CGFloat Y = (CGFloat)y; CGFloat Width = (CGFloat)width; CGFloat Height = (CGFloat)height; - CGFloat XOff = (CGFloat)macWin->winPtr->wmInfoPtr->xInParent; + CGFloat XOff = (CGFloat)macWin->winPtr->wmInfoPtr->xInParent; CGFloat YOff = (CGFloat)macWin->winPtr->wmInfoPtr->yInParent; NSRect r = NSMakeRect(X + XOff, tkMacOSXZeroScreenHeight - Y - YOff - Height, diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c index a2d175b..1ed526d 100644 --- a/macosx/tkMacOSXXStubs.c +++ b/macosx/tkMacOSXXStubs.c @@ -897,7 +897,7 @@ XGetImage( * We do not support any other values here. */ int scalefactor = 1; - if (win && [win respondsToSelector:@selector(backingScaleFactor)]) { + if (win && [win respondsToSelector:@selector(backingScaleFactor)]) { scalefactor = ([win backingScaleFactor] == 2.0) ? 2 : 1; } int scaled_height = height * scalefactor; diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index edcfc8a..41cd096 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -778,7 +778,7 @@ LookUpColor(Display *display, /* Display to lookup colors on */ i >= 0; last2 = last, last = i, i = fontPtr->colors[i].next) { if (pixel == fontPtr->colors[i].color.pixel) { - /* + /* * Color found in cache. Move it to the front of the list and return it. */ if (last >= 0) { @@ -802,7 +802,7 @@ LookUpColor(Display *display, /* Display to lookup colors on */ last = fontPtr->ncolors++; } - /* + /* * Translate the pixel value to a color. Needs a server round-trip. */ xcolor.pixel = pixel; diff --git a/win/tkWinFont.c b/win/tkWinFont.c index a281a4f..7c6c0ba 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -742,7 +742,7 @@ void TkpGetFontAttrsForChar( Tk_Window tkwin, /* Window on the font's display */ Tk_Font tkfont, /* Font to query */ - int c, /* Character of interest */ + int c, /* Character of interest */ TkFontAttributes *faPtr) /* Output: Font attributes */ { WinFont *fontPtr = (WinFont *) tkfont; diff --git a/win/tkWinX.c b/win/tkWinX.c index 987fbb5..b2424ce 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -92,7 +92,7 @@ static Tcl_ThreadDataKey dataKey; static void GenerateXEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); static unsigned int GetState(UINT message, WPARAM wParam, LPARAM lParam); -static void GetTranslatedKey(XKeyEvent *xkey); +static void GetTranslatedKey(XKeyEvent *xkey, UINT type); static void UpdateInputLanguage(int charset); static int HandleIMEComposition(HWND hwnd, LPARAM lParam); @@ -1157,7 +1157,8 @@ GenerateXEvent( event.type = KeyPress; event.xany.send_event = -1; event.xkey.keycode = wParam; - GetTranslatedKey(&event.xkey); + GetTranslatedKey(&event.xkey, (message == WM_KEYDOWN) ? WM_CHAR : + WM_SYSCHAR); break; case WM_SYSKEYUP: @@ -1229,9 +1230,10 @@ GenerateXEvent( if (IsDBCSLeadByte((BYTE) wParam)) { MSG msg; - if ((PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) != 0) + if ((PeekMessage(&msg, NULL, WM_CHAR, WM_CHAR, + PM_NOREMOVE) != 0) && (msg.message == WM_CHAR)) { - GetMessage(&msg, NULL, 0, 0); + GetMessage(&msg, NULL, WM_CHAR, WM_CHAR); event.xkey.nbytes = 2; event.xkey.trans_chars[1] = (char) msg.wParam; } @@ -1370,19 +1372,20 @@ GetState( static void GetTranslatedKey( - XKeyEvent *xkey) + XKeyEvent *xkey, + UINT type) { MSG msg; xkey->nbytes = 0; while ((xkey->nbytes < XMaxTransChars) - && PeekMessageA(&msg, NULL, 0, 0, PM_NOREMOVE)) { - if ((msg.message != WM_CHAR) && (msg.message != WM_SYSCHAR)) { + && (PeekMessageA(&msg, NULL, type, type, PM_NOREMOVE) != 0)) { + if (msg.message != type) { break; } - GetMessageA(&msg, NULL, 0, 0); + GetMessageA(&msg, NULL, type, type); /* * If this is a normal character message, we may need to strip off the @@ -1523,7 +1526,7 @@ TkWinGetUnicodeEncoding(void) * * HandleIMEComposition -- * - * This function works around a definciency in some versions of Windows + * This function works around a deficiency in some versions of Windows * 2000 to make it possible to entry multi-lingual characters under all * versions of Windows 2000. * @@ -1553,6 +1556,7 @@ HandleIMEComposition( { HIMC hIMC; int n; + int high = 0; if ((lParam & GCS_RESULTSTR) == 0) { /* @@ -1570,12 +1574,12 @@ HandleIMEComposition( n = ImmGetCompositionString(hIMC, GCS_RESULTSTR, NULL, 0); if (n > 0) { - char *buff = ckalloc(n); + WCHAR *buff = (WCHAR *) ckalloc(n); TkWindow *winPtr; XEvent event; int i; - n = ImmGetCompositionString(hIMC, GCS_RESULTSTR, buff, (unsigned) n); + n = ImmGetCompositionString(hIMC, GCS_RESULTSTR, buff, (unsigned) n) / 2; /* * Set up the fields pertinent to key event. @@ -1600,7 +1604,6 @@ HandleIMEComposition( event.xkey.state = TkWinGetModifierState(); event.xkey.time = TkpGetMS(); event.xkey.same_screen = True; - event.xkey.nbytes = 0; for (i=0; i<n; ) { /* @@ -1608,9 +1611,16 @@ HandleIMEComposition( * UNICODE character in the composition. */ - event.xkey.keycode = ((unsigned char) buff[i++]) << 8; - event.xkey.keycode += (unsigned char) buff[i++]; + event.xkey.keycode = buff[i++]; + if ((event.xkey.keycode & 0xfc00) == 0xd800) { + high = ((event.xkey.keycode & 0x3ff) << 10) + 0x10000; + break; + } else if (high && (event.xkey.keycode & 0xfc00) == 0xdc00) { + event.xkey.keycode &= 0x3ff; + event.xkey.keycode += high; + high = 0; + } event.type = KeyPress; Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); |