summaryrefslogtreecommitdiffstats
path: root/generic/tkScale.c
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2016-03-07 21:01:49 (GMT)
committerfvogel <fvogelnew1@free.fr>2016-03-07 21:01:49 (GMT)
commit1e12a7a6bfefbc1315f92dfb45a245d831328e4e (patch)
tree40b9d6f440e7ddb575b8a3c05012c6251aad6489 /generic/tkScale.c
parentc7d53262ae761b4bffa6be4626431ec3e58bf394 (diff)
downloadtk-1e12a7a6bfefbc1315f92dfb45a245d831328e4e.zip
tk-1e12a7a6bfefbc1315f92dfb45a245d831328e4e.tar.gz
tk-1e12a7a6bfefbc1315f92dfb45a245d831328e4e.tar.bz2
Fixed bug [2262543] - Scale widget unexpectedly fires command callback (cherrypicked [3c1a8559dd])
Diffstat (limited to 'generic/tkScale.c')
-rw-r--r--generic/tkScale.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/generic/tkScale.c b/generic/tkScale.c
index cc7c294..cbc5202 100644
--- a/generic/tkScale.c
+++ b/generic/tkScale.c
@@ -303,6 +303,12 @@ Tk_ScaleObjCmd(
return TCL_ERROR;
}
+ /*
+ * The widget was just created, no command callback must be invoked.
+ */
+
+ scalePtr->flags &= ~INVOKE_COMMAND;
+
Tcl_SetObjResult(interp, TkNewWindowObj(scalePtr->tkwin));
return TCL_OK;
}
@@ -1268,7 +1274,14 @@ TkScaleSetValue(
return;
}
scalePtr->value = value;
- if (invokeCommand) {
+
+ /*
+ * Schedule command callback invocation only if there is such a command
+ * already registered, otherwise the callback would trigger later when
+ * configuring the widget -command option even if the value did not change.
+ */
+
+ if ((invokeCommand) && (scalePtr->command != NULL)) {
scalePtr->flags |= INVOKE_COMMAND;
}
TkEventuallyRedrawScale(scalePtr, REDRAW_SLIDER);