diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-05-17 14:30:10 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-05-17 14:30:10 (GMT) |
commit | b57fd64f0b6a601210b3a91bb3afa78ab1b9d28c (patch) | |
tree | 0b3fda6e6c85bf245c7ad42cabee8f06fd6a4687 /generic/tkCmds.c | |
parent | 52d33317608b7963059a1ca37e3d3cc9d5c9aa44 (diff) | |
parent | 4e04d8c4e5426b6166e7100e72ab3e01b5e71af1 (diff) | |
download | tk-b57fd64f0b6a601210b3a91bb3afa78ab1b9d28c.zip tk-b57fd64f0b6a601210b3a91bb3afa78ab1b9d28c.tar.gz tk-b57fd64f0b6a601210b3a91bb3afa78ab1b9d28c.tar.bz2 |
Merge 8.7
Diffstat (limited to 'generic/tkCmds.c')
-rw-r--r-- | generic/tkCmds.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/generic/tkCmds.c b/generic/tkCmds.c index f60da14..ec48f91 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -60,6 +60,7 @@ MODULE_SCOPE const TkEnsemble tkFontchooserEnsemble[]; */ static const TkEnsemble tkCmdMap[] = { + {"fontchooser", NULL, tkFontchooserEnsemble}, {"appname", AppnameCmd, NULL }, {"busy", Tk_BusyObjCmd, NULL }, {"caret", CaretCmd, NULL }, @@ -67,7 +68,6 @@ static const TkEnsemble tkCmdMap[] = { {"scaling", ScalingCmd, NULL }, {"useinputmethods", UseinputmethodsCmd, NULL }, {"windowingsystem", WindowingsystemCmd, NULL }, - {"fontchooser", NULL, tkFontchooserEnsemble}, {NULL, NULL, NULL} }; @@ -185,10 +185,10 @@ Tk_BindObjCmd( if (winPtr == NULL) { return TCL_ERROR; } - object = (ClientData) winPtr->pathName; + object = winPtr->pathName; } else { winPtr = (TkWindow *)clientData; - object = (ClientData) Tk_GetUid(string); + object = (void *) Tk_GetUid(string); } /* @@ -267,10 +267,10 @@ TkBindEventProc( XEvent *eventPtr) /* Information about event. */ { #define MAX_OBJS 20 - ClientData objects[MAX_OBJS], *objPtr; + void *objects[MAX_OBJS], **objPtr; TkWindow *topLevPtr; TkSizeT i, count; - const char *p; + char *p; Tcl_HashEntry *hPtr; if ((winPtr->mainPtr == NULL) || (winPtr->mainPtr->bindingTable == NULL)) { @@ -288,7 +288,7 @@ TkBindEventProc( objPtr = (void **)ckalloc(winPtr->numTags * sizeof(void *)); } for (i = 0; i < winPtr->numTags; i++) { - p = (const char *)winPtr->tagPtr[i]; + p = (char *)winPtr->tagPtr[i]; if (*p == '.') { hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->nameTable, p); if (hPtr != NULL) { @@ -297,12 +297,12 @@ TkBindEventProc( p = NULL; } } - objPtr[i] = (ClientData) p; + objPtr[i] = p; } count = winPtr->numTags; } else { - objPtr[0] = (ClientData) winPtr->pathName; - objPtr[1] = (ClientData) winPtr->classUid; + objPtr[0] = winPtr->pathName; + objPtr[1] = (void *)winPtr->classUid; for (topLevPtr = winPtr; (topLevPtr != NULL) && !(topLevPtr->flags & TK_TOP_HIERARCHY); topLevPtr = topLevPtr->parentPtr) { @@ -310,11 +310,11 @@ TkBindEventProc( } if ((winPtr != topLevPtr) && (topLevPtr != NULL)) { count = 4; - objPtr[2] = (ClientData) topLevPtr->pathName; + objPtr[2] = topLevPtr->pathName; } else { count = 3; } - objPtr[count-1] = (ClientData) Tk_GetUid("all"); + objPtr[count-1] = (void *) Tk_GetUid("all"); } Tk_BindEvent(winPtr->mainPtr->bindingTable, eventPtr, (Tk_Window) winPtr, count, objPtr); @@ -414,9 +414,9 @@ Tk_BindtagsObjCmd( copy = (char *)ckalloc(strlen(p) + 1); strcpy(copy, p); - winPtr->tagPtr[i] = (ClientData) copy; + winPtr->tagPtr[i] = copy; } else { - winPtr->tagPtr[i] = (ClientData) Tk_GetUid(p); + winPtr->tagPtr[i] = (void *)Tk_GetUid(p); } } return TCL_OK; @@ -649,9 +649,13 @@ TkInitTkCmd( Tcl_Interp *interp, ClientData clientData) { - TkMakeEnsemble(interp, "::", "tk", clientData, tkCmdMap); + /* If the interp is safe, leave out "fontchooser" */ + int isSafe = Tcl_IsSafe(interp); + TkMakeEnsemble(interp, "::", "tk", clientData, tkCmdMap + isSafe); #if defined(_WIN32) || defined(MAC_OSX_TK) - TkInitFontchooser(interp, clientData); + if (!isSafe) { + TkInitFontchooser(interp, clientData); + } #endif return TCL_OK; } |