diff options
author | lfb <lfb> | 1999-01-07 02:42:48 (GMT) |
---|---|---|
committer | lfb <lfb> | 1999-01-07 02:42:48 (GMT) |
commit | 89aede68cdad0d2c46f898878aaeb6938693dc7b (patch) | |
tree | 2237ce3d80844c66482463c126b446a218e8fca3 | |
parent | a680377f5ddddc62a98638e7ab6280eab77c939e (diff) | |
download | tk-89aede68cdad0d2c46f898878aaeb6938693dc7b.zip tk-89aede68cdad0d2c46f898878aaeb6938693dc7b.tar.gz tk-89aede68cdad0d2c46f898878aaeb6938693dc7b.tar.bz2 |
Removed perky gloabal Tk_Uids causing concurrency problems.
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | generic/tk.h | 17 | ||||
-rw-r--r-- | generic/tkEntry.c | 20 | ||||
-rw-r--r-- | generic/tkGet.c | 83 | ||||
-rw-r--r-- | generic/tkMenubutton.c | 15 | ||||
-rw-r--r-- | generic/tkMenubutton.h | 4 | ||||
-rw-r--r-- | generic/tkOldConfig.c | 11 | ||||
-rw-r--r-- | generic/tkScale.c | 16 | ||||
-rw-r--r-- | generic/tkScale.h | 7 | ||||
-rw-r--r-- | generic/tkText.c | 4 | ||||
-rw-r--r-- | generic/tkTextDisp.c | 4 | ||||
-rw-r--r-- | generic/tkWindow.c | 27 | ||||
-rw-r--r-- | mac/tkMacMenu.c | 6 | ||||
-rw-r--r-- | mac/tkMacMenubutton.c | 10 | ||||
-rw-r--r-- | unix/tkUnixMenubu.c | 9 | ||||
-rw-r--r-- | unix/tkUnixScale.c | 6 |
16 files changed, 171 insertions, 79 deletions
@@ -1,3 +1,14 @@ +1999-01-06 <lfb@JUSTICE> + + * generic/tk.h, generic/tkGet.c, generic/tkConfig.c, + * generic/tkOldConfig.c, generic/tkEntry.c, generic/tkMenubutton.c, + * generic/tkMenubutton.h, generic/tkScale.c, generic/tkScale.h, + * generic/tkTextDisplay.c, generic/tkText.c, unix/tkUnixMenubu.c, + * unix/tkUnixScale.c, mac/tkMacMenu.c, mac/tkMacMenubutton.c, + + Removed global Tk_Uids dealing with "-state" configuration option + and added new TK_CONFIG_STATE configSpec that doesn't use + Tk_Uids. 1998-12-11 === Tk 8.1b1 Release === diff --git a/generic/tk.h b/generic/tk.h index f48f3a8..68d2369 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -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: tk.h,v 1.1.4.4 1998/12/04 07:21:20 welch Exp $ + * RCS: @(#) $Id: tk.h,v 1.1.4.5 1999/01/07 02:42:48 lfb Exp $ */ #ifndef _TK @@ -331,7 +331,7 @@ typedef struct Tk_ConfigSpec { typedef enum { TK_CONFIG_BOOLEAN, TK_CONFIG_INT, TK_CONFIG_DOUBLE, TK_CONFIG_STRING, TK_CONFIG_UID, TK_CONFIG_COLOR, TK_CONFIG_FONT, TK_CONFIG_BITMAP, - TK_CONFIG_BORDER, TK_CONFIG_RELIEF, TK_CONFIG_CURSOR, + TK_CONFIG_BORDER, TK_CONFIG_RELIEF, TK_CONFIG_STATE, TK_CONFIG_CURSOR, TK_CONFIG_ACTIVE_CURSOR, TK_CONFIG_JUSTIFY, TK_CONFIG_ANCHOR, TK_CONFIG_SYNONYM, TK_CONFIG_CAP_STYLE, TK_CONFIG_JOIN_STYLE, TK_CONFIG_PIXELS, TK_CONFIG_MM, TK_CONFIG_WINDOW, TK_CONFIG_CUSTOM, @@ -433,6 +433,16 @@ typedef enum { #define TK_RELIEF_SUNKEN 5 /* + * Values used to represent various widget states, used by + * Tk_GetState, Tk_GetStateFromObj. + */ + +#define TK_STATE_ACTIVE 0 +#define TK_STATE_DISABLED 1 +#define TK_STATE_NORMAL 2 +#define TK_STATE_UNDEFINED -1 + +/* * "Which" argument values for Tk_3DBorderGC: */ @@ -1505,6 +1515,8 @@ EXTERN int Tk_GetScreenMM _ANSI_ARGS_((Tcl_Interp *interp, EXTERN int Tk_GetSelection _ANSI_ARGS_((Tcl_Interp *interp, Tk_Window tkwin, Atom selection, Atom target, Tk_GetSelProc *proc, ClientData clientData)); +EXTERN int Tk_GetState _ANSI_ARGS_((Tcl_Interp *interp, + char *name, int *statePtr)); EXTERN Tk_Uid Tk_GetUid _ANSI_ARGS_((CONST char *string)); EXTERN Visual * Tk_GetVisual _ANSI_ARGS_((Tcl_Interp *interp, Tk_Window tkwin, char *string, int *depthPtr, @@ -1564,6 +1576,7 @@ EXTERN char * Tk_NameOfImage _ANSI_ARGS_(( EXTERN char * Tk_NameOfJoinStyle _ANSI_ARGS_((int join)); EXTERN char * Tk_NameOfJustify _ANSI_ARGS_((Tk_Justify justify)); EXTERN char * Tk_NameOfRelief _ANSI_ARGS_((int relief)); +EXTERN char * Tk_NameOfState _ANSI_ARGS_((int state)); EXTERN Tk_Window Tk_NameToWindow _ANSI_ARGS_((Tcl_Interp *interp, char *pathName, Tk_Window tkwin)); EXTERN void Tk_OwnSelection _ANSI_ARGS_((Tk_Window tkwin, diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 6d38ef6..7ccd73a 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.1.4.2 1998/09/30 02:16:53 stanton Exp $ + * RCS: @(#) $Id: tkEntry.c,v 1.1.4.3 1999/01/07 02:42:49 lfb Exp $ */ #include "tkInt.h" @@ -99,7 +99,7 @@ typedef struct { char *showChar; /* Value of -show option. If non-NULL, first * character is used for displaying all * characters in entry. Malloc'ed. */ - Tk_Uid state; /* Normal or disabled. Entry is read-only + int state; /* Normal or disabled. Entry is read-only * when disabled. */ char *textVarName; /* Name of variable (malloc'ed) or NULL. * If non-NULL, entry's string tracks the @@ -257,7 +257,7 @@ static Tk_ConfigSpec configSpecs[] = { TK_CONFIG_MONO_ONLY}, {TK_CONFIG_STRING, "-show", "show", "Show", DEF_ENTRY_SHOW, Tk_Offset(Entry, showChar), TK_CONFIG_NULL_OK}, - {TK_CONFIG_UID, "-state", "state", "State", + {TK_CONFIG_STATE, "-state", "state", "State", DEF_ENTRY_STATE, Tk_Offset(Entry, state), 0}, {TK_CONFIG_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_ENTRY_TAKE_FOCUS, Tk_Offset(Entry, takeFocus), TK_CONFIG_NULL_OK}, @@ -420,7 +420,7 @@ Tk_EntryCmd(clientData, interp, argc, argv) entryPtr->selBorderWidth = 0; entryPtr->selFgColorPtr = NULL; entryPtr->showChar = NULL; - entryPtr->state = tkNormalUid; + entryPtr->state = TK_STATE_NORMAL; entryPtr->textVarName = NULL; entryPtr->takeFocus = NULL; entryPtr->prefWidth = 0; @@ -564,7 +564,7 @@ EntryWidgetCmd(clientData, interp, argc, argv) goto error; } } - if ((last >= first) && (entryPtr->state == tkNormalUid)) { + if ((last >= first) && (entryPtr->state == TK_STATE_NORMAL)) { DeleteChars(entryPtr, first, last - first); } } else if ((c == 'g') && (strncmp(argv[1], "get", length) == 0)) { @@ -615,7 +615,7 @@ EntryWidgetCmd(clientData, interp, argc, argv) if (GetEntryIndex(interp, entryPtr, argv[2], &index) != TCL_OK) { goto error; } - if (entryPtr->state == tkNormalUid) { + if (entryPtr->state == TK_STATE_NORMAL) { InsertChars(entryPtr, index, argv[3]); } } else if ((c == 's') && (length >= 2) @@ -948,11 +948,11 @@ ConfigureEntry(interp, entryPtr, argc, argv, flags) * the geometry and setting the background from a 3-D border. */ - if ((entryPtr->state != tkNormalUid) - && (entryPtr->state != tkDisabledUid)) { + if ((entryPtr->state != TK_STATE_NORMAL) + && (entryPtr->state != TK_STATE_DISABLED)) { Tcl_AppendResult(interp, "bad state value \"", entryPtr->state, "\": must be normal or disabled", (char *) NULL); - entryPtr->state = tkNormalUid; + entryPtr->state = TK_STATE_NORMAL; return TCL_ERROR; } @@ -1185,7 +1185,7 @@ DisplayEntry(clientData) */ if ((entryPtr->insertPos >= entryPtr->leftIndex) - && (entryPtr->state == tkNormalUid) + && (entryPtr->state == TK_STATE_NORMAL) && (entryPtr->flags & GOT_FOCUS)) { int insertByte; diff --git a/generic/tkGet.c b/generic/tkGet.c index c6db408..c6997d6 100644 --- a/generic/tkGet.c +++ b/generic/tkGet.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkGet.c,v 1.1.4.3 1998/12/13 08:16:05 lfb Exp $ + * RCS: @(#) $Id: tkGet.c,v 1.1.4.4 1999/01/07 02:42:50 lfb Exp $ */ #include "tkInt.h" @@ -676,3 +676,84 @@ Tk_GetPixels(interp, tkwin, string, intPtr) } return TCL_OK; } + +/* + *---------------------------------------------------------------------- + * + * Tk_GetState -- + * + * Parse a state description and return the corresponding + * state value, or an error. + * + * Results: + * A standard Tcl return value. If all goes well then + * *statePtr is filled in with one of the values + * TK_STATE_ACTIVE, TK_STATE_DISABLED, or TK_STATE_NORMAL. + * If an unknown state value is used, then *statePtr is + * filled with TK_STATE_UNDEFINED. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +Tk_GetState(interp, name, statePtr) + Tcl_Interp *interp; /* For error messages. */ + char *name; /* Name of a state type. */ + int *statePtr; /* Where to store converted state. */ +{ + char c; + size_t length; + + c = name[0]; + length = strlen(name); + if ((c == 'a') && (strncmp(name, "active", length) == 0)) { + *statePtr = TK_STATE_ACTIVE; + } else if ((c == 'd') && (strncmp(name, "disabled", length) == 0) + && (length >= 2)) { + *statePtr = TK_STATE_DISABLED; + } else if ((c == 'n') && (strncmp(name, "normal", length) == 0) + && (length >= 2)) { + *statePtr = TK_STATE_NORMAL; + } else { + *statePtr = TK_STATE_UNDEFINED; + } + return TCL_OK; +} + +/* + *-------------------------------------------------------------- + * + * Tk_NameOfState -- + * + * Given a state value, produce a string describing that + * state value. + * + * Results: + * The return value is a static string that is equivalent + * to state. + * + * Side effects: + * None. + * + *-------------------------------------------------------------- + */ + +char * +Tk_NameOfState(state) + int state; /* One of TK_STATE_ACTIVE, TK_STATE_DISABLED, + * or TK_STATE_NORMAL */ +{ + if (state == TK_STATE_ACTIVE) { + return "active"; + } else if (state == TK_STATE_DISABLED) { + return "disabled"; + } else if (state == TK_STATE_NORMAL) { + return "normal"; + } else { + return "unknown state"; + } +} + diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c index 2ee8b35..f4960fa 100644 --- a/generic/tkMenubutton.c +++ b/generic/tkMenubutton.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: tkMenubutton.c,v 1.1.4.3 1998/12/13 08:16:09 lfb Exp $ + * RCS: @(#) $Id: tkMenubutton.c,v 1.1.4.4 1999/01/07 02:42:50 lfb Exp $ */ #include "tkMenubutton.h" @@ -109,7 +109,7 @@ static Tk_ConfigSpec configSpecs[] = { DEF_MENUBUTTON_PADY, Tk_Offset(TkMenuButton, padY), 0}, {TK_CONFIG_RELIEF, "-relief", "relief", "Relief", DEF_MENUBUTTON_RELIEF, Tk_Offset(TkMenuButton, relief), 0}, - {TK_CONFIG_UID, "-state", "state", "State", + {TK_CONFIG_STATE, "-state", "state", "State", DEF_MENUBUTTON_STATE, Tk_Offset(TkMenuButton, state), 0}, {TK_CONFIG_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_MENUBUTTON_TAKE_FOCUS, Tk_Offset(TkMenuButton, takeFocus), @@ -216,7 +216,7 @@ Tk_MenubuttonCmd(clientData, interp, argc, argv) mbPtr->bitmap = None; mbPtr->imageString = NULL; mbPtr->image = NULL; - mbPtr->state = tkNormalUid; + mbPtr->state = TK_STATE_NORMAL; mbPtr->normalBorder = NULL; mbPtr->activeBorder = NULL; mbPtr->borderWidth = 0; @@ -458,15 +458,16 @@ ConfigureMenuButton(interp, mbPtr, argc, argv, flags) * defaults that couldn't be specified to Tk_ConfigureWidget. */ - if ((mbPtr->state == tkActiveUid) && !Tk_StrictMotif(mbPtr->tkwin)) { + if ((mbPtr->state == TK_STATE_ACTIVE) && !Tk_StrictMotif(mbPtr->tkwin)) { Tk_SetBackgroundFromBorder(mbPtr->tkwin, mbPtr->activeBorder); } else { Tk_SetBackgroundFromBorder(mbPtr->tkwin, mbPtr->normalBorder); - if ((mbPtr->state != tkNormalUid) && (mbPtr->state != tkActiveUid) - && (mbPtr->state != tkDisabledUid)) { + if ((mbPtr->state != TK_STATE_NORMAL) + && (mbPtr->state != TK_STATE_ACTIVE) + && (mbPtr->state != TK_STATE_DISABLED)) { Tcl_AppendResult(interp, "bad state value \"", mbPtr->state, "\": must be normal, active, or disabled", (char *) NULL); - mbPtr->state = tkNormalUid; + mbPtr->state = TK_STATE_NORMAL; return TCL_ERROR; } } diff --git a/generic/tkMenubutton.h b/generic/tkMenubutton.h index a8598c4..e9481ab 100644 --- a/generic/tkMenubutton.h +++ b/generic/tkMenubutton.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: tkMenubutton.h,v 1.1.4.1 1998/09/30 02:17:11 stanton Exp $ + * RCS: @(#) $Id: tkMenubutton.h,v 1.1.4.2 1999/01/07 02:42:50 lfb Exp $ */ #ifndef _TKMENUBUTTON @@ -65,7 +65,7 @@ typedef struct { * Information used when displaying widget: */ - Tk_Uid state; /* State of button for display purposes: + int state; /* State of button for display purposes: * normal, active, or disabled. */ Tk_3DBorder normalBorder; /* Structure used to draw 3-D * border and background when window diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index 02d0e7d..ec2944b 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.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: tkOldConfig.c,v 1.1.2.2 1998/09/30 02:17:12 stanton Exp $ + * RCS: @(#) $Id: tkOldConfig.c,v 1.1.2.3 1999/01/07 02:42:50 lfb Exp $ */ #include "tkPort.h" @@ -462,6 +462,12 @@ DoConfig(interp, tkwin, specPtr, value, valueIsUid, widgRec) return TCL_ERROR; } break; + case TK_CONFIG_STATE: + uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value); + if (Tk_GetState(interp, uid, (int *) ptr) != TCL_OK) { + return TCL_ERROR; + } + break; case TK_CONFIG_CURSOR: case TK_CONFIG_ACTIVE_CURSOR: { Tk_Cursor new, old; @@ -819,6 +825,9 @@ FormatConfigValue(interp, tkwin, specPtr, widgRec, buffer, freeProcPtr) case TK_CONFIG_RELIEF: result = Tk_NameOfRelief(*((int *) ptr)); break; + case TK_CONFIG_STATE: + result = Tk_NameOfState(*((int *) ptr)); + break; case TK_CONFIG_CURSOR: case TK_CONFIG_ACTIVE_CURSOR: { Tk_Cursor cursor = *((Tk_Cursor *) ptr); diff --git a/generic/tkScale.c b/generic/tkScale.c index 11e090e..57d1fd3 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -17,7 +17,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.1.4.2 1998/09/30 02:17:16 stanton Exp $ + * RCS: @(#) $Id: tkScale.c,v 1.1.4.3 1999/01/07 02:42:51 lfb Exp $ */ #include "tkPort.h" @@ -95,7 +95,7 @@ static Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_RELIEF, "-sliderrelief", "sliderRelief", "SliderRelief", DEF_SCALE_SLIDER_RELIEF, Tk_Offset(TkScale, sliderRelief), TK_CONFIG_DONT_SET_DEFAULT}, - {TK_CONFIG_UID, "-state", "state", "State", + {TK_CONFIG_STATE, "-state", "state", "State", DEF_SCALE_STATE, Tk_Offset(TkScale, state), 0}, {TK_CONFIG_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_SCALE_TAKE_FOCUS, Tk_Offset(TkScale, takeFocus), @@ -222,7 +222,7 @@ Tk_ScaleCmd(clientData, interp, argc, argv) scalePtr->repeatInterval = 0; scalePtr->label = NULL; scalePtr->labelLength = 0; - scalePtr->state = tkNormalUid; + scalePtr->state = TK_STATE_NORMAL; scalePtr->borderWidth = 0; scalePtr->bgBorder = NULL; scalePtr->activeBorder = NULL; @@ -415,7 +415,7 @@ ScaleWidgetCmd(clientData, interp, argc, argv) if (Tcl_GetDouble(interp, argv[2], &value) != TCL_OK) { goto error; } - if (scalePtr->state != tkDisabledUid) { + if (scalePtr->state != TK_STATE_DISABLED) { TkpSetScaleValue(scalePtr, value, 1, 1); } } else { @@ -596,12 +596,12 @@ ConfigureScale(interp, scalePtr, argc, argv, flags) scalePtr->labelLength = 0; } - if ((scalePtr->state != tkNormalUid) - && (scalePtr->state != tkDisabledUid) - && (scalePtr->state != tkActiveUid)) { + if ((scalePtr->state != TK_STATE_NORMAL) + && (scalePtr->state != TK_STATE_DISABLED) + && (scalePtr->state != TK_STATE_ACTIVE)) { Tcl_AppendResult(interp, "bad state value \"", scalePtr->state, "\": must be normal, active, or disabled", (char *) NULL); - scalePtr->state = tkNormalUid; + scalePtr->state = TK_STATE_NORMAL; return TCL_ERROR; } diff --git a/generic/tkScale.h b/generic/tkScale.h index d74d083..8144b4d 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.1.4.1 1998/09/30 02:17:17 stanton Exp $ + * RCS: @(#) $Id: tkScale.h,v 1.1.4.2 1999/01/07 02:42:51 lfb Exp $ */ #ifndef _TKSCALE @@ -79,8 +79,9 @@ typedef struct TkScale { * scale; NULL means don't display a * label. Malloc'ed. */ int labelLength; /* Number of non-NULL chars. in label. */ - Tk_Uid state; /* Normal or disabled. Value cannot be - * changed when scale is disabled. */ + int state; /* TK_STATE_ACTIVE, TK_STATE_NORMAL + * or TK_STATE_DISABLED. Value of scale + * cannot be changed when disabled. */ /* * Information used when displaying widget: diff --git a/generic/tkText.c b/generic/tkText.c index cb720b4..a5e4b59 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkText.c,v 1.1.4.2 1998/09/30 02:17:20 stanton Exp $ + * RCS: @(#) $Id: tkText.c,v 1.1.4.3 1999/01/07 02:42:51 lfb Exp $ */ #include "default.h" @@ -112,7 +112,7 @@ static Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_PIXELS, "-spacing3", "spacing3", "Spacing", DEF_TEXT_SPACING3, Tk_Offset(TkText, spacing3), TK_CONFIG_DONT_SET_DEFAULT}, - {TK_CONFIG_UID, "-state", "state", "State", + {TK_CONFIG_STATE, "-state", "state", "State", DEF_TEXT_STATE, Tk_Offset(TkText, state), 0}, {TK_CONFIG_STRING, "-tabs", "tabs", "Tabs", DEF_TEXT_TABS, Tk_Offset(TkText, tabOptionString), TK_CONFIG_NULL_OK}, diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index c3f3d2d..73d86d1 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.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: tkTextDisp.c,v 1.1.4.2 1998/09/30 02:17:23 stanton Exp $ + * RCS: @(#) $Id: tkTextDisp.c,v 1.1.4.3 1999/01/07 02:42:52 lfb Exp $ */ #include "tkPort.h" @@ -1581,7 +1581,7 @@ DisplayDLine(textPtr, dlPtr, prevPtr, pixmap) * to its left. */ - if (textPtr->state == tkNormalUid) { + if (textPtr->state == TK_STATE_NORMAL) { for (chunkPtr = dlPtr->chunkPtr; (chunkPtr != NULL); chunkPtr = chunkPtr->nextPtr) { x = chunkPtr->x + dInfoPtr->x - dInfoPtr->curPixelOffset; diff --git a/generic/tkWindow.c b/generic/tkWindow.c index b638fc7..4f9578c 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -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: tkWindow.c,v 1.1.4.4 1998/12/30 02:52:21 lfb Exp $ + * RCS: @(#) $Id: tkWindow.c,v 1.1.4.5 1999/01/07 02:42:53 lfb Exp $ */ #include "tkPort.h" @@ -32,21 +32,11 @@ typedef struct ThreadSpecificData { } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; -/* - * The variables below hold several uid's that are used in many places - * in the toolkit. - */ - -Tk_Uid tkDisabledUid = NULL; -Tk_Uid tkActiveUid = NULL; -Tk_Uid tkNormalUid = NULL; - /* * The Mutex below is used to lock access to the Tk_Uids above. */ TCL_DECLARE_MUTEX(windowMutex); -TCL_DECLARE_MUTEX(uidMutex); /* * Default values for "changes" and "atts" fields of TkWindows. Note @@ -259,18 +249,8 @@ CreateTopLevelWindow(interp, parent, name, screenName) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { - if (tkNormalUid == NULL) { - Tcl_MutexLock(&uidMutex); - if (tkNormalUid == NULL) { - tkActiveUid = Tk_GetUid("active"); - tkDisabledUid = Tk_GetUid("disabled"); - tkNormalUid = Tk_GetUid("normal"); - } - Tcl_MutexUnlock(&uidMutex); tsdPtr->initialized = 1; - } - /* * Create built-in image types. */ @@ -2600,11 +2580,6 @@ DeleteWindowsExitProc(clientData) tsdPtr->numMainWindows = 0; tsdPtr->mainWindowList = NULL; tsdPtr->initialized = 0; - Tcl_MutexLock(&uidMutex); - tkDisabledUid = NULL; - tkActiveUid = NULL; - tkNormalUid = NULL; - Tcl_MutexUnlock(&uidMutex); } /* diff --git a/mac/tkMacMenu.c b/mac/tkMacMenu.c index cc46f2a..48ac797 100644 --- a/mac/tkMacMenu.c +++ b/mac/tkMacMenu.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacMenu.c,v 1.1.4.4 1998/11/25 21:16:36 stanton Exp $ + * RCS: @(#) $Id: tkMacMenu.c,v 1.1.4.5 1999/01/07 02:42:54 lfb Exp $ */ #include <Menus.h> @@ -3231,9 +3231,9 @@ AppearanceEntryDrawWrapper( itemRect.bottom = itemRect.top + height; itemRect.right = itemRect.left + width; - if (mePtr->state == tkActiveUid) { + if (mePtr->state == TK_STATE_ACTIVE) { theState = kThemeMenuSelected; - } else if (mePtr->state == tkDisabledUid) { + } else if (mePtr->state == TK_STATE_DISABLED) { theState = kThemeMenuDisabled; } else { theState = kThemeMenuActive; diff --git a/mac/tkMacMenubutton.c b/mac/tkMacMenubutton.c index 5eba33e..b4c4f78 100644 --- a/mac/tkMacMenubutton.c +++ b/mac/tkMacMenubutton.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: tkMacMenubutton.c,v 1.1.4.1 1998/09/30 02:18:12 stanton Exp $ + * RCS: @(#) $Id: tkMacMenubutton.c,v 1.1.4.2 1999/01/07 02:42:56 lfb Exp $ */ #include "tkMenubutton.h" @@ -110,9 +110,9 @@ TkpDisplayMenuButton( SetGWorld(destPort, NULL); macDraw = (MacDrawable *) Tk_WindowId(tkwin); - if ((mbPtr->state == tkDisabledUid) && (mbPtr->disabledFg != NULL)) { + if ((mbPtr->state == TK_STATE_DISABLED) && (mbPtr->disabledFg != NULL)) { gc = mbPtr->disabledGC; - } else if ((mbPtr->state == tkActiveUid) && !Tk_StrictMotif(mbPtr->tkwin)) { + } else if ((mbPtr->state == TK_STATE_ACTIVE) && !Tk_StrictMotif(mbPtr->tkwin)) { gc = mbPtr->activeTextGC; } else { gc = mbPtr->normalTextGC; @@ -162,7 +162,7 @@ TkpDisplayMenuButton( * foreground color, generate the stippled effect. */ - if ((mbPtr->state == tkDisabledUid) + if ((mbPtr->state == TK_STATE_DISABLED) && ((mbPtr->disabledFg == NULL) || (mbPtr->image != NULL))) { XFillRectangle(mbPtr->display, Tk_WindowId(tkwin), mbPtr->disabledGC, mbPtr->inset, mbPtr->inset, @@ -221,7 +221,7 @@ TkpDisplayMenuButton( LineTo(r.left + kShadowOffset, r.bottom); } - if (mbPtr->state == tkDisabledUid) { + if (mbPtr->state == TK_STATE_DISABLED) { } if (mbPtr->highlightWidth != 0) { diff --git a/unix/tkUnixMenubu.c b/unix/tkUnixMenubu.c index 9f203b9..6d756d3 100644 --- a/unix/tkUnixMenubu.c +++ b/unix/tkUnixMenubu.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: tkUnixMenubu.c,v 1.1.4.1 1998/09/30 02:19:20 stanton Exp $ + * RCS: @(#) $Id: tkUnixMenubu.c,v 1.1.4.2 1999/01/07 02:42:57 lfb Exp $ */ #include "tkMenubutton.h" @@ -84,10 +84,11 @@ TkpDisplayMenuButton(clientData) return; } - if ((mbPtr->state == tkDisabledUid) && (mbPtr->disabledFg != NULL)) { + if ((mbPtr->state == TK_STATE_DISABLED) && (mbPtr->disabledFg != NULL)) { gc = mbPtr->disabledGC; border = mbPtr->normalBorder; - } else if ((mbPtr->state == tkActiveUid) && !Tk_StrictMotif(mbPtr->tkwin)) { + } else if ((mbPtr->state == TK_STATE_ACTIVE) + && !Tk_StrictMotif(mbPtr->tkwin)) { gc = mbPtr->activeTextGC; border = mbPtr->activeBorder; } else { @@ -142,7 +143,7 @@ TkpDisplayMenuButton(clientData) * foreground color, generate the stippled effect. */ - if ((mbPtr->state == tkDisabledUid) + if ((mbPtr->state == TK_STATE_DISABLED) && ((mbPtr->disabledFg == NULL) || (mbPtr->image != NULL))) { XFillRectangle(mbPtr->display, pixmap, mbPtr->disabledGC, mbPtr->inset, mbPtr->inset, diff --git a/unix/tkUnixScale.c b/unix/tkUnixScale.c index 86e0cf5..431cf9c 100644 --- a/unix/tkUnixScale.c +++ b/unix/tkUnixScale.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: tkUnixScale.c,v 1.1.4.1 1998/09/30 02:19:21 stanton Exp $ + * RCS: @(#) $Id: tkUnixScale.c,v 1.1.4.2 1999/01/07 02:42:57 lfb Exp $ */ #include "tkScale.h" @@ -177,7 +177,7 @@ DisplayVerticalScale(scalePtr, drawable, drawnAreaPtr) (unsigned) scalePtr->width, (unsigned) (Tk_Height(tkwin) - 2*scalePtr->inset - 2*scalePtr->borderWidth)); - if (scalePtr->state == tkActiveUid) { + if (scalePtr->state == TK_STATE_ACTIVE) { sliderBorder = scalePtr->activeBorder; } else { sliderBorder = scalePtr->bgBorder; @@ -376,7 +376,7 @@ DisplayHorizontalScale(scalePtr, drawable, drawnAreaPtr) (unsigned) (Tk_Width(tkwin) - 2*scalePtr->inset - 2*scalePtr->borderWidth), (unsigned) scalePtr->width); - if (scalePtr->state == tkActiveUid) { + if (scalePtr->state == TK_STATE_ACTIVE) { sliderBorder = scalePtr->activeBorder; } else { sliderBorder = scalePtr->bgBorder; |