diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkFocus.c | 6 | ||||
-rw-r--r-- | generic/tkImgGIF.c | 2 | ||||
-rw-r--r-- | generic/tkMain.c | 39 |
3 files changed, 30 insertions, 17 deletions
diff --git a/generic/tkFocus.c b/generic/tkFocus.c index c621bf9..eae981e 100644 --- a/generic/tkFocus.c +++ b/generic/tkFocus.c @@ -630,7 +630,7 @@ TkSetFocusWin( tlFocusPtr->focusWinPtr = winPtr; if (topLevelPtr->flags & TK_EMBEDDED) { - + /* * We are assigning focus to an embedded toplevel. The platform * specific function TkpClaimFocus needs to handle the job of @@ -646,7 +646,7 @@ TkSetFocusWin( * toplevel from a different application, clear the focus in that * application. */ - + if (force) { TkWindow *focusPtr = winPtr->dispPtr->focusPtr; if (focusPtr && focusPtr->mainPtr != winPtr->mainPtr) { @@ -660,7 +660,7 @@ TkSetFocusWin( * Call the platform specific function TkpChangeFocus to move the * window manager's focus to a new toplevel. */ - + serial = TkpChangeFocus(TkpGetWrapperWindow(topLevelPtr), force); if (serial != 0) { displayFocusPtr->focusSerial = serial; diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c index fa4b728..0c32047 100644 --- a/generic/tkImgGIF.c +++ b/generic/tkImgGIF.c @@ -1260,7 +1260,7 @@ ReadImage( * * The field "stack" is abused for temporary buffer. it has 4096 bytes * and we need 256. - * + * * Loop until we hit a 0 length block which is the end sign. */ while ( 0 < (count = GetDataBlock(gifConfPtr, chan, stack))) diff --git a/generic/tkMain.c b/generic/tkMain.c index a7d4ca1..3600142 100644 --- a/generic/tkMain.c +++ b/generic/tkMain.c @@ -79,22 +79,35 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr; #endif /* - * Further on, in UNICODE mode, we need to use Tcl_NewUnicodeObj, - * while otherwise NewNativeObj is needed (which provides proper - * conversion from native encoding to UTF-8). + * Further on, in UNICODE mode we just use Tcl_NewUnicodeObj, otherwise + * NewNativeObj is needed (which provides proper conversion from native + * encoding to UTF-8). */ -#ifdef UNICODE + +#if defined(UNICODE) && (TCL_UTF_MAX <= 4) # define NewNativeObj Tcl_NewUnicodeObj -#else /* !UNICODE */ - static Tcl_Obj *NewNativeObj(char *string, int length) { - Tcl_Obj *obj; - Tcl_DString ds; - Tcl_ExternalToUtfDString(NULL, string, length, &ds); - obj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); - Tcl_DStringFree(&ds); - return obj; +#else /* !UNICODE || (TCL_UTF_MAX > 4) */ +static inline Tcl_Obj * +NewNativeObj( + TCHAR *string, + int length) +{ + Tcl_Obj *obj; + Tcl_DString ds; + +#ifdef UNICODE + if (length > 0) { + length *= sizeof(WCHAR); + } + Tcl_WinTCharToUtf(string, length, &ds); +#else + Tcl_ExternalToUtfDString(NULL, (char *) string, length, &ds); +#endif + obj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); + Tcl_DStringFree(&ds); + return obj; } -#endif /* !UNICODE */ +#endif /* !UNICODE || (TCL_UTF_MAX > 4) */ /* * Declarations for various library functions and variables (don't want to |