summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-03-15 20:24:47 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-03-15 20:24:47 (GMT)
commit5d3696a737a0d6cbfc1c3eda16547cff2f9078d7 (patch)
treead635935285c9cb8e34d1f1c7cb147700351236e /generic
parente7ffce5e2c326fd4b70d785a4cab86708aa9c9df (diff)
downloadtk-5d3696a737a0d6cbfc1c3eda16547cff2f9078d7.zip
tk-5d3696a737a0d6cbfc1c3eda16547cff2f9078d7.tar.gz
tk-5d3696a737a0d6cbfc1c3eda16547cff2f9078d7.tar.bz2
Make Tk run on win32/win64 using -DTCL_UTF_MAX=6. Adapted from androwish.
Diffstat (limited to 'generic')
-rw-r--r--generic/tkFocus.c6
-rw-r--r--generic/tkImgGIF.c2
-rw-r--r--generic/tkMain.c39
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