From e3249c7140d13964c60a406053e850c11fe0a8d3 Mon Sep 17 00:00:00 2001 From: hobbs Date: Tue, 21 Dec 1999 23:55:09 +0000 Subject: * generic/tk.h: * README: updated for patch level 8.3b1 * generic/tkScale.c: * generic/tkScale.h: fixed possible core when freeing options (cursor) associated with scale widget [Bug: 3897] * generic/tk3d.c: added extra calculations to ensure that thin frames get refreshed too [Bug: 3596] * generic/tkCanvText.c: * generic/tkEntry.c: * generic/tkFont.c: * generic/tkImgPPM.c: removed extranneous vars that were set but never used. --- generic/tk.h | 9 +++++---- generic/tk3d.c | 13 ++++++++++++- generic/tkCanvText.c | 5 +---- generic/tkCmds.c | 4 ++-- generic/tkEntry.c | 6 +----- generic/tkFont.c | 4 +--- generic/tkImgPPM.c | 8 ++------ generic/tkScale.c | 23 ++++++++++++----------- generic/tkScale.h | 20 +++++++++++--------- 9 files changed, 47 insertions(+), 45 deletions(-) diff --git a/generic/tk.h b/generic/tk.h index 1217e26..0dba382 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tk.h,v 1.34 1999/12/14 06:52:25 hobbs Exp $ + * RCS: @(#) $Id: tk.h,v 1.35 1999/12/21 23:55:09 hobbs Exp $ */ #ifndef _TK @@ -38,18 +38,19 @@ extern "C" { * mac/README (not patchlevel) * win/README (not patchlevel) * unix/README (not patchlevel) - + * win/aclocal.m4 (not patchlevel) + * * You may also need to update some of these files when the numbers change * for the version of Tcl that this release of Tk is compiled against. */ #define TK_MAJOR_VERSION 8 #define TK_MINOR_VERSION 3 -#define TK_RELEASE_LEVEL TCL_ALPHA_RELEASE +#define TK_RELEASE_LEVEL TCL_BETA_RELEASE #define TK_RELEASE_SERIAL 1 #define TK_VERSION "8.3" -#define TK_PATCH_LEVEL "8.3a1" +#define TK_PATCH_LEVEL "8.3b1" /* * The following definitions set up the proper options for Macintosh diff --git a/generic/tk3d.c b/generic/tk3d.c index 9caf526..8cbe0ee 100644 --- a/generic/tk3d.c +++ b/generic/tk3d.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tk3d.c,v 1.5 1999/04/21 21:53:23 rjohnson Exp $ + * RCS: @(#) $Id: tk3d.c,v 1.6 1999/12/21 23:55:10 hobbs Exp $ */ #include "tk3d.h" @@ -975,6 +975,17 @@ Tk_Fill3DRectangle(tkwin, drawable, border, x, y, width, if (relief == TK_RELIEF_FLAT) { borderWidth = 0; + } else { + /* + * We need to make this extra check, otherwise we will leave + * garbage in thin frames [Bug: 3596] + */ + if (width < 2*borderWidth) { + borderWidth = width/2; + } + if (height < 2*borderWidth) { + borderWidth = height/2; + } } doubleBorder = 2*borderWidth; diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index 4e826e9..fa419c3 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCanvText.c,v 1.7 1999/12/14 06:52:26 hobbs Exp $ + * RCS: @(#) $Id: tkCanvText.c,v 1.8 1999/12/21 23:55:10 hobbs Exp $ */ #include @@ -767,9 +767,6 @@ DisplayCanvText(canvas, itemPtr, display, drawable, x, y, width, height) selLastChar = 0; /* lint. */ if (textInfoPtr->selItemPtr == itemPtr) { - char *text; - - text = textPtr->text; selFirstChar = textInfoPtr->selectFirst; selLastChar = textInfoPtr->selectLast; if (selLastChar > textPtr->numChars) { diff --git a/generic/tkCmds.c b/generic/tkCmds.c index 15650f2..ffa171f 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCmds.c,v 1.9 1999/12/16 21:57:35 hobbs Exp $ + * RCS: @(#) $Id: tkCmds.c,v 1.10 1999/12/21 23:55:10 hobbs Exp $ */ #include "tkPort.h" @@ -652,7 +652,6 @@ Tk_TkObjCmd(clientData, interp, objc, objv) dispPtr = ((TkWindow *) tkwin)->dispPtr; } if ((objc - skip) == 3) { -#ifdef TK_USE_INPUT_METHODS /* * In the case where TK_USE_INPUT_METHODS is not defined, * this will be ignored and we will always return 0. @@ -664,6 +663,7 @@ Tk_TkObjCmd(clientData, interp, objc, objv) != TCL_OK) { return TCL_ERROR; } +#ifdef TK_USE_INPUT_METHODS dispPtr->useInputMethods = bool; #endif /* TK_USE_INPUT_METHODS */ } else if ((objc - skip) != 2) { diff --git a/generic/tkEntry.c b/generic/tkEntry.c index ac0f288..856869f 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkEntry.c,v 1.7 1999/12/14 06:52:27 hobbs Exp $ + * RCS: @(#) $Id: tkEntry.c,v 1.8 1999/12/21 23:55:10 hobbs Exp $ */ #include "tkInt.h" @@ -663,7 +663,6 @@ EntryWidgetObjCmd(clientData, interp, objc, objv) switch (cmdIndex) { case COMMAND_BBOX: { int index, x, y, width, height; - char *string; char buf[TCL_INTEGER_SPACE * 4]; if (objc != 3) { @@ -677,7 +676,6 @@ EntryWidgetObjCmd(clientData, interp, objc, objv) if ((index == entryPtr->numChars) && (index > 0)) { index--; } - string = entryPtr->displayString; Tk_CharBbox(entryPtr->textLayout, index, &x, &y, &width, &height); sprintf(buf, "%d %d %d %d", x + entryPtr->layoutX, @@ -1365,7 +1363,6 @@ DisplayEntry(clientData) Tk_FontMetrics fm; Pixmap pixmap; int showSelection; - char *string; entryPtr->flags &= ~REDRAW_PENDING; if ((entryPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) { @@ -1421,7 +1418,6 @@ DisplayEntry(clientData) Tk_Fill3DRectangle(tkwin, pixmap, entryPtr->normalBorder, 0, 0, Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT); - string = entryPtr->displayString; if (showSelection && (entryPtr->selectLast > entryPtr->leftIndex)) { if (entryPtr->selectFirst <= entryPtr->leftIndex) { diff --git a/generic/tkFont.c b/generic/tkFont.c index 59e8a7f..e66a41e 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkFont.c,v 1.8 1999/12/16 21:57:36 hobbs Exp $ + * RCS: @(#) $Id: tkFont.c,v 1.9 1999/12/21 23:55:11 hobbs Exp $ */ #include "tkPort.h" @@ -3039,11 +3039,9 @@ ParseFontNameObj(interp, tkwin, objPtr, faPtr) char *dash; int objc, result, i, n; Tcl_Obj **objv; - Tcl_Obj *resultPtr; char *string; TkInitFontAttributes(faPtr); - resultPtr = Tcl_GetObjResult(interp); string = Tcl_GetString(objPtr); if (*string == '-') { diff --git a/generic/tkImgPPM.c b/generic/tkImgPPM.c index fe7818f..49aba5a 100644 --- a/generic/tkImgPPM.c +++ b/generic/tkImgPPM.c @@ -13,7 +13,7 @@ * Department of Computer Science, * Australian National University. * - * RCS: @(#) $Id: tkImgPPM.c,v 1.6 1999/10/29 03:57:56 hobbs Exp $ + * RCS: @(#) $Id: tkImgPPM.c,v 1.7 1999/12/21 23:55:11 hobbs Exp $ */ #define USE_OLD_IMAGE @@ -355,7 +355,7 @@ ReadPPMFileHeader(chan, widthPtr, heightPtr, maxIntensityPtr) { #define BUFFER_SIZE 1000 char buffer[BUFFER_SIZE]; - int i, numFields, firstInLine; + int i, numFields; int type = 0; char c; @@ -367,7 +367,6 @@ ReadPPMFileHeader(chan, widthPtr, heightPtr, maxIntensityPtr) if (Tcl_Read(chan, &c, 1) != 1) { return 0; } - firstInLine = 1; i = 0; for (numFields = 0; numFields < 4; numFields++) { /* @@ -376,7 +375,6 @@ ReadPPMFileHeader(chan, widthPtr, heightPtr, maxIntensityPtr) while (1) { while (isspace(UCHAR(c))) { - firstInLine = (c == '\n'); if (Tcl_Read(chan, &c, 1) != 1) { return 0; } @@ -389,7 +387,6 @@ ReadPPMFileHeader(chan, widthPtr, heightPtr, maxIntensityPtr) return 0; } } while (c != '\n'); - firstInLine = 1; } /* @@ -409,7 +406,6 @@ ReadPPMFileHeader(chan, widthPtr, heightPtr, maxIntensityPtr) buffer[i] = ' '; i++; } - firstInLine = 0; } done: buffer[i] = 0; diff --git a/generic/tkScale.c b/generic/tkScale.c index 9ea237c..ee942e9 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -18,7 +18,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkScale.c,v 1.8 1999/04/21 21:53:27 rjohnson Exp $ + * RCS: @(#) $Id: tkScale.c,v 1.9 1999/12/21 23:55:11 hobbs Exp $ */ #include "tkPort.h" @@ -528,6 +528,13 @@ DestroyScale(memPtr) { register TkScale *scalePtr = (TkScale *) memPtr; + scalePtr->flags |= SCALE_DELETED; + + Tcl_DeleteCommandFromToken(scalePtr->interp, scalePtr->widgetCmd); + if (scalePtr->flags & REDRAW_ALL) { + Tcl_CancelIdleCall(TkpDisplayScale, (ClientData) scalePtr); + } + /* * Free up all the stuff that requires special handling, then * let Tk_FreeOptions handle all the standard option-related @@ -550,6 +557,7 @@ DestroyScale(memPtr) } Tk_FreeConfigOptions((char *) scalePtr, scalePtr->optionTable, scalePtr->tkwin); + scalePtr->tkwin = NULL; TkpDestroyScale(scalePtr); } @@ -1022,14 +1030,7 @@ ScaleEventProc(clientData, eventPtr) if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { TkEventuallyRedrawScale(scalePtr, REDRAW_ALL); } else if (eventPtr->type == DestroyNotify) { - if (scalePtr->tkwin != NULL) { - scalePtr->tkwin = NULL; - Tcl_DeleteCommandFromToken(scalePtr->interp, scalePtr->widgetCmd); - } - if (scalePtr->flags & REDRAW_ALL) { - Tcl_CancelIdleCall(TkpDisplayScale, (ClientData) scalePtr); - } - Tcl_EventuallyFree((ClientData) scalePtr, DestroyScale); + DestroyScale((char *) clientData); } else if (eventPtr->type == ConfigureNotify) { ComputeScaleGeometry(scalePtr); TkEventuallyRedrawScale(scalePtr, REDRAW_ALL); @@ -1082,8 +1083,7 @@ ScaleCmdDeletedProc(clientData) * destroys the widget. */ - if (tkwin != NULL) { - scalePtr->tkwin = NULL; + if (!(scalePtr->flags & SCALE_DELETED)) { Tk_DestroyWindow(tkwin); } } @@ -1114,6 +1114,7 @@ TkEventuallyRedrawScale(scalePtr, what) * or REDRAW_ALL. */ { if ((what == 0) || (scalePtr->tkwin == NULL) + || (scalePtr->flags & SCALE_DELETED) || !Tk_IsMapped(scalePtr->tkwin)) { return; } diff --git a/generic/tkScale.h b/generic/tkScale.h index af0ca43..2a5daf5 100644 --- a/generic/tkScale.h +++ b/generic/tkScale.h @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkScale.h,v 1.5 1999/04/16 01:51:21 stanton Exp $ + * RCS: @(#) $Id: tkScale.h,v 1.6 1999/12/21 23:55:11 hobbs Exp $ */ #ifndef _TKSCALE @@ -189,16 +189,18 @@ typedef struct TkScale { * doesn't appear to have changed). * GOT_FOCUS - 1 means that the focus is currently in * this widget. + * SCALE_DELETED - 1 means the scale widget is being deleted */ -#define REDRAW_SLIDER 1 -#define REDRAW_OTHER 2 -#define REDRAW_ALL 3 -#define ACTIVE 4 -#define INVOKE_COMMAND 0x10 -#define SETTING_VAR 0x20 -#define NEVER_SET 0x40 -#define GOT_FOCUS 0x80 +#define REDRAW_SLIDER (1<<0) +#define REDRAW_OTHER (1<<1) +#define REDRAW_ALL (REDRAW_OTHER|REDRAW_SLIDER) +#define ACTIVE (1<<2) +#define INVOKE_COMMAND (1<<3) +#define SETTING_VAR (1<<4) +#define NEVER_SET (1<<5) +#define GOT_FOCUS (1<<6) +#define SCALE_DELETED (1<<7) /* * Symbolic values for the active parts of a slider. These are -- cgit v0.12