summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2021-03-19 14:16:08 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2021-03-19 14:16:08 (GMT)
commitd0cea6b66ee95113d0dad0eb8be5f117d48d901b (patch)
tree9aa0f7acc88b52b81b469ee4acd2524b1c32997b /generic
parente9f3439f70e36130011ece4455e8e9bbfc691afa (diff)
parent1a3588fddcd6bac239367f9c7dc73b642a2546a5 (diff)
downloadtk-d0cea6b66ee95113d0dad0eb8be5f117d48d901b.zip
tk-d0cea6b66ee95113d0dad0eb8be5f117d48d901b.tar.gz
tk-d0cea6b66ee95113d0dad0eb8be5f117d48d901b.tar.bz2
Merge 8.6
Diffstat (limited to 'generic')
-rw-r--r--generic/tkInt.h4
-rw-r--r--generic/tkWindow.c27
2 files changed, 27 insertions, 4 deletions
diff --git a/generic/tkInt.h b/generic/tkInt.h
index 843a502..c171bf0 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -701,6 +701,10 @@ typedef struct TkMainInfo {
struct TkMainInfo *nextPtr; /* Next in list of all main windows managed by
* this process. */
Tcl_HashTable busyTable; /* Information used by [tk busy] command. */
+ Tcl_ObjCmdProc *tclUpdateObjProc;
+ /* Saved Tcl [update] command, used to restore
+ * Tcl's version of [update] after Tk is shut
+ * down */
} TkMainInfo;
/*
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 2a98876..d3a6052 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -93,6 +93,7 @@ static const XSetWindowAttributes defAtts= {
#define PASSMAINWINDOW 2
#define WINMACONLY 4
#define USEINITPROC 8
+#define SAVEUPDATECMD 16 /* better only be one of these! */
typedef int (TkInitProc)(Tcl_Interp *interp, ClientData clientData);
typedef struct {
@@ -126,7 +127,7 @@ static const TkCmd commands[] = {
{"selection", Tk_SelectionObjCmd, PASSMAINWINDOW},
{"tk", (Tcl_ObjCmdProc *)(void *)TkInitTkCmd, USEINITPROC|PASSMAINWINDOW|ISSAFE},
{"tkwait", Tk_TkwaitObjCmd, PASSMAINWINDOW|ISSAFE},
- {"update", Tk_UpdateObjCmd, PASSMAINWINDOW|ISSAFE},
+ {"update", Tk_UpdateObjCmd, PASSMAINWINDOW|ISSAFE|SAVEUPDATECMD},
{"winfo", Tk_WinfoObjCmd, PASSMAINWINDOW|ISSAFE},
{"wm", Tk_WmObjCmd, PASSMAINWINDOW},
@@ -876,6 +877,7 @@ TkCreateMainWindow(
Tcl_InitHashTable(&mainPtr->imageTable, TCL_STRING_KEYS);
mainPtr->strictMotif = 0;
mainPtr->alwaysShowSelection = 0;
+ mainPtr->tclUpdateObjProc = NULL;
if (Tcl_LinkVar(interp, "tk_strictMotif", (char *) &mainPtr->strictMotif,
TCL_LINK_BOOLEAN) != TCL_OK) {
Tcl_ResetResult(interp);
@@ -915,6 +917,8 @@ TkCreateMainWindow(
isSafe = Tcl_IsSafe(interp);
for (cmdPtr = commands; cmdPtr->name != NULL; cmdPtr++) {
+ Tcl_CmdInfo cmdInfo;
+
if (cmdPtr->objProc == NULL) {
Tcl_Panic("TkCreateMainWindow: builtin command with NULL string and object procs");
}
@@ -934,6 +938,11 @@ TkCreateMainWindow(
} else {
clientData = NULL;
}
+ if ((cmdPtr->flags & SAVEUPDATECMD) &&
+ Tcl_GetCommandInfo(interp, cmdPtr->name, &cmdInfo) &&
+ cmdInfo.isNativeObjectProc) {
+ mainPtr->tclUpdateObjProc = cmdInfo.objProc;
+ }
if (cmdPtr->flags & USEINITPROC) {
((TkInitProc *)(void *)cmdPtr->objProc)(interp, clientData);
} else {
@@ -1496,10 +1505,20 @@ Tk_DestroyWindow(
*/
if ((winPtr->mainPtr->interp != NULL) &&
- !Tcl_InterpDeleted(winPtr->mainPtr->interp)) {
+ !Tcl_InterpDeleted(winPtr->mainPtr->interp)) {
for (cmdPtr = commands; cmdPtr->name != NULL; cmdPtr++) {
- Tcl_CreateObjCommand(winPtr->mainPtr->interp, cmdPtr->name,
- TkDeadAppObjCmd, NULL, NULL);
+ if ((cmdPtr->flags & SAVEUPDATECMD) &&
+ winPtr->mainPtr->tclUpdateObjProc != NULL) {
+ /* Restore Tcl's version of [update] */
+ Tcl_CreateObjCommand(winPtr->mainPtr->interp,
+ cmdPtr->name,
+ winPtr->mainPtr->tclUpdateObjProc,
+ NULL, NULL);
+ } else {
+ Tcl_CreateObjCommand(winPtr->mainPtr->interp,
+ cmdPtr->name, TkDeadAppObjCmd,
+ NULL, NULL);
+ }
}
Tcl_CreateObjCommand(winPtr->mainPtr->interp, "send",
TkDeadAppObjCmd, NULL, NULL);