summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-06-11 15:14:16 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-06-11 15:14:16 (GMT)
commit8f72212fd698ae61734ebcaff08e59a3781f31f4 (patch)
tree4b7a6fac10d116ff32cffde3826336ee8a4fabf1 /win
parent91aae5e4e2fcc969d686c0fd4e5d6f308cb983e3 (diff)
downloadtk-8f72212fd698ae61734ebcaff08e59a3781f31f4.zip
tk-8f72212fd698ae61734ebcaff08e59a3781f31f4.tar.gz
tk-8f72212fd698ae61734ebcaff08e59a3781f31f4.tar.bz2
Switch back to using Tcl_UtfToExternalDString() in tkWinFont.c, since - somehow - changing it doesn't work.
More usage of implicit WCHAR, since we are always building with UNICODE.
Diffstat (limited to 'win')
-rw-r--r--win/tkWinFont.c17
-rw-r--r--win/tkWinInt.h4
-rw-r--r--win/tkWinTest.c23
3 files changed, 25 insertions, 19 deletions
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index ecc18d3..33faede 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -179,6 +179,12 @@ typedef struct ThreadSpecificData {
static Tcl_ThreadDataKey dataKey;
/*
+ * Information cached about the system at startup time.
+ */
+
+static Tcl_Encoding systemEncoding;
+
+/*
* Procedures used only in this file.
*/
@@ -256,6 +262,7 @@ void
TkpFontPkgInit(
TkMainInfo *mainPtr) /* The application being created. */
{
+ systemEncoding = TkWinGetUnicodeEncoding();
TkWinSetupSystemFonts(mainPtr);
}
@@ -657,7 +664,7 @@ WinFontFamilyEnumProc(
int fontType, /* Type of font (not used). */
LPARAM lParam) /* Result object to hold result. */
{
- WCHAR *faceName = (WCHAR *) lfPtr->elfLogFont.lfFaceName;
+ WCHAR *faceName = lfPtr->elfLogFont.lfFaceName;
Tcl_Obj *resultObj = (Tcl_Obj *) lParam;
Tcl_DString faceString;
@@ -2066,7 +2073,7 @@ WinFontCanUseProc(
fontPtr = canUsePtr->fontPtr;
nameTriedPtr = canUsePtr->nameTriedPtr;
- fallbackName = (char *)lfPtr->elfLogFont.lfFaceName;
+ fallbackName = (char *) lfPtr->elfLogFont.lfFaceName;
Tcl_DStringInit(&faceString);
Tcl_UniCharToUtfDString((WCHAR *)fallbackName, wcslen((WCHAR *)fallbackName), &faceString);
fallbackName = Tcl_DStringValue(&faceString);
@@ -2490,8 +2497,7 @@ GetScreenFont(
lf.lfQuality = DEFAULT_QUALITY;
lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
- Tcl_DStringInit(&ds);
- Tcl_UtfToUniCharDString(faceName, -1, &ds);
+ Tcl_UtfToExternalDString(systemEncoding, faceName, -1, &ds);
wcsncpy(lf.lfFaceName, (WCHAR *)Tcl_DStringValue(&ds), LF_FACESIZE-1);
Tcl_DStringFree(&ds);
lf.lfFaceName[LF_FACESIZE-1] = 0;
@@ -2526,8 +2532,7 @@ FamilyExists(
int result;
Tcl_DString faceString;
- Tcl_DStringInit(&faceString);
- Tcl_UtfToUniCharDString(faceName, -1, &faceString);
+ Tcl_UtfToExternalDString(systemEncoding, faceName, -1, &faceString);
/*
* If the family exists, WinFontExistProc() will be called and
diff --git a/win/tkWinInt.h b/win/tkWinInt.h
index 0e2c844..f1c2ee4 100644
--- a/win/tkWinInt.h
+++ b/win/tkWinInt.h
@@ -117,8 +117,8 @@ typedef struct {
* The following macros define the class names for Tk Window types.
*/
-#define TK_WIN_TOPLEVEL_CLASS_NAME TEXT("TkTopLevel")
-#define TK_WIN_CHILD_CLASS_NAME TEXT("TkChild")
+#define TK_WIN_TOPLEVEL_CLASS_NAME L"TkTopLevel"
+#define TK_WIN_CHILD_CLASS_NAME L"TkChild"
/*
* The following variable is a translation table between X gc functions and
diff --git a/win/tkWinTest.c b/win/tkWinTest.c
index 957bc02..14e5433 100644
--- a/win/tkWinTest.c
+++ b/win/tkWinTest.c
@@ -378,20 +378,21 @@ TestwineventObjCmd(
case WM_SETTEXT: {
Tcl_DString ds;
- control = TestFindControl(hwnd, id);
- if (control == NULL) {
- Tcl_SetObjResult(interp,
- Tcl_ObjPrintf("Could not find control with id %d", id));
- return TCL_ERROR;
- }
+ control = TestFindControl(hwnd, id);
+ if (control == NULL) {
+ Tcl_SetObjResult(interp,
+ Tcl_ObjPrintf("Could not find control with id %d", id));
+ return TCL_ERROR;
+ }
+ Tcl_DStringInit(&ds);
Tcl_UtfToExternalDString(NULL, Tcl_GetString(objv[4]), -1, &ds);
- result = SendMessageA(control, WM_SETTEXT, 0,
- (LPARAM) Tcl_DStringValue(&ds));
+ result = SendMessageA(control, WM_SETTEXT, 0,
+ (LPARAM) Tcl_DStringValue(&ds));
Tcl_DStringFree(&ds);
if (result == 0) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to send text to dialog: ", -1));
- AppendSystemError(interp, GetLastError());
- return TCL_ERROR;
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to send text to dialog: ", -1));
+ AppendSystemError(interp, GetLastError());
+ return TCL_ERROR;
}
break;
}