summaryrefslogtreecommitdiffstats
path: root/unix/tkUnixScale.c
diff options
context:
space:
mode:
Diffstat (limited to 'unix/tkUnixScale.c')
-rw-r--r--unix/tkUnixScale.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/unix/tkUnixScale.c b/unix/tkUnixScale.c
index e158549..cc33a27 100644
--- a/unix/tkUnixScale.c
+++ b/unix/tkUnixScale.c
@@ -46,7 +46,7 @@ TkScale *
TkpCreateScale(
Tk_Window tkwin)
{
- return (TkScale *) ckalloc(sizeof(TkScale));
+ return ckalloc(sizeof(TkScale));
}
/*
@@ -71,7 +71,7 @@ void
TkpDestroyScale(
TkScale *scalePtr)
{
- Tcl_EventuallyFree((ClientData) scalePtr, TCL_DYNAMIC);
+ Tcl_EventuallyFree(scalePtr, TCL_DYNAMIC);
}
/*
@@ -537,6 +537,7 @@ TkpDisplayScale(
int result;
char string[PRINT_CHARS];
XRectangle drawnArea;
+ Tcl_DString buf;
scalePtr->flags &= ~REDRAW_PENDING;
if ((scalePtr->tkwin == NULL) || !Tk_IsMapped(scalePtr->tkwin)) {
@@ -547,24 +548,28 @@ TkpDisplayScale(
* Invoke the scale's command if needed.
*/
- Tcl_Preserve((ClientData) scalePtr);
+ Tcl_Preserve(scalePtr);
if ((scalePtr->flags & INVOKE_COMMAND) && (scalePtr->command != NULL)) {
- Tcl_Preserve((ClientData) interp);
+ Tcl_Preserve(interp);
sprintf(string, scalePtr->format, scalePtr->value);
- result = Tcl_VarEval(interp, scalePtr->command, " ", string,
- (char *) NULL);
+ Tcl_DStringInit(&buf);
+ Tcl_DStringAppend(&buf, scalePtr->command, -1);
+ Tcl_DStringAppend(&buf, " ", -1);
+ Tcl_DStringAppend(&buf, string, -1);
+ result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, 0);
+ Tcl_DStringFree(&buf);
if (result != TCL_OK) {
Tcl_AddErrorInfo(interp, "\n (command executed by scale)");
- Tcl_BackgroundError(interp);
+ Tcl_BackgroundException(interp, result);
}
- Tcl_Release((ClientData) interp);
+ Tcl_Release(interp);
}
scalePtr->flags &= ~INVOKE_COMMAND;
if (scalePtr->flags & SCALE_DELETED) {
- Tcl_Release((ClientData) scalePtr);
+ Tcl_Release(scalePtr);
return;
}
- Tcl_Release((ClientData) scalePtr);
+ Tcl_Release(scalePtr);
#ifndef TK_NO_DOUBLE_BUFFERING
/*