summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/linux-with-tcl8-build.yml4
-rw-r--r--.github/workflows/linux-with-tcl9-build.yml4
-rw-r--r--.github/workflows/onefiledist.yml6
-rw-r--r--.github/workflows/win-build.yml2
-rw-r--r--generic/nanosvgrast.h8
-rw-r--r--generic/tkButton.c75
-rw-r--r--generic/tkCanvas.c52
-rw-r--r--generic/tkCmds.c24
-rw-r--r--generic/tkConfig.c57
-rw-r--r--generic/tkEntry.c26
-rw-r--r--generic/tkEntry.h2
-rw-r--r--generic/tkFont.c6
-rw-r--r--generic/tkInt.h36
-rw-r--r--generic/tkListbox.c14
-rw-r--r--generic/tkMenu.c41
-rw-r--r--generic/tkMenu.h10
-rw-r--r--generic/tkMenubutton.c50
-rw-r--r--generic/tkMessage.c4
-rw-r--r--generic/tkPack.c4
-rw-r--r--generic/tkPanedWindow.c176
-rw-r--r--generic/tkPlace.c6
-rw-r--r--generic/tkScale.c19
-rw-r--r--generic/tkTest.c50
-rw-r--r--generic/tkText.c24
-rw-r--r--generic/tkTextDisp.c6
-rw-r--r--generic/tkTextTag.c14
-rw-r--r--generic/ttk/ttkButton.c6
-rw-r--r--generic/ttk/ttkEntry.c2
-rw-r--r--generic/ttk/ttkInit.c30
-rw-r--r--generic/ttk/ttkNotebook.c8
-rw-r--r--generic/ttk/ttkPanedwindow.c2
-rw-r--r--generic/ttk/ttkProgress.c4
-rw-r--r--generic/ttk/ttkScale.c4
-rw-r--r--generic/ttk/ttkScrollbar.c2
-rw-r--r--generic/ttk/ttkSeparator.c2
-rw-r--r--generic/ttk/ttkTheme.c2
-rw-r--r--generic/ttk/ttkTheme.h4
-rw-r--r--generic/ttk/ttkTreeview.c19
-rw-r--r--generic/ttk/ttkWidget.h2
-rw-r--r--macosx/tkMacOSXBitmap.c8
-rw-r--r--macosx/tkMacOSXDialog.c122
-rw-r--r--macosx/tkMacOSXNotify.c4
-rw-r--r--macosx/tkMacOSXPrint.c2
-rw-r--r--macosx/tkMacOSXTest.c10
-rw-r--r--macosx/tkMacOSXWm.c56
-rw-r--r--tests/choosedir.test2
-rw-r--r--tests/entry.test2
-rw-r--r--tests/filebox.test4
-rw-r--r--tests/font.test4
-rw-r--r--tests/listbox.test2
-rw-r--r--tests/menu.test4
-rw-r--r--tests/menuDraw.test2
-rw-r--r--tests/pack.test2
-rw-r--r--tests/place.test2
-rw-r--r--tests/spinbox.test2
-rw-r--r--tests/textDisp.test2
-rw-r--r--tests/ttk/treeview.test11
-rw-r--r--tests/unixWm.test4
-rw-r--r--unix/tkUnixWm.c4
-rwxr-xr-xwin/configure2
-rw-r--r--win/rules.vc19
-rw-r--r--win/tcl.m42
-rw-r--r--win/tkWinDialog.c16
-rw-r--r--win/tkWinGDI.c6
-rw-r--r--win/tkWinSysTray.c4
-rw-r--r--win/tkWinWm.c28
-rw-r--r--win/ttkWinXPTheme.c12
67 files changed, 564 insertions, 581 deletions
diff --git a/.github/workflows/linux-with-tcl8-build.yml b/.github/workflows/linux-with-tcl8-build.yml
index 6fd7aea..29998ec 100644
--- a/.github/workflows/linux-with-tcl8-build.yml
+++ b/.github/workflows/linux-with-tcl8-build.yml
@@ -30,7 +30,7 @@ jobs:
uses: actions/checkout@v2
with:
repository: tcltk/tcl
- ref: full-utf-for-87
+ ref: core-8-branch
path: tcl
- name: Setup Environment (compiler=${{ matrix.compiler }})
run: |
@@ -133,7 +133,7 @@ jobs:
uses: actions/checkout@v2
with:
repository: tcltk/tcl
- ref: full-utf-for-87
+ ref: core-8-branch
path: tcl
- name: Setup Environment (compiler=${{ matrix.compiler }})
run: |
diff --git a/.github/workflows/linux-with-tcl9-build.yml b/.github/workflows/linux-with-tcl9-build.yml
index 9528e16..4b1ceed 100644
--- a/.github/workflows/linux-with-tcl9-build.yml
+++ b/.github/workflows/linux-with-tcl9-build.yml
@@ -30,7 +30,7 @@ jobs:
uses: actions/checkout@v2
with:
repository: tcltk/tcl
- ref: glyph_indexing_2
+ ref: main
path: tcl
- name: Setup Environment (compiler=${{ matrix.compiler }})
run: |
@@ -119,7 +119,7 @@ jobs:
uses: actions/checkout@v2
with:
repository: tcltk/tcl
- ref: glyph_indexing_2
+ ref: main
path: tcl
- name: Setup Environment (compiler=${{ matrix.compiler }})
run: |
diff --git a/.github/workflows/onefiledist.yml b/.github/workflows/onefiledist.yml
index 74b66de..70e9379 100644
--- a/.github/workflows/onefiledist.yml
+++ b/.github/workflows/onefiledist.yml
@@ -19,7 +19,7 @@ jobs:
uses: actions/checkout@v2
with:
repository: tcltk/tcl
- ref: full-utf-for-87
+ ref: core-8-branch
path: tcl
- name: Setup Environment
run: |
@@ -83,7 +83,7 @@ jobs:
uses: actions/checkout@v2
with:
repository: tcltk/tcl
- ref: full-utf-for-87
+ ref: core-8-branch
path: tcl
- name: Checkout create-dmg
uses: actions/checkout@v2
@@ -171,7 +171,7 @@ jobs:
uses: actions/checkout@v2
with:
repository: tcltk/tcl
- ref: full-utf-for-87
+ ref: core-8-branch
path: tcl
- name: Setup Environment
run: |
diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml
index a77d814..8968f5d 100644
--- a/.github/workflows/win-build.yml
+++ b/.github/workflows/win-build.yml
@@ -19,7 +19,7 @@ jobs:
uses: actions/checkout@v2
with:
repository: tcltk/tcl
- ref: full-utf-for-87
+ ref: core-8-branch
path: tcl
- name: Init MSVC
uses: ilammy/msvc-dev-cmd@v1
diff --git a/generic/nanosvgrast.h b/generic/nanosvgrast.h
index b288bcf..3625238 100644
--- a/generic/nanosvgrast.h
+++ b/generic/nanosvgrast.h
@@ -972,7 +972,7 @@ static float nsvg__clampf(float a, float mn, float mx) { return a < mn ? mn : (a
static unsigned int nsvg__RGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
{
- return (r) | (g << 8) | (b << 16) | (a << 24);
+ return ((unsigned int)r) | ((unsigned int)g << 8) | ((unsigned int)b << 16) | ((unsigned int)a << 24);
}
static unsigned int nsvg__lerpRGBA(unsigned int c0, unsigned int c1, float u)
@@ -1423,7 +1423,8 @@ void nsvgRasterize(NSVGrasterizer* r,
}
/* Rasterize edges */
- qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge);
+ if (r->nedges != 0)
+ qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge);
/* now, traverse the scanlines and find the intersections on each scanline, use non-zero rule */
nsvg__initPaint(&cache, &shape->fill, shape->opacity);
@@ -1449,7 +1450,8 @@ void nsvgRasterize(NSVGrasterizer* r,
}
/* Rasterize edges */
- qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge);
+ if (r->nedges != 0)
+ qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge);
/* now, traverse the scanlines and find the intersections on each scanline, use non-zero rule */
nsvg__initPaint(&cache, &shape->stroke, shape->opacity);
diff --git a/generic/tkButton.c b/generic/tkButton.c
index 057b11c..430c336 100644
--- a/generic/tkButton.c
+++ b/generic/tkButton.c
@@ -29,20 +29,11 @@ static Tcl_ThreadDataKey dataKey;
static const char *const classNames[] = {"Label", "Button", "Checkbutton", "Radiobutton"};
/*
- * The following table defines the legal values for the -default option. It is
- * used together with the "enum defaultValue" declaration in tkButton.h.
+ * The following table defines the legal values for the -default/-state options.
+ * It is used together with the "enum defaultValue/state" declarations in tkButton.h.
*/
-static const char *const defaultStrings[] = {
- "active", "disabled", "normal", NULL
-};
-
-/*
- * The following table defines the legal values for the -state option.
- * It is used together with the "enum state" declaration in tkButton.h.
- */
-
-static const char *const stateStrings[] = {
+const char *const tkStateStrings[] = {
"active", "disabled", "normal", NULL
};
@@ -51,7 +42,7 @@ static const char *const stateStrings[] = {
* It is used with the "enum compound" declaration in tkButton.h
*/
-static const char *const compoundStrings[] = {
+const char *const tkCompoundStrings[] = {
"bottom", "center", "left", "none", "right", "top", NULL
};
@@ -91,15 +82,15 @@ static const Tk_OptionSpec labelOptionSpecs[] = {
tkDefButtonBorderWidth, offsetof(TkButton, borderWidthPtr),
offsetof(TkButton, borderWidth), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
- DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkButton, compound), 0,
- compoundStrings, 0},
+ DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkButton, compound),
+ 0, tkCompoundStrings, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_BUTTON_CURSOR, TCL_INDEX_NONE, offsetof(TkButton, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_COLOR, "-disabledforeground", "disabledForeground",
"DisabledForeground", DEF_BUTTON_DISABLED_FG_COLOR,
TCL_INDEX_NONE, offsetof(TkButton, disabledFg), TK_OPTION_NULL_OK,
- (ClientData) DEF_BUTTON_DISABLED_FG_MONO, 0},
+ DEF_BUTTON_DISABLED_FG_MONO, 0},
{TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
@@ -111,7 +102,7 @@ static const Tk_OptionSpec labelOptionSpecs[] = {
{TK_OPTION_BORDER, "-highlightbackground", "highlightBackground",
"HighlightBackground", DEF_BUTTON_HIGHLIGHT_BG_COLOR,
TCL_INDEX_NONE, offsetof(TkButton, highlightBorder), 0,
- (ClientData) DEF_BUTTON_HIGHLIGHT_BG_MONO, 0},
+ DEF_BUTTON_HIGHLIGHT_BG_MONO, 0},
{TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
DEF_BUTTON_HIGHLIGHT, TCL_INDEX_NONE, offsetof(TkButton, highlightColorPtr),
0, 0, 0},
@@ -134,7 +125,7 @@ static const Tk_OptionSpec labelOptionSpecs[] = {
DEF_LABCHKRAD_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, relief), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
DEF_BUTTON_STATE, TCL_INDEX_NONE, offsetof(TkButton, state),
- 0, stateStrings, 0},
+ TK_OPTION_ENUM_VAR, tkStateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
DEF_LABEL_TAKE_FOCUS, offsetof(TkButton, takeFocusPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
@@ -179,18 +170,18 @@ static const Tk_OptionSpec buttonOptionSpecs[] = {
DEF_BUTTON_COMMAND, offsetof(TkButton, commandPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
- DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkButton, compound), 0,
- compoundStrings, 0},
+ DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkButton, compound),
+ 0, tkCompoundStrings, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_BUTTON_CURSOR, TCL_INDEX_NONE, offsetof(TkButton, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-default", "default", "Default",
- DEF_BUTTON_DEFAULT, TCL_INDEX_NONE, offsetof(TkButton, defaultState),
- 0, defaultStrings, 0},
+ DEF_BUTTON_DEFAULT, TCL_INDEX_NONE, offsetof(TkButton, defaultState),
+ TK_OPTION_ENUM_VAR, tkStateStrings, 0},
{TK_OPTION_COLOR, "-disabledforeground", "disabledForeground",
"DisabledForeground", DEF_BUTTON_DISABLED_FG_COLOR,
TCL_INDEX_NONE, offsetof(TkButton, disabledFg), TK_OPTION_NULL_OK,
- (ClientData) DEF_BUTTON_DISABLED_FG_MONO, 0},
+ DEF_BUTTON_DISABLED_FG_MONO, 0},
{TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
@@ -202,7 +193,7 @@ static const Tk_OptionSpec buttonOptionSpecs[] = {
{TK_OPTION_BORDER, "-highlightbackground", "highlightBackground",
"HighlightBackground", DEF_BUTTON_HIGHLIGHT_BG_COLOR,
TCL_INDEX_NONE, offsetof(TkButton, highlightBorder), 0,
- (ClientData) DEF_BUTTON_HIGHLIGHT_BG_MONO, 0},
+ DEF_BUTTON_HIGHLIGHT_BG_MONO, 0},
{TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
DEF_BUTTON_HIGHLIGHT, TCL_INDEX_NONE, offsetof(TkButton, highlightColorPtr),
0, 0, 0},
@@ -235,7 +226,7 @@ static const Tk_OptionSpec buttonOptionSpecs[] = {
0, 0, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
DEF_BUTTON_STATE, TCL_INDEX_NONE, offsetof(TkButton, state),
- 0, stateStrings, 0},
+ TK_OPTION_ENUM_VAR, tkStateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
DEF_BUTTON_TAKE_FOCUS, offsetof(TkButton, takeFocusPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
@@ -280,15 +271,15 @@ static const Tk_OptionSpec checkbuttonOptionSpecs[] = {
DEF_BUTTON_COMMAND, offsetof(TkButton, commandPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
- DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkButton, compound), 0,
- compoundStrings, 0},
+ DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkButton, compound),
+ 0, tkCompoundStrings, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_BUTTON_CURSOR, TCL_INDEX_NONE, offsetof(TkButton, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_COLOR, "-disabledforeground", "disabledForeground",
"DisabledForeground", DEF_BUTTON_DISABLED_FG_COLOR,
TCL_INDEX_NONE, offsetof(TkButton, disabledFg), TK_OPTION_NULL_OK,
- (ClientData) DEF_BUTTON_DISABLED_FG_MONO, 0},
+ DEF_BUTTON_DISABLED_FG_MONO, 0},
{TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
@@ -300,7 +291,7 @@ static const Tk_OptionSpec checkbuttonOptionSpecs[] = {
{TK_OPTION_BORDER, "-highlightbackground", "highlightBackground",
"HighlightBackground", DEF_BUTTON_HIGHLIGHT_BG_COLOR,
TCL_INDEX_NONE, offsetof(TkButton, highlightBorder), 0,
- (ClientData) DEF_BUTTON_HIGHLIGHT_BG_MONO, 0},
+ DEF_BUTTON_HIGHLIGHT_BG_MONO, 0},
{TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
DEF_BUTTON_HIGHLIGHT, TCL_INDEX_NONE, offsetof(TkButton, highlightColorPtr),
0, 0, 0},
@@ -316,14 +307,14 @@ static const Tk_OptionSpec checkbuttonOptionSpecs[] = {
{TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
DEF_BUTTON_JUSTIFY, TCL_INDEX_NONE, offsetof(TkButton, justify), 0, 0, 0},
{TK_OPTION_RELIEF, "-offrelief", "offRelief", "OffRelief",
- DEF_BUTTON_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, offRelief), 0, 0, 0},
+ DEF_BUTTON_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, offRelief), 0, 0, 0},
{TK_OPTION_STRING, "-offvalue", "offValue", "Value",
DEF_BUTTON_OFF_VALUE, offsetof(TkButton, offValuePtr), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_STRING, "-onvalue", "onValue", "Value",
DEF_BUTTON_ON_VALUE, offsetof(TkButton, onValuePtr), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_RELIEF, "-overrelief", "overRelief", "OverRelief",
- DEF_BUTTON_OVER_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, overRelief),
- TK_OPTION_NULL_OK, 0, 0},
+ DEF_BUTTON_OVER_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, overRelief),
+ TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-padx", "padX", "Pad",
tkDefLabelPadx, offsetof(TkButton, padXPtr),
offsetof(TkButton, padX), 0, 0, 0},
@@ -340,7 +331,7 @@ static const Tk_OptionSpec checkbuttonOptionSpecs[] = {
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
DEF_BUTTON_STATE, TCL_INDEX_NONE, offsetof(TkButton, state),
- 0, stateStrings, 0},
+ TK_OPTION_ENUM_VAR, tkStateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
DEF_BUTTON_TAKE_FOCUS, offsetof(TkButton, takeFocusPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
@@ -393,15 +384,15 @@ static const Tk_OptionSpec radiobuttonOptionSpecs[] = {
DEF_BUTTON_COMMAND, offsetof(TkButton, commandPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
- DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkButton, compound), 0,
- compoundStrings, 0},
+ DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkButton, compound),
+ 0, tkCompoundStrings, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_BUTTON_CURSOR, TCL_INDEX_NONE, offsetof(TkButton, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_COLOR, "-disabledforeground", "disabledForeground",
"DisabledForeground", DEF_BUTTON_DISABLED_FG_COLOR,
TCL_INDEX_NONE, offsetof(TkButton, disabledFg), TK_OPTION_NULL_OK,
- (ClientData) DEF_BUTTON_DISABLED_FG_MONO, 0},
+ DEF_BUTTON_DISABLED_FG_MONO, 0},
{TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
@@ -413,7 +404,7 @@ static const Tk_OptionSpec radiobuttonOptionSpecs[] = {
{TK_OPTION_BORDER, "-highlightbackground", "highlightBackground",
"HighlightBackground", DEF_BUTTON_HIGHLIGHT_BG_COLOR,
TCL_INDEX_NONE, offsetof(TkButton, highlightBorder), 0,
- (ClientData) DEF_BUTTON_HIGHLIGHT_BG_MONO, 0},
+ DEF_BUTTON_HIGHLIGHT_BG_MONO, 0},
{TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
DEF_BUTTON_HIGHLIGHT, TCL_INDEX_NONE, offsetof(TkButton, highlightColorPtr),
0, 0, 0},
@@ -450,7 +441,7 @@ static const Tk_OptionSpec radiobuttonOptionSpecs[] = {
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
DEF_BUTTON_STATE, TCL_INDEX_NONE, offsetof(TkButton, state),
- 0, stateStrings, 0},
+ TK_OPTION_ENUM_VAR, tkStateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
DEF_BUTTON_TAKE_FOCUS, offsetof(TkButton, takeFocusPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
@@ -1626,14 +1617,14 @@ ButtonVarProc(
if (flags & TCL_TRACE_UNSETS) {
butPtr->flags &= ~(SELECTED | TRISTATED);
if (!Tcl_InterpDeleted(interp)) {
- ClientData probe = NULL;
+ void *probe = NULL;
do {
probe = Tcl_VarTraceInfo(interp,
Tcl_GetString(butPtr->selVarNamePtr),
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
ButtonVarProc, probe);
- if (probe == (ClientData)butPtr) {
+ if (probe == (void *)butPtr) {
break;
}
} while (probe);
@@ -1745,14 +1736,14 @@ ButtonTextVarProc(
* the variable we have stored in butPtr->textVarNamePtr ?
*/
- ClientData probe = NULL;
+ void *probe = NULL;
do {
probe = Tcl_VarTraceInfo(interp,
Tcl_GetString(butPtr->textVarNamePtr),
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
ButtonTextVarProc, probe);
- if (probe == (ClientData)butPtr) {
+ if (probe == (void *)butPtr) {
break;
}
} while (probe);
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c
index 5b9affe..ed9f2b6 100644
--- a/generic/tkCanvas.c
+++ b/generic/tkCanvas.c
@@ -215,28 +215,28 @@ static SearchUids * GetStaticUids(void);
* Prototypes for functions defined later in this file:
*/
-static void CanvasBindProc(ClientData clientData,
+static void CanvasBindProc(void *clientData,
XEvent *eventPtr);
-static void CanvasBlinkProc(ClientData clientData);
-static void CanvasCmdDeletedProc(ClientData clientData);
+static void CanvasBlinkProc(void *clientData);
+static void CanvasCmdDeletedProc(void *clientData);
static void CanvasDoEvent(TkCanvas *canvasPtr, XEvent *eventPtr);
-static void CanvasEventProc(ClientData clientData,
+static void CanvasEventProc(void *clientData,
XEvent *eventPtr);
-static TkSizeT CanvasFetchSelection(ClientData clientData, TkSizeT offset,
+static TkSizeT CanvasFetchSelection(void *clientData, TkSizeT offset,
char *buffer, TkSizeT maxBytes);
static Tk_Item * CanvasFindClosest(TkCanvas *canvasPtr,
double coords[2]);
static void CanvasFocusProc(TkCanvas *canvasPtr, int gotFocus);
-static void CanvasLostSelection(ClientData clientData);
+static void CanvasLostSelection(void *clientData);
static void CanvasSelectTo(TkCanvas *canvasPtr,
Tk_Item *itemPtr, TkSizeT index);
static void CanvasSetOrigin(TkCanvas *canvasPtr,
int xOrigin, int yOrigin);
static void CanvasUpdateScrollbars(TkCanvas *canvasPtr);
-static int CanvasWidgetCmd(ClientData clientData,
+static int CanvasWidgetCmd(void *clientData,
Tcl_Interp *interp, int argc,
Tcl_Obj *const *argv);
-static void CanvasWorldChanged(ClientData instanceData);
+static void CanvasWorldChanged(void *instanceData);
static int ConfigureCanvas(Tcl_Interp *interp,
TkCanvas *canvasPtr, int argc,
Tcl_Obj *const *argv, int flags);
@@ -244,8 +244,8 @@ static void DefaultRotateImplementation(TkCanvas *canvasPtr,
Tk_Item *itemPtr, double x, double y,
double angleRadians);
static void DestroyCanvas(void *memPtr);
-static int DrawCanvas(Tcl_Interp *interp, ClientData clientData, Tk_PhotoHandle photohandle, int subsample, int zoom);
-static void DisplayCanvas(ClientData clientData);
+static int DrawCanvas(Tcl_Interp *interp, void *clientData, Tk_PhotoHandle photohandle, int subsample, int zoom);
+static void DisplayCanvas(void *clientData);
static void DoItem(Tcl_Obj *accumObj,
Tk_Item *itemPtr, Tk_Uid tag);
static void EventuallyRedrawItem(TkCanvas *canvasPtr,
@@ -678,7 +678,7 @@ DefaultRotateImplementation(
int
Tk_CanvasObjCmd(
- ClientData clientData, /* Main window associated with interpreter. */
+ void *clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
Tcl_Obj *const argv[]) /* Argument objects. */
@@ -826,7 +826,7 @@ Tk_CanvasObjCmd(
static int
CanvasWidgetCmd(
- ClientData clientData, /* Information about canvas widget. */
+ void *clientData, /* Information about canvas widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1917,7 +1917,7 @@ CanvasWidgetCmd(
case CANV_SCAN: {
int x, y, gain = 10;
static const char *const optionStrings[] = {
- "mark", "dragto", NULL
+ "dragto", "mark", NULL
};
if (objc < 5) {
@@ -1926,8 +1926,8 @@ CanvasWidgetCmd(
} else if (Tcl_GetIndexFromObj(interp, objv[2], optionStrings,
"scan option", 0, &idx) != TCL_OK) {
result = TCL_ERROR;
- } else if ((objc != 5) && (objc != 5+idx)) {
- Tcl_WrongNumArgs(interp, 3, objv, idx?"x y ?gain?":"x y");
+ } else if ((objc != 5) && (objc != 6-idx)) {
+ Tcl_WrongNumArgs(interp, 3, objv, idx?"x y":"x y ?gain?");
result = TCL_ERROR;
} else if ((Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK)
|| (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK)){
@@ -1935,7 +1935,7 @@ CanvasWidgetCmd(
} else if ((objc == 6) &&
(Tcl_GetIntFromObj(interp, objv[5], &gain) != TCL_OK)) {
result = TCL_ERROR;
- } else if (!idx) {
+ } else if (idx) {
canvasPtr->scanX = x;
canvasPtr->scanXOrigin = canvasPtr->xOrigin;
canvasPtr->scanY = y;
@@ -2464,7 +2464,7 @@ ConfigureCanvas(
static void
CanvasWorldChanged(
- ClientData instanceData) /* Information about widget. */
+ void *instanceData) /* Information about widget. */
{
TkCanvas *canvasPtr = (TkCanvas *)instanceData;
Tk_Item *itemPtr;
@@ -2574,7 +2574,7 @@ DecomposeMaskToShiftAndBits(
static int
DrawCanvas(
Tcl_Interp *interp, /* As passed to the widget command, and we will leave errors here */
- ClientData clientData,
+ void *clientData,
Tk_PhotoHandle photohandle, /* The photo we are rendering into */
int subsample, /* If either subsample or zoom are not 1 then we call Tk_PhotoPutZoomedBlock() */
int zoom)
@@ -3029,7 +3029,7 @@ done:
static void
DisplayCanvas(
- ClientData clientData) /* Information about widget. */
+ void *clientData) /* Information about widget. */
{
TkCanvas *canvasPtr = (TkCanvas *)clientData;
Tk_Window tkwin = canvasPtr->tkwin;
@@ -3286,7 +3286,7 @@ DisplayCanvas(
static void
CanvasEventProc(
- ClientData clientData, /* Information about window. */
+ void *clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
TkCanvas *canvasPtr = (TkCanvas *)clientData;
@@ -3377,7 +3377,7 @@ CanvasEventProc(
static void
CanvasCmdDeletedProc(
- ClientData clientData) /* Pointer to widget record for widget. */
+ void *clientData) /* Pointer to widget record for widget. */
{
TkCanvas *canvasPtr = (TkCanvas *)clientData;
Tk_Window tkwin = canvasPtr->tkwin;
@@ -4631,7 +4631,7 @@ DoItem(
itemPtr->tagSpace += 5;
newTagPtr = (Tk_Uid *)ckalloc(itemPtr->tagSpace * sizeof(Tk_Uid));
- memcpy((void *) newTagPtr, itemPtr->tagPtr,
+ memcpy(newTagPtr, itemPtr->tagPtr,
itemPtr->numTags * sizeof(Tk_Uid));
if (itemPtr->tagPtr != itemPtr->staticTagSpace) {
ckfree(itemPtr->tagPtr);
@@ -5112,7 +5112,7 @@ RelinkItems(
static void
CanvasBindProc(
- ClientData clientData, /* Pointer to canvas structure. */
+ void *clientData, /* Pointer to canvas structure. */
XEvent *eventPtr) /* Pointer to X event that just happened. */
{
TkCanvas *canvasPtr = (TkCanvas *)clientData;
@@ -5575,7 +5575,7 @@ CanvasDoEvent(
static void
CanvasBlinkProc(
- ClientData clientData) /* Pointer to record describing entry. */
+ void *clientData) /* Pointer to record describing entry. */
{
TkCanvas *canvasPtr = (TkCanvas *)clientData;
@@ -5725,7 +5725,7 @@ CanvasSelectTo(
static TkSizeT
CanvasFetchSelection(
- ClientData clientData, /* Information about canvas widget. */
+ void *clientData, /* Information about canvas widget. */
TkSizeT offset, /* Offset within selection of first character
* to be returned. */
char *buffer, /* Location in which to place selection. */
@@ -5759,7 +5759,7 @@ CanvasFetchSelection(
static void
CanvasLostSelection(
- ClientData clientData) /* Information about entry widget. */
+ void *clientData) /* Information about entry widget. */
{
TkCanvas *canvasPtr = (TkCanvas *)clientData;
diff --git a/generic/tkCmds.c b/generic/tkCmds.c
index 4fb06b2..b4c6cc6 100644
--- a/generic/tkCmds.c
+++ b/generic/tkCmds.c
@@ -185,10 +185,10 @@ Tk_BindObjCmd(
if (winPtr == NULL) {
return TCL_ERROR;
}
- object = (ClientData) winPtr->pathName;
+ object = winPtr->pathName;
} else {
winPtr = (TkWindow *)clientData;
- object = (ClientData) Tk_GetUid(string);
+ object = (void *) Tk_GetUid(string);
}
/*
@@ -267,10 +267,10 @@ TkBindEventProc(
XEvent *eventPtr) /* Information about event. */
{
#define MAX_OBJS 20
- ClientData objects[MAX_OBJS], *objPtr;
+ void *objects[MAX_OBJS], **objPtr;
TkWindow *topLevPtr;
TkSizeT i, count;
- const char *p;
+ char *p;
Tcl_HashEntry *hPtr;
if ((winPtr->mainPtr == NULL) || (winPtr->mainPtr->bindingTable == NULL)) {
@@ -288,7 +288,7 @@ TkBindEventProc(
objPtr = (void **)ckalloc(winPtr->numTags * sizeof(void *));
}
for (i = 0; i < winPtr->numTags; i++) {
- p = (const char *)winPtr->tagPtr[i];
+ p = (char *)winPtr->tagPtr[i];
if (*p == '.') {
hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->nameTable, p);
if (hPtr != NULL) {
@@ -297,12 +297,12 @@ TkBindEventProc(
p = NULL;
}
}
- objPtr[i] = (ClientData) p;
+ objPtr[i] = p;
}
count = winPtr->numTags;
} else {
- objPtr[0] = (ClientData) winPtr->pathName;
- objPtr[1] = (ClientData) winPtr->classUid;
+ objPtr[0] = winPtr->pathName;
+ objPtr[1] = (void *)winPtr->classUid;
for (topLevPtr = winPtr;
(topLevPtr != NULL) && !(topLevPtr->flags & TK_TOP_HIERARCHY);
topLevPtr = topLevPtr->parentPtr) {
@@ -310,11 +310,11 @@ TkBindEventProc(
}
if ((winPtr != topLevPtr) && (topLevPtr != NULL)) {
count = 4;
- objPtr[2] = (ClientData) topLevPtr->pathName;
+ objPtr[2] = topLevPtr->pathName;
} else {
count = 3;
}
- objPtr[count-1] = (ClientData) Tk_GetUid("all");
+ objPtr[count-1] = (void *) Tk_GetUid("all");
}
Tk_BindEvent(winPtr->mainPtr->bindingTable, eventPtr, (Tk_Window) winPtr,
count, objPtr);
@@ -415,9 +415,9 @@ Tk_BindtagsObjCmd(
copy = (char *)ckalloc(strlen(p) + 1);
strcpy(copy, p);
- winPtr->tagPtr[i] = (ClientData) copy;
+ winPtr->tagPtr[i] = copy;
} else {
- winPtr->tagPtr[i] = (ClientData) Tk_GetUid(p);
+ winPtr->tagPtr[i] = (void *)Tk_GetUid(p);
}
}
return TCL_OK;
diff --git a/generic/tkConfig.c b/generic/tkConfig.c
index 9fbfb76..6314bb2 100644
--- a/generic/tkConfig.c
+++ b/generic/tkConfig.c
@@ -27,6 +27,16 @@
#include "tkFont.h"
/*
+ * The following encoding is used in TYPE_FLAGS:
+ *
+ * if sizeof(type) == sizeof(int) => TYPE_FLAGS(type) = 0
+ * if sizeof(type) == 1 => TYPE_FLAGS(type) = 64
+ * if sizeof(type) == 2 => TYPE_FLAGS(type) = 128
+ */
+#define TYPE_FLAGS(type) (((int)(sizeof(type)&(sizeof(int)-1))<<6))
+#define TYPE_MASK (((((int)sizeof(int)-1))|3)<<6)
+
+/*
* The following definition keeps track of all of
* the option tables that have been created for a thread.
*/
@@ -739,8 +749,20 @@ DoObjConfig(
}
}
if (internalPtr != NULL) {
- *((int *) oldInternalPtr) = *((int *) internalPtr);
- *((int *) internalPtr) = newValue;
+ if (optionPtr->specPtr->flags & TYPE_MASK) {
+ if ((optionPtr->specPtr->flags & TYPE_MASK) == TYPE_FLAGS(char)) {
+ *((char *) oldInternalPtr) = *((char *) internalPtr);
+ *((char *) internalPtr) = newValue;
+ } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TYPE_FLAGS(short)) {
+ *((short *) oldInternalPtr) = *((short *) internalPtr);
+ *((short *) internalPtr) = newValue;
+ } else {
+ Tcl_Panic("Invalid flags for %s", "TK_OPTION_STRING_TABLE");
+ }
+ } else {
+ *((int *) oldInternalPtr) = *((int *) internalPtr);
+ *((int *) internalPtr) = newValue;
+ }
}
break;
}
@@ -1470,7 +1492,17 @@ Tk_RestoreSavedOptions(
*((char **) internalPtr) = *((char **) ptr);
break;
case TK_OPTION_STRING_TABLE:
- *((int *) internalPtr) = *((int *) ptr);
+ if (optionPtr->specPtr->flags & TYPE_MASK) {
+ if ((optionPtr->specPtr->flags & TYPE_MASK) == TYPE_FLAGS(char)) {
+ *((char *) internalPtr) = *((char *) ptr);
+ } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TYPE_FLAGS(short)) {
+ *((short *) internalPtr) = *((short *) ptr);
+ } else {
+ Tcl_Panic("Invalid flags for %s", "TK_OPTION_STRING_TABLE");
+ }
+ } else {
+ *((int *) internalPtr) = *((int *) ptr);
+ }
break;
case TK_OPTION_COLOR:
*((XColor **) internalPtr) = *((XColor **) ptr);
@@ -1961,12 +1993,25 @@ GetObjectForOption(
case TK_OPTION_STRING:
objPtr = Tcl_NewStringObj(*((char **)internalPtr), -1);
break;
- case TK_OPTION_STRING_TABLE:
- if (*((int *) internalPtr) >= 0) {
+ case TK_OPTION_STRING_TABLE: {
+ int value;
+ if (optionPtr->specPtr->flags & TYPE_MASK) {
+ if ((optionPtr->specPtr->flags & TYPE_MASK) == TYPE_FLAGS(char)) {
+ value = *((signed char *)internalPtr);
+ } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TYPE_FLAGS(short)) {
+ value = *((short *)internalPtr);
+ } else {
+ Tcl_Panic("Invalid flags for %s", "TK_OPTION_STRING_TABLE");
+ }
+ } else {
+ value = *((int *)internalPtr);
+ }
+ if (value >= 0) {
objPtr = Tcl_NewStringObj(((char **) optionPtr->specPtr->clientData)[
- *((int *) internalPtr)], -1);
+ value], -1);
}
break;
+ }
case TK_OPTION_COLOR: {
XColor *colorPtr = *((XColor **)internalPtr);
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index 28ad727..26e4d86 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.c
@@ -77,7 +77,7 @@ static const Tk_OptionSpec entryOptSpec[] = {
{TK_OPTION_BORDER, "-disabledbackground", "disabledBackground",
"DisabledBackground", DEF_ENTRY_DISABLED_BG_COLOR, TCL_INDEX_NONE,
offsetof(Entry, disabledBorder), TK_OPTION_NULL_OK,
- (ClientData) DEF_ENTRY_DISABLED_BG_MONO, 0},
+ DEF_ENTRY_DISABLED_BG_MONO, 0},
{TK_OPTION_COLOR, "-disabledforeground", "disabledForeground",
"DisabledForeground", DEF_ENTRY_DISABLED_FG, TCL_INDEX_NONE,
offsetof(Entry, dfgColorPtr), TK_OPTION_NULL_OK, 0, 0},
@@ -103,7 +103,7 @@ static const Tk_OptionSpec entryOptSpec[] = {
{TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth",
"BorderWidth", DEF_ENTRY_INSERT_BD_COLOR, TCL_INDEX_NONE,
offsetof(Entry, insertBorderWidth), 0,
- (ClientData) DEF_ENTRY_INSERT_BD_MONO, 0},
+ DEF_ENTRY_INSERT_BD_MONO, 0},
{TK_OPTION_INT, "-insertofftime", "insertOffTime", "OffTime",
DEF_ENTRY_INSERT_OFF_TIME, TCL_INDEX_NONE, offsetof(Entry, insertOffTime),
0, 0, 0},
@@ -122,12 +122,12 @@ static const Tk_OptionSpec entryOptSpec[] = {
DEF_ENTRY_PLACEHOLDER, TCL_INDEX_NONE, offsetof(Entry, placeholderString),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_COLOR, "-placeholderforeground", "placeholderForeground",
- "PlaceholderForeground", DEF_ENTRY_PLACEHOLDERFG, TCL_INDEX_NONE,
- offsetof(Entry, placeholderColorPtr), 0, 0, 0},
+ "PlaceholderForeground", DEF_ENTRY_PLACEHOLDERFG, TCL_INDEX_NONE,
+ offsetof(Entry, placeholderColorPtr), 0, 0, 0},
{TK_OPTION_BORDER, "-readonlybackground", "readonlyBackground",
"ReadonlyBackground", DEF_ENTRY_READONLY_BG_COLOR, TCL_INDEX_NONE,
offsetof(Entry, readonlyBorder), TK_OPTION_NULL_OK,
- (ClientData) DEF_ENTRY_READONLY_BG_MONO, 0},
+ DEF_ENTRY_READONLY_BG_MONO, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
DEF_ENTRY_RELIEF, TCL_INDEX_NONE, offsetof(Entry, relief), 0, 0, 0},
{TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground",
@@ -216,7 +216,7 @@ static const Tk_OptionSpec sbOptSpec[] = {
{TK_OPTION_BORDER, "-disabledbackground", "disabledBackground",
"DisabledBackground", DEF_ENTRY_DISABLED_BG_COLOR, TCL_INDEX_NONE,
offsetof(Entry, disabledBorder), TK_OPTION_NULL_OK,
- (ClientData) DEF_ENTRY_DISABLED_BG_MONO, 0},
+ DEF_ENTRY_DISABLED_BG_MONO, 0},
{TK_OPTION_COLOR, "-disabledforeground", "disabledForeground",
"DisabledForeground", DEF_ENTRY_DISABLED_FG, TCL_INDEX_NONE,
offsetof(Entry, dfgColorPtr), TK_OPTION_NULL_OK, 0, 0},
@@ -249,7 +249,7 @@ static const Tk_OptionSpec sbOptSpec[] = {
{TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth",
"BorderWidth", DEF_ENTRY_INSERT_BD_COLOR, TCL_INDEX_NONE,
offsetof(Entry, insertBorderWidth), 0,
- (ClientData) DEF_ENTRY_INSERT_BD_MONO, 0},
+ DEF_ENTRY_INSERT_BD_MONO, 0},
{TK_OPTION_INT, "-insertofftime", "insertOffTime", "OffTime",
DEF_ENTRY_INSERT_OFF_TIME, TCL_INDEX_NONE, offsetof(Entry, insertOffTime),
0, 0, 0},
@@ -275,7 +275,7 @@ static const Tk_OptionSpec sbOptSpec[] = {
{TK_OPTION_BORDER, "-readonlybackground", "readonlyBackground",
"ReadonlyBackground", DEF_ENTRY_READONLY_BG_COLOR, TCL_INDEX_NONE,
offsetof(Entry, readonlyBorder), TK_OPTION_NULL_OK,
- (ClientData) DEF_ENTRY_READONLY_BG_MONO, 0},
+ DEF_ENTRY_READONLY_BG_MONO, 0},
{TK_OPTION_INT, "-repeatdelay", "repeatDelay", "RepeatDelay",
DEF_SPINBOX_REPEAT_DELAY, TCL_INDEX_NONE, offsetof(Spinbox, repeatDelay),
0, 0, 0},
@@ -387,7 +387,7 @@ enum sbselCmd {
*/
static const char *const selElementNames[] = {
- "none", "buttondown", "buttonup", NULL, "entry"
+ "buttondown", "buttonup", "none", NULL, "entry"
};
/*
@@ -784,7 +784,7 @@ EntryWidgetObjCmd(
EntryScanTo(entryPtr, x);
} else {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad scan option \"%s\": must be mark or dragto",
+ "bad scan option \"%s\": must be dragto or mark",
minorCmd));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "INDEX", "scan option",
minorCmd, NULL);
@@ -3267,14 +3267,14 @@ EntryTextVarProc(
if (flags & TCL_TRACE_UNSETS) {
if (!Tcl_InterpDeleted(interp) && entryPtr->textVarName) {
- ClientData probe = NULL;
+ void *probe = NULL;
do {
probe = Tcl_VarTraceInfo(interp,
entryPtr->textVarName,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
EntryTextVarProc, probe);
- if (probe == (ClientData)entryPtr) {
+ if (probe == (void *)entryPtr) {
break;
}
} while (probe);
@@ -4059,7 +4059,7 @@ SpinboxWidgetObjCmd(
EntryScanTo(entryPtr, x);
} else {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad scan option \"%s\": must be mark or dragto",
+ "bad scan option \"%s\": must be dragto or mark",
minorCmd));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "INDEX", "scan option",
minorCmd, NULL);
diff --git a/generic/tkEntry.h b/generic/tkEntry.h
index fe0f2f7..939206b 100644
--- a/generic/tkEntry.h
+++ b/generic/tkEntry.h
@@ -296,7 +296,7 @@ enum state {
*/
enum selelement {
- SEL_NONE, SEL_BUTTONDOWN, SEL_BUTTONUP, SEL_NULL, SEL_ENTRY
+ SEL_BUTTONDOWN, SEL_BUTTONUP, SEL_NONE, SEL_NULL, SEL_ENTRY
};
/*
diff --git a/generic/tkFont.c b/generic/tkFont.c
index 18821df..74c617f 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.c
@@ -744,7 +744,7 @@ Tk_FontObjCmd(
int skip, i;
const TkFontMetrics *fmPtr;
static const char *const switches[] = {
- "-ascent", "-descent", "-linespace", "-fixed", NULL
+ "-ascent", "-descent", "-fixed", "-linespace", NULL
};
skip = TkGetDisplayOf(interp, objc - 3, objv + 3, &tkwin);
@@ -778,8 +778,8 @@ Tk_FontObjCmd(
switch (index) {
case 0: i = fmPtr->ascent; break;
case 1: i = fmPtr->descent; break;
- case 2: i = fmPtr->ascent + fmPtr->descent; break;
- case 3: i = fmPtr->fixed; break;
+ case 2: i = fmPtr->fixed; break;
+ case 3: i = fmPtr->ascent + fmPtr->descent; break;
}
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(i));
}
diff --git a/generic/tkInt.h b/generic/tkInt.h
index 50dd589..5d69236 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -19,6 +19,8 @@
#include "tkPort.h"
#endif
+#define TK_OPTION_ENUM_VAR ((int)(sizeof(Tk_OptionType)&(sizeof(int)-1))<<6)
+
/*
* Ensure WORDS_BIGENDIAN is defined correctly:
* Needs to happen here in addition to configure to work with fat compiles on
@@ -113,23 +115,17 @@
* to/from pointer from/to integer of different size".
*/
-#if !defined(INT2PTR) && !defined(PTR2INT)
-# if defined(HAVE_INTPTR_T) || defined(intptr_t)
-# define INT2PTR(p) ((void*)(intptr_t)(p))
-# define PTR2INT(p) ((intptr_t)(p))
-# else
-# define INT2PTR(p) ((void*)(p))
-# define PTR2INT(p) ((long)(p))
-# endif
+#if !defined(INT2PTR)
+# define INT2PTR(p) ((void *)(ptrdiff_t)(p))
#endif
-#if !defined(UINT2PTR) && !defined(PTR2UINT)
-# if defined(HAVE_UINTPTR_T) || defined(uintptr_t)
-# define UINT2PTR(p) ((void*)(uintptr_t)(p))
-# define PTR2UINT(p) ((uintptr_t)(p))
-# else
-# define UINT2PTR(p) ((void*)(p))
-# define PTR2UINT(p) ((unsigned long)(p))
-# endif
+#if !defined(PTR2INT)
+# define PTR2INT(p) ((ptrdiff_t)(p))
+#endif
+#if !defined(UINT2PTR)
+# define UINT2PTR(p) ((void *)(size_t)(p))
+#endif
+#if !defined(PTR2UINT)
+# define PTR2UINT(p) ((size_t)(p))
#endif
/*
@@ -137,12 +133,12 @@
* (TCL_INDEX_TEMP_TABLE) or TIP #613 (TCL_INDEX_NULL_OK)
*/
-#if !defined(TCL_INDEX_TEMP_TABLE)
-# define TCL_INDEX_TEMP_TABLE 2
-#endif
#ifndef TCL_INDEX_NULL_OK
# define TCL_INDEX_NULL_OK 32
#endif
+#if !defined(TCL_INDEX_TEMP_TABLE)
+# define TCL_INDEX_TEMP_TABLE 64
+#endif
#ifndef TCL_Z_MODIFIER
# if defined(_WIN64)
@@ -937,6 +933,8 @@ typedef struct TkWindow {
* String tables:
*/
+MODULE_SCOPE const char *const tkStateStrings[];
+MODULE_SCOPE const char *const tkCompoundStrings[];
MODULE_SCOPE const char *const tkAnchorStrings[];
MODULE_SCOPE const char *const tkReliefStrings[];
MODULE_SCOPE const char *const tkJustifyStrings[];
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index 6a3b73e..10ab4ee 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.c
@@ -220,10 +220,6 @@ enum state {
STATE_DISABLED, STATE_NORMAL
};
-static const char *const stateStrings[] = {
- "disabled", "normal", NULL
-};
-
enum activeStyle {
ACTIVE_STYLE_DOTBOX, ACTIVE_STYLE_NONE, ACTIVE_STYLE_UNDERLINE
};
@@ -297,7 +293,7 @@ static const Tk_OptionSpec optionSpecs[] = {
DEF_LISTBOX_SET_GRID, TCL_INDEX_NONE, offsetof(Listbox, setGrid), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
DEF_LISTBOX_STATE, TCL_INDEX_NONE, offsetof(Listbox, state),
- 0, stateStrings, 0},
+ 0, &tkStateStrings[1], 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
DEF_LISTBOX_TAKE_FOCUS, TCL_INDEX_NONE, offsetof(Listbox, takeFocus),
TK_OPTION_NULL_OK, 0, 0},
@@ -370,10 +366,10 @@ enum selcommand {
};
static const char *const scanCommandNames[] = {
- "mark", "dragto", NULL
+ "dragto", "mark", NULL
};
enum scancommand {
- SCAN_MARK, SCAN_DRAGTO
+ SCAN_DRAGTO, SCAN_MARK
};
static const char *const indexNames[] = {
@@ -3455,14 +3451,14 @@ ListboxListVarProc(
if (flags & TCL_TRACE_UNSETS) {
if (!Tcl_InterpDeleted(interp) && listPtr->listVarName) {
- ClientData probe = NULL;
+ void *probe = NULL;
do {
probe = Tcl_VarTraceInfo(interp,
listPtr->listVarName,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
ListboxListVarProc, probe);
- if (probe == (ClientData)listPtr) {
+ if (probe == (void *)listPtr) {
break;
}
} while (probe);
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index 8958c51..c1696f4 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -101,21 +101,10 @@ TCL_DECLARE_MUTEX(menuMutex)
* to update code in TkpMenuInit that changes the font string entry.
*/
-static const char *const menuStateStrings[] = {"active", "normal", "disabled", NULL};
-
static const char *const menuEntryTypeStrings[] = {
"cascade", "checkbutton", "command", "radiobutton", "separator", NULL
};
-/*
- * The following table defines the legal values for the -compound option. It
- * is used with the "enum compound" declaration in tkMenu.h
- */
-
-static const char *const compoundStrings[] = {
- "bottom", "center", "left", "none", "right", "top", NULL
-};
-
static const Tk_OptionSpec tkBasicMenuEntryConfigSpecs[] = {
{TK_OPTION_BORDER, "-activebackground", NULL, NULL,
DEF_MENU_ENTRY_ACTIVE_BG, offsetof(TkMenuEntry, activeBorderPtr), TCL_INDEX_NONE,
@@ -140,7 +129,7 @@ static const Tk_OptionSpec tkBasicMenuEntryConfigSpecs[] = {
offsetof(TkMenuEntry, commandPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
DEF_MENU_ENTRY_COMPOUND, TCL_INDEX_NONE, offsetof(TkMenuEntry, compound), 0,
- (ClientData) compoundStrings, 0},
+ tkCompoundStrings, 0},
{TK_OPTION_FONT, "-font", NULL, NULL,
DEF_MENU_ENTRY_FONT,
offsetof(TkMenuEntry, fontPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
@@ -158,8 +147,8 @@ static const Tk_OptionSpec tkBasicMenuEntryConfigSpecs[] = {
offsetof(TkMenuEntry, labelPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_STRING_TABLE, "-state", NULL, NULL,
DEF_MENU_ENTRY_STATE,
- TCL_INDEX_NONE, offsetof(TkMenuEntry, state), 0,
- (ClientData) menuStateStrings, 0},
+ TCL_INDEX_NONE, offsetof(TkMenuEntry, state),
+ 0, tkStateStrings, 0},
{TK_OPTION_INDEX, "-underline", NULL, NULL,
TK_OPTION_UNDERLINE_DEF(TkMenuEntry, underline), 0},
{TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0}
@@ -228,8 +217,8 @@ static const Tk_OptionSpec tkTearoffEntryConfigSpecs[] = {
DEF_MENU_ENTRY_BG,
offsetof(TkMenuEntry, borderPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_STRING_TABLE, "-state", NULL, NULL,
- DEF_MENU_ENTRY_STATE, TCL_INDEX_NONE, offsetof(TkMenuEntry, state), 0,
- (ClientData) menuStateStrings, 0},
+ DEF_MENU_ENTRY_STATE, TCL_INDEX_NONE, offsetof(TkMenuEntry, state),
+ 0, tkStateStrings, 0},
{TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0}
};
@@ -244,27 +233,27 @@ static const Tk_OptionSpec *specsArray[] = {
*/
static const char *const menuTypeStrings[] = {
- "normal", "tearoff", "menubar", NULL
+ "menubar", "normal", "tearoff", NULL
};
static const Tk_OptionSpec tkMenuConfigSpecs[] = {
{TK_OPTION_BORDER, "-activebackground", "activeBackground",
"Foreground", DEF_MENU_ACTIVE_BG_COLOR,
offsetof(TkMenu, activeBorderPtr), TCL_INDEX_NONE, 0,
- (ClientData) DEF_MENU_ACTIVE_BG_MONO, 0},
+ DEF_MENU_ACTIVE_BG_MONO, 0},
{TK_OPTION_PIXELS, "-activeborderwidth", "activeBorderWidth",
"BorderWidth", DEF_MENU_ACTIVE_BORDER_WIDTH,
offsetof(TkMenu, activeBorderWidthPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_COLOR, "-activeforeground", "activeForeground",
"Background", DEF_MENU_ACTIVE_FG_COLOR,
offsetof(TkMenu, activeFgPtr), TCL_INDEX_NONE, 0,
- (ClientData) DEF_MENU_ACTIVE_FG_MONO, 0},
+ DEF_MENU_ACTIVE_FG_MONO, 0},
{TK_OPTION_RELIEF, "-activerelief", "activeRelief", "Relief",
DEF_MENU_ACTIVE_RELIEF, offsetof(TkMenu, activeReliefPtr),
TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_BORDER, "-background", "background", "Background",
DEF_MENU_BG_COLOR, offsetof(TkMenu, borderPtr), TCL_INDEX_NONE, 0,
- (ClientData) DEF_MENU_BG_MONO, 0},
+ DEF_MENU_BG_MONO, 0},
{TK_OPTION_SYNONYM, "-bd", NULL, NULL,
NULL, 0, TCL_INDEX_NONE, 0, "-borderwidth", 0},
{TK_OPTION_SYNONYM, "-bg", NULL, NULL,
@@ -278,7 +267,7 @@ static const Tk_OptionSpec tkMenuConfigSpecs[] = {
{TK_OPTION_COLOR, "-disabledforeground", "disabledForeground",
"DisabledForeground", DEF_MENU_DISABLED_FG_COLOR,
offsetof(TkMenu, disabledFgPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK,
- (ClientData) DEF_MENU_DISABLED_FG_MONO, 0},
+ DEF_MENU_DISABLED_FG_MONO, 0},
{TK_OPTION_SYNONYM, "-fg", NULL, NULL,
NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
@@ -292,7 +281,7 @@ static const Tk_OptionSpec tkMenuConfigSpecs[] = {
DEF_MENU_RELIEF, offsetof(TkMenu, reliefPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_COLOR, "-selectcolor", "selectColor", "Background",
DEF_MENU_SELECT_COLOR, offsetof(TkMenu, indicatorFgPtr), TCL_INDEX_NONE, 0,
- (ClientData) DEF_MENU_SELECT_MONO, 0},
+ DEF_MENU_SELECT_MONO, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
DEF_MENU_TAKE_FOCUS,
offsetof(TkMenu, takeFocusPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0},
@@ -305,8 +294,8 @@ static const Tk_OptionSpec tkMenuConfigSpecs[] = {
DEF_MENU_TITLE, offsetof(TkMenu, titlePtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, NULL, 0},
{TK_OPTION_STRING_TABLE, "-type", "type", "Type",
- DEF_MENU_TYPE, offsetof(TkMenu, menuTypePtr), TCL_INDEX_NONE, 0,
- (ClientData) menuTypeStrings, 0},
+ DEF_MENU_TYPE, offsetof(TkMenu, menuTypePtr), TCL_INDEX_NONE,
+ 0, menuTypeStrings, 0},
{TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0}
};
@@ -2522,14 +2511,14 @@ MenuVarProc(
*/
if (flags & TCL_TRACE_UNSETS) {
- ClientData probe = NULL;
+ void *probe = NULL;
mePtr->entryFlags &= ~ENTRY_SELECTED;
do {
probe = Tcl_VarTraceInfo(interp, name,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
MenuVarProc, probe);
- if (probe == (ClientData)mePtr) {
+ if (probe == (void *)mePtr) {
break;
}
} while (probe);
diff --git a/generic/tkMenu.h b/generic/tkMenu.h
index 522a00c..d53dc5f 100644
--- a/generic/tkMenu.h
+++ b/generic/tkMenu.h
@@ -244,8 +244,8 @@ typedef struct TkMenuEntry {
*/
#define ENTRY_ACTIVE 0
-#define ENTRY_NORMAL 1
-#define ENTRY_DISABLED 2
+#define ENTRY_DISABLED 1
+#define ENTRY_NORMAL 2
/*
* A data structure of the following type is kept for each menu widget:
@@ -461,9 +461,9 @@ typedef struct TkMenuReferences {
*/
#define UNKNOWN_TYPE -1
-#define MAIN_MENU 0
-#define TEAROFF_MENU 1
-#define MENUBAR 2
+#define MENUBAR 0
+#define MAIN_MENU 1
+#define TEAROFF_MENU 2
/*
* Various geometry definitions:
diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c
index e81342e..1843780 100644
--- a/generic/tkMenubutton.c
+++ b/generic/tkMenubutton.c
@@ -36,24 +36,6 @@ static const char *const directionStrings[] = {
};
/*
- * The following table defines the legal values for the -state option. It is
- * used together with the "enum state" declaration in tkMenubutton.h.
- */
-
-static const char *const stateStrings[] = {
- "active", "disabled", "normal", NULL
-};
-
-/*
- * The following table defines the legal values for the -compound option. It
- * is used with the "enum compound" declaration in tkMenuButton.h
- */
-
-static const char *const compoundStrings[] = {
- "bottom", "center", "left", "none", "right", "top", NULL
-};
-
-/*
* Information used for parsing configuration specs:
*/
@@ -61,21 +43,21 @@ static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground",
DEF_MENUBUTTON_ACTIVE_BG_COLOR, TCL_INDEX_NONE,
offsetof(TkMenuButton, activeBorder), 0,
- (ClientData) DEF_MENUBUTTON_ACTIVE_BG_MONO, 0},
+ DEF_MENUBUTTON_ACTIVE_BG_MONO, 0},
{TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background",
DEF_MENUBUTTON_ACTIVE_FG_COLOR, TCL_INDEX_NONE,
- offsetof(TkMenuButton, activeFg),
- 0, DEF_MENUBUTTON_ACTIVE_FG_MONO, 0},
+ offsetof(TkMenuButton, activeFg),
+ 0, DEF_MENUBUTTON_ACTIVE_FG_MONO, 0},
{TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor",
DEF_MENUBUTTON_ANCHOR, TCL_INDEX_NONE,
offsetof(TkMenuButton, anchor), 0, 0, 0},
{TK_OPTION_BORDER, "-background", "background", "Background",
DEF_MENUBUTTON_BG_COLOR, TCL_INDEX_NONE, offsetof(TkMenuButton, normalBorder),
0, DEF_MENUBUTTON_BG_MONO, 0},
- {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0,
- (ClientData) "-borderwidth", 0},
- {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0,
- (ClientData) "-background", 0},
+ {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, TCL_INDEX_NONE,
+ 0, "-borderwidth", 0},
+ {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, TCL_INDEX_NONE,
+ 0, "-background", 0},
{TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap",
DEF_MENUBUTTON_BITMAP, TCL_INDEX_NONE, offsetof(TkMenuButton, bitmap),
TK_OPTION_NULL_OK, 0, 0},
@@ -87,13 +69,13 @@ static const Tk_OptionSpec optionSpecs[] = {
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-direction", "direction", "Direction",
DEF_MENUBUTTON_DIRECTION, TCL_INDEX_NONE, offsetof(TkMenuButton, direction),
- 0, directionStrings, 0},
+ TK_OPTION_ENUM_VAR, directionStrings, 0},
{TK_OPTION_COLOR, "-disabledforeground", "disabledForeground",
"DisabledForeground", DEF_MENUBUTTON_DISABLED_FG_COLOR,
TCL_INDEX_NONE, offsetof(TkMenuButton, disabledFg), TK_OPTION_NULL_OK,
- (ClientData) DEF_MENUBUTTON_DISABLED_FG_MONO, 0},
- {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, TCL_INDEX_NONE, 0,
- (ClientData) "-foreground", 0},
+ DEF_MENUBUTTON_DISABLED_FG_MONO, 0},
+ {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, TCL_INDEX_NONE,
+ 0, "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
DEF_MENUBUTTON_FONT, TCL_INDEX_NONE, offsetof(TkMenuButton, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
@@ -131,11 +113,11 @@ static const Tk_OptionSpec optionSpecs[] = {
DEF_MENUBUTTON_RELIEF, TCL_INDEX_NONE, offsetof(TkMenuButton, relief),
0, 0, 0},
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
- DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkMenuButton, compound), 0,
- compoundStrings, 0},
+ DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkMenuButton, compound),
+ 0, tkCompoundStrings, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
DEF_MENUBUTTON_STATE, TCL_INDEX_NONE, offsetof(TkMenuButton, state),
- 0, stateStrings, 0},
+ TK_OPTION_ENUM_VAR, tkStateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
DEF_MENUBUTTON_TAKE_FOCUS, TCL_INDEX_NONE,
offsetof(TkMenuButton, takeFocus), TK_OPTION_NULL_OK, 0, 0},
@@ -888,14 +870,14 @@ MenuButtonTextVarProc(
if (flags & TCL_TRACE_UNSETS) {
if (!Tcl_InterpDeleted(interp) && mbPtr->textVarName) {
- ClientData probe = NULL;
+ void *probe = NULL;
do {
probe = Tcl_VarTraceInfo(interp,
mbPtr->textVarName,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
MenuButtonTextVarProc, probe);
- if (probe == (ClientData)mbPtr) {
+ if (probe == (void *)mbPtr) {
break;
}
} while (probe);
diff --git a/generic/tkMessage.c b/generic/tkMessage.c
index 90d92ea..a5c3a2f 100644
--- a/generic/tkMessage.c
+++ b/generic/tkMessage.c
@@ -848,14 +848,14 @@ MessageTextVarProc(
if (flags & TCL_TRACE_UNSETS) {
if (!Tcl_InterpDeleted(interp) && msgPtr->textVarName) {
- ClientData probe = NULL;
+ void *probe = NULL;
do {
probe = Tcl_VarTraceInfo(interp,
msgPtr->textVarName,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
MessageTextVarProc, probe);
- if (probe == (ClientData)msgPtr) {
+ if (probe == (void *)msgPtr) {
break;
}
} while (probe);
diff --git a/generic/tkPack.c b/generic/tkPack.c
index ffb24f0..05a530c 100644
--- a/generic/tkPack.c
+++ b/generic/tkPack.c
@@ -13,9 +13,9 @@
#include "tkInt.h"
-typedef enum {TOP, BOTTOM, LEFT, RIGHT} Side;
+typedef enum {BOTTOM, LEFT, RIGHT, TOP} Side;
static const char *const sideNames[] = {
- "top", "bottom", "left", "right", NULL
+ "bottom", "left", "right", "top", NULL
};
/*
diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c
index 60d4fc0..7147ad2 100644
--- a/generic/tkPanedWindow.c
+++ b/generic/tkPanedWindow.c
@@ -183,33 +183,33 @@ typedef struct PanedWindow {
* Forward declarations for functions defined later in this file:
*/
-int Tk_PanedWindowObjCmd(ClientData clientData,
+int Tk_PanedWindowObjCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-static void PanedWindowCmdDeletedProc(ClientData clientData);
+static void PanedWindowCmdDeletedProc(void *clientData);
static int ConfigurePanedWindow(Tcl_Interp *interp,
PanedWindow *pwPtr, int objc,
Tcl_Obj *const objv[]);
static void DestroyPanedWindow(PanedWindow *pwPtr);
-static void DisplayPanedWindow(ClientData clientData);
-static void PanedWindowEventProc(ClientData clientData,
+static void DisplayPanedWindow(void *clientData);
+static void PanedWindowEventProc(void *clientData,
XEvent *eventPtr);
-static void ProxyWindowEventProc(ClientData clientData,
+static void ProxyWindowEventProc(void *clientData,
XEvent *eventPtr);
-static void DisplayProxyWindow(ClientData clientData);
-static void PanedWindowWorldChanged(ClientData instanceData);
-static int PanedWindowWidgetObjCmd(ClientData clientData,
+static void DisplayProxyWindow(void *clientData);
+static void PanedWindowWorldChanged(void *instanceData);
+static int PanedWindowWidgetObjCmd(void *clientData,
Tcl_Interp *, int objc, Tcl_Obj * const objv[]);
-static void PanedWindowLostPaneProc(ClientData clientData,
+static void PanedWindowLostPaneProc(void *clientData,
Tk_Window tkwin);
-static void PanedWindowReqProc(ClientData clientData,
+static void PanedWindowReqProc(void *clientData,
Tk_Window tkwin);
-static void ArrangePanes(ClientData clientData);
+static void ArrangePanes(void *clientData);
static void Unlink(Pane *panePtr);
static Pane * GetPane(PanedWindow *pwPtr, Tk_Window tkwin);
static void GetFirstLastVisiblePane(PanedWindow *pwPtr,
int *firstPtr, int *lastPtr);
-static void PaneStructureProc(ClientData clientData,
+static void PaneStructureProc(void *clientData,
XEvent *eventPtr);
static int PanedWindowSashCommand(PanedWindow *pwPtr,
Tcl_Interp *interp, int objc,
@@ -221,15 +221,15 @@ static void ComputeGeometry(PanedWindow *pwPtr);
static int ConfigurePanes(PanedWindow *pwPtr,
Tcl_Interp *interp, int objc,
Tcl_Obj * const objv[]);
-static void DestroyOptionTables(ClientData clientData,
+static void DestroyOptionTables(void *clientData,
Tcl_Interp *interp);
-static int SetSticky(ClientData clientData, Tcl_Interp *interp,
+static int SetSticky(void *clientData, Tcl_Interp *interp,
Tk_Window tkwin, Tcl_Obj **value, char *recordPtr,
TkSizeT internalOffset, char *oldInternalPtr,
int flags);
-static Tcl_Obj * GetSticky(ClientData clientData, Tk_Window tkwin,
+static Tcl_Obj * GetSticky(void *clientData, Tk_Window tkwin,
char *recordPtr, TkSizeT internalOffset);
-static void RestoreSticky(ClientData clientData, Tk_Window tkwin,
+static void RestoreSticky(void *clientData, Tk_Window tkwin,
char *internalPtr, char *oldInternalPtr);
static void AdjustForSticky(int sticky, int cavityWidth,
int cavityHeight, int *xPtr, int *yPtr,
@@ -275,92 +275,92 @@ static const Tk_ObjCustomOption stickyOption = {
static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_BORDER, "-background", "background", "Background",
- DEF_PANEDWINDOW_BG_COLOR, TCL_INDEX_NONE, offsetof(PanedWindow, background), 0,
- DEF_PANEDWINDOW_BG_MONO, 0},
+ DEF_PANEDWINDOW_BG_COLOR, TCL_INDEX_NONE, offsetof(PanedWindow, background), 0,
+ DEF_PANEDWINDOW_BG_MONO, 0},
{TK_OPTION_SYNONYM, "-bd", NULL, NULL,
- NULL, 0, TCL_INDEX_NONE, 0, "-borderwidth", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-borderwidth", 0},
{TK_OPTION_SYNONYM, "-bg", NULL, NULL,
- NULL, 0, TCL_INDEX_NONE, 0, "-background", 0},
+ NULL, 0, TCL_INDEX_NONE, 0, "-background", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_PANEDWINDOW_BORDERWIDTH, TCL_INDEX_NONE, offsetof(PanedWindow, borderWidth),
- 0, 0, GEOMETRY},
+ DEF_PANEDWINDOW_BORDERWIDTH, TCL_INDEX_NONE, offsetof(PanedWindow, borderWidth),
+ 0, 0, GEOMETRY},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
- DEF_PANEDWINDOW_CURSOR, TCL_INDEX_NONE, offsetof(PanedWindow, cursor),
- TK_OPTION_NULL_OK, 0, 0},
+ DEF_PANEDWINDOW_CURSOR, TCL_INDEX_NONE, offsetof(PanedWindow, cursor),
+ TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-handlepad", "handlePad", "HandlePad",
- DEF_PANEDWINDOW_HANDLEPAD, TCL_INDEX_NONE, offsetof(PanedWindow, handlePad),
- 0, 0, GEOMETRY},
+ DEF_PANEDWINDOW_HANDLEPAD, TCL_INDEX_NONE, offsetof(PanedWindow, handlePad),
+ 0, 0, GEOMETRY},
{TK_OPTION_PIXELS, "-handlesize", "handleSize", "HandleSize",
- DEF_PANEDWINDOW_HANDLESIZE, offsetof(PanedWindow, handleSizePtr),
- offsetof(PanedWindow, handleSize), 0, 0, GEOMETRY},
+ DEF_PANEDWINDOW_HANDLESIZE, offsetof(PanedWindow, handleSizePtr),
+ offsetof(PanedWindow, handleSize), 0, 0, GEOMETRY},
{TK_OPTION_PIXELS, "-height", "height", "Height",
- DEF_PANEDWINDOW_HEIGHT, offsetof(PanedWindow, heightPtr),
- offsetof(PanedWindow, height), TK_OPTION_NULL_OK, 0, GEOMETRY},
+ DEF_PANEDWINDOW_HEIGHT, offsetof(PanedWindow, heightPtr),
+ offsetof(PanedWindow, height), TK_OPTION_NULL_OK, 0, GEOMETRY},
{TK_OPTION_BOOLEAN, "-opaqueresize", "opaqueResize", "OpaqueResize",
- DEF_PANEDWINDOW_OPAQUERESIZE, TCL_INDEX_NONE,
- offsetof(PanedWindow, resizeOpaque), 0, 0, 0},
+ DEF_PANEDWINDOW_OPAQUERESIZE, TCL_INDEX_NONE,
+ offsetof(PanedWindow, resizeOpaque), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient",
- DEF_PANEDWINDOW_ORIENT, TCL_INDEX_NONE, offsetof(PanedWindow, orient),
- 0, orientStrings, GEOMETRY},
+ DEF_PANEDWINDOW_ORIENT, TCL_INDEX_NONE, offsetof(PanedWindow, orient),
+ TK_OPTION_ENUM_VAR, orientStrings, GEOMETRY},
{TK_OPTION_BORDER, "-proxybackground", "proxyBackground", "ProxyBackground",
- 0, TCL_INDEX_NONE, offsetof(PanedWindow, proxyBackground), TK_OPTION_NULL_OK,
- (ClientData) DEF_PANEDWINDOW_BG_MONO, 0},
+ 0, TCL_INDEX_NONE, offsetof(PanedWindow, proxyBackground), TK_OPTION_NULL_OK,
+ (void *)DEF_PANEDWINDOW_BG_MONO, 0},
{TK_OPTION_PIXELS, "-proxyborderwidth", "proxyBorderWidth", "ProxyBorderWidth",
- DEF_PANEDWINDOW_PROXYBORDER, offsetof(PanedWindow, proxyBorderWidthPtr),
- offsetof(PanedWindow, proxyBorderWidth), 0, 0, GEOMETRY},
+ DEF_PANEDWINDOW_PROXYBORDER, offsetof(PanedWindow, proxyBorderWidthPtr),
+ offsetof(PanedWindow, proxyBorderWidth), 0, 0, GEOMETRY},
{TK_OPTION_RELIEF, "-proxyrelief", "proxyRelief", "Relief",
- 0, TCL_INDEX_NONE, offsetof(PanedWindow, proxyRelief),
- TK_OPTION_NULL_OK, 0, 0},
+ 0, TCL_INDEX_NONE, offsetof(PanedWindow, proxyRelief),
+ TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- DEF_PANEDWINDOW_RELIEF, TCL_INDEX_NONE, offsetof(PanedWindow, relief), 0, 0, 0},
+ DEF_PANEDWINDOW_RELIEF, TCL_INDEX_NONE, offsetof(PanedWindow, relief), 0, 0, 0},
{TK_OPTION_CURSOR, "-sashcursor", "sashCursor", "Cursor",
- DEF_PANEDWINDOW_SASHCURSOR, TCL_INDEX_NONE, offsetof(PanedWindow, sashCursor),
- TK_OPTION_NULL_OK, 0, 0},
+ DEF_PANEDWINDOW_SASHCURSOR, TCL_INDEX_NONE, offsetof(PanedWindow, sashCursor),
+ TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-sashpad", "sashPad", "SashPad",
- DEF_PANEDWINDOW_SASHPAD, TCL_INDEX_NONE, offsetof(PanedWindow, sashPad),
- 0, 0, GEOMETRY},
+ DEF_PANEDWINDOW_SASHPAD, TCL_INDEX_NONE, offsetof(PanedWindow, sashPad),
+ 0, 0, GEOMETRY},
{TK_OPTION_RELIEF, "-sashrelief", "sashRelief", "Relief",
- DEF_PANEDWINDOW_SASHRELIEF, TCL_INDEX_NONE, offsetof(PanedWindow, sashRelief),
- 0, 0, 0},
+ DEF_PANEDWINDOW_SASHRELIEF, TCL_INDEX_NONE, offsetof(PanedWindow, sashRelief),
+ 0, 0, 0},
{TK_OPTION_PIXELS, "-sashwidth", "sashWidth", "Width",
- DEF_PANEDWINDOW_SASHWIDTH, offsetof(PanedWindow, sashWidthPtr),
- offsetof(PanedWindow, sashWidth), 0, 0, GEOMETRY},
+ DEF_PANEDWINDOW_SASHWIDTH, offsetof(PanedWindow, sashWidthPtr),
+ offsetof(PanedWindow, sashWidth), 0, 0, GEOMETRY},
{TK_OPTION_BOOLEAN, "-showhandle", "showHandle", "ShowHandle",
- DEF_PANEDWINDOW_SHOWHANDLE, TCL_INDEX_NONE, offsetof(PanedWindow, showHandle),
- 0, 0, GEOMETRY},
+ DEF_PANEDWINDOW_SHOWHANDLE, TCL_INDEX_NONE, offsetof(PanedWindow, showHandle),
+ 0, 0, GEOMETRY},
{TK_OPTION_PIXELS, "-width", "width", "Width",
- DEF_PANEDWINDOW_WIDTH, offsetof(PanedWindow, widthPtr),
- offsetof(PanedWindow, width), TK_OPTION_NULL_OK, 0, GEOMETRY},
+ DEF_PANEDWINDOW_WIDTH, offsetof(PanedWindow, widthPtr),
+ offsetof(PanedWindow, width), TK_OPTION_NULL_OK, 0, GEOMETRY},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};
static const Tk_OptionSpec paneOptionSpecs[] = {
{TK_OPTION_WINDOW, "-after", NULL, NULL,
- DEF_PANEDWINDOW_PANE_AFTER, TCL_INDEX_NONE, offsetof(Pane, after),
- TK_OPTION_NULL_OK, 0, 0},
+ DEF_PANEDWINDOW_PANE_AFTER, TCL_INDEX_NONE, offsetof(Pane, after),
+ TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_WINDOW, "-before", NULL, NULL,
- DEF_PANEDWINDOW_PANE_BEFORE, TCL_INDEX_NONE, offsetof(Pane, before),
- TK_OPTION_NULL_OK, 0, 0},
+ DEF_PANEDWINDOW_PANE_BEFORE, TCL_INDEX_NONE, offsetof(Pane, before),
+ TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-height", NULL, NULL,
- DEF_PANEDWINDOW_PANE_HEIGHT, offsetof(Pane, heightPtr),
- offsetof(Pane, height), TK_OPTION_NULL_OK, 0, 0},
+ DEF_PANEDWINDOW_PANE_HEIGHT, offsetof(Pane, heightPtr),
+ offsetof(Pane, height), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BOOLEAN, "-hide", "hide", "Hide",
- DEF_PANEDWINDOW_PANE_HIDE, TCL_INDEX_NONE, offsetof(Pane, hide), 0,0,GEOMETRY},
+ DEF_PANEDWINDOW_PANE_HIDE, TCL_INDEX_NONE, offsetof(Pane, hide), 0,0,GEOMETRY},
{TK_OPTION_PIXELS, "-minsize", NULL, NULL,
- DEF_PANEDWINDOW_PANE_MINSIZE, TCL_INDEX_NONE, offsetof(Pane, minSize), 0, 0, 0},
+ DEF_PANEDWINDOW_PANE_MINSIZE, TCL_INDEX_NONE, offsetof(Pane, minSize), 0, 0, 0},
{TK_OPTION_PIXELS, "-padx", NULL, NULL,
- DEF_PANEDWINDOW_PANE_PADX, TCL_INDEX_NONE, offsetof(Pane, padx), 0, 0, 0},
+ DEF_PANEDWINDOW_PANE_PADX, TCL_INDEX_NONE, offsetof(Pane, padx), 0, 0, 0},
{TK_OPTION_PIXELS, "-pady", NULL, NULL,
- DEF_PANEDWINDOW_PANE_PADY, TCL_INDEX_NONE, offsetof(Pane, pady), 0, 0, 0},
+ DEF_PANEDWINDOW_PANE_PADY, TCL_INDEX_NONE, offsetof(Pane, pady), 0, 0, 0},
{TK_OPTION_CUSTOM, "-sticky", NULL, NULL,
- DEF_PANEDWINDOW_PANE_STICKY, TCL_INDEX_NONE, offsetof(Pane, sticky), 0,
- &stickyOption, 0},
+ DEF_PANEDWINDOW_PANE_STICKY, TCL_INDEX_NONE, offsetof(Pane, sticky),
+ 0, &stickyOption, 0},
{TK_OPTION_STRING_TABLE, "-stretch", "stretch", "Stretch",
- DEF_PANEDWINDOW_PANE_STRETCH, TCL_INDEX_NONE, offsetof(Pane, stretch), 0,
- (ClientData) stretchStrings, 0},
+ DEF_PANEDWINDOW_PANE_STRETCH, TCL_INDEX_NONE, offsetof(Pane, stretch),
+ TK_OPTION_ENUM_VAR, stretchStrings, 0},
{TK_OPTION_PIXELS, "-width", NULL, NULL,
- DEF_PANEDWINDOW_PANE_WIDTH, offsetof(Pane, widthPtr),
- offsetof(Pane, width), TK_OPTION_NULL_OK, 0, 0},
+ DEF_PANEDWINDOW_PANE_WIDTH, offsetof(Pane, widthPtr),
+ offsetof(Pane, width), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};
@@ -383,7 +383,7 @@ static const Tk_OptionSpec paneOptionSpecs[] = {
int
Tk_PanedWindowObjCmd(
- TCL_UNUSED(ClientData), /* NULL. */
+ TCL_UNUSED(void *), /* NULL. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj * const objv[]) /* Argument objects. */
@@ -530,7 +530,7 @@ Tk_PanedWindowObjCmd(
static int
PanedWindowWidgetObjCmd(
- ClientData clientData, /* Information about square widget. */
+ void *clientData, /* Information about square widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj * const objv[]) /* Argument objects. */
@@ -1015,10 +1015,14 @@ ConfigurePanes(
/*
* If none of the existing panes have to be moved, just copy the old
* and append the new.
+ * Be careful about the case pwPtr->numPanes == 0 since in this case
+ * pwPtr->panes is NULL, and the memcpy would have undefined behavior.
*/
- memcpy((void *)&(newPanes[0]), pwPtr->panes,
- sizeof(Pane *) * pwPtr->numPanes);
- memcpy((void *)&(newPanes[pwPtr->numPanes]), inserts,
+ if (pwPtr->numPanes) {
+ memcpy(newPanes, pwPtr->panes,
+ sizeof(Pane *) * pwPtr->numPanes);
+ }
+ memcpy(&newPanes[pwPtr->numPanes], inserts,
sizeof(Pane *) * numNewPanes);
} else {
/*
@@ -1037,7 +1041,7 @@ ConfigurePanes(
}
}
- memcpy((void *)&(newPanes[j]), inserts, sizeof(Pane *)*insertIndex);
+ memcpy(&newPanes[j], inserts, sizeof(Pane *)*insertIndex);
j += firstOptionArg - 2;
for (i = index; i < pwPtr->numPanes; i++) {
@@ -1290,7 +1294,7 @@ ConfigurePanedWindow(
static void
PanedWindowWorldChanged(
- ClientData instanceData) /* Information about the paned window. */
+ void *instanceData) /* Information about the paned window. */
{
XGCValues gcValues;
GC newGC;
@@ -1348,7 +1352,7 @@ PanedWindowWorldChanged(
static void
PanedWindowEventProc(
- ClientData clientData, /* Information about window. */
+ void *clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
PanedWindow *pwPtr = (PanedWindow *)clientData;
@@ -1402,7 +1406,7 @@ PanedWindowEventProc(
static void
PanedWindowCmdDeletedProc(
- ClientData clientData) /* Pointer to widget record for widget. */
+ void *clientData) /* Pointer to widget record for widget. */
{
PanedWindow *pwPtr = (PanedWindow *)clientData;
@@ -1439,7 +1443,7 @@ PanedWindowCmdDeletedProc(
static void
DisplayPanedWindow(
- ClientData clientData) /* Information about window. */
+ void *clientData) /* Information about window. */
{
PanedWindow *pwPtr = (PanedWindow *)clientData;
Pane *panePtr;
@@ -1624,7 +1628,7 @@ DestroyPanedWindow(
static void
PanedWindowReqProc(
- ClientData clientData, /* Paned window's information about window
+ void *clientData, /* Paned window's information about window
* that got new preferred geometry. */
TCL_UNUSED(Tk_Window)) /* Other Tk-related information about the
* window. */
@@ -1670,7 +1674,7 @@ PanedWindowReqProc(
static void
PanedWindowLostPaneProc(
- ClientData clientData, /* Grid structure for the pane that was
+ void *clientData, /* Grid structure for the pane that was
* stolen away. */
TCL_UNUSED(Tk_Window)) /* Tk's handle for the pane. */
{
@@ -1710,7 +1714,7 @@ PanedWindowLostPaneProc(
static void
ArrangePanes(
- ClientData clientData) /* Structure describing parent whose panes
+ void *clientData) /* Structure describing parent whose panes
* are to be re-layed out. */
{
PanedWindow *pwPtr = (PanedWindow *)clientData;
@@ -2156,7 +2160,7 @@ GetFirstLastVisiblePane(
static void
PaneStructureProc(
- ClientData clientData, /* Pointer to record describing window item. */
+ void *clientData, /* Pointer to record describing window item. */
XEvent *eventPtr) /* Describes what just happened. */
{
Pane *panePtr = (Pane *)clientData;
@@ -2368,7 +2372,7 @@ ComputeGeometry(
static void
DestroyOptionTables(
- ClientData clientData, /* Pointer to the OptionTables struct */
+ void *clientData, /* Pointer to the OptionTables struct */
TCL_UNUSED(Tcl_Interp *)) /* Pointer to the calling interp */
{
ckfree(clientData);
@@ -2751,7 +2755,7 @@ MoveSash(
static void
ProxyWindowEventProc(
- ClientData clientData, /* Information about window. */
+ void *clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
PanedWindow *pwPtr = (PanedWindow *)clientData;
@@ -2784,7 +2788,7 @@ ProxyWindowEventProc(
static void
DisplayProxyWindow(
- ClientData clientData) /* Information about window. */
+ void *clientData) /* Information about window. */
{
PanedWindow *pwPtr = (PanedWindow *)clientData;
Pixmap pixmap;
diff --git a/generic/tkPlace.c b/generic/tkPlace.c
index a15a021..cde51a7 100644
--- a/generic/tkPlace.c
+++ b/generic/tkPlace.c
@@ -25,10 +25,10 @@
*/
static const char *const borderModeStrings[] = {
- "inside", "outside", "ignore", NULL
+ "inside", "ignore", "outside", NULL
};
-typedef enum {BM_INSIDE, BM_OUTSIDE, BM_IGNORE} BorderMode;
+typedef enum {BM_INSIDE, BM_IGNORE, BM_OUTSIDE} BorderMode;
/*
* For each window whose geometry is managed by the placer there is a
@@ -82,7 +82,7 @@ static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_ANCHOR, "-anchor", NULL, NULL, "nw", TCL_INDEX_NONE,
offsetof(Content, anchor), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-bordermode", NULL, NULL, "inside", TCL_INDEX_NONE,
- offsetof(Content, borderMode), 0, borderModeStrings, 0},
+ offsetof(Content, borderMode), TK_OPTION_ENUM_VAR, borderModeStrings, 0},
{TK_OPTION_PIXELS, "-height", NULL, NULL, "", offsetof(Content, heightPtr),
offsetof(Content, height), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_WINDOW, "-in", NULL, NULL, "", TCL_INDEX_NONE, offsetof(Content, inTkwin),
diff --git a/generic/tkScale.c b/generic/tkScale.c
index c67e35c..8245f97 100644
--- a/generic/tkScale.c
+++ b/generic/tkScale.c
@@ -34,15 +34,6 @@ static const char *const orientStrings[] = {
"horizontal", "vertical", NULL
};
-/*
- * The following table defines the legal values for the -state option. It is
- * used together with the "enum state" declaration in tkScale.h.
- */
-
-static const char *const stateStrings[] = {
- "active", "disabled", "normal", NULL
-};
-
static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground",
DEF_SCALE_ACTIVE_BG_COLOR, TCL_INDEX_NONE, offsetof(TkScale, activeBorder),
@@ -75,7 +66,7 @@ static const Tk_OptionSpec optionSpecs[] = {
DEF_SCALE_FONT, TCL_INDEX_NONE, offsetof(TkScale, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
DEF_SCALE_FG_COLOR, TCL_INDEX_NONE, offsetof(TkScale, textColorPtr), 0,
- (ClientData) DEF_SCALE_FG_MONO, 0},
+ DEF_SCALE_FG_MONO, 0},
{TK_OPTION_DOUBLE, "-from", "from", "From", DEF_SCALE_FROM, TCL_INDEX_NONE,
offsetof(TkScale, fromValue), 0, 0, 0},
{TK_OPTION_BORDER, "-highlightbackground", "highlightBackground",
@@ -95,7 +86,7 @@ static const Tk_OptionSpec optionSpecs[] = {
DEF_SCALE_LENGTH, TCL_INDEX_NONE, offsetof(TkScale, length), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient",
DEF_SCALE_ORIENT, TCL_INDEX_NONE, offsetof(TkScale, orient),
- 0, orientStrings, 0},
+ TK_OPTION_ENUM_VAR, orientStrings, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
DEF_SCALE_RELIEF, TCL_INDEX_NONE, offsetof(TkScale, relief), 0, 0, 0},
{TK_OPTION_INT, "-repeatdelay", "repeatDelay", "RepeatDelay",
@@ -118,7 +109,7 @@ static const Tk_OptionSpec optionSpecs[] = {
0, 0, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
DEF_SCALE_STATE, TCL_INDEX_NONE, offsetof(TkScale, state),
- 0, stateStrings, 0},
+ TK_OPTION_ENUM_VAR, tkStateStrings, 0},
{TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
DEF_SCALE_TAKE_FOCUS, offsetof(TkScale, takeFocusPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, 0},
@@ -1359,14 +1350,14 @@ ScaleVarProc(
if (flags & TCL_TRACE_UNSETS) {
if (!Tcl_InterpDeleted(interp) && scalePtr->varNamePtr) {
- ClientData probe = NULL;
+ void *probe = NULL;
do {
probe = Tcl_VarTraceInfo(interp,
Tcl_GetString(scalePtr->varNamePtr),
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
ScaleVarProc, probe);
- if (probe == (ClientData)scalePtr) {
+ if (probe == (void *)scalePtr) {
break;
}
} while (probe);
diff --git a/generic/tkTest.c b/generic/tkTest.c
index 68b5a36..e566777 100644
--- a/generic/tkTest.c
+++ b/generic/tkTest.c
@@ -253,42 +253,42 @@ Tktest_Init(
Tcl_CreateObjCommand(interp, "square", SquareObjCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "testbitmap", TestbitmapObjCmd,
- (ClientData) Tk_MainWindow(interp), NULL);
+ Tk_MainWindow(interp), NULL);
Tcl_CreateObjCommand(interp, "testborder", TestborderObjCmd,
- (ClientData) Tk_MainWindow(interp), NULL);
+ Tk_MainWindow(interp), NULL);
Tcl_CreateObjCommand(interp, "testcolor", TestcolorObjCmd,
- (ClientData) Tk_MainWindow(interp), NULL);
+ Tk_MainWindow(interp), NULL);
Tcl_CreateObjCommand(interp, "testcursor", TestcursorObjCmd,
- (ClientData) Tk_MainWindow(interp), NULL);
+ Tk_MainWindow(interp), NULL);
Tcl_CreateObjCommand(interp, "testdeleteapps", TestdeleteappsObjCmd,
- (ClientData) Tk_MainWindow(interp), NULL);
+ Tk_MainWindow(interp), NULL);
Tcl_CreateObjCommand(interp, "testembed", TkpTestembedCmd,
- (ClientData) Tk_MainWindow(interp), NULL);
+ Tk_MainWindow(interp), NULL);
Tcl_CreateObjCommand(interp, "testobjconfig", TestobjconfigObjCmd,
- (ClientData) Tk_MainWindow(interp), NULL);
+ Tk_MainWindow(interp), NULL);
Tcl_CreateObjCommand(interp, "testfont", TestfontObjCmd,
- (ClientData) Tk_MainWindow(interp), NULL);
+ Tk_MainWindow(interp), NULL);
Tcl_CreateObjCommand(interp, "testmakeexist", TestmakeexistObjCmd,
- (ClientData) Tk_MainWindow(interp), NULL);
+ Tk_MainWindow(interp), NULL);
Tcl_CreateObjCommand(interp, "testprop", TestpropObjCmd,
- (ClientData) Tk_MainWindow(interp), NULL);
+ Tk_MainWindow(interp), NULL);
Tcl_CreateObjCommand(interp, "testprintf", TestprintfObjCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "testtext", TkpTesttextCmd,
- (ClientData) Tk_MainWindow(interp), NULL);
+ Tk_MainWindow(interp), NULL);
Tcl_CreateObjCommand(interp, "testphotostringmatch",
- TestPhotoStringMatchCmd, (ClientData) Tk_MainWindow(interp),
+ TestPhotoStringMatchCmd, Tk_MainWindow(interp),
NULL);
#if defined(_WIN32)
Tcl_CreateObjCommand(interp, "testmetrics", TestmetricsObjCmd,
- (ClientData) Tk_MainWindow(interp), NULL);
+ Tk_MainWindow(interp), NULL);
#elif !defined(__CYGWIN__) && !defined(MAC_OSX_TK)
Tcl_CreateObjCommand(interp, "testmenubar", TestmenubarObjCmd,
- (ClientData) Tk_MainWindow(interp), NULL);
+ Tk_MainWindow(interp), NULL);
Tcl_CreateObjCommand(interp, "testsend", TkpTestsendCmd,
- (ClientData) Tk_MainWindow(interp), NULL);
+ Tk_MainWindow(interp), NULL);
Tcl_CreateObjCommand(interp, "testwrapper", TestwrapperObjCmd,
- (ClientData) Tk_MainWindow(interp), NULL);
+ Tk_MainWindow(interp), NULL);
#endif /* _WIN32 */
/*
@@ -367,7 +367,7 @@ TestbitmapObjCmd(
static int
TestborderObjCmd(
- TCL_UNUSED(ClientData), /* Main window for application. */
+ TCL_UNUSED(void *), /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -683,9 +683,9 @@ TestobjconfigObjCmd(
if (result == TCL_OK) {
recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp,
Tcl_GetString(objv[2]), TrivialConfigObjCmd,
- (ClientData) recordPtr, TrivialCmdDeletedProc);
+ recordPtr, TrivialCmdDeletedProc);
Tk_CreateEventHandler(tkwin, StructureNotifyMask,
- TrivialEventProc, (ClientData) recordPtr);
+ TrivialEventProc, recordPtr);
result = Tk_SetOptions(interp, recordPtr, optionTable,
objc-3, objv+3, tkwin, NULL, NULL);
if (result != TCL_OK) {
@@ -731,9 +731,9 @@ TestobjconfigObjCmd(
if (result == TCL_OK) {
recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp,
Tcl_GetString(objv[2]), TrivialConfigObjCmd,
- (ClientData) recordPtr, TrivialCmdDeletedProc);
+ recordPtr, TrivialCmdDeletedProc);
Tk_CreateEventHandler(tkwin, StructureNotifyMask,
- TrivialEventProc, (ClientData) recordPtr);
+ TrivialEventProc, recordPtr);
Tcl_SetObjResult(interp, objv[2]);
}
break;
@@ -753,7 +753,7 @@ TestobjconfigObjCmd(
"-oneAgain", "oneAgain", "OneAgain", "one again",
offsetof(ExtensionWidgetRecord, extension5ObjPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0,
- (ClientData) baseSpecs, 0}
+ baseSpecs, 0}
};
Tk_OptionTable optionTable;
@@ -784,9 +784,9 @@ TestobjconfigObjCmd(
if (result == TCL_OK) {
recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp,
Tcl_GetString(objv[2]), TrivialConfigObjCmd,
- (ClientData) recordPtr, TrivialCmdDeletedProc);
+ recordPtr, TrivialCmdDeletedProc);
Tk_CreateEventHandler(tkwin, StructureNotifyMask,
- TrivialEventProc, (ClientData) recordPtr);
+ TrivialEventProc, recordPtr);
Tcl_SetObjResult(interp, objv[2]);
}
break;
@@ -1024,7 +1024,7 @@ TestobjconfigObjCmd(
if (result == TCL_OK) {
recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp,
Tcl_GetString(objv[2]), TrivialConfigObjCmd,
- (ClientData) recordPtr, TrivialCmdDeletedProc);
+ recordPtr, TrivialCmdDeletedProc);
} else {
Tk_FreeConfigOptions(recordPtr,
recordPtr->header.optionTable, (Tk_Window) NULL);
diff --git a/generic/tkText.c b/generic/tkText.c
index b1475b0..deeeec8 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -43,16 +43,6 @@
#define PIXEL_CLIENTS 5
/*
- * The 'TkTextState' enum in tkText.h is used to define a type for the -state
- * option of the Text widget. These values are used as indices into the string
- * table below.
- */
-
-static const char *const stateStrings[] = {
- "disabled", "normal", NULL
-};
-
-/*
* The 'TkWrapMode' enum in tkText.h is used to define a type for the -wrap
* option of the Text widget. These values are used as indices into the string
* table below.
@@ -179,7 +169,7 @@ static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth",
"BorderWidth", DEF_TEXT_INSERT_BD_COLOR, TCL_INDEX_NONE,
offsetof(TkText, insertBorderWidth), 0,
- (ClientData) DEF_TEXT_INSERT_BD_MONO, 0},
+ DEF_TEXT_INSERT_BD_MONO, 0},
{TK_OPTION_INT, "-insertofftime", "insertOffTime", "OffTime",
DEF_TEXT_INSERT_OFF_TIME, TCL_INDEX_NONE, offsetof(TkText, insertOffTime),
0, 0, 0},
@@ -189,7 +179,7 @@ static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_STRING_TABLE,
"-insertunfocussed", "insertUnfocussed", "InsertUnfocussed",
DEF_TEXT_INSERT_UNFOCUSSED, TCL_INDEX_NONE, offsetof(TkText, insertUnfocussed),
- 0, insertUnfocussedStrings, 0},
+ TK_OPTION_ENUM_VAR, insertUnfocussedStrings, 0},
{TK_OPTION_PIXELS, "-insertwidth", "insertWidth", "InsertWidth",
DEF_TEXT_INSERT_WIDTH, TCL_INDEX_NONE, offsetof(TkText, insertWidth),
0, 0, 0},
@@ -230,7 +220,7 @@ static const Tk_OptionSpec optionSpecs[] = {
&lineOption, TK_TEXT_LINE_RANGE},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
DEF_TEXT_STATE, TCL_INDEX_NONE, offsetof(TkText, state),
- 0, stateStrings, 0},
+ 0, &tkStateStrings[1], 0},
{TK_OPTION_STRING, "-tabs", "tabs", "Tabs",
DEF_TEXT_TABS, offsetof(TkText, tabOptionPtr), TCL_INDEX_NONE,
TK_OPTION_NULL_OK, 0, TK_TEXT_LINE_GEOMETRY},
@@ -248,7 +238,7 @@ static const Tk_OptionSpec optionSpecs[] = {
TK_TEXT_LINE_GEOMETRY},
{TK_OPTION_STRING_TABLE, "-wrap", "wrap", "Wrap",
DEF_TEXT_WRAP, TCL_INDEX_NONE, offsetof(TkText, wrapMode),
- 0, tkTextWrapStrings, TK_TEXT_LINE_GEOMETRY},
+ TK_OPTION_ENUM_VAR, tkTextWrapStrings, TK_TEXT_LINE_GEOMETRY},
{TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand",
DEF_TEXT_XSCROLL_COMMAND, TCL_INDEX_NONE, offsetof(TkText, xScrollCmd),
TK_OPTION_NULL_OK, 0, 0},
@@ -1543,7 +1533,7 @@ TextWidgetObjCmd(
textPtr->afterSyncCmd = cmd;
} else {
textPtr->afterSyncCmd = cmd;
- Tcl_DoWhenIdle(TkTextRunAfterSyncCmd, (ClientData) textPtr);
+ Tcl_DoWhenIdle(TkTextRunAfterSyncCmd, textPtr);
}
break;
} else if (objc != 2) {
@@ -5609,13 +5599,13 @@ TkTextRunAfterSyncCmd(
return;
}
- Tcl_Preserve((ClientData) textPtr->interp);
+ Tcl_Preserve(textPtr->interp);
code = Tcl_EvalObjEx(textPtr->interp, textPtr->afterSyncCmd, TCL_EVAL_GLOBAL);
if (code == TCL_ERROR) {
Tcl_AddErrorInfo(textPtr->interp, "\n (text sync)");
Tcl_BackgroundException(textPtr->interp, TCL_ERROR);
}
- Tcl_Release((ClientData) textPtr->interp);
+ Tcl_Release(textPtr->interp);
Tcl_DecrRefCount(textPtr->afterSyncCmd);
textPtr->afterSyncCmd = NULL;
}
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 2301f49..303c3d5 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -3087,14 +3087,14 @@ AsyncUpdateLineMetrics(
if (textPtr->afterSyncCmd) {
int code;
Tcl_CancelIdleCall(TkTextRunAfterSyncCmd, textPtr);
- Tcl_Preserve((ClientData) textPtr->interp);
+ Tcl_Preserve(textPtr->interp);
code = Tcl_EvalObjEx(textPtr->interp, textPtr->afterSyncCmd,
TCL_EVAL_GLOBAL);
if (code == TCL_ERROR) {
Tcl_AddErrorInfo(textPtr->interp, "\n (text sync)");
Tcl_BackgroundException(textPtr->interp, TCL_ERROR);
}
- Tcl_Release((ClientData) textPtr->interp);
+ Tcl_Release(textPtr->interp);
Tcl_DecrRefCount(textPtr->afterSyncCmd);
textPtr->afterSyncCmd = NULL;
}
@@ -6459,7 +6459,7 @@ TkTextScanCmd(
dInfoPtr->scanMarkY = y;
} else {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad scan option \"%s\": must be mark or dragto",
+ "bad scan option \"%s\": must be dragto or mark",
Tcl_GetString(objv[2])));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "INDEX", "scan option",
Tcl_GetString(objv[2]), NULL);
diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c
index 24d8ba6..9d4e874 100644
--- a/generic/tkTextTag.c
+++ b/generic/tkTextTag.c
@@ -78,7 +78,7 @@ static const Tk_OptionSpec tagOptionSpecs[] = {
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_STRING_TABLE, "-wrap", NULL, NULL,
NULL, TCL_INDEX_NONE, offsetof(TkTextTag, wrapMode),
- TK_OPTION_NULL_OK, tkTextWrapStrings, 0},
+ TK_OPTION_NULL_OK|TK_OPTION_ENUM_VAR, tkTextWrapStrings, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};
@@ -257,7 +257,7 @@ TkTextTagCmd(
if (fifth[0] == 0) {
return Tk_DeleteBinding(interp,
textPtr->sharedTextPtr->bindingTable,
- (ClientData) tagPtr->name, Tcl_GetString(objv[4]));
+ (void *) tagPtr->name, Tcl_GetString(objv[4]));
}
if (fifth[0] == '+') {
fifth++;
@@ -265,7 +265,7 @@ TkTextTagCmd(
}
mask = Tk_CreateBinding(interp,
textPtr->sharedTextPtr->bindingTable,
- (ClientData) tagPtr->name, Tcl_GetString(objv[4]), fifth,
+ (void *) tagPtr->name, Tcl_GetString(objv[4]), fifth,
append);
if (mask == 0) {
return TCL_ERROR;
@@ -276,7 +276,7 @@ TkTextTagCmd(
|EnterWindowMask|LeaveWindowMask|KeyPressMask
|KeyReleaseMask|PointerMotionMask|VirtualEventMask)) {
Tk_DeleteBinding(interp, textPtr->sharedTextPtr->bindingTable,
- (ClientData) tagPtr->name, Tcl_GetString(objv[4]));
+ (void *) tagPtr->name, Tcl_GetString(objv[4]));
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"requested illegal events; only key, button, motion,"
" enter, leave, and virtual events may be used", -1));
@@ -288,7 +288,7 @@ TkTextTagCmd(
command = Tk_GetBinding(interp,
textPtr->sharedTextPtr->bindingTable,
- (ClientData) tagPtr->name, Tcl_GetString(objv[4]));
+ (void *) tagPtr->name, Tcl_GetString(objv[4]));
if (command == NULL) {
const char *string = Tcl_GetString(Tcl_GetObjResult(interp));
@@ -307,7 +307,7 @@ TkTextTagCmd(
}
} else {
Tk_GetAllBindings(interp, textPtr->sharedTextPtr->bindingTable,
- (ClientData) tagPtr->name);
+ (void *) tagPtr->name);
}
break;
case TAG_CGET:
@@ -1147,7 +1147,7 @@ TkTextDeleteTag(
if (textPtr->sharedTextPtr->bindingTable != NULL) {
Tk_DeleteAllBindings(textPtr->sharedTextPtr->bindingTable,
- (ClientData) tagPtr->name);
+ (void *) tagPtr->name);
}
}
diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c
index bfa754c..9cd8fd9 100644
--- a/generic/ttk/ttkButton.c
+++ b/generic/ttk/ttkButton.c
@@ -84,7 +84,7 @@ static const Tk_OptionSpec BaseOptionSpecs[] =
*/
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
NULL, offsetof(Base,base.compoundObj), TCL_INDEX_NONE,
- TK_OPTION_NULL_OK, (void *)ttkCompoundStrings,
+ TK_OPTION_NULL_OK, ttkCompoundStrings,
GEOMETRY_CHANGED },
{TK_OPTION_STRING, "-padding", "padding", "Pad",
NULL, offsetof(Base,base.paddingObj), TCL_INDEX_NONE,
@@ -330,7 +330,7 @@ static const Tk_OptionSpec ButtonOptionSpecs[] =
"", offsetof(Button, button.commandObj), TCL_INDEX_NONE, 0,0,0},
{TK_OPTION_STRING_TABLE, "-default", "default", "Default",
"normal", offsetof(Button, button.defaultStateObj), TCL_INDEX_NONE,
- 0, (void *)ttkDefaultStrings, DEFAULTSTATE_CHANGED},
+ 0, ttkDefaultStrings, DEFAULTSTATE_CHANGED},
WIDGET_TAKEFOCUS_TRUE,
WIDGET_INHERIT_OPTIONS(BaseOptionSpecs)
@@ -826,7 +826,7 @@ static const Tk_OptionSpec MenubuttonOptionSpecs[] =
"", offsetof(Menubutton, menubutton.menuObj), TCL_INDEX_NONE, 0,0,0},
{TK_OPTION_STRING_TABLE, "-direction", "direction", "Direction",
"below", offsetof(Menubutton, menubutton.directionObj), TCL_INDEX_NONE,
- 0, (void *)directionStrings, GEOMETRY_CHANGED},
+ 0, directionStrings, GEOMETRY_CHANGED},
WIDGET_TAKEFOCUS_TRUE,
WIDGET_INHERIT_OPTIONS(BaseOptionSpecs)
diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c
index 19732ed..0e7cded 100644
--- a/generic/ttk/ttkEntry.c
+++ b/generic/ttk/ttkEntry.c
@@ -181,7 +181,7 @@ static const Tk_OptionSpec EntryOptionSpecs[] = {
TK_OPTION_NULL_OK,0,TEXTVAR_CHANGED},
{TK_OPTION_STRING_TABLE, "-validate", "validate", "Validate",
"none", TCL_INDEX_NONE, offsetof(Entry, entry.validate),
- 0, (void *) validateStrings, 0},
+ TK_OPTION_ENUM_VAR, validateStrings, 0},
{TK_OPTION_STRING, "-validatecommand", "validateCommand", "ValidateCommand",
NULL, TCL_INDEX_NONE, offsetof(Entry, entry.validateCmd),
TK_OPTION_NULL_OK, 0, 0},
diff --git a/generic/ttk/ttkInit.c b/generic/ttk/ttkInit.c
index 2672a0b..3829f09 100644
--- a/generic/ttk/ttkInit.c
+++ b/generic/ttk/ttkInit.c
@@ -13,15 +13,15 @@
* See also: enum Ttk_ButtonDefaultState.
*/
const char *const ttkDefaultStrings[] = {
- "normal", "active", "disabled", NULL
+ "active", "disabled", "normal", NULL
};
int Ttk_GetButtonDefaultStateFromObj(
Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_ButtonDefaultState *statePtr)
{
int state = (int)TTK_BUTTON_DEFAULT_DISABLED;
- int result = Tcl_GetIndexFromObjStruct(interp, objPtr, ttkDefaultStrings,
- sizeof(char *), "default state", 0, &state);
+ int result = Tcl_GetIndexFromObj(interp, objPtr, ttkDefaultStrings,
+ "default state", 0, &state);
*statePtr = (Ttk_ButtonDefaultState)state;
return result;
@@ -40,8 +40,8 @@ int Ttk_GetCompoundFromObj(
Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Compound *compoundPtr)
{
int compound = (int)TTK_COMPOUND_NONE;
- int result = Tcl_GetIndexFromObjStruct(interp, objPtr, ttkCompoundStrings,
- sizeof(char *), "compound layout", 0, &compound);
+ int result = Tcl_GetIndexFromObj(interp, objPtr, ttkCompoundStrings,
+ "compound layout", 0, &compound);
*compoundPtr = (Ttk_Compound)compound;
return result;
@@ -60,8 +60,8 @@ int Ttk_GetOrientFromObj(
Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr)
{
*resultPtr = TTK_ORIENT_HORIZONTAL;
- return Tcl_GetIndexFromObjStruct(interp, objPtr, ttkOrientStrings,
- sizeof(char *), "orientation", 0, resultPtr);
+ return Tcl_GetIndexFromObj(interp, objPtr, ttkOrientStrings,
+ "orientation", 0, resultPtr);
}
#endif
@@ -69,8 +69,8 @@ int TtkGetOrientFromObj(
Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Orient *resultPtr)
{
int orient = (int)TTK_ORIENT_HORIZONTAL;
- int result = Tcl_GetIndexFromObjStruct(interp, objPtr, ttkOrientStrings,
- sizeof(char *), "orientation", 0, &orient);
+ int result = Tcl_GetIndexFromObj(interp, objPtr, ttkOrientStrings,
+ "orientation", 0, &orient);
*resultPtr = (Ttk_Orient)orient;
return result;
@@ -81,13 +81,13 @@ int TtkGetOrientFromObj(
* Other options are accepted and interpreted as synonyms for "normal".
*/
static const char *const ttkStateStrings[] = {
- "normal", "readonly", "disabled", "active", NULL
+ "active", "disabled", "normal", "readonly", NULL
};
enum {
- TTK_COMPAT_STATE_NORMAL,
- TTK_COMPAT_STATE_READONLY,
+ TTK_COMPAT_STATE_ACTIVE,
TTK_COMPAT_STATE_DISABLED,
- TTK_COMPAT_STATE_ACTIVE
+ TTK_COMPAT_STATE_NORMAL,
+ TTK_COMPAT_STATE_READONLY
};
/* TtkCheckStateOption --
@@ -104,8 +104,8 @@ void TtkCheckStateOption(WidgetCore *corePtr, Tcl_Obj *objPtr)
unsigned all = TTK_STATE_DISABLED|TTK_STATE_READONLY|TTK_STATE_ACTIVE;
# define SETFLAGS(f) TtkWidgetChangeState(corePtr, f, all^f)
- (void)Tcl_GetIndexFromObjStruct(NULL, objPtr, ttkStateStrings,
- sizeof(char *), "", 0, &stateOption);
+ Tcl_GetIndexFromObj(NULL, objPtr, ttkStateStrings,
+ "", 0, &stateOption);
switch (stateOption) {
case TTK_COMPAT_STATE_NORMAL:
default:
diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c
index 15edc59..318c4e0 100644
--- a/generic/ttk/ttkNotebook.c
+++ b/generic/ttk/ttkNotebook.c
@@ -16,9 +16,9 @@
#define DEFAULT_MIN_TAB_WIDTH 24
-static const char *const TabStateStrings[] = { "normal", "disabled", "hidden", 0 };
+static const char *const TabStateStrings[] = { "disabled", "hidden", "normal", 0 };
typedef enum {
- TAB_STATE_NORMAL, TAB_STATE_DISABLED, TAB_STATE_HIDDEN
+ TAB_STATE_DISABLED, TAB_STATE_HIDDEN, TAB_STATE_NORMAL
} TAB_STATE;
typedef struct
@@ -59,14 +59,14 @@ static const Tk_OptionSpec TabOptionSpecs[] =
{
{TK_OPTION_STRING_TABLE, "-state", "", "",
"normal", TCL_INDEX_NONE, offsetof(Tab,state),
- 0, (void *)TabStateStrings, 0 },
+ TK_OPTION_ENUM_VAR, TabStateStrings, 0 },
{TK_OPTION_STRING, "-text", "text", "Text", "",
offsetof(Tab,textObj), TCL_INDEX_NONE, 0, 0, GEOMETRY_CHANGED },
{TK_OPTION_STRING, "-image", "image", "Image", NULL/*default*/,
offsetof(Tab,imageObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, GEOMETRY_CHANGED },
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
NULL, offsetof(Tab,compoundObj), TCL_INDEX_NONE,
- TK_OPTION_NULL_OK,(void *)ttkCompoundStrings,GEOMETRY_CHANGED },
+ TK_OPTION_NULL_OK,ttkCompoundStrings,GEOMETRY_CHANGED },
{TK_OPTION_INDEX, "-underline", "underline", "Underline",
TK_OPTION_UNDERLINE_DEF(Tab, underline), GEOMETRY_CHANGED},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0 }
diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c
index c072f97..2a18682 100644
--- a/generic/ttk/ttkPanedwindow.c
+++ b/generic/ttk/ttkPanedwindow.c
@@ -77,7 +77,7 @@ typedef struct {
static const Tk_OptionSpec PanedOptionSpecs[] = {
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical",
offsetof(Paned,paned.orientObj), offsetof(Paned,paned.orient),
- 0, (void *)ttkOrientStrings, READONLY_OPTION|STYLE_CHANGED },
+ 0, ttkOrientStrings, READONLY_OPTION|STYLE_CHANGED },
{TK_OPTION_INT, "-width", "width", "Width", "0",
TCL_INDEX_NONE, offsetof(Paned, paned.width),
0, 0, GEOMETRY_CHANGED },
diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c
index 608b226..09c94d6 100644
--- a/generic/ttk/ttkProgress.c
+++ b/generic/ttk/ttkProgress.c
@@ -63,7 +63,7 @@ static const Tk_OptionSpec ProgressbarOptionSpecs[] =
"left", offsetof(Progressbar,progress.justifyObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
{TK_OPTION_PIXELS, "-length", "length", "Length",
- DEF_PROGRESSBAR_LENGTH, offsetof(Progressbar,progress.lengthObj), TCL_INDEX_NONE,
+ DEF_PROGRESSBAR_LENGTH, offsetof(Progressbar,progress.lengthObj), TCL_INDEX_NONE,
0, 0, GEOMETRY_CHANGED },
{TK_OPTION_DOUBLE, "-maximum", "maximum", "Maximum",
"100", offsetof(Progressbar,progress.maximumObj), TCL_INDEX_NONE,
@@ -71,7 +71,7 @@ static const Tk_OptionSpec ProgressbarOptionSpecs[] =
{TK_OPTION_STRING_TABLE, "-mode", "mode", "ProgressMode", "determinate",
offsetof(Progressbar,progress.modeObj),
offsetof(Progressbar,progress.mode),
- 0, (void *)ProgressbarModeStrings, 0 },
+ 0, ProgressbarModeStrings, 0 },
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient",
"horizontal", offsetof(Progressbar,progress.orientObj), TCL_INDEX_NONE,
0, (void *)ttkOrientStrings, STYLE_CHANGED },
diff --git a/generic/ttk/ttkScale.c b/generic/ttk/ttkScale.c
index 7e8fdc9..9322e76 100644
--- a/generic/ttk/ttkScale.c
+++ b/generic/ttk/ttkScale.c
@@ -60,8 +60,8 @@ static const Tk_OptionSpec ScaleOptionSpecs[] =
0, 0, 0},
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal",
offsetof(Scale,scale.orientObj),
- offsetof(Scale,scale.orient), 0,
- (void *)ttkOrientStrings, STYLE_CHANGED },
+ offsetof(Scale,scale.orient),
+ 0, ttkOrientStrings, STYLE_CHANGED },
{TK_OPTION_DOUBLE, "-from", "from", "From", "0",
offsetof(Scale,scale.fromObj), TCL_INDEX_NONE, 0, 0, 0},
diff --git a/generic/ttk/ttkScrollbar.c b/generic/ttk/ttkScrollbar.c
index a3f1594..6ea44b9 100644
--- a/generic/ttk/ttkScrollbar.c
+++ b/generic/ttk/ttkScrollbar.c
@@ -39,7 +39,7 @@ static const Tk_OptionSpec ScrollbarOptionSpecs[] =
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical",
offsetof(Scrollbar, scrollbar.orientObj),
offsetof(Scrollbar, scrollbar.orient),
- 0, (void *)ttkOrientStrings, STYLE_CHANGED },
+ 0, ttkOrientStrings, STYLE_CHANGED },
WIDGET_TAKEFOCUS_FALSE,
WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
diff --git a/generic/ttk/ttkSeparator.c b/generic/ttk/ttkSeparator.c
index 9b712fd..a847093 100644
--- a/generic/ttk/ttkSeparator.c
+++ b/generic/ttk/ttkSeparator.c
@@ -26,7 +26,7 @@ static const Tk_OptionSpec SeparatorOptionSpecs[] = {
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal",
offsetof(Separator,separator.orientObj),
offsetof(Separator,separator.orient),
- 0, (void *)ttkOrientStrings, STYLE_CHANGED },
+ 0, ttkOrientStrings, STYLE_CHANGED },
WIDGET_TAKEFOCUS_FALSE,
WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c
index a4ad79b..bf72b8a 100644
--- a/generic/ttk/ttkTheme.c
+++ b/generic/ttk/ttkTheme.c
@@ -1615,7 +1615,7 @@ static int StyleLayoutCmd(
* Use the current theme if $theme is omitted.
*/
static int StyleThemeStylesCmd(
- TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+ TCL_UNUSED(void *), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
Ttk_Theme themePtr;
diff --git a/generic/ttk/ttkTheme.h b/generic/ttk/ttkTheme.h
index 4da5da3..3364971 100644
--- a/generic/ttk/ttkTheme.h
+++ b/generic/ttk/ttkTheme.h
@@ -351,9 +351,9 @@ TTKAPI Tk_Image TtkSelectImage(Ttk_ImageSpec *, Ttk_State);
*/
typedef enum /* -default option values */
{
- TTK_BUTTON_DEFAULT_NORMAL, /* widget defaultable */
TTK_BUTTON_DEFAULT_ACTIVE, /* currently the default widget */
- TTK_BUTTON_DEFAULT_DISABLED /* not defaultable */
+ TTK_BUTTON_DEFAULT_DISABLED, /* not defaultable */
+ TTK_BUTTON_DEFAULT_NORMAL /* widget defaultable */
} Ttk_ButtonDefaultState;
TTKAPI int Ttk_GetButtonDefaultStateFromObj(Tcl_Interp *, Tcl_Obj *, Ttk_ButtonDefaultState *);
diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c
index 5431a58..8e57e39 100644
--- a/generic/ttk/ttkTreeview.c
+++ b/generic/ttk/ttkTreeview.c
@@ -523,10 +523,10 @@ static const Tk_OptionSpec TreeviewOptionSpecs[] = {
{TK_OPTION_STRING_TABLE, "-selectmode", "selectMode", "SelectMode",
"extended", offsetof(Treeview,tree.selectModeObj), TCL_INDEX_NONE,
- 0, (void *)SelectModeStrings, 0 },
+ 0, SelectModeStrings, 0 },
{TK_OPTION_STRING_TABLE, "-selecttype", "selectType", "SelectType",
"item", offsetof(Treeview,tree.selectTypeObj), TCL_INDEX_NONE,
- 0,(ClientData)SelectTypeStrings,0 },
+ 0, SelectTypeStrings, 0 },
{TK_OPTION_PIXELS, "-height", "height", "Height",
DEF_TREE_ROWS, offsetof(Treeview,tree.heightObj), TCL_INDEX_NONE,
@@ -822,10 +822,10 @@ static int TreeviewInitColumns(Tcl_Interp *interp, Treeview *tv)
InitColumn(tv->tree.columns + i);
Tk_InitOptions(
- interp, (ClientData)(tv->tree.columns + i),
+ interp, tv->tree.columns + i,
tv->tree.columnOptionTable, tv->core.tkwin);
Tk_InitOptions(
- interp, (ClientData)(tv->tree.columns + i),
+ interp, tv->tree.columns + i,
tv->tree.headingOptionTable, tv->core.tkwin);
Tcl_IncrRefCount(columnName);
tv->tree.columns[i].idObj = columnName;
@@ -1294,10 +1294,10 @@ static void TreeviewInitialize(Tcl_Interp *interp, void *recordPtr)
tv->tree.column0.idObj = Tcl_NewStringObj("#0", 2);
Tcl_IncrRefCount(tv->tree.column0.idObj);
Tk_InitOptions(
- interp, (ClientData)(&tv->tree.column0),
+ interp, &tv->tree.column0,
tv->tree.columnOptionTable, tv->core.tkwin);
Tk_InitOptions(
- interp, (ClientData)(&tv->tree.column0),
+ interp, &tv->tree.column0,
tv->tree.headingOptionTable, tv->core.tkwin);
Tcl_InitHashTable(&tv->tree.items, TCL_STRING_KEYS);
@@ -1308,7 +1308,7 @@ static void TreeviewInitialize(Tcl_Interp *interp, void *recordPtr)
/* Create root item "":
*/
tv->tree.root = NewItem();
- Tk_InitOptions(interp, (ClientData)tv->tree.root,
+ Tk_InitOptions(interp, tv->tree.root,
tv->tree.itemOptionTable, tv->core.tkwin);
tv->tree.root->tagset = Ttk_GetTagSetFromObj(NULL, tv->tree.tagTable, NULL);
tv->tree.root->entryPtr = Tcl_CreateHashEntry(&tv->tree.items, "", &unused);
@@ -1344,7 +1344,7 @@ static void TreeviewCleanup(void *recordPtr)
TreeviewFreeColumns(tv);
if (tv->tree.displayColumns)
- ckfree((ClientData)tv->tree.displayColumns);
+ ckfree(tv->tree.displayColumns);
foreachHashEntry(&tv->tree.items, FreeItemCB);
Tcl_DeleteHashTable(&tv->tree.items);
@@ -3169,7 +3169,7 @@ static int TreeviewInsertCommand(
*/
newItem = NewItem();
Tk_InitOptions(
- interp, (ClientData)newItem, tv->tree.itemOptionTable, tv->core.tkwin);
+ interp, newItem, tv->tree.itemOptionTable, tv->core.tkwin);
newItem->tagset = Ttk_GetTagSetFromObj(NULL, tv->tree.tagTable, NULL);
if (ConfigureItem(interp, tv, newItem, objc, objv) != TCL_OK) {
Tcl_DeleteHashEntry(entryPtr);
@@ -3969,6 +3969,7 @@ static int TreeviewTagDeleteCommand(
item = NextPreorder(item);
}
/* then remove the tag from the tag table */
+ Tk_DeleteAllBindings(tv->tree.bindingTable, tag);
Ttk_DeleteTagFromTable(tagTable, tag);
TtkRedisplayWidget(&tv->core);
diff --git a/generic/ttk/ttkWidget.h b/generic/ttk/ttkWidget.h
index 4b6bd0f..dbe073e 100644
--- a/generic/ttk/ttkWidget.h
+++ b/generic/ttk/ttkWidget.h
@@ -109,7 +109,7 @@ MODULE_SCOPE int TtkWidgetConstructorObjCmd(
#define RegisterWidget(interp, name, specPtr) \
Tcl_CreateObjCommand(interp, name, \
- TtkWidgetConstructorObjCmd, (ClientData)specPtr,NULL)
+ TtkWidgetConstructorObjCmd, (void *)specPtr,NULL)
/* WIDGET_TAKEFOCUS_TRUE --
* WIDGET_TAKEFOCUS_FALSE --
diff --git a/macosx/tkMacOSXBitmap.c b/macosx/tkMacOSXBitmap.c
index e26c5bb..abf0211 100644
--- a/macosx/tkMacOSXBitmap.c
+++ b/macosx/tkMacOSXBitmap.c
@@ -59,12 +59,12 @@ typedef struct {
} IconBitmap;
static const char *const iconBitmapOptionStrings[] = {
- "-file", "-fileType", "-osType", "-systemType", "-namedImage",
- "-imageFile", NULL
+ "-file", "-fileType", "-imageFile", "-namedImage", "-osType",
+ "-systemType", NULL
};
enum iconBitmapOptions {
- ICON_FILE, ICON_FILETYPE, ICON_OSTYPE, ICON_SYSTEMTYPE, ICON_NAMEDIMAGE,
- ICON_IMAGEFILE,
+ ICON_FILE, ICON_FILETYPE, ICON_IMAGEFILE, ICON_NAMEDIMAGE, ICON_OSTYPE,
+ ICON_SYSTEMTYPE
};
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c
index 528b0f2..03d3cf2 100644
--- a/macosx/tkMacOSXDialog.c
+++ b/macosx/tkMacOSXDialog.c
@@ -68,32 +68,32 @@ enum colorOptions {
};
static const char *const openOptionStrings[] = {
- "-defaultextension", "-filetypes", "-initialdir", "-initialfile",
- "-message", "-multiple", "-parent", "-title", "-typevariable",
- "-command", NULL
+ "-command", "-defaultextension", "-filetypes", "-initialdir",
+ "-initialfile", "-message", "-multiple", "-parent", "-title",
+ "-typevariable", NULL
};
enum openOptions {
- OPEN_DEFAULT, OPEN_FILETYPES, OPEN_INITDIR, OPEN_INITFILE,
- OPEN_MESSAGE, OPEN_MULTIPLE, OPEN_PARENT, OPEN_TITLE,
- OPEN_TYPEVARIABLE, OPEN_COMMAND,
+ OPEN_COMMAND, OPEN_DEFAULT, OPEN_FILETYPES, OPEN_INITDIR,
+ OPEN_INITFILE, OPEN_MESSAGE, OPEN_MULTIPLE, OPEN_PARENT, OPEN_TITLE,
+ OPEN_TYPEVARIABLE
};
static const char *const saveOptionStrings[] = {
- "-defaultextension", "-filetypes", "-initialdir", "-initialfile",
- "-message", "-parent", "-title", "-typevariable", "-command",
- "-confirmoverwrite", NULL
+ "-command", "-confirmoverwrite", "-defaultextension", "-filetypes",
+ "-initialdir", "-initialfile", "-message", "-parent", "-title",
+ "-typevariable", NULL
};
enum saveOptions {
- SAVE_DEFAULT, SAVE_FILETYPES, SAVE_INITDIR, SAVE_INITFILE,
- SAVE_MESSAGE, SAVE_PARENT, SAVE_TITLE, SAVE_TYPEVARIABLE, SAVE_COMMAND,
- SAVE_CONFIRMOW
+ SAVE_COMMAND, SAVE_CONFIRMOW, SAVE_DEFAULT, SAVE_FILETYPES,
+ SAVE_INITDIR, SAVE_INITFILE, SAVE_MESSAGE, SAVE_PARENT, SAVE_TITLE,
+ SAVE_TYPEVARIABLE
};
static const char *const chooseOptionStrings[] = {
- "-initialdir", "-message", "-mustexist", "-parent", "-title", "-command",
+ "-command", "-initialdir", "-message", "-mustexist", "-parent", "-title",
NULL
};
enum chooseOptions {
- CHOOSE_INITDIR, CHOOSE_MESSAGE, CHOOSE_MUSTEXIST, CHOOSE_PARENT,
- CHOOSE_TITLE, CHOOSE_COMMAND,
+ CHOOSE_COMMAND, CHOOSE_INITDIR, CHOOSE_MESSAGE, CHOOSE_MUSTEXIST,
+ CHOOSE_PARENT, CHOOSE_TITLE
};
typedef struct {
Tcl_Interp *interp;
@@ -107,7 +107,7 @@ static const char *const alertOptionStrings[] = {
};
enum alertOptions {
ALERT_DEFAULT, ALERT_DETAIL, ALERT_ICON, ALERT_MESSAGE, ALERT_PARENT,
- ALERT_TITLE, ALERT_TYPE, ALERT_COMMAND,
+ ALERT_TITLE, ALERT_TYPE, ALERT_COMMAND
};
typedef struct {
Tcl_Interp *interp;
@@ -219,9 +219,9 @@ getFileURL(
- (void) tkFilePanelDidEnd: (NSSavePanel *) panel
returnCode: (NSModalResponse) returnCode
- contextInfo: (void *) contextInfo
+ contextInfo: (const void *) contextInfo
{
- FilePanelCallbackInfo *callbackInfo = (FilePanelCallbackInfo *)contextInfo;
+ const FilePanelCallbackInfo *callbackInfo = (const FilePanelCallbackInfo *)contextInfo;
if (returnCode == modalOK) {
Tcl_Obj *resultObj;
@@ -254,17 +254,11 @@ getFileURL(
} else if (returnCode == modalCancel) {
Tcl_ResetResult(callbackInfo->interp);
}
- if (callbackInfo->cmdObj) {
- Tcl_DecrRefCount(callbackInfo->cmdObj);
- }
- if (callbackInfo) {
- ckfree(callbackInfo);
- }
[NSApp stopModalWithCode:returnCode];
}
- (void) tkAlertDidEnd: (NSAlert *) alert returnCode: (NSInteger) returnCode
- contextInfo: (void *) contextInfo
+ contextInfo: (const void *) contextInfo
{
AlertCallbackInfo *callbackInfo = (AlertCallbackInfo *)contextInfo;
@@ -293,10 +287,6 @@ getFileURL(
if ([alert window] == [NSApp modalWindow]) {
[NSApp stopModalWithCode:returnCode];
}
- if (callbackInfo->cmdObj) {
- Tcl_DecrRefCount(callbackInfo->cmdObj);
- ckfree(callbackInfo);
- }
}
- (void)selectFormat:(id)sender {
@@ -347,10 +337,13 @@ getFileURL(
static NSInteger showOpenSavePanel(
NSSavePanel *panel,
NSWindow *parent,
- FilePanelCallbackInfo *callbackInfo)
+ Tcl_Interp *interp,
+ Tcl_Obj *cmdObj,
+ int multiple)
{
NSInteger modalReturnCode;
int OSVersion = [NSApp macOSVersion];
+ const FilePanelCallbackInfo callbackInfo = {interp, cmdObj, multiple};
/*
* Use a sheet if -parent is specified (unless there is already a sheet).
@@ -362,7 +355,7 @@ static NSInteger showOpenSavePanel(
completionHandler:^(NSModalResponse returnCode) {
[NSApp tkFilePanelDidEnd:panel
returnCode:returnCode
- contextInfo:callbackInfo ];
+ contextInfo:&callbackInfo ];
}];
modalReturnCode = [NSApp runModalForWindow:panel];
} else if (OSVersion < 110000) {
@@ -370,7 +363,7 @@ static NSInteger showOpenSavePanel(
completionHandler:^(NSModalResponse returnCode) {
[NSApp tkFilePanelDidEnd:panel
returnCode:returnCode
- contextInfo:callbackInfo ];
+ contextInfo:&callbackInfo ];
}];
modalReturnCode = [panel runModal];
} else {
@@ -378,16 +371,16 @@ static NSInteger showOpenSavePanel(
modalReturnCode = [panel runModal];
[NSApp tkFilePanelDidEnd:panel
returnCode:modalReturnCode
- contextInfo:callbackInfo ];
+ contextInfo:&callbackInfo ];
[parent endSheet:panel];
}
} else {
modalReturnCode = [panel runModal];
[NSApp tkFilePanelDidEnd:panel
returnCode:modalReturnCode
- contextInfo:callbackInfo ];
+ contextInfo:&callbackInfo ];
}
- return callbackInfo->cmdObj ? modalOther : modalReturnCode;
+ return cmdObj ? modalOther : modalReturnCode;
}
/*
@@ -675,8 +668,6 @@ Tk_GetOpenFileObjCmd(
int i, result = TCL_ERROR, haveParentOption = 0;
int index, len, multiple = 0;
Tcl_Obj *cmdObj = NULL, *typeVariablePtr = NULL, *fileTypesPtr = NULL;
- FilePanelCallbackInfo callbackInfoStruct;
- FilePanelCallbackInfo *callbackInfo = &callbackInfoStruct;
NSString *directory = nil, *filename = nil;
NSString *message = nil, *title = nil;
NSWindow *parent;
@@ -833,10 +824,6 @@ Tk_GetOpenFileObjCmd(
}
Tcl_IncrRefCount(cmdObj);
}
- callbackInfo = (FilePanelCallbackInfo *)ckalloc(sizeof(FilePanelCallbackInfo));
- callbackInfo->cmdObj = cmdObj;
- callbackInfo->interp = interp;
- callbackInfo->multiple = multiple;
if (directory || filename) {
NSURL *fileURL = getFileURL(directory, filename);
@@ -849,7 +836,10 @@ Tk_GetOpenFileObjCmd(
parent = nil;
parentIsKey = False;
}
- modalReturnCode = showOpenSavePanel(openpanel, parent, callbackInfo);
+ modalReturnCode = showOpenSavePanel(openpanel, parent, interp, cmdObj, multiple);
+ if (cmdObj) {
+ Tcl_DecrRefCount(cmdObj);
+ }
result = (modalReturnCode != modalError) ? TCL_OK : TCL_ERROR;
if (parentIsKey) {
[parent makeKeyWindow];
@@ -948,8 +938,6 @@ Tk_GetSaveFileObjCmd(
int confirmOverwrite = 1;
int index, len;
Tcl_Obj *cmdObj = NULL, *typeVariablePtr = NULL, *fileTypesPtr = NULL;
- FilePanelCallbackInfo callbackInfoStruct;
- FilePanelCallbackInfo *callbackInfo = &callbackInfoStruct;
NSString *directory = nil, *filename = nil, *defaultType = nil;
NSString *message = nil, *title = nil;
NSWindow *parent;
@@ -1109,10 +1097,6 @@ Tk_GetSaveFileObjCmd(
}
Tcl_IncrRefCount(cmdObj);
}
- callbackInfo = (FilePanelCallbackInfo *)ckalloc(sizeof(FilePanelCallbackInfo));
- callbackInfo->cmdObj = cmdObj;
- callbackInfo->interp = interp;
- callbackInfo->multiple = 0;
if (directory) {
[savepanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]];
@@ -1135,7 +1119,10 @@ Tk_GetSaveFileObjCmd(
parent = nil;
parentIsKey = False;
}
- modalReturnCode = showOpenSavePanel(savepanel, parent, callbackInfo);
+ modalReturnCode = showOpenSavePanel(savepanel, parent, interp, cmdObj, 0);
+ if (cmdObj) {
+ Tcl_DecrRefCount(cmdObj);
+ }
result = (modalReturnCode != modalError) ? TCL_OK : TCL_ERROR;
if (parentIsKey) {
[parent makeKeyWindow];
@@ -1189,8 +1176,6 @@ Tk_ChooseDirectoryObjCmd(
int i, result = TCL_ERROR, haveParentOption = 0;
int index, len, mustexist = 0;
Tcl_Obj *cmdObj = NULL;
- FilePanelCallbackInfo callbackInfoStruct;
- FilePanelCallbackInfo *callbackInfo = &callbackInfoStruct;
NSString *directory = nil;
NSString *message, *title;
NSWindow *parent;
@@ -1258,10 +1243,6 @@ Tk_ChooseDirectoryObjCmd(
}
Tcl_IncrRefCount(cmdObj);
}
- callbackInfo = (FilePanelCallbackInfo *)ckalloc(sizeof(FilePanelCallbackInfo));
- callbackInfo->cmdObj = cmdObj;
- callbackInfo->interp = interp;
- callbackInfo->multiple = 0;
/*
* Check for directory value, set to root if not specified; otherwise
@@ -1280,7 +1261,10 @@ Tk_ChooseDirectoryObjCmd(
parent = nil;
parentIsKey = False;
}
- modalReturnCode = showOpenSavePanel(panel, parent, callbackInfo);
+ modalReturnCode = showOpenSavePanel(panel, parent, interp, cmdObj, 0);
+ if (cmdObj) {
+ Tcl_DecrRefCount(cmdObj);
+ }
result = (modalReturnCode != modalError) ? TCL_OK : TCL_ERROR;
if (parentIsKey) {
[parent makeKeyWindow];
@@ -1371,7 +1355,7 @@ Tk_MessageBoxObjCmd(
int index, typeIndex, iconIndex, indexDefaultOption = 0;
int defaultNativeButtonIndex = 1; /* 1, 2, 3: right to left */
Tcl_Obj *cmdObj = NULL;
- AlertCallbackInfo callbackInfoStruct, *callbackInfo = &callbackInfoStruct;
+ AlertCallbackInfo callbackInfo;
NSString *message, *title;
NSWindow *parent;
NSArray *buttons;
@@ -1499,10 +1483,9 @@ Tk_MessageBoxObjCmd(
}
Tcl_IncrRefCount(cmdObj);
}
- callbackInfo = (AlertCallbackInfo *)ckalloc(sizeof(AlertCallbackInfo));
- callbackInfo->cmdObj = cmdObj;
- callbackInfo->interp = interp;
- callbackInfo->typeIndex = typeIndex;
+ callbackInfo.cmdObj = cmdObj;
+ callbackInfo.interp = interp;
+ callbackInfo.typeIndex = typeIndex;
parent = TkMacOSXGetNSWindowForDrawable(((TkWindow *)tkwin)->window);
if (haveParentOption && parent && ![parent attachedSheet]) {
parentIsKey = [parent isKeyWindow];
@@ -1511,20 +1494,23 @@ Tk_MessageBoxObjCmd(
completionHandler:^(NSModalResponse returnCode) {
[NSApp tkAlertDidEnd:alert
returnCode:returnCode
- contextInfo:callbackInfo];
+ contextInfo:&callbackInfo];
}];
#else
[alert beginSheetModalForWindow:parent
modalDelegate:NSApp
didEndSelector:@selector(tkAlertDidEnd:returnCode:contextInfo:)
- contextInfo:callbackInfo];
+ contextInfo:&callbackInfo];
#endif
modalReturnCode = cmdObj ? 0 :
[alert runModal];
} else {
modalReturnCode = [alert runModal];
[NSApp tkAlertDidEnd:alert returnCode:modalReturnCode
- contextInfo:callbackInfo];
+ contextInfo:&callbackInfo];
+ }
+ if (cmdObj) {
+ Tcl_DecrRefCount(cmdObj);
}
result = (modalReturnCode >= NSAlertFirstButtonReturn) ? TCL_OK : TCL_ERROR;
end:
@@ -1587,11 +1573,11 @@ static NSFont *fontPanelFont = nil;
static NSMutableDictionary *fontPanelFontAttributes = nil;
static const char *const fontchooserOptionStrings[] = {
- "-parent", "-title", "-font", "-command",
+ "-command", "-font", "-parent", "-title",
"-visible", NULL
};
enum FontchooserOption {
- FontchooserParent, FontchooserTitle, FontchooserFont, FontchooserCmd,
+ FontchooserCmd, FontchooserFont, FontchooserParent, FontchooserTitle,
FontchooserVisible
};
@@ -1760,8 +1746,8 @@ FontchooserCget(
}
break;
case FontchooserVisible:
- resObj = Tcl_NewWideIntObj([[[NSFontManager sharedFontManager]
- fontPanel:NO] isVisible] != 0);
+ resObj = Tcl_NewBooleanObj([[[NSFontManager sharedFontManager]
+ fontPanel:NO] isVisible]);
break;
default:
resObj = Tcl_NewObj();
diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c
index bc30949..293e7ea 100644
--- a/macosx/tkMacOSXNotify.c
+++ b/macosx/tkMacOSXNotify.c
@@ -441,7 +441,7 @@ static Tcl_TimerToken ticker = NULL;
static void
Heartbeat(
- TCL_UNUSED(ClientData))
+ TCL_UNUSED(void *))
{
if (ticker) {
@@ -520,7 +520,7 @@ TkMacOSXEventsSetupProc(
*/
static void
TkMacOSXEventsCheckProc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
int flags)
{
NSString *runloopMode = [[NSRunLoop currentRunLoop] currentMode];
diff --git a/macosx/tkMacOSXPrint.c b/macosx/tkMacOSXPrint.c
index 2a2aa86..fdb66aa 100644
--- a/macosx/tkMacOSXPrint.c
+++ b/macosx/tkMacOSXPrint.c
@@ -341,7 +341,7 @@ FinishPrint(
int MacPrint_Init(Tcl_Interp * interp) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
- Tcl_CreateObjCommand(interp, "::tk::print::_print", StartPrint, (ClientData) NULL, (Tcl_CmdDeleteProc * ) NULL);
+ Tcl_CreateObjCommand(interp, "::tk::print::_print", StartPrint, NULL, NULL);
[pool release];
return TCL_OK;
}
diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c
index 26d68d9..a8d770b 100644
--- a/macosx/tkMacOSXTest.c
+++ b/macosx/tkMacOSXTest.c
@@ -278,12 +278,12 @@ InjectKeyEventObjCmd(
Tcl_Obj *const objv[])
{
static const char *const optionStrings[] = {
- "press", "release", "flagschanged", NULL};
- NSUInteger types[3] = {NSKeyDown, NSKeyUp, NSFlagsChanged};
+ "flagschanged", "press", "release", NULL};
+ NSUInteger types[3] = {NSFlagsChanged, NSKeyDown, NSKeyUp};
static const char *const argStrings[] = {
- "-shift", "-control", "-option", "-command", "-function", "-x", "-y", NULL};
- enum args {KEYEVENT_SHIFT, KEYEVENT_CONTROL, KEYEVENT_OPTION, KEYEVENT_COMMAND,
- KEYEVENT_FUNCTION, KEYEVENT_X, KEYEVENT_Y};
+ "-command", "-control", "-function", "-option", "-shift", "-x", "-y", NULL};
+ enum args {KEYEVENT_COMMAND, KEYEVENT_CONTROL, KEYEVENT_FUNCTION, KEYEVENT_OPTION,
+ KEYEVENT_SHIFT, KEYEVENT_X, KEYEVENT_Y};
int i, index, keysym, mods = 0, x = 0, y = 0;
NSString *chars = nil, *unmod = nil, *upper, *lower;
NSEvent *keyEvent;
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index b273030..39da1eb 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -1272,8 +1272,8 @@ Tk_WmObjCmd(
return Tcl_GetBooleanFromObj(interp, objv[2], &wmTracing);
}
- if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings,
- sizeof(char *), "option", 0, &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings,
+ "option", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
@@ -1682,8 +1682,8 @@ WmAttributesCmd(
}
Tcl_SetObjResult(interp, result);
} else if (objc == 4) { /* wm attributes $win -attribute */
- if (Tcl_GetIndexFromObjStruct(interp, objv[3], WmAttributeNames,
- sizeof(char *), "attribute", 0, &attribute) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[3], WmAttributeNames,
+ "attribute", 0, &attribute) != TCL_OK) {
return TCL_ERROR;
}
Tcl_SetObjResult(interp, WmGetAttribute(winPtr, macWindow, (WmAttribute)attribute));
@@ -1691,8 +1691,8 @@ WmAttributesCmd(
int i;
for (i = 3; i < objc; i += 2) {
- if (Tcl_GetIndexFromObjStruct(interp, objv[i], WmAttributeNames,
- sizeof(char *), "attribute", 0, &attribute) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[i], WmAttributeNames,
+ "attribute", 0, &attribute) != TCL_OK) {
return TCL_ERROR;
}
if (WmSetAttribute(winPtr, macWindow, interp, (WmAttribute)attribute, objv[i+1])
@@ -2031,8 +2031,8 @@ WmFocusmodelCmd(
return TCL_OK;
}
- if (Tcl_GetIndexFromObjStruct(interp, objv[3], optionStrings,
- sizeof(char *), "argument", 0, &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings,
+ "argument", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
if (index == OPT_ACTIVE) {
@@ -3243,8 +3243,8 @@ WmPositionfromCmd(
if (*Tcl_GetString(objv[3]) == '\0') {
wmPtr->sizeHintsFlags &= ~(USPosition|PPosition);
} else {
- if (Tcl_GetIndexFromObjStruct(interp, objv[3], optionStrings,
- sizeof(char *), "argument", 0, &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings,
+ "argument", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
if (index == OPT_USER) {
@@ -3489,8 +3489,8 @@ WmSizefromCmd(
if (*Tcl_GetString(objv[3]) == '\0') {
wmPtr->sizeHintsFlags &= ~(USSize|PSize);
} else {
- if (Tcl_GetIndexFromObjStruct(interp, objv[3], optionStrings,
- sizeof(char *), "argument", 0, &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings,
+ "argument", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
if (index == OPT_USER) {
@@ -3618,8 +3618,8 @@ WmStackorderCmd(
ckfree(windows);
- if (Tcl_GetIndexFromObjStruct(interp, objv[3], optionStrings,
- sizeof(char *), "argument", 0, &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings,
+ "argument", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
if (index == OPT_ISABOVE) {
@@ -3659,9 +3659,9 @@ WmStateCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
static const char *const optionStrings[] = {
- "normal", "iconic", "withdrawn", "zoomed", NULL };
+ "iconic", "normal", "withdrawn", "zoomed", NULL };
enum options {
- OPT_NORMAL, OPT_ICONIC, OPT_WITHDRAWN, OPT_ZOOMED };
+ OPT_ICONIC, OPT_NORMAL, OPT_WITHDRAWN, OPT_ZOOMED };
int index;
if ((objc < 3) || (objc > 4)) {
@@ -3685,8 +3685,8 @@ WmStateCmd(
return TCL_ERROR;
}
- if (Tcl_GetIndexFromObjStruct(interp, objv[3], optionStrings,
- sizeof(char *), "argument", 0, &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings,
+ "argument", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
@@ -5741,10 +5741,10 @@ TkUnsupported1ObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
static const char *const subcmds[] = {
- "style", "tabbingid", "appearance", "isdark", NULL
+ "appearance", "isdark", "style", "tabbingid", NULL
};
enum SubCmds {
- TKMWS_STYLE, TKMWS_TABID, TKMWS_APPEARANCE, TKMWS_ISDARK
+ TKMWS_APPEARANCE, TKMWS_ISDARK, TKMWS_STYLE, TKMWS_TABID
};
Tk_Window tkwin = (Tk_Window)clientData;
TkWindow *winPtr;
@@ -5767,8 +5767,8 @@ TkUnsupported1ObjCmd(
return TCL_ERROR;
}
- if (Tcl_GetIndexFromObjStruct(interp, objv[1], subcmds,
- sizeof(char *), "option", 0, &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[1], subcmds,
+ "option", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
switch((enum SubCmds) index) {
@@ -6134,10 +6134,10 @@ WmWinAppearance(
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED > 1090
static const char *const appearanceStrings[] = {
- "aqua", "darkaqua", "auto", NULL
+ "aqua", "auto", "darkaqua", NULL
};
enum appearances {
- APPEARANCE_AQUA, APPEARANCE_DARKAQUA, APPEARANCE_AUTO
+ APPEARANCE_AQUA, APPEARANCE_AUTO, APPEARANCE_DARKAQUA
};
Tcl_Obj *result = NULL;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101300
@@ -6169,10 +6169,10 @@ WmWinAppearance(
}
if (objc == 4) {
int index;
- if (Tcl_GetIndexFromObjStruct(interp, objv[3], appearanceStrings,
- sizeof(char *), "appearancename", 0, &index) != TCL_OK) {
- return TCL_ERROR;
- }
+ if (Tcl_GetIndexFromObj(interp, objv[3], appearanceStrings,
+ "appearancename", 0, &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
switch ((enum appearances) index) {
case APPEARANCE_AQUA:
win.appearance = [NSAppearance appearanceNamed:
diff --git a/tests/choosedir.test b/tests/choosedir.test
index 7e66756..5ddc2e7 100644
--- a/tests/choosedir.test
+++ b/tests/choosedir.test
@@ -102,7 +102,7 @@ test choosedir-1.5.1 {tk_chooseDirectory command} -constraints notAqua -body {
} -returnCodes error -result {bad option "-foo": must be -initialdir, -mustexist, -parent, or -title}
test choosedir-1.5.2 {tk_chooseDirectory command} -constraints aqua -body {
tk_chooseDirectory -foo bar
-} -returnCodes error -result {bad option "-foo": must be -initialdir, -message, -mustexist, -parent, -title, or -command}
+} -returnCodes error -result {bad option "-foo": must be -command, -initialdir, -message, -mustexist, -parent, or -title}
test choosedir-1.6 {tk_chooseDirectory command} -body {
tk_chooseDirectory -parent foo.bar
} -returnCodes error -result {bad window path name "foo.bar"}
diff --git a/tests/entry.test b/tests/entry.test
index cd26264..b7a5593 100644
--- a/tests/entry.test
+++ b/tests/entry.test
@@ -1115,7 +1115,7 @@ test entry-3.44 {EntryWidgetCmd procedure, "scan" widget command} -setup {
.e scan foobar 20
} -cleanup {
destroy .e
-} -returnCodes error -result {bad scan option "foobar": must be mark or dragto}
+} -returnCodes error -result {bad scan option "foobar": must be dragto or mark}
test entry-3.45 {EntryWidgetCmd procedure, "scan" widget command} -setup {
entry .e
pack .e ; update idletasks
diff --git a/tests/filebox.test b/tests/filebox.test
index cdf3224..f46c906 100644
--- a/tests/filebox.test
+++ b/tests/filebox.test
@@ -110,9 +110,9 @@ if {$tcl_platform(platform) == "unix"} {
}
set unknownOptionsMsg(tk_getOpenFile,notAqua) {bad option "-foo": must be -defaultextension, -filetypes, -initialdir, -initialfile, -multiple, -parent, -title, or -typevariable}
-set unknownOptionsMsg(tk_getOpenFile,aqua) {bad option "-foo": must be -defaultextension, -filetypes, -initialdir, -initialfile, -message, -multiple, -parent, -title, -typevariable, or -command}
+set unknownOptionsMsg(tk_getOpenFile,aqua) {bad option "-foo": must be -command, -defaultextension, -filetypes, -initialdir, -initialfile, -message, -multiple, -parent, -title, or -typevariable}
set unknownOptionsMsg(tk_getSaveFile,notAqua) {bad option "-foo": must be -confirmoverwrite, -defaultextension, -filetypes, -initialdir, -initialfile, -parent, -title, or -typevariable}
-set unknownOptionsMsg(tk_getSaveFile,aqua) {bad option "-foo": must be -defaultextension, -filetypes, -initialdir, -initialfile, -message, -parent, -title, -typevariable, -command, or -confirmoverwrite}
+set unknownOptionsMsg(tk_getSaveFile,aqua) {bad option "-foo": must be -command, -confirmoverwrite, -defaultextension, -filetypes, -initialdir, -initialfile, -message, -parent, -title, or -typevariable}
set tmpFile "filebox.tmp"
makeFile {
diff --git a/tests/font.test b/tests/font.test
index dca3106..b4071d9 100644
--- a/tests/font.test
+++ b/tests/font.test
@@ -440,7 +440,7 @@ test font-10.4 {font command: metrics: arguments} -body {
test font-10.5 {font command: metrics: arguments} -body {
# (objc - skip) > 4) when skip == 2
font metrics xyz -displayof . abc
-} -returnCodes error -result {bad metric "abc": must be -ascent, -descent, -linespace, or -fixed}
+} -returnCodes error -result {bad metric "abc": must be -ascent, -descent, -fixed, or -linespace}
test font-10.6 {font command: metrics: bad font} -constraints noExceed -body {
# (tkfont == NULL)
font metrics "\{xyz"
@@ -457,7 +457,7 @@ test font-10.7 {font command: metrics: get all metrics} -setup {
test font-10.8 {font command: metrics: bad metric} -body {
# (Tcl_GetIndexFromObj() != TCL_OK)
font metrics $fixed -xyz
-} -returnCodes error -result {bad metric "-xyz": must be -ascent, -descent, -linespace, or -fixed}
+} -returnCodes error -result {bad metric "-xyz": must be -ascent, -descent, -fixed, or -linespace}
test font-10.9 {font command: metrics: get individual metrics} -body {
font metrics $fixed -ascent
font metrics $fixed -descent
diff --git a/tests/listbox.test b/tests/listbox.test
index f5418da..6b32297 100644
--- a/tests/listbox.test
+++ b/tests/listbox.test
@@ -816,7 +816,7 @@ test listbox-3.78 {ListboxWidgetCmd procedure, "scan" option} -constraints {
} -result {{0.249364 0.427481} {0.0714286 0.428571}}
test listbox-3.79 {ListboxWidgetCmd procedure, "scan" option} -body {
.l scan foo 2 4
-} -returnCodes error -result {bad option "foo": must be mark or dragto}
+} -returnCodes error -result {bad option "foo": must be dragto or mark}
test listbox-3.80 {ListboxWidgetCmd procedure, "see" option} -body {
.l see
} -returnCodes error -result {wrong # args: should be ".l see index"}
diff --git a/tests/menu.test b/tests/menu.test
index 85746b8..c18a274 100644
--- a/tests/menu.test
+++ b/tests/menu.test
@@ -3305,7 +3305,7 @@ test menu-20.5 {CloneMenu} -setup {
} -body {
menu .m1
.m1 clone .m2 foo
-} -returnCodes error -result {bad menu type "foo": must be normal, tearoff, or menubar}
+} -returnCodes error -result {bad menu type "foo": must be menubar, normal, or tearoff}
test menu-20.6 {CloneMenu - hooking up bookeeping ptrs} -setup {
deleteWindows
} -body {
@@ -4002,7 +4002,7 @@ test menu-39.1 {empty -type - bug be8f5b9fc2} -setup {
menu .m -type {}
} -cleanup {
destroy .m
-} -returnCodes error -result {ambiguous type "": must be normal, tearoff, or menubar}
+} -returnCodes error -result {ambiguous type "": must be menubar, normal, or tearoff}
# cleanup
diff --git a/tests/menuDraw.test b/tests/menuDraw.test
index 96cdb71..ff639c1 100644
--- a/tests/menuDraw.test
+++ b/tests/menuDraw.test
@@ -132,7 +132,7 @@ test menuDraw-6.6 {TkMenuConfigureEntryDrawOptions - bad state} -setup {
.m1 entryconfigure 1 -state foo
} -cleanup {
deleteWindows
-} -returnCodes error -result {bad state "foo": must be active, normal, or disabled}
+} -returnCodes error -result {bad state "foo": must be active, disabled, or normal}
test menuDraw-6.7 {TkMenuConfigureEntryDrawOptions - tkfont specified} -setup {
deleteWindows
} -body {
diff --git a/tests/pack.test b/tests/pack.test
index a17de62..f85369d 100644
--- a/tests/pack.test
+++ b/tests/pack.test
@@ -1263,7 +1263,7 @@ test pack-12.29 {command options and errors} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
pack .pack.a -side bac
-} -returnCodes error -result {bad side "bac": must be top, bottom, left, or right}
+} -returnCodes error -result {bad side "bac": must be bottom, left, right, or top}
test pack-12.30 {command options and errors} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
diff --git a/tests/place.test b/tests/place.test
index 49edeb0..af54043 100644
--- a/tests/place.test
+++ b/tests/place.test
@@ -416,7 +416,7 @@ test place-10.3 {ConfigureContent} -setup {
place .foo -bordermode j
} -cleanup {
destroy .foo
-} -returnCodes error -result {bad bordermode "j": must be inside, outside, or ignore}
+} -returnCodes error -result {bad bordermode "j": must be inside, ignore, or outside}
test place-10.4 {ConfigureContent} -setup {
destroy .foo
} -body {
diff --git a/tests/spinbox.test b/tests/spinbox.test
index c73e31e..cf92877 100644
--- a/tests/spinbox.test
+++ b/tests/spinbox.test
@@ -1452,7 +1452,7 @@ test spinbox-3.44 {SpinboxWidgetCmd procedure, "scan" widget command} -setup {
.e scan foobar 20
} -cleanup {
destroy .e
-} -returnCodes error -result {bad scan option "foobar": must be mark or dragto}
+} -returnCodes error -result {bad scan option "foobar": must be dragto or mark}
test spinbox-3.45 {SpinboxWidgetCmd procedure, "scan" widget command} -setup {
spinbox .e
pack .e
diff --git a/tests/textDisp.test b/tests/textDisp.test
index da8c1d2..df72060 100644
--- a/tests/textDisp.test
+++ b/tests/textDisp.test
@@ -2371,7 +2371,7 @@ test textDisp-17.4 {TkTextScanCmd procedure} {
} {1 {expected integer but got "bogus"}}
test textDisp-17.5 {TkTextScanCmd procedure} {
list [catch {.t scan stupid 123 456} msg] $msg
-} {1 {bad scan option "stupid": must be mark or dragto}}
+} {1 {bad scan option "stupid": must be dragto or mark}}
test textDisp-17.6 {TkTextScanCmd procedure} {textfonts} {
.t yview 1.0
.t xview moveto 0
diff --git a/tests/ttk/treeview.test b/tests/ttk/treeview.test
index f7168ee..f32d37f 100644
--- a/tests/ttk/treeview.test
+++ b/tests/ttk/treeview.test
@@ -16,7 +16,7 @@ loadTestedCommands
# follows ->prev links, this should cover all invariants.
#
proc consistencyCheck {tv {item {}}} {
- set i 0;
+ set i 0
foreach child [$tv children $item] {
assert {[$tv parent $child] == $item} "parent $child = $item"
assert {[$tv index $child] == $i} "index $child [$tv index $child]=$i"
@@ -1410,5 +1410,14 @@ test treeview-12.1 "tag bindings" -setup {
rename cellEvent {}
destroy .tv
} -result {a t1 t2 b t1 c t2 b t1 a t1}
+test treeview-12.2 "tag bindings deletion on tag delete" -setup {
+ tvSetupWithItems
+ .tv tag bind nn.n1 <Button-1> {puts Triggered}
+} -body {
+ .tv tag delete nn.n1
+ .tv tag bind nn.n1
+} -cleanup {
+ destroy .tv
+} -result {}
tcltest::cleanupTests
diff --git a/tests/unixWm.test b/tests/unixWm.test
index 8c87cb5..c103253 100644
--- a/tests/unixWm.test
+++ b/tests/unixWm.test
@@ -1230,9 +1230,9 @@ test unixWm-34.3 {Tk_WmCmd procedure, "sizefrom" option} unix {
list [catch {wm sizefrom .t none} msg] $msg
} {1 {bad argument "none": must be program or user}}
if {[tk windowingsystem] == "aqua"} {
- set result_35_1 {1 {bad argument "1": must be normal, iconic, withdrawn, or zoomed}}
+ set result_35_1 {1 {bad argument "1": must be iconic, normal, withdrawn, or zoomed}}
} else {
- set result_35_1 {1 {bad argument "1": must be normal, iconic, or withdrawn}}
+ set result_35_1 {1 {bad argument "1": must be iconic, normal, or withdrawn}}
}
test unixWm-35.1 {Tk_WmCmd procedure, "state" option} {unix notAqua} {
list [catch {wm state .t 1} msg] $msg
diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c
index 3f69f8a..a49fdc3 100644
--- a/unix/tkUnixWm.c
+++ b/unix/tkUnixWm.c
@@ -3415,9 +3415,9 @@ WmStateCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
static const char *const optionStrings[] = {
- "normal", "iconic", "withdrawn", NULL };
+ "iconic", "normal", "withdrawn", NULL };
enum options {
- OPT_NORMAL, OPT_ICONIC, OPT_WITHDRAWN };
+ OPT_ICONIC, OPT_NORMAL, OPT_WITHDRAWN };
int index;
if ((objc < 3) || (objc > 4)) {
diff --git a/win/configure b/win/configure
index cbb5195..3468ac0 100755
--- a/win/configure
+++ b/win/configure
@@ -4216,7 +4216,7 @@ printf "%s\n" "$ac_cv_cross" >&6; }
RC="x86_64-w64-mingw32-windres"
;;
arm64|aarch64)
- CC="aarch64-w64-mingw32-clang"
+ CC="aarch64-w64-mingw32-${CC}"
LD="aarch64-w64-mingw32-ld"
AR="aarch64-w64-mingw32-ar"
RANLIB="aarch64-w64-mingw32-ranlib"
diff --git a/win/rules.vc b/win/rules.vc
index 372d70a..3107756 100644
--- a/win/rules.vc
+++ b/win/rules.vc
@@ -816,8 +816,7 @@ DOTSEPARATED=$(DOTSEPARATED:b=.)
# configuration (ignored for Tcl itself)
# _USE_64BIT_TIME_T - forces a build using 64-bit time_t for 32-bit build
# (CRT library should support this, not needed for Tcl 9.x)
-# TCL_UTF_MAX=4 - forces a build allowing 4-byte UTF-8 sequences internally.
-# (Not needed for Tcl 9.x)
+# TCL_UTF_MAX=3 - forces a build using UTF-16 internally (not recommended).
# Further, LINKERFLAGS are modified based on above.
# Default values for all the above
@@ -884,9 +883,9 @@ USE_THREAD_ALLOC= 0
_USE_64BIT_TIME_T = 1
!endif
-!if [nmakehlp -f $(OPTS) "utfmax"]
-!message *** Force allowing 4-byte UTF-8 sequences internally
-TCL_UTF_MAX = 4
+!if [nmakehlp -f $(OPTS) "utf16"]
+!message *** Force UTF-16 internally
+TCL_UTF_MAX = 3
!endif
!endif
@@ -1423,13 +1422,13 @@ OPTDEFINES = $(OPTDEFINES) /DNO_STRTOI64=1
!if "$(_USE_64BIT_TIME_T)" == "1"
OPTDEFINES = $(OPTDEFINES) /D_USE_64BIT_TIME_T=1
!endif
-!if "$(TCL_UTF_MAX)" == "4"
-OPTDEFINES = $(OPTDEFINES) /DTCL_UTF_MAX=4
-!endif
# _ATL_XP_TARGETING - Newer SDK's need this to build for XP
COMPILERFLAGS = /D_ATL_XP_TARGETING
!endif
+!if "$(TCL_UTF_MAX)" == "3"
+OPTDEFINES = $(OPTDEFINES) /DTCL_UTF_MAX=3
+!endif
# Like the TEA system only set this non empty for non-Tk extensions
# Note: some extensions use PACKAGE_NAME and others use PACKAGE_TCLNAME
@@ -1471,8 +1470,8 @@ cdebug = $(cdebug) -Zi
!endif # $(DEBUG)
-# cwarn includes default warning levels.
-cwarn = $(WARNINGS)
+# cwarn includes default warning levels, also C4146 is useless.
+cwarn = $(WARNINGS) -wd4146
!if "$(MACHINE)" == "AMD64" || "$(MACHINE)" == "ARM64"
# Disable pointer<->int warnings related to cast between different sizes
diff --git a/win/tcl.m4 b/win/tcl.m4
index cfc9167..8774b94 100644
--- a/win/tcl.m4
+++ b/win/tcl.m4
@@ -527,7 +527,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
RC="x86_64-w64-mingw32-windres"
;;
arm64|aarch64)
- CC="aarch64-w64-mingw32-clang"
+ CC="aarch64-w64-mingw32-${CC}"
LD="aarch64-w64-mingw32-ld"
AR="aarch64-w64-mingw32-ar"
RANLIB="aarch64-w64-mingw32-ranlib"
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c
index 07997e2..0bfc7f1 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.c
@@ -744,8 +744,8 @@ Tk_ChooseColorObjCmd(
optionPtr = objv[i];
valuePtr = objv[i + 1];
- if (Tcl_GetIndexFromObjStruct(interp, optionPtr, optionStrings,
- sizeof(char *), "option", TCL_EXACT, &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, optionPtr, optionStrings,
+ "option", TCL_EXACT, &index) != TCL_OK) {
return TCL_ERROR;
}
if (i + 1 == objc) {
@@ -2767,8 +2767,8 @@ Tk_MessageBoxObjCmd(
optionPtr = objv[i];
valuePtr = objv[i + 1];
- if (Tcl_GetIndexFromObjStruct(interp, optionPtr, optionStrings,
- sizeof(char *), "option", TCL_EXACT, &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, optionPtr, optionStrings,
+ "option", TCL_EXACT, &index) != TCL_OK) {
return TCL_ERROR;
}
if (i + 1 == objc) {
@@ -3164,7 +3164,7 @@ HookProc(
*/
enum FontchooserOption {
- FontchooserParent, FontchooserTitle, FontchooserFont, FontchooserCmd,
+ FontchooserCmd, FontchooserFont, FontchooserParent, FontchooserTitle,
FontchooserVisible
};
@@ -3241,7 +3241,7 @@ FontchooserConfigureCmd(
HookData *hdPtr = NULL;
int i, r = TCL_OK;
static const char *const optionStrings[] = {
- "-parent", "-title", "-font", "-command", "-visible", NULL
+ "-command", "-font", "-parent", "-title", "-visible", NULL
};
hdPtr = (HookData *)Tcl_GetAssocData(interp, "::tk::fontchooser", NULL);
@@ -3268,8 +3268,8 @@ FontchooserConfigureCmd(
for (i = 1; i < objc; i += 2) {
int optionIndex;
- if (Tcl_GetIndexFromObjStruct(interp, objv[i], optionStrings,
- sizeof(char *), "option", 0, &optionIndex) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings,
+ "option", 0, &optionIndex) != TCL_OK) {
return TCL_ERROR;
}
if (objc == 2) {
diff --git a/win/tkWinGDI.c b/win/tkWinGDI.c
index 9daca0f..1c29770 100644
--- a/win/tkWinGDI.c
+++ b/win/tkWinGDI.c
@@ -3538,13 +3538,13 @@ int Winprint_Init(
*/
namespacePtr = Tcl_CreateNamespace(interp, gdiName,
- (ClientData) NULL, (Tcl_NamespaceDeleteProc *) NULL);
+ NULL, (Tcl_NamespaceDeleteProc *) NULL);
for (i=0; i<numCommands; i++) {
char buffer[100];
sprintf(buffer, "%s::%s", gdiName, gdi_commands[i].command_string);
Tcl_CreateCommand(interp, buffer, gdi_commands[i].command,
- (ClientData) 0, (Tcl_CmdDeleteProc *) 0);
+ NULL, (Tcl_CmdDeleteProc *) 0);
Tcl_Export(interp, namespacePtr, gdi_commands[i].command_string, 0);
}
Tcl_CreateEnsemble(interp, gdiName, namespacePtr, 0);
@@ -3802,7 +3802,7 @@ int PrintOpenDoc(
*/
int PrintCloseDoc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
TCL_UNUSED(int),
TCL_UNUSED(Tcl_Obj *const *))
diff --git a/win/tkWinSysTray.c b/win/tkWinSysTray.c
index 73d5d37..b71a301 100644
--- a/win/tkWinSysTray.c
+++ b/win/tkWinSysTray.c
@@ -925,9 +925,9 @@ WinSystrayCmd(
};
enum { CMD_ADD, CMD_DELETE, CMD_MODIFY };
static const char *const optStrings[] = {
- "-image", "-text", "-callback", NULL
+ "-callback", "-image", "-text", NULL
};
- enum { OPT_IMAGE, OPT_TEXT, OPT_CALLBACK };
+ enum { OPT_CALLBACK, OPT_IMAGE, OPT_TEXT };
int cmd, opt;
HICON hIcon;
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 87c236e..e568f0c 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -2721,8 +2721,8 @@ Tk_WmObjCmd(
return TCL_OK;
}
- if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings,
- sizeof(char *), "option", 0, &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings,
+ "option", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
@@ -3514,8 +3514,8 @@ WmFocusmodelCmd(
return TCL_OK;
}
- if (Tcl_GetIndexFromObjStruct(interp, objv[3], optionStrings,
- sizeof(char *), "argument", 0,&index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings,
+ "argument", 0,&index) != TCL_OK) {
return TCL_ERROR;
}
if (index == OPT_ACTIVE) {
@@ -4829,8 +4829,8 @@ WmPositionfromCmd(
if (*Tcl_GetString(objv[3]) == '\0') {
wmPtr->sizeHintsFlags &= ~(USPosition|PPosition);
} else {
- if (Tcl_GetIndexFromObjStruct(interp, objv[3], optionStrings,
- sizeof(char *), "argument", 0, &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings,
+ "argument", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
if (index == OPT_USER) {
@@ -5056,8 +5056,8 @@ WmSizefromCmd(
if (*Tcl_GetString(objv[3]) == '\0') {
wmPtr->sizeHintsFlags &= ~(USSize|PSize);
} else {
- if (Tcl_GetIndexFromObjStruct(interp, objv[3], optionStrings,
- sizeof(char *), "argument", 0, &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings,
+ "argument", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
if (index == OPT_USER) {
@@ -5186,8 +5186,8 @@ WmStackorderCmd(
ckfree(windows);
- if (Tcl_GetIndexFromObjStruct(interp, objv[3], optionStrings,
- sizeof(char *), "argument", 0, &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings,
+ "argument", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
if (index == OPT_ISABOVE) {
@@ -5227,10 +5227,10 @@ WmStateCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
static const char *const optionStrings[] = {
- "normal", "iconic", "withdrawn", "zoomed", NULL
+ "iconic", "normal", "withdrawn", "zoomed", NULL
};
enum options {
- OPT_NORMAL, OPT_ICONIC, OPT_WITHDRAWN, OPT_ZOOMED
+ OPT_ICONIC, OPT_NORMAL, OPT_WITHDRAWN, OPT_ZOOMED
};
int index;
@@ -5246,8 +5246,8 @@ WmStateCmd(
Tcl_SetErrorCode(interp, "TK", "WM", "STATE", "ICON", NULL);
return TCL_ERROR;
}
- if (Tcl_GetIndexFromObjStruct(interp, objv[3], optionStrings,
- sizeof(char *), "argument", 0, &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings,
+ "argument", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c
index 2500ea2..6917192 100644
--- a/win/ttkWinXPTheme.c
+++ b/win/ttkWinXPTheme.c
@@ -1127,10 +1127,10 @@ Ttk_CreateVsapiElement(
Tcl_DString classBuf;
static const char *const optionStrings[] =
- { "-padding","-width","-height","-margins", "-syssize",
- "-halfheight", "-halfwidth", NULL };
- enum { O_PADDING, O_WIDTH, O_HEIGHT, O_MARGINS, O_SYSSIZE,
- O_HALFHEIGHT, O_HALFWIDTH };
+ { "-halfheight", "-halfwidth", "-height", "-margins", "-padding",
+ "-syssize", "-width", NULL };
+ enum { O_HALFHEIGHT, O_HALFWIDTH, O_HEIGHT, O_MARGINS, O_PADDING,
+ O_SYSSIZE, O_WIDTH };
if (objc < 2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -1158,8 +1158,8 @@ Ttk_CreateVsapiElement(
Tcl_SetErrorCode(interp, "TTK", "VSAPI", "MISSING", NULL);
goto retErr;
}
- if (Tcl_GetIndexFromObjStruct(interp, objv[i], optionStrings,
- sizeof(char *), "option", 0, &option) != TCL_OK)
+ if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings,
+ "option", 0, &option) != TCL_OK)
goto retErr;
switch (option) {
case O_PADDING: