diff options
author | hobbs <hobbs> | 1999-11-19 22:00:02 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 1999-11-19 22:00:02 (GMT) |
commit | 3fd1d29ce817601c769d7549d8f3c9bec8d49539 (patch) | |
tree | 1a1f21c36821c32fa17912052769a5db4bb4d736 /generic | |
parent | 1c7268724fdcf2d1928feb5d8bf0082e3f36c92d (diff) | |
download | tk-3fd1d29ce817601c769d7549d8f3c9bec8d49539.zip tk-3fd1d29ce817601c769d7549d8f3c9bec8d49539.tar.gz tk-3fd1d29ce817601c769d7549d8f3c9bec8d49539.tar.bz2 |
* generic/tkColor.c:
* generic/tkColor.h: fixed Tk_NameOfColor to work correctly,
with minor change to TkColor struct.
* generic/tkConsole.c: added static declaration to
ConsoleDeleteProc function (proto already had it)
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkColor.c | 20 | ||||
-rw-r--r-- | generic/tkColor.h | 8 | ||||
-rw-r--r-- | generic/tkConsole.c | 4 |
3 files changed, 18 insertions, 14 deletions
diff --git a/generic/tkColor.c b/generic/tkColor.c index 8c6b0be..006e93b 100644 --- a/generic/tkColor.c +++ b/generic/tkColor.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: tkColor.c,v 1.5 1999/04/21 21:53:25 rjohnson Exp $ + * RCS: @(#) $Id: tkColor.c,v 1.6 1999/11/19 22:00:02 hobbs Exp $ */ #include "tkColor.h" @@ -254,7 +254,7 @@ Tk_GetColor(interp, tkwin, name) tkColPtr->visual = Tk_Visual(tkwin); tkColPtr->resourceRefCount = 1; tkColPtr->objRefCount = 0; - tkColPtr->tablePtr = &dispPtr->colorNameTable; + tkColPtr->type = TK_COLOR_BY_NAME; tkColPtr->hashPtr = nameHashPtr; tkColPtr->nextPtr = existingColPtr; Tcl_SetHashValue(nameHashPtr, tkColPtr); @@ -334,7 +334,7 @@ Tk_GetColorByValue(tkwin, colorPtr) tkColPtr->visual = Tk_Visual(tkwin); tkColPtr->resourceRefCount = 1; tkColPtr->objRefCount = 0; - tkColPtr->tablePtr = &dispPtr->colorValueTable; + tkColPtr->type = TK_COLOR_BY_VALUE; tkColPtr->hashPtr = valueHashPtr; tkColPtr->nextPtr = NULL; Tcl_SetHashValue(valueHashPtr, tkColPtr); @@ -368,15 +368,17 @@ Tk_NameOfColor(colorPtr) XColor *colorPtr; /* Color whose name is desired. */ { register TkColor *tkColPtr = (TkColor *) colorPtr; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) - Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); - if (tkColPtr->magic == COLOR_MAGIC) { + if ((tkColPtr->magic == COLOR_MAGIC) && + (tkColPtr->type == TK_COLOR_BY_NAME)) { return tkColPtr->hashPtr->key.string; + } else { + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + sprintf(tsdPtr->rgbString, "#%04x%04x%04x", colorPtr->red, + colorPtr->green, colorPtr->blue); + return tsdPtr->rgbString; } - sprintf(tsdPtr->rgbString, "#%04x%04x%04x", colorPtr->red, - colorPtr->green, colorPtr->blue); - return tsdPtr->rgbString; } /* diff --git a/generic/tkColor.h b/generic/tkColor.h index 7e1ab3b..53975c1 100644 --- a/generic/tkColor.h +++ b/generic/tkColor.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: tkColor.h,v 1.5 1999/04/16 01:51:12 stanton Exp $ + * RCS: @(#) $Id: tkColor.h,v 1.6 1999/11/19 22:00:03 hobbs Exp $ */ #ifndef _TKCOLOR @@ -28,6 +28,9 @@ * is a colormap entry allocated for each of these colors. */ +#define TK_COLOR_BY_NAME 1 +#define TK_COLOR_BY_VALUE 2 + #define COLOR_MAGIC ((unsigned int) 0x46140277) typedef struct TkColor { @@ -55,8 +58,7 @@ typedef struct TkColor { * are both 0. */ int objRefCount; /* The number of Tcl objects that reference * this structure. */ - Tcl_HashTable *tablePtr; /* Hash table that indexes this structure - * (needed when deleting structure). */ + int type; /* TK_COLOR_BY_NAME or TK_COLOR_BY_VALUE */ Tcl_HashEntry *hashPtr; /* Pointer to hash table entry for this * structure. (for use in deleting entry). */ struct TkColor *nextPtr; /* Points to the next TkColor structure with diff --git a/generic/tkConsole.c b/generic/tkConsole.c index d39fcdf..5892df5 100644 --- a/generic/tkConsole.c +++ b/generic/tkConsole.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: tkConsole.c,v 1.10 1999/07/30 02:09:25 redman Exp $ + * RCS: @(#) $Id: tkConsole.c,v 1.11 1999/11/19 22:00:03 hobbs Exp $ */ #include "tk.h" @@ -673,7 +673,7 @@ InterpreterCmd(clientData, interp, argc, argv) *---------------------------------------------------------------------- */ -void +static void ConsoleDeleteProc(clientData) ClientData clientData; { |