summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.travis.yml1
-rw-r--r--ChangeLog4
-rw-r--r--changes6
-rw-r--r--doc/bind.n3
-rw-r--r--doc/grid.n2
-rw-r--r--doc/ttk_combobox.n2
-rw-r--r--doc/ttk_entry.n2
-rw-r--r--doc/ttk_spinbox.n4
-rw-r--r--generic/nanosvg.h18
-rw-r--r--generic/tkCanvArc.c39
-rw-r--r--generic/tkCanvLine.c53
-rw-r--r--generic/tkCanvPoly.c6
-rw-r--r--generic/tkCanvText.c13
-rw-r--r--generic/tkCanvas.c26
-rw-r--r--generic/tkFont.c20
-rw-r--r--generic/tkGeometry.c2
-rw-r--r--generic/tkGrid.c35
-rw-r--r--generic/tkImage.c2
-rw-r--r--generic/tkImgPNG.c4
-rw-r--r--generic/tkImgPPM.c28
-rw-r--r--generic/tkImgPhInstance.c12
-rw-r--r--generic/tkImgPhoto.c14
-rw-r--r--generic/tkImgPhoto.h13
-rw-r--r--generic/tkImgSVGnano.c6
-rw-r--r--generic/tkMenu.c4
-rw-r--r--generic/tkPack.c9
-rw-r--r--generic/tkPanedWindow.c1
-rw-r--r--generic/tkPkgConfig.c3
-rw-r--r--generic/tkPlace.c33
-rw-r--r--generic/tkScrollbar.c4
-rw-r--r--generic/tkTest.c67
-rw-r--r--generic/tkText.c8
-rw-r--r--generic/tkTextBTree.c6
-rw-r--r--generic/tkTextDisp.c50
-rw-r--r--generic/tkTextWind.c2
-rw-r--r--generic/tkUtil.c2
-rw-r--r--generic/ttk/ttkImage.c10
-rw-r--r--generic/ttk/ttkNotebook.c4
-rw-r--r--macosx/Tk-Common.xcconfig2
-rw-r--r--macosx/tkMacOSXColor.c4
-rw-r--r--macosx/tkMacOSXCursor.c29
-rw-r--r--macosx/tkMacOSXDialog.c10
-rw-r--r--macosx/tkMacOSXFont.c21
-rw-r--r--macosx/tkMacOSXKeyboard.c2
-rw-r--r--macosx/tkMacOSXMenu.c28
-rw-r--r--macosx/tkMacOSXMouseEvent.c2
-rw-r--r--macosx/tkMacOSXNotify.c2
-rw-r--r--macosx/tkMacOSXPrivate.h8
-rw-r--r--macosx/tkMacOSXScrlbr.c2
-rw-r--r--macosx/tkMacOSXSubwindows.c21
-rw-r--r--macosx/tkMacOSXWindowEvent.c9
-rw-r--r--macosx/tkMacOSXWm.c7
-rw-r--r--macosx/ttkMacOSXTheme.c38
-rw-r--r--tests/all.tcl3
-rw-r--r--tests/bind.test25
-rw-r--r--tests/canvText.test3
-rw-r--r--tests/clipboard.test4
-rw-r--r--tests/entry.test8
-rw-r--r--tests/focus.test9
-rw-r--r--tests/font.test440
-rw-r--r--tests/fontchooser.test5
-rw-r--r--tests/grid.test2
-rw-r--r--tests/image.test6
-rw-r--r--tests/imgPhoto.test11
-rw-r--r--tests/oldpack.test4
-rw-r--r--tests/pack.test7
-rw-r--r--tests/pkgconfig.test4
-rw-r--r--tests/place.test7
-rw-r--r--tests/safe.test5
-rw-r--r--tests/scrollbar.test30
-rw-r--r--tests/select.test15
-rw-r--r--tests/spinbox.test5
-rw-r--r--tests/text.test8
-rw-r--r--tests/textDisp.test31
-rw-r--r--tests/textTag.test9
-rw-r--r--tests/ttk/all.tcl3
-rw-r--r--tests/unixEmbed.test9
-rw-r--r--tests/unixFont.test12
-rw-r--r--tests/unixWm.test13
-rw-r--r--tests/winWm.test15
-rw-r--r--tests/winfo.test3
-rw-r--r--tests/wm.test9
-rwxr-xr-xunix/configure4
-rw-r--r--unix/configure.ac2
-rw-r--r--unix/tcl.m44
-rw-r--r--unix/tkUnix.c2
-rw-r--r--unix/tkUnixButton.c6
-rw-r--r--unix/tkUnixFont.c12
-rw-r--r--unix/tkUnixMenu.c106
-rw-r--r--unix/tkUnixMenubu.c8
-rw-r--r--unix/tkUnixRFont.c21
-rw-r--r--unix/tkUnixScale.c4
-rw-r--r--unix/tkUnixSelect.c9
-rw-r--r--unix/tkUnixSend.c12
-rw-r--r--unix/tkUnixWm.c96
-rwxr-xr-xwin/configure2
-rw-r--r--win/tcl.m42
-rw-r--r--win/tkWinMenu.c4
-rw-r--r--win/tkWinSendCom.c4
-rw-r--r--win/tkWinX.c6
-rw-r--r--win/ttkWinXPTheme.c6
101 files changed, 802 insertions, 916 deletions
diff --git a/.travis.yml b/.travis.yml
index 6711414..ca444b1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -35,6 +35,7 @@ jobs:
- make install
- make test-classic >out-classic.txt
- cat out-classic.txt
+ - grep -q "Failed 0" out-classic.txt
- make test-ttk >out-ttk.txt
- cat out-ttk.txt
- grep -q "Failed 0" out-ttk.txt
diff --git a/ChangeLog b/ChangeLog
index f01946a..4fbb0eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -714,7 +714,7 @@ a better first place to look now.
2011-10-27 Kevin B. Kenny <kennykb@acm.org>
* generic/tkInt.h: [Bug 3410609]: Change the event mechanism
- * unix/tkUnixEvent.c: for <KeyPress> events to use the keysym
+ * unix/tkUnixEvent.c: for <Key> events to use the keysym
* unix/tkUnixKey.c: returned by XLookupString in preference to
the one that appears in the raw X event at any level. This change
allows binding to ISO_Level3_Shift-ed characters, composed characters,
@@ -5213,7 +5213,7 @@ a better first place to look now.
2008-01-29 Joe English <jenglish@users.sourceforge.net>
- * library/treeview.tcl: Fix bug in Shift-ButtonPress-1 binding (error
+ * library/treeview.tcl: Fix bug in Shift-Button-1 binding (error
if no current focus item; reported on c.l.t.)
2008-01-29 Donal K. Fellows <donal.k.fellows@man.ac.uk>
diff --git a/changes b/changes
index 61aff06..b83c642 100644
--- a/changes
+++ b/changes
@@ -333,7 +333,7 @@ same menu.
4/12/92 (bug fix) Fixed core dump that occurred in tkError.c when
removing the first error record from the error list.
-4/15/92 (bug fix) Fixed bug in tkBind.c that prevented <KeyPress-1>
+4/15/92 (bug fix) Fixed bug in tkBind.c that prevented <Key-1>
event specifications from being processed correctly: the "1" was
treated as a button name rather than a keysym.
@@ -3998,7 +3998,7 @@ into account the "-displayof" option. This problem also existed for the
command to the Mac. Also fixed "resource write" when the resource
was specified by id and already existed. (JI)
-9/16/97 (bug fix) Added null bindings to <Command-KeyPress> for the
+9/16/97 (bug fix) Added null bindings to <Command-Key> for the
text and entry widget on the Macintosh. This prevents unbound command
key sequences from having the character echoed to the widget. Also
fixed Cut & Copy bindings. (JI) (RJ)
@@ -7527,7 +7527,7 @@ in this changeset (new minor version) rather than bug fixes:
2018-01-07 (bug)[fa8de7] Crash [ttk::checkbutton .x -variable {}] (werner)
-2018-01-16 (bug)[382712] Crash in [event generate . <KeyPress>] (werner)
+2018-01-16 (bug)[382712] Crash in [event generate . <Key>] (werner)
2018-01-19 (bug)[657c38] Crash in menu destroy with checkbutton entry (werner)
diff --git a/doc/bind.n b/doc/bind.n
index 96c5d34..f307436 100644
--- a/doc/bind.n
+++ b/doc/bind.n
@@ -286,7 +286,8 @@ it is destroyed.
When the \fBDestroy\fR event is delivered
to a widget, it is in a
.QW half-dead
-state: the widget still exists, but most operations on it will fail.
+state: the widget still exists, but operations that involve it
+may return invalid results, or return an error.
.RE
.IP "\fBFocusIn\fR, \fBFocusOut\fR" 5
The \fBFocusIn\fR and \fBFocusOut\fR events are generated
diff --git a/doc/grid.n b/doc/grid.n
index 004c71e..684474b 100644
--- a/doc/grid.n
+++ b/doc/grid.n
@@ -301,7 +301,7 @@ The size is determined either by the \fIcontent\fR occupying the largest
row or column, or the largest column or row with a \fB\-minsize\fR,
\fB\-weight\fR, or \fB\-pad\fR that is non-zero.
.TP
-\fBgrid content fI\window\fR ?\fI\-option value\fR?
+\fBgrid content \fIwindow\fR ?\fI\-option value\fR?
.
If no options are supplied, a list of all of the content in \fIwindow\fR
is returned, most recently managed first.
diff --git a/doc/ttk_combobox.n b/doc/ttk_combobox.n
index 3ece362..ec61428 100644
--- a/doc/ttk_combobox.n
+++ b/doc/ttk_combobox.n
@@ -142,6 +142,8 @@ are:
.RS
Can only be changed when using non-native and non-graphical themes.
.RE
+\fB\-insertcolor\fP \fIcolor\fP
+.br
\fB\-insertwidth\fP \fIamount\fP
.br
\fB\-lightcolor\fP \fIcolor\fP
diff --git a/doc/ttk_entry.n b/doc/ttk_entry.n
index 62b9951..9a2d429 100644
--- a/doc/ttk_entry.n
+++ b/doc/ttk_entry.n
@@ -448,6 +448,8 @@ Some themes use a graphical background and their field background colors cannot
.RE
\fB\-foreground\fP \fIcolor\fP
.br
+\fB\-insertcolor\fP \fIcolor\fP
+.br
\fB\-insertwidth\fP \fIamount\fP
.br
\fB\-lightcolor\fP \fIcolor\fP
diff --git a/doc/ttk_spinbox.n b/doc/ttk_spinbox.n
index b8f3ca2..49dc8ff 100644
--- a/doc/ttk_spinbox.n
+++ b/doc/ttk_spinbox.n
@@ -107,6 +107,10 @@ value is specified for \fB\-fieldbackground\fP. Otherwise it is ignored.
.br
\fB\-foreground\fP \fIcolor\fP
.br
+\fB\-insertcolor\fP \fIcolor\fP
+.br
+\fB\-insertwidth\fP \fIamount\fP
+.br
\fB\-lightcolor\fP \fIcolor\fP
.br
\fB\-padding\fP \fIpadding\fP
diff --git a/generic/nanosvg.h b/generic/nanosvg.h
index 3f9548b..d762f5a 100644
--- a/generic/nanosvg.h
+++ b/generic/nanosvg.h
@@ -86,7 +86,7 @@ extern "C" {
#endif
// float emulation for MS VC6++ compiler
-#if (_MSC_VER == 1200)
+#if defined(_MSC_VER) && (_MSC_VER == 1200)
#define tanf(a) (float)tan(a)
#define cosf(a) (float)cos(a)
#define sinf(a) (float)sin(a)
@@ -99,7 +99,7 @@ extern "C" {
#define floorf(a) (float)floor(a)
#endif
// float emulation for MS VC8++ compiler
-#if (_MSC_VER == 1400)
+#if defined(_MSC_VER) && (_MSC_VER == 1400)
#define fabsf(a) (float)fabs(a)
#endif
@@ -284,7 +284,7 @@ static void nsvg__parseElement(char* s,
{
const char* attr[NSVG_XML_MAX_ATTRIBS];
int nattr = 0;
- char* name;
+ char* cbname;
int start = 0;
int end = 0;
char quote;
@@ -305,7 +305,7 @@ static void nsvg__parseElement(char* s,
return;
// Get tag name
- name = s;
+ cbname = s;
while (*s && !nsvg__isspace(*s)) s++;
if (*s) { *s++ = '\0'; }
@@ -348,9 +348,9 @@ static void nsvg__parseElement(char* s,
// Call callbacks.
if (start && startelCb)
- (*startelCb)(ud, name, attr);
+ (*startelCb)(ud, cbname, attr);
if (end && endelCb)
- (*endelCb)(ud, name);
+ (*endelCb)(ud, cbname);
}
NANOSVG_SCOPE
@@ -1157,7 +1157,7 @@ static double nsvg__atof(const char* s)
char* cur = (char*)s;
char* end = NULL;
double res = 0.0, sign = 1.0;
-#if (_MSC_VER == 1200)
+#if defined(_MSC_VER) && (_MSC_VER == 1200)
__int64 intPart = 0, fracPart = 0;
#else
long long intPart = 0, fracPart = 0;
@@ -1175,7 +1175,7 @@ static double nsvg__atof(const char* s)
// Parse integer part
if (nsvg__isdigit(*cur)) {
// Parse digit sequence
-#if (_MSC_VER == 1200)
+#if defined(_MSC_VER) && (_MSC_VER == 1200)
intPart = strtol(cur, &end, 10);
#else
intPart = strtoll(cur, &end, 10);
@@ -1192,7 +1192,7 @@ static double nsvg__atof(const char* s)
cur++; // Skip '.'
if (nsvg__isdigit(*cur)) {
// Parse digit sequence
-#if (_MSC_VER == 1200)
+#if defined(_MSC_VER) && (_MSC_VER == 1200)
fracPart = strtol(cur, &end, 10);
#else
fracPart = strtoll(cur, &end, 10);
diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c
index c711f1d..257dcfc 100644
--- a/generic/tkCanvArc.c
+++ b/generic/tkCanvArc.c
@@ -707,12 +707,11 @@ ComputeArcParametersFromHeight(
static void
DeleteArc(
- Tk_Canvas canvas, /* Info about overall canvas. */
+ TCL_UNUSED(Tk_Canvas), /* Info about overall canvas. */
Tk_Item *itemPtr, /* Item that is being deleted. */
Display *display) /* Display containing window for canvas. */
{
- ArcItem *arcPtr = (ArcItem *) itemPtr;
- (void)canvas;
+ ArcItem *arcPtr = (ArcItem *)itemPtr;
Tk_DeleteOutline(display, &(arcPtr->outline));
if (arcPtr->numOutlinePoints != 0) {
@@ -794,13 +793,13 @@ ComputeArcBbox(
*/
if (arcPtr->bbox[1] > arcPtr->bbox[3]) {
- double tmp = arcPtr->bbox[3];
+ tmp = arcPtr->bbox[3];
arcPtr->bbox[3] = arcPtr->bbox[1];
arcPtr->bbox[1] = tmp;
}
if (arcPtr->bbox[0] > arcPtr->bbox[2]) {
- double tmp = arcPtr->bbox[2];
+ tmp = arcPtr->bbox[2];
arcPtr->bbox[2] = arcPtr->bbox[0];
arcPtr->bbox[0] = tmp;
@@ -900,8 +899,10 @@ DisplayArc(
Tk_Item *itemPtr, /* Item to be displayed. */
Display *display, /* Display on which to draw item. */
Drawable drawable, /* Pixmap or window in which to draw item. */
- int x, int y, /* Describes region of canvas that must be */
- int width, int height) /* redisplayed (not used). */
+ TCL_UNUSED(int), /* Describes region of canvas that must be */
+ TCL_UNUSED(int), /* redisplayed (not used). */
+ TCL_UNUSED(int),
+ TCL_UNUSED(int))
{
ArcItem *arcPtr = (ArcItem *) itemPtr;
short x1, y1, x2, y2;
@@ -909,10 +910,6 @@ DisplayArc(
double lineWidth;
Tk_State state = itemPtr->state;
Pixmap stipple;
- (void)x;
- (void)y;
- (void)width;
- (void)height;
if (state == TK_STATE_NULL) {
state = Canvas(canvas)->canvas_state;
@@ -1648,7 +1645,7 @@ ComputeArcOutline(
* curved arc segment, which are marked with X's in the figure below:
*
*
- * * * *
+ * * * *
* * *
* * * * *
* * * * *
@@ -2001,7 +1998,7 @@ ArcToPostscript(
Tcl_Interp *interp, /* Leave Postscript or error message here. */
Tk_Canvas canvas, /* Information about overall canvas. */
Tk_Item *itemPtr, /* Item for which Postscript is wanted. */
- int prepass) /* 1 means this is a prepass to collect font
+ TCL_UNUSED(int)) /* 1 means this is a prepass to collect font
* information; 0 means final Postscript is
* being created. */
{
@@ -2014,7 +2011,6 @@ ArcToPostscript(
Tk_State state = itemPtr->state;
Tcl_Obj *psObj;
Tcl_InterpState interpState;
- (void)prepass;
y1 = Tk_CanvasPsY(canvas, arcPtr->bbox[1]);
y2 = Tk_CanvasPsY(canvas, arcPtr->bbox[3]);
@@ -2197,9 +2193,9 @@ ArcToPostscript(
static int
StyleParseProc(
- ClientData dummy, /* some flags.*/
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Used for reporting errors. */
- Tk_Window tkwin, /* Window containing canvas widget. */
+ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */
const char *value, /* Value of option. */
char *widgRec, /* Pointer to record for item. */
TkSizeT offset) /* Offset into item. */
@@ -2207,8 +2203,6 @@ StyleParseProc(
int c;
size_t length;
Style *stylePtr = (Style *) (widgRec + offset);
- (void)dummy;
- (void)tkwin;
if (value == NULL || *value == 0) {
*stylePtr = PIESLICE_STYLE;
@@ -2262,18 +2256,15 @@ StyleParseProc(
static const char *
StylePrintProc(
- ClientData dummy, /* Ignored. */
- Tk_Window tkwin, /* Ignored. */
+ TCL_UNUSED(void *), /* Ignored. */
+ TCL_UNUSED(Tk_Window), /* Ignored. */
char *widgRec, /* Pointer to record for item. */
TkSizeT offset, /* Offset into item. */
- Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with
+ TCL_UNUSED(Tcl_FreeProc **)) /* Pointer to variable to fill in with
* information about how to reclaim storage
* for return string. */
{
Style *stylePtr = (Style *) (widgRec + offset);
- (void)dummy;
- (void)tkwin;
- (void)freeProcPtr;
if (*stylePtr == ARC_STYLE) {
return "arc";
diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c
index 88ddc97..378e6ed 100644
--- a/generic/tkCanvLine.c
+++ b/generic/tkCanvLine.c
@@ -605,12 +605,11 @@ ConfigureLine(
static void
DeleteLine(
- Tk_Canvas canvas, /* Info about overall canvas widget. */
+ TCL_UNUSED(Tk_Canvas), /* Info about overall canvas widget. */
Tk_Item *itemPtr, /* Item that is being deleted. */
Display *display) /* Display containing window for canvas. */
{
LineItem *linePtr = (LineItem *) itemPtr;
- (void)canvas;
Tk_DeleteOutline(display, &linePtr->outline);
if (linePtr->coordPtr != NULL) {
@@ -710,7 +709,7 @@ ComputeLineBbox(
tsoffset = &linePtr->outline.tsoffset;
if (tsoffset->flags & TK_OFFSET_INDEX) {
- double *coordPtr = linePtr->coordPtr
+ coordPtr = linePtr->coordPtr
+ (tsoffset->flags & ~TK_OFFSET_INDEX);
if (tsoffset->flags <= 0) {
@@ -834,20 +833,17 @@ DisplayLine(
Tk_Item *itemPtr, /* Item to be displayed. */
Display *display, /* Display on which to draw item. */
Drawable drawable, /* Pixmap or window in which to draw item. */
- int x, int y, int width, int height)
- /* Describes region of canvas that must be
- * redisplayed (not used). */
+ TCL_UNUSED(int), /* Describes region of canvas that must be */
+ TCL_UNUSED(int), /* redisplayed (not used). */
+ TCL_UNUSED(int),
+ TCL_UNUSED(int))
{
- LineItem *linePtr = (LineItem *) itemPtr;
+ LineItem *linePtr = (LineItem *)itemPtr;
XPoint staticPoints[MAX_STATIC_POINTS*3];
XPoint *pointPtr;
double linewidth;
int numPoints;
Tk_State state = itemPtr->state;
- (void)x;
- (void)y;
- (void)width;
- (void)height;
if (!linePtr->numPoints || (linePtr->outline.gc == NULL)) {
return;
@@ -1701,8 +1697,6 @@ ScaleLine(
linePtr->firstArrowPtr = NULL;
}
if (linePtr->lastArrowPtr != NULL) {
- int i;
-
i = 2*(linePtr->numPoints-1);
linePtr->coordPtr[i] = linePtr->lastArrowPtr[0];
linePtr->coordPtr[i+1] = linePtr->lastArrowPtr[1];
@@ -1931,9 +1925,9 @@ RotateLine(
static int
ParseArrowShape(
- ClientData dummy, /* Not used. */
+ TCL_UNUSED(void *), /* Not used. */
Tcl_Interp *interp, /* Used for error reporting. */
- Tk_Window tkwin, /* Not used. */
+ TCL_UNUSED(Tk_Window), /* Not used. */
const char *value, /* Textual specification of arrow shape. */
char *recordPtr, /* Pointer to item record in which to store
* arrow information. */
@@ -1944,8 +1938,6 @@ ParseArrowShape(
double a, b, c;
int argc;
const char **argv = NULL;
- (void)dummy;
- (void)tkwin;
if ((size_t)offset != offsetof(LineItem, arrowShapeA)) {
Tcl_Panic("ParseArrowShape received bogus offset");
@@ -2001,19 +1993,16 @@ ParseArrowShape(
static const char *
PrintArrowShape(
- ClientData dummy, /* Not used. */
- Tk_Window tkwin, /* Window associated with linePtr's widget. */
+ TCL_UNUSED(void *), /* Not used. */
+ TCL_UNUSED(Tk_Window), /* Window associated with linePtr's widget. */
char *recordPtr, /* Pointer to item record containing current
* shape information. */
- TkSizeT offset, /* Offset of arrow information in record. */
+ TCL_UNUSED(TkSizeT), /* Offset of arrow information in record. */
Tcl_FreeProc **freeProcPtr) /* Store address of function to call to free
* string here. */
{
LineItem *linePtr = (LineItem *) recordPtr;
char *buffer = (char *)ckalloc(120);
- (void)dummy;
- (void)tkwin;
- (void)offset;
sprintf(buffer, "%.5g %.5g %.5g", linePtr->arrowShapeA,
linePtr->arrowShapeB, linePtr->arrowShapeC);
@@ -2041,9 +2030,9 @@ PrintArrowShape(
static int
ArrowParseProc(
- ClientData dummy, /* some flags.*/
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Used for reporting errors. */
- Tk_Window tkwin, /* Window containing canvas widget. */
+ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */
const char *value, /* Value of option. */
char *widgRec, /* Pointer to record for item. */
TkSizeT offset) /* Offset into item. */
@@ -2051,8 +2040,6 @@ ArrowParseProc(
int c;
size_t length;
Arrows *arrowPtr = (Arrows *) (widgRec + offset);
- (void)dummy;
- (void)tkwin;
if (value == NULL || *value == 0) {
*arrowPtr = ARROWS_NONE;
@@ -2110,18 +2097,15 @@ ArrowParseProc(
static const char *
ArrowPrintProc(
- ClientData dummy, /* Ignored. */
- Tk_Window tkwin, /* Window containing canvas widget. */
+ TCL_UNUSED(void *), /* Ignored. */
+ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */
char *widgRec, /* Pointer to record for item. */
TkSizeT offset, /* Offset into item. */
- Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with
+ TCL_UNUSED(Tcl_FreeProc **)) /* Pointer to variable to fill in with
* information about how to reclaim storage
* for return string. */
{
Arrows *arrowPtr = (Arrows *) (widgRec + offset);
- (void)dummy;
- (void)tkwin;
- (void)freeProcPtr;
switch (*arrowPtr) {
case ARROWS_FIRST:
@@ -2316,7 +2300,7 @@ LineToPostscript(
Tcl_Interp *interp, /* Leave Postscript or error message here. */
Tk_Canvas canvas, /* Information about overall canvas. */
Tk_Item *itemPtr, /* Item for which Postscript is wanted. */
- int prepass) /* 1 means this is a prepass to collect font
+ TCL_UNUSED(int)) /* 1 means this is a prepass to collect font
* information; 0 means final Postscript is
* being created. */
{
@@ -2328,7 +2312,6 @@ LineToPostscript(
Tk_State state = itemPtr->state;
Tcl_Obj *psObj;
Tcl_InterpState interpState;
- (void)prepass;
if (state == TK_STATE_NULL) {
state = Canvas(canvas)->canvas_state;
diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c
index 88f63e8..a827fdb 100644
--- a/generic/tkCanvPoly.c
+++ b/generic/tkCanvPoly.c
@@ -876,12 +876,10 @@ DisplayPolygon(
Tk_Item *itemPtr, /* Item to be displayed. */
Display *display, /* Display on which to draw item. */
Drawable drawable, /* Pixmap or window in which to draw item. */
- TCL_UNUSED(int),
- TCL_UNUSED(int),
+ TCL_UNUSED(int), /* Describes region of canvas that must be */
+ TCL_UNUSED(int), /* redisplayed (not used). */
TCL_UNUSED(int),
TCL_UNUSED(int))
- /* Describes region of canvas that must be
- * redisplayed (not used). */
{
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
Tk_State state = itemPtr->state;
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c
index d9c836f..2c6125d 100644
--- a/generic/tkCanvText.c
+++ b/generic/tkCanvText.c
@@ -1464,7 +1464,7 @@ TranslateText(
static int
GetTextIndex(
Tcl_Interp *interp, /* Used for error reporting. */
- Tk_Canvas canvas, /* Canvas containing item. */
+ TCL_UNUSED(Tk_Canvas), /* Canvas containing item. */
Tk_Item *itemPtr, /* Item for which the index is being
* specified. */
Tcl_Obj *obj, /* Specification of a particular character in
@@ -1477,7 +1477,6 @@ GetTextIndex(
int c;
Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr;
const char *string;
- (void)canvas;
if (TCL_OK == TkGetIntForIndex(obj, textPtr->numChars - 1, 1, &idx)) {
if (idx == TCL_INDEX_NONE) {
@@ -1515,7 +1514,7 @@ GetTextIndex(
*indexPtr = textInfoPtr->selectLast;
} else if (c == '@') {
int x, y;
- double tmp, c = textPtr->cosine, s = textPtr->sine;
+ double tmp, cs = textPtr->cosine, s = textPtr->sine;
char *end;
const char *p;
@@ -1534,7 +1533,7 @@ GetTextIndex(
x -= (int) textPtr->drawOrigin[0];
y -= (int) textPtr->drawOrigin[1];
*indexPtr = Tk_PointToChar(textPtr->textLayout,
- (int) (x*c - y*s), (int) (y*c + x*s));
+ (int) (x*cs - y*s), (int) (y*cs + x*s));
} else {
/*
* Some of the paths here leave messages in the interp's result, so we
@@ -1567,14 +1566,13 @@ GetTextIndex(
static void
SetTextCursor(
- Tk_Canvas canvas, /* Record describing canvas widget. */
+ TCL_UNUSED(Tk_Canvas), /* Record describing canvas widget. */
Tk_Item *itemPtr, /* Text item in which cursor position is to be
* set. */
TkSizeT index) /* Character index of character just before
* which cursor is to be positioned. */
{
TextItem *textPtr = (TextItem *) itemPtr;
- (void)canvas;
if (index == TCL_INDEX_NONE) {
textPtr->insertPos = 0;
@@ -1607,7 +1605,7 @@ SetTextCursor(
static TkSizeT
GetSelText(
- Tk_Canvas canvas, /* Canvas containing selection. */
+ TCL_UNUSED(Tk_Canvas), /* Canvas containing selection. */
Tk_Item *itemPtr, /* Text item containing selection. */
TkSizeT offset, /* Byte offset within selection of first
* character to be returned. */
@@ -1621,7 +1619,6 @@ GetSelText(
char *text;
const char *selStart, *selEnd;
Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr;
- (void)canvas;
if (((int)textInfoPtr->selectFirst < 0) ||
(textInfoPtr->selectFirst + 1 > textInfoPtr->selectLast + 1)) {
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c
index c3e8a7f..3dd1403 100644
--- a/generic/tkCanvas.c
+++ b/generic/tkCanvas.c
@@ -839,8 +839,8 @@ CanvasWidgetCmd(
TagSearch *searchPtr = NULL;/* Allocated by first TagSearchScan, freed by
* TagSearchDestroy */
- int index;
- static const char *const optionStrings[] = {
+ int idx;
+ static const char *const canvasOptionStrings[] = {
"addtag", "bbox", "bind", "canvasx",
"canvasy", "cget", "configure", "coords",
"create", "dchars", "delete", "dtag",
@@ -852,7 +852,7 @@ CanvasWidgetCmd(
"scan", "select", "type", "xview",
"yview", NULL
};
- enum options {
+ enum canvasOptionStringsEnum {
CANV_ADDTAG, CANV_BBOX, CANV_BIND, CANV_CANVASX,
CANV_CANVASY, CANV_CGET, CANV_CONFIGURE, CANV_COORDS,
CANV_CREATE, CANV_DCHARS, CANV_DELETE, CANV_DTAG,
@@ -869,14 +869,14 @@ CanvasWidgetCmd(
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
return TCL_ERROR;
}
- if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0,
- &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[1], canvasOptionStrings, "option", 0,
+ &idx) != TCL_OK) {
return TCL_ERROR;
}
Tcl_Preserve(canvasPtr);
result = TCL_OK;
- switch ((enum options) index) {
+ switch ((enum canvasOptionStringsEnum)idx) {
case CANV_ADDTAG:
if (objc < 4) {
Tcl_WrongNumArgs(interp, 2, objv, "tag searchCommand ?arg ...?");
@@ -1247,7 +1247,6 @@ CanvasWidgetCmd(
case CANV_CREATE: {
Tk_ItemType *typePtr;
Tk_ItemType *matchPtr = NULL;
- Tk_Item *itemPtr;
int isNew = 0;
Tcl_HashEntry *entryPtr;
const char *arg;
@@ -1663,7 +1662,6 @@ CanvasWidgetCmd(
}
break;
case CANV_LOWER: {
- Tk_Item *itemPtr;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "tagOrId ?belowThis?");
@@ -1927,10 +1925,10 @@ CanvasWidgetCmd(
Tcl_WrongNumArgs(interp, 2, objv, "mark|dragto x y ?dragGain?");
result = TCL_ERROR;
} else if (Tcl_GetIndexFromObj(interp, objv[2], optionStrings,
- "scan option", 0, &index) != TCL_OK) {
+ "scan option", 0, &idx) != TCL_OK) {
result = TCL_ERROR;
- } else if ((objc != 5) && (objc != 5+index)) {
- Tcl_WrongNumArgs(interp, 3, objv, index?"x y ?gain?":"x y");
+ } else if ((objc != 5) && (objc != 5+idx)) {
+ Tcl_WrongNumArgs(interp, 3, objv, idx?"x y ?gain?":"x y");
result = TCL_ERROR;
} else if ((Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK)
|| (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK)){
@@ -1938,7 +1936,7 @@ CanvasWidgetCmd(
} else if ((objc == 6) &&
(Tcl_GetIntFromObj(interp, objv[5], &gain) != TCL_OK)) {
result = TCL_ERROR;
- } else if (!index) {
+ } else if (!idx) {
canvasPtr->scanX = x;
canvasPtr->scanXOrigin = canvasPtr->xOrigin;
canvasPtr->scanY = y;
@@ -3763,7 +3761,7 @@ TagSearchScan(
*/
searchPtr->rewritebufferAllocated = 100;
- searchPtr->rewritebuffer =(char *) ckalloc(searchPtr->rewritebufferAllocated);
+ searchPtr->rewritebuffer = (char *)ckalloc(searchPtr->rewritebufferAllocated);
}
TagSearchExprInit(&searchPtr->expr);
@@ -4596,7 +4594,7 @@ DoItem(
Tk_Uid *newTagPtr;
itemPtr->tagSpace += 5;
- newTagPtr = (Tk_Uid*)ckalloc(itemPtr->tagSpace * sizeof(Tk_Uid));
+ newTagPtr = (Tk_Uid *)ckalloc(itemPtr->tagSpace * sizeof(Tk_Uid));
memcpy((void *) newTagPtr, itemPtr->tagPtr,
itemPtr->numTags * sizeof(Tk_Uid));
if (itemPtr->tagPtr != itemPtr->staticTagSpace) {
diff --git a/generic/tkFont.c b/generic/tkFont.c
index 4e7eb49..6cf0dfe 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.c
@@ -741,7 +741,7 @@ Tk_FontObjCmd(
}
case FONT_METRICS: {
Tk_Font tkfont;
- int skip, index, i;
+ int skip, i;
const TkFontMetrics *fmPtr;
static const char *const switches[] = {
"-ascent", "-descent", "-linespace", "-fixed", NULL
@@ -1968,7 +1968,7 @@ Tk_ComputeTextLayout(
int *heightPtr) /* Filled with height of string. */
{
TkFont *fontPtr = (TkFont *) tkfont;
- const char *start, *end, *special;
+ const char *start, *endp, *special;
int n, y, bytesThisChunk, maxChunks, curLine, layoutHeight;
int baseline, height, curX, newX, maxWidth, *lineLengths;
TextLayout *layoutPtr;
@@ -2016,12 +2016,12 @@ Tk_ComputeTextLayout(
curX = 0;
- end = Tcl_UtfAtIndex(string, numChars);
+ endp = Tcl_UtfAtIndex(string, numChars);
special = string;
flags &= TK_IGNORE_TABS | TK_IGNORE_NEWLINES;
flags |= TK_WHOLE_WORDS | TK_AT_LEAST_ONE;
- for (start = string; start < end; ) {
+ for (start = string; start < endp; ) {
if (start >= special) {
/*
* Find the next special character in the string.
@@ -2032,7 +2032,7 @@ Tk_ComputeTextLayout(
* whitespace set.
*/
- for (special = start; special < end; special++) {
+ for (special = start; special < endp; special++) {
if (!(flags & TK_IGNORE_NEWLINES)) {
if ((*special == '\n') || (*special == '\r')) {
break;
@@ -2066,7 +2066,7 @@ Tk_ComputeTextLayout(
}
}
- if ((start == special) && (special < end)) {
+ if ((start == special) && (special < endp)) {
/*
* Handle the special character.
*
@@ -2083,7 +2083,7 @@ Tk_ComputeTextLayout(
start++;
curX = newX;
flags &= ~TK_AT_LEAST_ONE;
- if ((start < end) &&
+ if ((start < endp) &&
((wrapLength <= 0) || (newX <= wrapLength))) {
/*
* More chars can still fit on this line.
@@ -2105,7 +2105,7 @@ Tk_ComputeTextLayout(
* Consume all extra spaces at end of line.
*/
- while ((start < end) && isspace(UCHAR(*start))) { /* INTL: ISO space */
+ while ((start < endp) && isspace(UCHAR(*start))) { /* INTL: ISO space */
if (!(flags & TK_IGNORE_NEWLINES)) {
if ((*start == '\n') || (*start == '\r')) {
break;
@@ -2332,7 +2332,7 @@ Tk_DrawTextLayout(
numDisplayChars = lastChar;
}
lastByte = Tcl_UtfAtIndex(chunkPtr->start, numDisplayChars);
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
TkpDrawCharsInContext(display, drawable, gc, layoutPtr->tkfont,
chunkPtr->start, chunkPtr->numBytes,
firstByte - chunkPtr->start, lastByte - firstByte,
@@ -2402,7 +2402,7 @@ TkDrawAngledTextLayout(
numDisplayChars = lastChar;
}
lastByte = Tcl_UtfAtIndex(chunkPtr->start, numDisplayChars);
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
dx = cosA * (chunkPtr->x) + sinA * (chunkPtr->y);
dy = -sinA * (chunkPtr->x) + cosA * (chunkPtr->y);
if (angle == 0.0) {
diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c
index 31944ca..cd2c2c0 100644
--- a/generic/tkGeometry.c
+++ b/generic/tkGeometry.c
@@ -426,7 +426,6 @@ Tk_MaintainGeometry(
((TkWindow *)window)->maintainerPtr = (TkWindow *)container;
- ((TkWindow *)window)->maintainerPtr = (TkWindow *)container;
if (container == Tk_Parent(window)) {
/*
* If the window is a direct descendant of the container, don't bother
@@ -574,7 +573,6 @@ Tk_UnmaintainGeometry(
((TkWindow *)window)->maintainerPtr = NULL;
- ((TkWindow *)window)->maintainerPtr = NULL;
if (container == Tk_Parent(window)) {
/*
* If the window is a direct descendant of the container,
diff --git a/generic/tkGrid.c b/generic/tkGrid.c
index 51b9512..dc4db82 100644
--- a/generic/tkGrid.c
+++ b/generic/tkGrid.c
@@ -341,6 +341,11 @@ Tk_GridObjCmd(
"content", "forget", "info", "location", "propagate",
"remove", "rowconfigure", "size", "slaves", NULL
};
+ static const char *const optionStringsNoDep[] = {
+ "anchor", "bbox", "columnconfigure", "configure",
+ "content", "forget", "info", "location", "propagate",
+ "remove", "rowconfigure", "size", NULL
+ };
enum options {
GRID_ANCHOR, GRID_BBOX, GRID_COLUMNCONFIGURE, GRID_CONFIGURE,
GRID_CONTENT, GRID_FORGET, GRID_INFO, GRID_LOCATION, GRID_PROPAGATE,
@@ -361,8 +366,16 @@ Tk_GridObjCmd(
return TCL_ERROR;
}
- if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings,
+ if (Tcl_GetIndexFromObjStruct(NULL, objv[1], optionStrings,
sizeof(char *), "option", 0, &index) != TCL_OK) {
+ /*
+ * Call it again without the deprecated ones to get a proper error
+ * message. This works well since there can't be any ambiguity between
+ * deprecated and new options.
+ */
+
+ Tcl_GetIndexFromObjStruct(interp, objv[1], optionStringsNoDep,
+ sizeof(char *), "option", 0, &index);
return TCL_ERROR;
}
@@ -1236,7 +1249,7 @@ GridRowColumnConfigureCommand(
if (slotPtr != NULL) {
if (slotType == ROW) {
- int last = containerPtr->containerDataPtr->rowMax - 1;
+ last = containerPtr->containerDataPtr->rowMax - 1;
while ((last >= 0) && (slotPtr[last].weight == 0)
&& (slotPtr[last].pad == 0) && (slotPtr[last].minSize == 0)
@@ -1245,7 +1258,7 @@ GridRowColumnConfigureCommand(
}
containerPtr->containerDataPtr->rowMax = last+1;
} else {
- int last = containerPtr->containerDataPtr->columnMax - 1;
+ last = containerPtr->containerDataPtr->columnMax - 1;
while ((last >= 0) && (slotPtr[last].weight == 0)
&& (slotPtr[last].pad == 0) && (slotPtr[last].minSize == 0)
@@ -1819,7 +1832,6 @@ ArrangeGrid(
for (contentPtr = containerPtr->contentPtr; contentPtr != NULL && !abort;
contentPtr = contentPtr->nextPtr) {
int x, y; /* Top left coordinate */
- int width, height; /* Slot or content size */
int col = contentPtr->column;
int row = contentPtr->row;
@@ -1930,7 +1942,7 @@ ResolveConstraints(
int uniformGroups; /* Number of currently used uniform groups. */
int uniformGroupsAlloced; /* Size of allocated space for uniform
* groups. */
- int weight, minSize;
+ int minSize;
int prevGrow, accWeight, grow;
/*
@@ -2059,6 +2071,7 @@ ResolveConstraints(
for (slot = 0; slot < gridCount; slot++) {
if (layoutPtr[slot].uniform != NULL) {
+ int weight;
for (start = 0; start < uniformGroups; start++) {
if (uniformGroupPtr[start].group == layoutPtr[slot].uniform) {
break;
@@ -2111,7 +2124,7 @@ ResolveConstraints(
for (start = 0; start < uniformGroups; start++) {
if (uniformGroupPtr[start].group ==
layoutPtr[slot].uniform) {
- weight = layoutPtr[slot].weight;
+ int weight = layoutPtr[slot].weight;
weight = weight > 0 ? weight : 1;
layoutPtr[slot].minSize =
uniformGroupPtr[start].minSize * weight;
@@ -2992,7 +3005,7 @@ ConfigureContent(
* If the stored container does not exist, just ignore it.
*/
- struct Gridder *contentPtr = GetGrid(content);
+ contentPtr = GetGrid(content);
if (contentPtr->in != NULL) {
if (TkGetWindowFromObj(interp, content, contentPtr->in, &parent)
== TCL_OK) {
@@ -3132,7 +3145,7 @@ ConfigureContent(
for (defaultColumnSpan = 1; j + defaultColumnSpan < numWindows;
defaultColumnSpan++) {
- const char *string = Tcl_GetString(objv[j + defaultColumnSpan]);
+ string = Tcl_GetString(objv[j + defaultColumnSpan]);
if (*string != REL_HORIZ) {
break;
@@ -3434,9 +3447,9 @@ ConfigureContent(
int lastRow, lastColumn; /* Implied end of table. */
string = Tcl_GetString(objv[j]);
- firstChar = string[0];
+ firstChar = string[0];
- if (firstChar == '.') {
+ if (firstChar == '.') {
lastWindow = string;
numSkip = 0;
}
@@ -3459,7 +3472,7 @@ ConfigureContent(
*/
for (width = 1; width + j < numWindows; width++) {
- const char *string = Tcl_GetString(objv[j+width]);
+ string = Tcl_GetString(objv[j+width]);
if (*string != REL_VERT) {
break;
diff --git a/generic/tkImage.c b/generic/tkImage.c
index 23d7ecf..97d0702 100644
--- a/generic/tkImage.c
+++ b/generic/tkImage.c
@@ -361,8 +361,6 @@ Tk_ImageObjCmd(
objc -= firstOption;
args = (Tcl_Obj **) objv;
if (oldimage) {
- int i;
-
args = (Tcl_Obj **)ckalloc((objc+1) * sizeof(Tcl_Obj *));
for (i = 0; i < objc; i++) {
args[i] = (Tcl_Obj *) Tcl_GetString(objv[i]);
diff --git a/generic/tkImgPNG.c b/generic/tkImgPNG.c
index 0e0e59c..c8b2125 100644
--- a/generic/tkImgPNG.c
+++ b/generic/tkImgPNG.c
@@ -2295,7 +2295,7 @@ ParseFormat(
static const char *const fmtOptions[] = {
"-alpha", NULL
};
- enum fmtOptions {
+ enum fmtOptionsEnum {
OPT_ALPHA
};
@@ -2332,7 +2332,7 @@ ParseFormat(
objc--;
objv++;
- switch ((enum fmtOptions) optIndex) {
+ switch ((enum fmtOptionsEnum) optIndex) {
case OPT_ALPHA:
if (Tcl_GetDoubleFromObj(interp, objv[0],
&pngPtr->alpha) == TCL_ERROR) {
diff --git a/generic/tkImgPPM.c b/generic/tkImgPPM.c
index 91d809b..4a771ed 100644
--- a/generic/tkImgPPM.c
+++ b/generic/tkImgPPM.c
@@ -94,18 +94,15 @@ static int ReadPPMStringHeader(Tcl_Obj *dataObj, int *widthPtr,
static int
FileMatchPPM(
Tcl_Channel chan, /* The image file, open for reading. */
- const char *fileName, /* The name of the image file. */
- Tcl_Obj *format, /* User-specified format string, or NULL. */
+ TCL_UNUSED(const char *), /* The name of the image file. */
+ TCL_UNUSED(Tcl_Obj *), /* User-specified format string, or NULL. */
int *widthPtr, int *heightPtr,
/* The dimensions of the image are returned
* here if the file is a valid raw PPM
* file. */
- Tcl_Interp *interp) /* unused */
+ TCL_UNUSED(Tcl_Interp *)) /* unused */
{
int dummy;
- (void)fileName;
- (void)format;
- (void)interp;
return ReadPPMFileHeader(chan, widthPtr, heightPtr, &dummy);
}
@@ -134,7 +131,7 @@ FileReadPPM(
Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
Tcl_Channel chan, /* The image file, open for reading. */
const char *fileName, /* The name of the image file. */
- Tcl_Obj *format, /* User-specified format string, or NULL. */
+ TCL_UNUSED(Tcl_Obj *), /* User-specified format string, or NULL. */
Tk_PhotoHandle imageHandle, /* The photo image to write into. */
int destX, int destY, /* Coordinates of top-left pixel in photo
* image to be written to. */
@@ -148,7 +145,6 @@ FileReadPPM(
size_t nBytes, count;
unsigned char *pixelPtr;
Tk_PhotoImageBlock block;
- (void)format;
type = ReadPPMFileHeader(chan, &fileWidth, &fileHeight, &maxIntensity);
if (type == 0) {
@@ -286,7 +282,7 @@ static int
FileWritePPM(
Tcl_Interp *interp,
const char *fileName,
- Tcl_Obj *format,
+ TCL_UNUSED(Tcl_Obj *),
Tk_PhotoImageBlock *blockPtr)
{
Tcl_Channel chan;
@@ -294,7 +290,6 @@ FileWritePPM(
size_t nBytes;
unsigned char *pixelPtr, *pixLinePtr;
char header[16 + TCL_INTEGER_SPACE * 2];
- (void)format;
chan = Tcl_OpenFileChannel(interp, fileName, "w", 0666);
if (chan == NULL) {
@@ -375,14 +370,13 @@ FileWritePPM(
static int
StringWritePPM(
Tcl_Interp *interp,
- Tcl_Obj *format,
+ TCL_UNUSED(Tcl_Obj *),
Tk_PhotoImageBlock *blockPtr)
{
int w, h, size, greenOffset, blueOffset;
unsigned char *pixLinePtr, *byteArray;
char header[16 + TCL_INTEGER_SPACE * 2];
Tcl_Obj *byteArrayObj;
- (void)format;
sprintf(header, "P6\n%d %d\n255\n", blockPtr->width, blockPtr->height);
@@ -452,16 +446,14 @@ StringWritePPM(
static int
StringMatchPPM(
Tcl_Obj *dataObj, /* The image data. */
- Tcl_Obj *format, /* User-specified format string, or NULL. */
+ TCL_UNUSED(Tcl_Obj *), /* User-specified format string, or NULL. */
int *widthPtr, int *heightPtr,
/* The dimensions of the image are returned
* here if the file is a valid raw PPM
* file. */
- Tcl_Interp *interp) /* unused */
+ TCL_UNUSED(Tcl_Interp *)) /* unused */
{
int dummy;
- (void)format;
- (void)interp;
return ReadPPMStringHeader(dataObj, widthPtr, heightPtr,
&dummy, NULL, NULL);
@@ -489,7 +481,7 @@ static int
StringReadPPM(
Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
Tcl_Obj *dataObj, /* The image data. */
- Tcl_Obj *format, /* User-specified format string, or NULL. */
+ TCL_UNUSED(Tcl_Obj *), /* User-specified format string, or NULL. */
Tk_PhotoHandle imageHandle, /* The photo image to write into. */
int destX, int destY, /* Coordinates of top-left pixel in photo
* image to be written to. */
@@ -502,7 +494,6 @@ StringReadPPM(
int nLines, nBytes, h, type, count, dataSize, bytesPerChannel = 1;
unsigned char *pixelPtr, *dataBuffer;
Tk_PhotoImageBlock block;
- (void)format;
type = ReadPPMStringHeader(dataObj, &fileWidth, &fileHeight,
&maxIntensity, &dataBuffer, &dataSize);
@@ -611,7 +602,6 @@ StringReadPPM(
*p = (((int) *dataBuffer) * 255)/maxIntensity;
}
} else {
- unsigned char *p;
unsigned int value;
for (p = pixelPtr,count=nBytes; count > 1; count-=2, p += 2) {
diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c
index 11dc251..55cc226 100644
--- a/generic/tkImgPhInstance.c
+++ b/generic/tkImgPhInstance.c
@@ -44,7 +44,7 @@ static void BlendComplexAlpha(XImage *bgImg, PhotoInstance *iPtr,
#endif
static int IsValidPalette(PhotoInstance *instancePtr,
const char *palette);
-static int CountBits(pixel mask);
+static int CountBits(unsigned mask);
static void GetColorTable(PhotoInstance *instancePtr);
static void FreeColorTable(ColorTable *colorPtr, int force);
static void AllocateColors(ColorTable *colorPtr);
@@ -999,7 +999,7 @@ IsValidPalette(
static int
CountBits(
- pixel mask) /* Value to count the 1 bits in. */
+ unsigned mask) /* Value to count the 1 bits in. */
{
int n;
@@ -1649,7 +1649,7 @@ TkImgDitherInstance(
int bitsPerPixel, bytesPerLine, lineLength;
unsigned char *srcLinePtr;
schar *errLinePtr;
- pixel firstBit, word, mask;
+ unsigned firstBit, word, mask;
/*
* Turn dithering off in certain cases where it is not needed (TrueColor,
@@ -1722,7 +1722,7 @@ TkImgDitherInstance(
unsigned char *srcPtr = srcLinePtr;
schar *errPtr = errLinePtr;
unsigned char *destBytePtr = dstLinePtr;
- pixel *destLongPtr = (pixel *) dstLinePtr;
+ unsigned *destLongPtr = (unsigned *) dstLinePtr;
if (colorPtr->flags & COLOR_WINDOW) {
/*
@@ -1813,7 +1813,7 @@ TkImgDitherInstance(
* sizes.
*/
- case NBBY * sizeof(pixel):
+ case NBBY * sizeof(unsigned):
*destLongPtr++ = i;
break;
#endif
@@ -1875,7 +1875,7 @@ TkImgDitherInstance(
* sizes.
*/
- case NBBY * sizeof(pixel):
+ case NBBY * sizeof(unsigned):
*destLongPtr++ = i;
break;
#endif
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index db810d8..51083e6 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -221,12 +221,11 @@ static const char * GetExtension(const char *path);
static void
PhotoFormatThreadExitProc(
- ClientData dummy) /* not used */
+ TCL_UNUSED(void *)) /* not used */
{
Tk_PhotoImageFormat *freePtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- (void)dummy;
#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
while (tsdPtr->oldFormatList != NULL) {
@@ -343,14 +342,13 @@ ImgPhotoCreate(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[], /* Argument objects for options (doesn't
* include image name or type). */
- const Tk_ImageType *typePtr,/* Pointer to our type record (not used). */
+ TCL_UNUSED(const Tk_ImageType *),/* Pointer to our type record (not used). */
Tk_ImageModel model, /* Token for image, to be used by us in later
* callbacks. */
ClientData *clientDataPtr) /* Store manager's token for image here; it
* will be returned in later callbacks. */
{
PhotoModel *modelPtr;
- (void)typePtr;
/*
* Allocate and initialize the photo image model record.
@@ -3877,7 +3875,7 @@ ImgGetPhoto(
blueOffset = blockPtr->offset[2] - blockPtr->offset[0];
if (((optPtr->options & OPT_BACKGROUND) && alphaOffset) ||
((optPtr->options & OPT_GRAYSCALE) && (greenOffset||blueOffset))) {
- int newPixelSize,x,y;
+ int newPixelSize;
unsigned char *srcPtr, *destPtr;
char *data;
@@ -4065,15 +4063,13 @@ static int
ImgPhotoPostscript(
ClientData clientData, /* Handle for the photo image. */
Tcl_Interp *interp, /* Interpreter. */
- Tk_Window tkwin, /* (unused) */
+ TCL_UNUSED(Tk_Window), /* (unused) */
Tk_PostscriptInfo psInfo, /* Postscript info. */
int x, int y, /* First pixel to output. */
int width, int height, /* Width and height of area. */
- int prepass) /* (unused) */
+ TCL_UNUSED(int)) /* (unused) */
{
Tk_PhotoImageBlock block;
- (void)tkwin;
- (void)prepass;
Tk_PhotoGetImage(clientData, &block);
block.pixelPtr += y * block.pitch + x * block.pixelSize;
diff --git a/generic/tkImgPhoto.h b/generic/tkImgPhoto.h
index e65893f..d7283b3 100644
--- a/generic/tkImgPhoto.h
+++ b/generic/tkImgPhoto.h
@@ -50,13 +50,6 @@ typedef struct PhotoModel PhotoModel;
#endif
/*
- * An unsigned 32-bit integral type, used for pixel values. We use int rather
- * than long here to accommodate those systems where longs are 64 bits.
- */
-
-typedef unsigned int pixel;
-
-/*
* The maximum number of pixels to transmit to the server in a single
* XPutImage call.
*/
@@ -110,10 +103,10 @@ struct ColorTable {
XVisualInfo visualInfo; /* Information about the visual for windows
* using this color table. */
- pixel redValues[256]; /* Maps 8-bit values of red intensity to a
+ unsigned redValues[256]; /* Maps 8-bit values of red intensity to a
* pixel value or index in pixelMap. */
- pixel greenValues[256]; /* Ditto for green intensity. */
- pixel blueValues[256]; /* Ditto for blue intensity. */
+ unsigned greenValues[256]; /* Ditto for green intensity. */
+ unsigned blueValues[256]; /* Ditto for blue intensity. */
unsigned long *pixelMap; /* Actual pixel values allocated. */
unsigned char colorQuant[3][256];
diff --git a/generic/tkImgSVGnano.c b/generic/tkImgSVGnano.c
index c18b181..4cdb648 100644
--- a/generic/tkImgSVGnano.c
+++ b/generic/tkImgSVGnano.c
@@ -336,7 +336,7 @@ ParseSVGWithOptions(
static const char *const fmtOptions[] = {
"-dpi", "-scale", "-scaletoheight", "-scaletowidth", NULL
};
- enum fmtOptions {
+ enum fmtOptionsEnum {
OPT_DPI, OPT_SCALE, OPT_SCALE_TO_HEIGHT, OPT_SCALE_TO_WIDTH
};
@@ -394,7 +394,7 @@ ParseSVGWithOptions(
/*
* check that only one scale option is given
*/
- switch ((enum fmtOptions) optIndex) {
+ switch ((enum fmtOptionsEnum)optIndex) {
case OPT_SCALE:
case OPT_SCALE_TO_HEIGHT:
case OPT_SCALE_TO_WIDTH:
@@ -414,7 +414,7 @@ ParseSVGWithOptions(
/*
* Decode parameters
*/
- switch ((enum fmtOptions) optIndex) {
+ switch ((enum fmtOptionsEnum) optIndex) {
case OPT_DPI:
if (Tcl_GetDoubleFromObj(interp, objv[0], &dpi) == TCL_ERROR) {
goto error;
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index 9dc9534..a6f1c03 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -1632,7 +1632,6 @@ ConfigureMenu(
}
} else if ((menuListPtr->numEntries > 0)
&& (menuListPtr->entries[0]->type == TEAROFF_ENTRY)) {
- int i;
Tcl_EventuallyFree(menuListPtr->entries[0], (Tcl_FreeProc *) DestroyMenuEntry);
@@ -1827,7 +1826,6 @@ PostProcessEntry(
if ((mePtr->type == CHECK_BUTTON_ENTRY)
|| (mePtr->type == RADIO_BUTTON_ENTRY)) {
Tcl_Obj *valuePtr;
- const char *name;
if (mePtr->namePtr == NULL) {
if (mePtr->labelPtr == NULL) {
@@ -2743,7 +2741,7 @@ CloneMenu(
&& (menuPtr->numEntries == menuRefPtr->menuPtr->numEntries)) {
TkMenu *newMenuPtr = menuRefPtr->menuPtr;
Tcl_Obj *newObjv[3];
- int i, numElements;
+ int numElements;
/*
* Now put this newly created menu into the parent menu's instance
diff --git a/generic/tkPack.c b/generic/tkPack.c
index 00597b3..239b00a 100644
--- a/generic/tkPack.c
+++ b/generic/tkPack.c
@@ -203,6 +203,8 @@ Tk_PackObjCmd(
"after", "append", "before", "unpack",
#endif /* !TK_NO_DEPRECATED */
"configure", "content", "forget", "info", "propagate", "slaves", NULL };
+ static const char *const optionStringsNoDep[] = {
+ "configure", "content", "forget", "info", "propagate", NULL };
enum options {
#ifndef TK_NO_DEPRECATED
PACK_AFTER, PACK_APPEND, PACK_BEFORE, PACK_UNPACK,
@@ -222,19 +224,16 @@ Tk_PackObjCmd(
return TCL_ERROR;
}
- if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings,
+ if (Tcl_GetIndexFromObjStruct(NULL, objv[1], optionStrings,
sizeof(char *), "option", 0, &index) != TCL_OK) {
-#ifndef TK_NO_DEPRECATED
/*
* Call it again without the deprecated ones to get a proper error
* message. This works well since there can't be any ambiguity between
* deprecated and new options.
*/
- Tcl_ResetResult(interp);
- Tcl_GetIndexFromObjStruct(interp, objv[1], &optionStrings[4],
+ Tcl_GetIndexFromObjStruct(interp, objv[1], optionStringsNoDep,
sizeof(char *), "option", 0, &index);
-#endif /* TK_NO_DEPRECATED */
return TCL_ERROR;
}
diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c
index 2039256..c15236d 100644
--- a/generic/tkPanedWindow.c
+++ b/generic/tkPanedWindow.c
@@ -604,7 +604,6 @@ PanedWindowWidgetObjCmd(
break;
case PW_FORGET: {
- int i;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "widget ?widget ...?");
diff --git a/generic/tkPkgConfig.c b/generic/tkPkgConfig.c
index fe084bf..ed8fb0b 100644
--- a/generic/tkPkgConfig.c
+++ b/generic/tkPkgConfig.c
@@ -100,6 +100,9 @@ static const Tcl_Config cfg[] = {
{"profiled", CFG_PROFILED},
{"64bit", CFG_64},
{"optimized", CFG_OPTIMIZED},
+#ifdef TK_NO_DEPRECATED
+ {"nodeprecated", "1"},
+#endif
{"mem_debug", CFG_MEMDEBUG},
{"fontsystem", CFG_FONTSYSTEM},
diff --git a/generic/tkPlace.c b/generic/tkPlace.c
index 7625362..8d6b87e 100644
--- a/generic/tkPlace.c
+++ b/generic/tkPlace.c
@@ -216,6 +216,9 @@ Tk_PlaceObjCmd(
static const char *const optionStrings[] = {
"configure", "content", "forget", "info", "slaves", NULL
};
+ static const char *const optionStringsNoDep[] = {
+ "configure", "content", "forget", "info", NULL
+ };
enum options { PLACE_CONFIGURE, PLACE_CONTENT, PLACE_FORGET, PLACE_INFO, PLACE_SLAVES };
int index;
@@ -278,6 +281,14 @@ Tk_PlaceObjCmd(
if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings,
sizeof(char *), "option", 0, &index) != TCL_OK) {
+ /*
+ * Call it again without the deprecated ones to get a proper error
+ * message. This works well since there can't be any ambiguity between
+ * deprecated and new options.
+ */
+
+ Tcl_GetIndexFromObjStruct(interp, objv[1], optionStringsNoDep,
+ sizeof(char *), "option", 0, &index);
return TCL_ERROR;
}
@@ -666,10 +677,10 @@ ConfigureContent(
goto scheduleLayout;
} else if (mask & IN_MASK) {
/* -in changed */
- Tk_Window tkwin;
+ Tk_Window win;
Tk_Window ancestor;
- tkwin = contentPtr->inTkwin;
+ win = contentPtr->inTkwin;
/*
* Make sure that the new container is either the logical parent of the
@@ -677,19 +688,19 @@ ConfigureContent(
* aren't the same.
*/
- for (ancestor = tkwin; ; ancestor = Tk_Parent(ancestor)) {
+ for (ancestor = win; ; ancestor = Tk_Parent(ancestor)) {
if (ancestor == Tk_Parent(contentPtr->tkwin)) {
break;
}
if (Tk_TopWinHierarchy(ancestor)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't place \"%s\" relative to \"%s\"",
- Tk_PathName(contentPtr->tkwin), Tk_PathName(tkwin)));
+ Tk_PathName(contentPtr->tkwin), Tk_PathName(win)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL);
goto error;
}
}
- if (contentPtr->tkwin == tkwin) {
+ if (contentPtr->tkwin == win) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't place \"%s\" relative to itself",
Tk_PathName(contentPtr->tkwin)));
@@ -701,22 +712,22 @@ ConfigureContent(
* Check for management loops.
*/
- for (container = (TkWindow *)tkwin; container != NULL;
+ for (container = (TkWindow *)win; container != NULL;
container = (TkWindow *)TkGetContainer(container)) {
if (container == (TkWindow *)contentPtr->tkwin) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't put \"%s\" inside \"%s\": would cause management loop",
- Tk_PathName(contentPtr->tkwin), Tk_PathName(tkwin)));
+ Tk_PathName(contentPtr->tkwin), Tk_PathName(win)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL);
goto error;
}
}
- if (tkwin != Tk_Parent(contentPtr->tkwin)) {
- ((TkWindow *)contentPtr->tkwin)->maintainerPtr = (TkWindow *)tkwin;
+ if (win != Tk_Parent(contentPtr->tkwin)) {
+ ((TkWindow *)contentPtr->tkwin)->maintainerPtr = (TkWindow *)win;
}
if ((contentPtr->containerPtr != NULL)
- && (contentPtr->containerPtr->tkwin == tkwin)) {
+ && (contentPtr->containerPtr->tkwin == win)) {
/*
* Re-using same old container. Nothing to do.
*/
@@ -729,7 +740,7 @@ ConfigureContent(
Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin);
}
UnlinkContent(contentPtr);
- containerWin = tkwin;
+ containerWin = win;
}
/*
diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c
index 0d31a80..86ec25a 100644
--- a/generic/tkScrollbar.c
+++ b/generic/tkScrollbar.c
@@ -310,7 +310,7 @@ ScrollbarWidgetObjCmd(
break;
}
case COMMAND_DELTA: {
- int xDelta, yDelta, pixels, length;
+ int xDelta, yDelta, pixels;
double fraction;
if (objc != 4) {
@@ -339,7 +339,7 @@ ScrollbarWidgetObjCmd(
break;
}
case COMMAND_FRACTION: {
- int x, y, pos, length;
+ int x, y, pos;
double fraction;
if (objc != 4) {
diff --git a/generic/tkTest.c b/generic/tkTest.c
index db10124..4347600 100644
--- a/generic/tkTest.c
+++ b/generic/tkTest.c
@@ -334,13 +334,11 @@ Tktest_Init(
static int
TestbitmapObjCmd(
- ClientData 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. */
{
- (void)clientData;
-
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "bitmap");
return TCL_ERROR;
@@ -369,13 +367,11 @@ TestbitmapObjCmd(
static int
TestborderObjCmd(
- ClientData clientData, /* Main window for application. */
+ TCL_UNUSED(ClientData), /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- (void)clientData;
-
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "border");
return TCL_ERROR;
@@ -404,13 +400,11 @@ TestborderObjCmd(
static int
TestcolorObjCmd(
- ClientData 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. */
{
- (void)clientData;
-
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "color");
return TCL_ERROR;
@@ -439,13 +433,11 @@ TestcolorObjCmd(
static int
TestcursorObjCmd(
- ClientData 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. */
{
- (void)clientData;
-
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "cursor");
return TCL_ERROR;
@@ -475,16 +467,12 @@ TestcursorObjCmd(
static int
TestdeleteappsObjCmd(
- ClientData clientData, /* Main window for application. */
- Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
- Tcl_Obj *const objv[]) /* Argument strings. */
+ TCL_UNUSED(void *), /* Main window for application. */
+ TCL_UNUSED(Tcl_Interp *), /* Current interpreter. */
+ TCL_UNUSED(int), /* Number of arguments. */
+ TCL_UNUSED(Tcl_Obj *const *)) /* Argument strings. */
{
NewApp *nextPtr;
- (void)clientData;
- (void)interp;
- (void)objc;
- (void)objv;
while (newAppPtr != NULL) {
nextPtr = newAppPtr->nextPtr;
@@ -550,7 +538,7 @@ TestobjconfigObjCmd(
* "chain2" subcommand:
*/
- typedef struct ExtensionWidgetRecord {
+ typedef struct {
TrivialCommandHeader header;
Tcl_Obj *base1ObjPtr;
Tcl_Obj *base2ObjPtr;
@@ -578,7 +566,7 @@ TestobjconfigObjCmd(
switch (index) {
case ALL_TYPES: {
- typedef struct TypesRecord {
+ typedef struct {
TrivialCommandHeader header;
Tcl_Obj *booleanPtr;
Tcl_Obj *integerPtr;
@@ -651,7 +639,6 @@ TestobjconfigObjCmd(
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
Tk_OptionTable optionTable;
- Tk_Window tkwin;
optionTable = Tk_CreateOptionTable(interp, typesSpecs);
tables[index] = optionTable;
@@ -707,7 +694,6 @@ TestobjconfigObjCmd(
case CHAIN1: {
ExtensionWidgetRecord *recordPtr;
- Tk_Window tkwin;
Tk_OptionTable optionTable;
tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window)clientData,
@@ -760,7 +746,6 @@ TestobjconfigObjCmd(
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0,
(ClientData) baseSpecs, 0}
};
- Tk_Window tkwin;
Tk_OptionTable optionTable;
tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window)clientData,
@@ -799,7 +784,7 @@ TestobjconfigObjCmd(
}
case CONFIG_ERROR: {
- typedef struct ErrorWidgetRecord {
+ typedef struct {
Tcl_Obj *intPtr;
} ErrorWidgetRecord;
ErrorWidgetRecord widgetRecord;
@@ -853,7 +838,7 @@ TestobjconfigObjCmd(
* objects.
*/
- typedef struct InternalRecord {
+ typedef struct {
TrivialCommandHeader header;
int boolean;
int integer;
@@ -929,7 +914,6 @@ TestobjconfigObjCmd(
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
Tk_OptionTable optionTable;
- Tk_Window tkwin;
optionTable = Tk_CreateOptionTable(interp, internalSpecs);
tables[index] = optionTable;
@@ -985,7 +969,7 @@ TestobjconfigObjCmd(
}
case NEW: {
- typedef struct FiveRecord {
+ typedef struct {
TrivialCommandHeader header;
Tcl_Obj *one;
Tcl_Obj *two;
@@ -1044,7 +1028,7 @@ TestobjconfigObjCmd(
break;
}
case NOT_ENOUGH_PARAMS: {
- typedef struct NotEnoughRecord {
+ typedef struct {
Tcl_Obj *fooObjPtr;
} NotEnoughRecord;
NotEnoughRecord record;
@@ -1074,7 +1058,7 @@ TestobjconfigObjCmd(
}
case TWO_WINDOWS: {
- typedef struct ContentRecord {
+ typedef struct {
TrivialCommandHeader header;
Tcl_Obj *windowPtr;
} ContentRecord;
@@ -1084,7 +1068,7 @@ TestobjconfigObjCmd(
offsetof(ContentRecord, windowPtr), TCL_INDEX_NONE, TK_CONFIG_NULL_OK, NULL, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
- Tk_Window tkwin = Tk_CreateWindowFromPath(interp,
+ tkwin = Tk_CreateWindowFromPath(interp,
(Tk_Window)clientData, Tcl_GetString(objv[2]), NULL);
if (tkwin == NULL) {
@@ -1394,7 +1378,7 @@ ImageCreate(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[], /* Argument strings for options (doesn't
* include image name or type). */
- const Tk_ImageType *typePtr, /* Pointer to our type record (not used). */
+ TCL_UNUSED(const Tk_ImageType *), /* Pointer to our type record (not used). */
Tk_ImageModel model, /* Token for image, to be used by us in later
* callbacks. */
ClientData *clientDataPtr) /* Store manager's token for image here; it
@@ -1403,7 +1387,6 @@ ImageCreate(
TImageModel *timPtr;
const char *varName;
int i;
- (void)typePtr;
varName = "log";
for (i = 0; i < objc; i += 2) {
@@ -1820,14 +1803,13 @@ TestmenubarObjCmd(
#if defined(_WIN32)
static int
TestmetricsObjCmd(
- ClientData dummy, /* 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 strings. */
{
char buf[TCL_INTEGER_SPACE];
int val;
- (void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
@@ -2057,9 +2039,9 @@ TestwrapperObjCmd(
static int
CustomOptionSet(
- ClientData dummy,
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
- Tk_Window tkwin,
+ TCL_UNUSED(Tk_Window),
Tcl_Obj **value,
char *recordPtr,
TkSizeT internalOffset,
@@ -2068,8 +2050,6 @@ CustomOptionSet(
{
int objEmpty;
char *newStr, *string, *internalPtr;
- (void)dummy;
- (void)tkwin;
objEmpty = 0;
@@ -2120,14 +2100,11 @@ CustomOptionSet(
static Tcl_Obj *
CustomOptionGet(
- ClientData dummy,
- Tk_Window tkwin,
+ TCL_UNUSED(void *),
+ TCL_UNUSED(Tk_Window),
char *recordPtr,
TkSizeT internalOffset)
{
- (void)dummy;
- (void)tkwin;
-
return (Tcl_NewStringObj(*(char **)(recordPtr + internalOffset), -1));
}
diff --git a/generic/tkText.c b/generic/tkText.c
index 990ffb3..ce4f976 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -701,7 +701,7 @@ TextWidgetObjCmd(
{
TkText *textPtr = (TkText *)clientData;
int result = TCL_OK;
- int index;
+ int idx;
static const char *const optionStrings[] = {
"bbox", "cget", "compare", "configure", "count", "debug", "delete",
@@ -724,12 +724,12 @@ TextWidgetObjCmd(
}
if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings,
- sizeof(char *), "option", 0, &index) != TCL_OK) {
+ sizeof(char *), "option", 0, &idx) != TCL_OK) {
return TCL_ERROR;
}
textPtr->refCount++;
- switch ((enum options) index) {
+ switch ((enum options) idx) {
case TEXT_BBOX: {
int x, y, width, height;
const TkTextIndex *indexPtr;
@@ -3173,7 +3173,7 @@ DeleteIndexRange(
line2 = TkBTreeLinesTo(textPtr, index2.linePtr);
if (line2 == TkBTreeNumLines(sharedTextPtr->tree, textPtr)) {
TkTextTag **arrayPtr;
- int arraySize, i;
+ int arraySize;
TkTextIndex oldIndex2;
oldIndex2 = index2;
diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c
index a6a5e35..8feb2a2 100644
--- a/generic/tkTextBTree.c
+++ b/generic/tkTextBTree.c
@@ -4169,7 +4169,7 @@ Rebalance(
Node *otherPtr;
Node *halfwayNodePtr = NULL; /* Initialization needed only */
TkTextLine *halfwayLinePtr = NULL; /* to prevent cc warnings. */
- int totalChildren, firstChildren, i;
+ int totalChildren, firstChildren;
/*
* Too few children for this node. If this is the root then, it's
@@ -4230,8 +4230,6 @@ Rebalance(
otherPtr->children.linePtr = NULL;
}
if (nodePtr->level == 0) {
- TkTextLine *linePtr;
-
for (linePtr = nodePtr->children.linePtr, i = 1;
linePtr->nextPtr != NULL;
linePtr = linePtr->nextPtr, i++) {
@@ -4246,8 +4244,6 @@ Rebalance(
i++;
}
} else {
- Node *childPtr;
-
for (childPtr = nodePtr->children.nodePtr, i = 1;
childPtr->nextPtr != NULL;
childPtr = childPtr->nextPtr, i++) {
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index b1c5e17..6e96127 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -440,7 +440,7 @@ typedef struct TextDInfo {
* points to one of the following structures:
*/
-#if !TK_LAYOUT_WITH_BASE_CHUNKS
+#if !defined(TK_LAYOUT_WITH_BASE_CHUNKS)
typedef struct CharInfo {
int numBytes; /* Number of bytes to display. */
@@ -552,7 +552,7 @@ static void CharDisplayProc(TkText *textPtr,
static int CharMeasureProc(TkTextDispChunk *chunkPtr, int x);
static void CharUndisplayProc(TkText *textPtr,
TkTextDispChunk *chunkPtr);
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
static void FinalizeBaseChunk(TkTextDispChunk *additionalChunkPtr);
static void FreeBaseChunk(TkTextDispChunk *baseChunkPtr);
static int IsSameFGStyle(TextStyle *style1, TextStyle *style2);
@@ -1508,7 +1508,7 @@ LayoutDLine(
}
}
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
if (baseCharChunkPtr != NULL) {
int expectedX =
((BaseCharInfo *) baseCharChunkPtr->clientData)->width
@@ -1650,7 +1650,7 @@ LayoutDLine(
chunkPtr = NULL;
}
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
FinalizeBaseChunk(NULL);
#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
if (noCharsYet) {
@@ -1709,7 +1709,7 @@ LayoutDLine(
segPtr->typePtr->layoutProc(textPtr, &breakIndex, segPtr,
byteOffset, maxX, breakByteOffset, 0, wrapMode,
breakChunkPtr);
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
FinalizeBaseChunk(NULL);
#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
}
@@ -7628,7 +7628,7 @@ TkTextCharLayoutProc(
char *p;
TkTextSegment *nextPtr;
Tk_FontMetrics fm;
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
const char *line;
int lineOffset;
BaseCharInfo *bciPtr;
@@ -7653,7 +7653,7 @@ TkTextCharLayoutProc(
p = segPtr->body.chars + byteOffset;
tkfont = chunkPtr->stylePtr->sValuePtr->tkfont;
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
if (baseCharChunkPtr == NULL) {
baseCharChunkPtr = chunkPtr;
bciPtr = ckalloc(sizeof(BaseCharInfo));
@@ -7690,7 +7690,7 @@ TkTextCharLayoutProc(
int ch;
int chLen = TkUtfToUniChar(p, &ch);
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
bytesThatFit = CharChunkMeasureChars(chunkPtr, line,
lineOffset+chLen, lineOffset, -1, chunkPtr->x, -1, 0,
&nextX);
@@ -7734,7 +7734,7 @@ TkTextCharLayoutProc(
bytesThatFit++;
}
if (bytesThatFit == 0) {
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
chunkPtr->clientData = NULL;
if (chunkPtr == baseCharChunkPtr) {
baseCharChunkPtr = NULL;
@@ -7767,7 +7767,7 @@ TkTextCharLayoutProc(
chunkPtr->width = nextX - chunkPtr->x;
chunkPtr->breakIndex = -1;
-#if !TK_LAYOUT_WITH_BASE_CHUNKS
+#if !defined(TK_LAYOUT_WITH_BASE_CHUNKS)
ciPtr = (CharInfo *)ckalloc(offsetof(CharInfo, chars) + 1 + bytesThatFit);
chunkPtr->clientData = ciPtr;
memcpy(ciPtr->chars, p, bytesThatFit);
@@ -7778,7 +7778,7 @@ TkTextCharLayoutProc(
ciPtr->numBytes--;
}
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
/*
* Final update for the current base chunk data.
*/
@@ -7883,7 +7883,7 @@ CharChunkMeasureChars(
Tk_Font tkfont = chunkPtr->stylePtr->sValuePtr->tkfont;
CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData;
-#if !TK_LAYOUT_WITH_BASE_CHUNKS
+#if !defined(TK_LAYOUT_WITH_BASE_CHUNKS)
if (chars == NULL) {
chars = ciPtr->chars;
charsLen = ciPtr->numBytes;
@@ -7975,7 +7975,7 @@ CharDisplayProc(
TextStyle *stylePtr;
StyleValues *sValuePtr;
int numBytes, offsetBytes, offsetX;
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
BaseCharInfo *bciPtr;
#endif /* TK_DRAW_IN_CONTEXT */
@@ -7987,12 +7987,12 @@ CharDisplayProc(
return;
}
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
bciPtr = ciPtr->baseChunkPtr->clientData;
numBytes = Tcl_DStringLength(&bciPtr->baseChars);
string = Tcl_DStringValue(&bciPtr->baseChars);
-#elif TK_LAYOUT_WITH_BASE_CHUNKS
+#elif defined(TK_LAYOUT_WITH_BASE_CHUNKS)
if (ciPtr->baseChunkPtr != chunkPtr) {
/*
* Without context drawing only base chunks display their foreground.
@@ -8033,7 +8033,7 @@ CharDisplayProc(
if (!sValuePtr->elide && (numBytes > offsetBytes)
&& (stylePtr->fgGC != NULL)) {
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
int start = ciPtr->baseOffset + offsetBytes;
int len = ciPtr->numBytes - offsetBytes;
int xDisplacement = x - chunkPtr->x;
@@ -8124,7 +8124,7 @@ CharUndisplayProc(
CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData;
if (ciPtr) {
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
if (chunkPtr == ciPtr->baseChunkPtr) {
/*
* Basechunks are undisplayed first, when DLines are freed or
@@ -8706,7 +8706,7 @@ MeasureChars(
if ((maxX >= 0) && (curX >= maxX)) {
break;
}
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
start += TkpMeasureCharsInContext(tkfont, source, maxBytes,
start - source, special - start,
maxX >= 0 ? maxX - curX : -1, flags, &width);
@@ -8836,7 +8836,7 @@ TextGetScrollInfoObj(
return TKTEXT_SCROLL_ERROR;
}
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
/*
*----------------------------------------------------------------------
*
@@ -8867,7 +8867,7 @@ FinalizeBaseChunk(
const char *baseChars;
TkTextDispChunk *chunkPtr;
CharInfo *ciPtr;
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
int widthAdjust = 0;
int newwidth;
#endif /* TK_DRAW_IN_CONTEXT */
@@ -8881,7 +8881,7 @@ FinalizeBaseChunk(
for (chunkPtr = baseCharChunkPtr; chunkPtr != NULL;
chunkPtr = chunkPtr->nextPtr) {
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
chunkPtr->x += widthAdjust;
#endif /* TK_DRAW_IN_CONTEXT */
@@ -8894,7 +8894,7 @@ FinalizeBaseChunk(
}
ciPtr->chars = baseChars + ciPtr->baseOffset;
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
newwidth = 0;
CharChunkMeasureChars(chunkPtr, NULL, 0, 0, -1, 0, -1, 0, &newwidth);
if (newwidth < chunkPtr->width) {
@@ -8908,7 +8908,7 @@ FinalizeBaseChunk(
ciPtr = addChunkPtr->clientData;
ciPtr->chars = baseChars + ciPtr->baseOffset;
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
addChunkPtr->x += widthAdjust;
CharChunkMeasureChars(addChunkPtr, NULL, 0, 0, -1, 0, -1, 0,
&addChunkPtr->width);
@@ -9006,7 +9006,7 @@ IsSameFGStyle(
return 1;
}
-#if !TK_DRAW_IN_CONTEXT
+#if !defined(TK_DRAW_IN_CONTEXT)
if (
#ifdef MAC_OSX_TK
!TkMacOSXCompareColors(style1->fgGC->foreground,
@@ -9022,7 +9022,7 @@ IsSameFGStyle(
sv1 = style1->sValuePtr;
sv2 = style2->sValuePtr;
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
return sv1->tkfont == sv2->tkfont && sv1->offset == sv2->offset;
#else
return sv1->tkfont == sv2->tkfont
diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c
index 8622b3e..89f7f2a 100644
--- a/generic/tkTextWind.c
+++ b/generic/tkTextWind.c
@@ -160,7 +160,6 @@ TkTextWindowCmd(
switch ((enum windOptions) optionIndex) {
case WIND_CGET: {
TkTextIndex index;
- TkTextSegment *ewPtr;
Tcl_Obj *objPtr;
TkTextEmbWindowClient *client;
@@ -201,7 +200,6 @@ TkTextWindowCmd(
}
case WIND_CONFIGURE: {
TkTextIndex index;
- TkTextSegment *ewPtr;
if (objc < 4) {
Tcl_WrongNumArgs(interp, 3, objv, "index ?-option value ...?");
diff --git a/generic/tkUtil.c b/generic/tkUtil.c
index 6ff1ee0..0541830 100644
--- a/generic/tkUtil.c
+++ b/generic/tkUtil.c
@@ -1130,7 +1130,7 @@ TkMakeEnsemble(
dictObj = Tcl_NewObj();
for (i = 0; map[i].name != NULL ; ++i) {
- Tcl_Obj *nameObj, *fqdnObj;
+ Tcl_Obj *fqdnObj;
nameObj = Tcl_NewStringObj(map[i].name, -1);
fqdnObj = Tcl_NewStringObj(Tcl_DStringValue(&ds),
diff --git a/generic/ttk/ttkImage.c b/generic/ttk/ttkImage.c
index e6ad27d..d745b74 100644
--- a/generic/ttk/ttkImage.c
+++ b/generic/ttk/ttkImage.c
@@ -263,7 +263,7 @@ typedef struct { /* ClientData for image elements */
Ttk_Padding border; /* Fixed border region */
Ttk_Padding padding; /* Internal padding */
-#if TILE_07_COMPAT
+#ifdef TILE_07_COMPAT
Ttk_ResourceCache cache; /* Resource cache for images */
Ttk_StateMap imageMap; /* State-based lookup table for images */
#endif
@@ -273,7 +273,7 @@ static void FreeImageData(void *clientData)
{
ImageData *imageData = (ImageData *)clientData;
if (imageData->imageSpec) { TtkFreeImageSpec(imageData->imageSpec); }
-#if TILE_07_COMPAT
+#ifdef TILE_07_COMPAT
if (imageData->imageMap) { Tcl_DecrRefCount(imageData->imageMap); }
#endif
ckfree(clientData);
@@ -311,7 +311,7 @@ static void ImageElementDraw(
Ttk_Box src, dst;
(void)elementRecord;
-#if TILE_07_COMPAT
+#ifdef TILE_07_COMPAT
if (imageData->imageMap) {
Tcl_Obj *imageObj = Ttk_StateMapLookup(NULL,imageData->imageMap,state);
if (imageObj) {
@@ -383,7 +383,7 @@ Ttk_CreateImageElement(
imageData->minWidth = imageData->minHeight = -1;
imageData->sticky = TTK_FILL_BOTH;
imageData->border = imageData->padding = Ttk_UniformPadding(0);
-#if TILE_07_COMPAT
+#ifdef TILE_07_COMPAT
imageData->cache = Ttk_GetResourceCache(interp);
imageData->imageMap = 0;
#endif
@@ -398,7 +398,7 @@ Ttk_CreateImageElement(
goto error;
}
-#if TILE_07_COMPAT
+#ifdef TILE_07_COMPAT
if (!strcmp("-map", Tcl_GetString(objv[i]))) {
imageData->imageMap = objv[i+1];
Tcl_IncrRefCount(imageData->imageMap);
diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c
index 7e8d44f..d01c476 100644
--- a/generic/ttk/ttkNotebook.c
+++ b/generic/ttk/ttkNotebook.c
@@ -290,7 +290,7 @@ static void ActivateTab(Notebook *nb, TkSizeT index)
static Ttk_State TabState(Notebook *nb, TkSizeT index)
{
Ttk_State state = nb->core.state;
- Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
+ Tab *itab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
TkSizeT i = 0;
if (index == nb->notebook.currentIndex) {
@@ -322,7 +322,7 @@ static Ttk_State TabState(Notebook *nb, TkSizeT index)
}
break;
}
- if (tab->state == TAB_STATE_DISABLED) {
+ if (itab->state == TAB_STATE_DISABLED) {
state |= TTK_STATE_DISABLED;
}
diff --git a/macosx/Tk-Common.xcconfig b/macosx/Tk-Common.xcconfig
index 6219135..72ef08a 100644
--- a/macosx/Tk-Common.xcconfig
+++ b/macosx/Tk-Common.xcconfig
@@ -23,7 +23,7 @@ GCC_NO_COMMON_BLOCKS = YES
GCC_DYNAMIC_NO_PIC = YES
GCC_VERSION = 4.2
GCC = gcc-$(GCC_VERSION)
-WARNING_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-value -Winit-self -Wpointer-arith -Wcast-align -Wdisabled-optimization -Winline $(WARNING_CFLAGS)
+WARNING_CFLAGS = -Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith -Winit-self -Wcast-align -Wdisabled-optimization -Winline $(WARNING_CFLAGS)
REZ_RESOURCE_MAP_READ_ONLY = YES
APPLICATION_INSTALL_PATH = /Applications/Utilities
BINDIR = $(PREFIX)/bin
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c
index ab28fbf..acbfa0e 100644
--- a/macosx/tkMacOSXColor.c
+++ b/macosx/tkMacOSXColor.c
@@ -31,7 +31,7 @@ static NSAppearance *lightAqua = nil;
static NSAppearance *darkAqua = nil;
#endif
static NSColorSpace* sRGB = NULL;
-static CGFloat windowBackground[4] =
+static const CGFloat WINDOWBACKGROUND[4] =
{236.0 / 255, 236.0 / 255, 236.0 / 255, 1.0};
void initColorTable()
@@ -297,7 +297,7 @@ GetRGBA(
if ([NSApp macOSVersion] < 101400) {
for (int i = 0; i < 3; i++) {
- rgba[i] = windowBackground[i];
+ rgba[i] = WINDOWBACKGROUND[i];
}
} else {
bgColor = [[NSColor windowBackgroundColor] colorUsingColorSpace:sRGB];
diff --git a/macosx/tkMacOSXCursor.c b/macosx/tkMacOSXCursor.c
index 6c36ca7..9371889 100644
--- a/macosx/tkMacOSXCursor.c
+++ b/macosx/tkMacOSXCursor.c
@@ -366,14 +366,13 @@ FindCursorByName(
TkCursor *
TkGetCursorByName(
Tcl_Interp *interp, /* Interpreter to use for error reporting. */
- Tk_Window tkwin, /* Window in which cursor will be used. */
+ TCL_UNUSED(Tk_Window), /* Window in which cursor will be used. */
Tk_Uid string) /* Description of cursor. See manual entry
* for details on legal syntax. */
{
TkMacOSXCursor *macCursorPtr = NULL;
const char **argv = NULL;
int argc;
- (void)tkwin;
/*
* All cursor names are valid lists of one element (for
@@ -421,24 +420,16 @@ TkGetCursorByName(
TkCursor *
TkCreateCursorFromData(
- Tk_Window tkwin, /* Window in which cursor will be used. */
- const char *source, /* Bitmap data for cursor shape. */
- const char *mask, /* Bitmap data for cursor mask. */
- int width, int height, /* Dimensions of cursor. */
- int xHot, int yHot, /* Location of hot-spot in cursor. */
- XColor fgColor, /* Foreground color for cursor. */
- XColor bgColor) /* Background color for cursor. */
+ TCL_UNUSED(Tk_Window), /* Window in which cursor will be used. */
+ TCL_UNUSED(const char *), /* Bitmap data for cursor shape. */
+ TCL_UNUSED(const char *), /* Bitmap data for cursor mask. */
+ TCL_UNUSED(int), /* Dimensions of cursor. */
+ TCL_UNUSED(int),
+ TCL_UNUSED(int), /* Location of hot-spot in cursor. */
+ TCL_UNUSED(int),
+ TCL_UNUSED(XColor), /* Foreground color for cursor. */
+ TCL_UNUSED(XColor)) /* Background color for cursor. */
{
- (void)tkwin;
- (void)source;
- (void)mask;
- (void)width;
- (void)height;
- (void)xHot;
- (void)yHot;
- (void)fgColor;
- (void)bgColor;
-
return NULL;
}
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c
index 1bfd163..8575b10 100644
--- a/macosx/tkMacOSXDialog.c
+++ b/macosx/tkMacOSXDialog.c
@@ -870,15 +870,15 @@ Tk_GetOpenFileObjCmd(
selectedFilterIndex = filterInfo.fileTypeIndex; // The preselection from the typevariable
selectedFilter = [filterInfo.fileTypeNames objectAtIndex:selectedFilterIndex];
} else {
- NSUInteger i;
+ NSUInteger j;
- for (i = 0; i < [filterInfo.fileTypeNames count]; i++) {
- if (filterCompatible(extension, i)) {
- selectedFilterIndex = i;
+ for (j = 0; j < [filterInfo.fileTypeNames count]; j++) {
+ if (filterCompatible(extension, j)) {
+ selectedFilterIndex = j;
break;
}
}
- if (i == selectedFilterIndex) {
+ if (j == selectedFilterIndex) {
selectedFilter = [filterInfo.fileTypeNames objectAtIndex:selectedFilterIndex];
} else {
selectedFilter = @"";
diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c
index 72c83b4..6c66ed8 100644
--- a/macosx/tkMacOSXFont.c
+++ b/macosx/tkMacOSXFont.c
@@ -550,13 +550,12 @@ TkpFontPkgInit(
TkFont *
TkpGetNativeFont(
- Tk_Window tkwin, /* For display where font will be used. */
+ TCL_UNUSED(Tk_Window), /* For display where font will be used. */
const char *name) /* Platform-specific font name. */
{
MacFont *fontPtr = NULL;
ThemeFontID themeFontId;
CTFontRef ctFont;
- (void)tkwin;
if (strcmp(name, SYSTEMFONT_NAME) == 0) {
themeFontId = kThemeSystemFont;
@@ -700,11 +699,10 @@ TkpDeleteFont(
void
TkpGetFontFamilies(
Tcl_Interp *interp, /* Interp to hold result. */
- Tk_Window tkwin) /* For display to query. */
+ TCL_UNUSED(Tk_Window)) /* For display to query. */
{
Tcl_Obj *resultPtr = Tcl_NewListObj(0, NULL);
NSArray *list = [[NSFontManager sharedFontManager] availableFontFamilies];
- (void)tkwin;
for (NSString *family in list) {
Tcl_ListObjAppendElement(NULL, resultPtr,
@@ -774,7 +772,7 @@ TkpGetSubFonts(
void
TkpGetFontAttrsForChar(
- Tk_Window tkwin, /* Window on the font's display */
+ TCL_UNUSED(Tk_Window), /* Window on the font's display */
Tk_Font tkfont, /* Font to query */
int c, /* Character of interest */
TkFontAttributes* faPtr) /* Output: Font attributes */
@@ -784,7 +782,6 @@ TkpGetFontAttrsForChar(
*faPtr = fontPtr->font.fa;
if (nsFont && ![[nsFont coveredCharacterSet] characterIsMember:c]) {
UTF16Char ch = (UTF16Char) c;
- (void)tkwin;
nsFont = [nsFont bestMatchingFontForCharacters:&ch
length:1 attributes:nil actualCoveredLength:NULL];
@@ -1166,7 +1163,7 @@ TkpDrawCharsInContext(
void
TkpDrawAngledCharsInContext(
- Display *display, /* Display on which to draw. */
+ TCL_UNUSED(Display *), /* Display on which to draw. */
Drawable drawable, /* Window or pixmap in which to draw. */
GC gc, /* Graphics context for drawing characters. */
Tk_Font tkfont, /* Font in which characters will be drawn; must
@@ -1200,7 +1197,6 @@ TkpDrawAngledCharsInContext(
NSFont *nsFont;
CGAffineTransform t;
CGFloat width, height, textX = (CGFloat) x, textY = (CGFloat) y;
- (void)display;
if (rangeStart < 0 || rangeLength <= 0 ||
rangeStart + rangeLength > numBytes ||
@@ -1331,12 +1327,9 @@ TkMacOSXNSFontAttributesForFont(
int
TkMacOSXIsCharacterMissing(
- Tk_Font tkfont, /* The font we are looking in. */
- unsigned int searchChar) /* The character we are looking for. */
+ TCL_UNUSED(Tk_Font), /* The font we are looking in. */
+ TCL_UNUSED(unsigned int)) /* The character we are looking for. */
{
- (void)tkfont;
- (void)searchChar;
-
return 0;
}
@@ -1375,7 +1368,7 @@ TkMacOSXFontDescriptionForNSFontAndNSFontAttributes(
objv[i++] = Tcl_NewStringObj(familyName, -1);
objv[i++] = Tcl_NewWideIntObj([nsFont pointSize]);
-#define S(s) Tcl_NewStringObj(STRINGIFY(s), (int)(sizeof(STRINGIFY(s))-1))
+#define S(s) Tcl_NewStringObj(STRINGIFY(s), (sizeof(STRINGIFY(s))-1))
objv[i++] = (traits & NSBoldFontMask) ? S(bold) : S(normal);
objv[i++] = (traits & NSItalicFontMask) ? S(italic) : S(roman);
if ([underline respondsToSelector:@selector(intValue)] &&
diff --git a/macosx/tkMacOSXKeyboard.c b/macosx/tkMacOSXKeyboard.c
index 67ecba3..236ebbc 100644
--- a/macosx/tkMacOSXKeyboard.c
+++ b/macosx/tkMacOSXKeyboard.c
@@ -663,7 +663,7 @@ XKeysymToKeycode(
macKC.x.keychar = (unsigned int) data;
hPtr = Tcl_FindHashEntry(&unichar2xvirtual, INT2PTR(macKC.x.keychar));
if (hPtr != NULL) {
- unsigned long data = (unsigned long) Tcl_GetHashValue(hPtr);
+ data = (unsigned long) Tcl_GetHashValue(hPtr);
macKC.x.xvirtual = (unsigned int) data;
}
}
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c
index bccddc5..8970109 100644
--- a/macosx/tkMacOSXMenu.c
+++ b/macosx/tkMacOSXMenu.c
@@ -36,7 +36,7 @@
#define SPECIALMENU(n, f) {.name = "." #n, .len = sl(#n) + 1, \
.flag = ENTRY_##f##_MENU }
static const struct {
- const char *name; const size_t len; const int flag;
+ const char *name; size_t len; int flag;
} specialMenus[] = {
SPECIALMENU(help, HELP),
SPECIALMENU(apple, APPLE),
@@ -47,8 +47,8 @@ static const struct {
#define MODIFIER(n, f) {.name = #n, .len = sl(#n), .mask = f }
static const struct {
- const char *name; const size_t len; const NSUInteger mask;
-} modifiers[] = {
+ const char *name; size_t len; NSUInteger mask;
+} allModifiers[] = {
MODIFIER(Control, NSControlKeyMask),
MODIFIER(Ctrl, NSControlKeyMask),
MODIFIER(Option, NSAlternateKeyMask),
@@ -64,7 +64,7 @@ static const struct {
#define ACCEL(n, c) {.name = #n, .len = sl(#n), .ch = c }
static const struct {
- const char *name; const size_t len; const UniChar ch;
+ const char *name; size_t len; UniChar ch;
} specialAccelerators[] = {
ACCEL(PageUp, NSPageUpFunctionKey),
ACCEL(PageDown, NSPageDownFunctionKey),
@@ -1230,18 +1230,18 @@ ParseAccelerator(
*maskPtr = 0;
while (1) {
i = 0;
- while (modifiers[i].name) {
- int l = modifiers[i].len;
+ while (allModifiers[i].name) {
+ int l = allModifiers[i].len;
- if (!strncasecmp(accel, modifiers[i].name, l) &&
+ if (!strncasecmp(accel, allModifiers[i].name, l) &&
(accel[l] == '-' || accel[l] == '+')) {
- *maskPtr |= modifiers[i].mask;
+ *maskPtr |= allModifiers[i].mask;
accel += l+1;
break;
}
i++;
}
- if (!modifiers[i].name || !*accel) {
+ if (!allModifiers[i].name || !*accel) {
break;
}
}
@@ -1465,14 +1465,14 @@ TkpComputeStandardMenuGeometry(
}
} else {
NSUInteger modifMask = [menuItem keyEquivalentModifierMask];
- int i = 0;
+ int j = 0;
- while (modifiers[i].name) {
- if (modifMask & modifiers[i].mask) {
- modifMask &= ~modifiers[i].mask;
+ while (allModifiers[j].name) {
+ if (modifMask & allModifiers[j].mask) {
+ modifMask &= ~allModifiers[j].mask;
modifierWidth += modifierCharWidth;
}
- i++;
+ j++;
}
accelWidth = [[menuItem keyEquivalent] sizeWithAttributes:
TkMacOSXNSFontAttributesForFont(tkfont)].width;
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c
index d55ca5a..359f164 100644
--- a/macosx/tkMacOSXMouseEvent.c
+++ b/macosx/tkMacOSXMouseEvent.c
@@ -618,7 +618,7 @@ GenerateButtonEvent(
int dummy;
TkDisplay *dispPtr;
-#if UNUSED
+#ifdef UNUSED
/*
* ButtonDown events will always occur in the front window. ButtonUp
diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c
index 3247ade..e169a7d 100644
--- a/macosx/tkMacOSXNotify.c
+++ b/macosx/tkMacOSXNotify.c
@@ -156,7 +156,7 @@ void DebugPrintQueue(void)
* this block should be removed.
*/
-# if MAC_OSX_VERSION_MAX_ALLOWED >= 101500
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101500
if ([theEvent type] == NSAppKitDefined) {
static Bool aWindowIsMoving = NO;
switch([theEvent subtype]) {
diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h
index 25ce143..701c81f 100644
--- a/macosx/tkMacOSXPrivate.h
+++ b/macosx/tkMacOSXPrivate.h
@@ -103,11 +103,11 @@
* debug message in case of failure.
*/
#define ChkErr(f, ...) ({ \
- OSStatus err = f(__VA_ARGS__); \
- if (err != noErr) { \
- TkMacOSXDbgOSErr(f, err); \
+ OSStatus err_ = f(__VA_ARGS__); \
+ if (err_ != noErr) { \
+ TkMacOSXDbgOSErr(f, err_); \
} \
- err;})
+ err_;})
#else /* TK_MAC_DEBUG */
#define TKLog(f, ...)
diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c
index 8483cbb..3149b15 100644
--- a/macosx/tkMacOSXScrlbr.c
+++ b/macosx/tkMacOSXScrlbr.c
@@ -662,7 +662,7 @@ UpdateControlValues(
*
* ScrollbarEvent --
*
- * This procedure is invoked in response to <ButtonPress>,
+ * This procedure is invoked in response to <Button>,
* <ButtonRelease>, <EnterNotify>, and <LeaveNotify> events. The
* Scrollbar appearance is modified for each event.
*
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index a358bde..d2979f6 100644
--- a/macosx/tkMacOSXSubwindows.c
+++ b/macosx/tkMacOSXSubwindows.c
@@ -14,6 +14,7 @@
#include "tkMacOSXPrivate.h"
#include "tkMacOSXDebug.h"
#include "tkMacOSXWm.h"
+#include "tkMacOSXConstants.h"
/*
#ifdef TK_MAC_DEBUG
@@ -357,15 +358,19 @@ XResizeWindow(
display->request++;
if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) {
- NSWindow *w = macWin->winPtr->wmInfoPtr->window;
+ TKWindow *w = (TKWindow *)macWin->winPtr->wmInfoPtr->window;
if (w) {
- NSRect r = [w contentRectForFrameRect:[w frame]];
-
- r.origin.y += r.size.height - height;
- r.size.width = width;
- r.size.height = height;
- [w setFrame:[w frameRectForContentRect:r] display:YES];
+ if ([w styleMask] & NSFullScreenWindowMask) {
+ [w tkLayoutChanged];
+ } else {
+ NSRect r = [w contentRectForFrameRect:[w frame]];
+
+ r.origin.y += r.size.height - height;
+ r.size.width = width;
+ r.size.height = height;
+ [w setFrame:[w frameRectForContentRect:r] display:NO];
+ }
}
} else {
MoveResizeWindow(macWin);
@@ -421,7 +426,7 @@ XMoveResizeWindow(
X + XOff, TkMacOSXZeroScreenHeight() - Y - YOff - Height,
Width, Height);
- [w setFrame:[w frameRectForContentRect:r] display:YES];
+ [w setFrame:[w frameRectForContentRect:r] display:NO];
}
} else {
MoveResizeWindow(macWin);
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index 98bec7d..c585fa2 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -1013,11 +1013,14 @@ ConfigureRestrictProc(
TkMacOSXUpdateClipRgn(winPtr);
/*
- * Generate and process expose events to redraw the window.
+ * Generate and process expose events to redraw the window. To avoid
+ * crashes, only do this if we are being called from drawRect. See
+ * ticket [1fa8c3ed8d].
*/
- [self generateExposeEvents: [self bounds]];
- [w displayIfNeeded];
+ if([NSApp isDrawing] || [self inLiveResize]) {
+ [self generateExposeEvents: [self bounds]];
+ }
/*
* Finally, unlock the main autoreleasePool.
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 5128631..95b84bf 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -6839,7 +6839,7 @@ ApplyWindowAttributeFlagChanges(
* after 10.10.
*/
-#if !(MAC_OS_X_VERSION_MAX_ALLOWED < 101000)
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101100
if (!(macWindow.styleMask & NSUtilityWindowMask)) {
/*
* Exclude overrideredirect, transient, and "help"-styled
@@ -6861,11 +6861,10 @@ ApplyWindowAttributeFlagChanges(
* window. To work around this we make the max size equal
* to the screen size. (For 10.11 and up, only)
*/
- if ([NSApp macOSVersion] > 101000) {
-#if !(MAC_OS_X_VERSION_MAX_ALLOWED > 101000)
+
+ if (@available(macOS 10.11, *)) {
NSSize screenSize = [[macWindow screen] frame].size;
[macWindow setMaxFullScreenContentSize:screenSize];
-#endif
}
}
}
diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c
index 1a7ce39..8437aa6 100644
--- a/macosx/ttkMacOSXTheme.c
+++ b/macosx/ttkMacOSXTheme.c
@@ -232,11 +232,11 @@ static CGRect NormalizeButtonBounds(
* support Dark Mode anyway.
*/
-static CGFloat windowBackground[4] = {
+static const CGFloat WINDOWBACKGROUND[4] = {
235.0 / 255, 235.0 / 255, 235.0 / 255, 1.0
};
-static CGFloat whiteRGBA[4] = {1.0, 1.0, 1.0, 1.0};
-static CGFloat blackRGBA[4] = {0.0, 0.0, 0.0, 1.0};
+static const CGFloat WHITERGBA[4] = {1.0, 1.0, 1.0, 1.0};
+static const CGFloat BLACKRGBA[4] = {0.0, 0.0, 0.0, 1.0};
/*----------------------------------------------------------------------
* GetBackgroundColor --
@@ -276,7 +276,7 @@ static void GetBackgroundColor(
[windowColor getComponents: rgba];
} else {
for (int i = 0; i < 4; i++) {
- rgba[i] = windowBackground[i];
+ rgba[i] = WINDOWBACKGROUND[i];
}
}
}
@@ -314,7 +314,7 @@ static void DrawDownArrow(
CGRect bounds,
CGFloat inset,
CGFloat size,
- CGFloat *rgba)
+ const CGFloat *rgba)
{
CGFloat x, y;
@@ -336,7 +336,7 @@ static void DrawUpArrow(
CGRect bounds,
CGFloat inset,
CGFloat size,
- CGFloat *rgba)
+ const CGFloat *rgba)
{
CGFloat x, y;
@@ -406,7 +406,7 @@ static void DrawUpDownArrows(
CGRect bounds,
CGFloat inset,
CGFloat size,
- CGFloat *rgba)
+ const CGFloat *rgba)
{
CGFloat x, y;
@@ -633,9 +633,9 @@ static void DrawListHeader(
arrowBounds.origin.x = bounds.origin.x + bounds.size.width - 16;
arrowBounds.size.width = 16;
if (state & TTK_STATE_ALTERNATE) {
- DrawUpArrow(context, arrowBounds, 3, 8, blackRGBA);
+ DrawUpArrow(context, arrowBounds, 3, 8, BLACKRGBA);
} else if (state & TTK_STATE_SELECTED) {
- DrawDownArrow(context, arrowBounds, 3, 8, blackRGBA);
+ DrawDownArrow(context, arrowBounds, 3, 8, BLACKRGBA);
}
}
}
@@ -757,9 +757,9 @@ static void DrawDarkButton(
darkSelectedGradient, 2);
}
if (kind == kThemePopupButton) {
- DrawUpDownArrows(context, arrowBounds, 3, 7, whiteRGBA);
+ DrawUpDownArrows(context, arrowBounds, 3, 7, WHITERGBA);
} else {
- DrawDownArrow(context, arrowBounds, 4, 8, whiteRGBA);
+ DrawDownArrow(context, arrowBounds, 4, 8, WHITERGBA);
}
}
@@ -818,7 +818,7 @@ static void DrawDarkIncDecButton(
darkSelectedGradient, 2);
CGContextRestoreGState(context);
}
- DrawUpDownArrows(context, bounds, 3, 5, whiteRGBA);
+ DrawUpDownArrows(context, bounds, 3, 5, WHITERGBA);
HighlightButtonBorder(context, bounds);
}
@@ -1245,9 +1245,9 @@ static void DrawDarkListHeader(
arrowBounds.origin.x = bounds.origin.x + bounds.size.width - 16;
arrowBounds.size.width = 16;
if (state & TTK_STATE_ALTERNATE) {
- DrawUpArrow(context, arrowBounds, 3, 8, whiteRGBA);
+ DrawUpArrow(context, arrowBounds, 3, 8, WHITERGBA);
} else if (state & TTK_STATE_SELECTED) {
- DrawDownArrow(context, arrowBounds, 3, 8, whiteRGBA);
+ DrawDownArrow(context, arrowBounds, 3, 8, WHITERGBA);
}
}
}
@@ -2137,6 +2137,7 @@ static void TrackElementDraw(
TrackElement *elem = elementRecord;
Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL;
double from = 0, to = 100, value = 0, factor;
+ CGRect bounds;
TtkGetOrientFromObj(NULL, elem->orientObj, &orientation);
Tcl_GetDoubleFromObj(NULL, elem->fromObj, &from);
@@ -2149,7 +2150,7 @@ static void TrackElementDraw(
* bounds variable avoids UBSan (-fsanitize=alignment) complaints.
*/
- CGRect bounds = BoxToRect(d, b);
+ bounds = BoxToRect(d, b);
HIThemeTrackDrawInfo info = {
.version = 0,
.kind = data->kind,
@@ -2175,7 +2176,7 @@ static void TrackElementDraw(
}
BEGIN_DRAWING(d)
if (TkMacOSXInDarkMode(tkwin)) {
- CGRect bounds = BoxToRect(d, b);
+ bounds = BoxToRect(d, b);
NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace];
NSColor *trackColor = [NSColor colorWithColorSpace: deviceRGB
components: darkTrack
@@ -2282,6 +2283,7 @@ static void PbarElementDraw(
Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL;
int phase = 0;
double value = 0, maximum = 100, factor;
+ CGRect bounds;
TtkGetOrientFromObj(NULL, pbar->orientObj, &orientation);
Tcl_GetDoubleFromObj(NULL, pbar->valueObj, &value);
@@ -2294,7 +2296,7 @@ static void PbarElementDraw(
* bounds variable avoids UBSan (-fsanitize=alignment) complaints.
*/
- CGRect bounds = BoxToRect(d, b);
+ bounds = BoxToRect(d, b);
HIThemeTrackDrawInfo info = {
.version = 0,
.kind =
@@ -2314,7 +2316,7 @@ static void PbarElementDraw(
BEGIN_DRAWING(d)
if (TkMacOSXInDarkMode(tkwin)) {
- CGRect bounds = BoxToRect(d, b);
+ bounds = BoxToRect(d, b);
NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace];
NSColor *trackColor = [NSColor colorWithColorSpace: deviceRGB
components: darkTrack
diff --git a/tests/all.tcl b/tests/all.tcl
index 3b6b75f..46721a2 100644
--- a/tests/all.tcl
+++ b/tests/all.tcl
@@ -4,7 +4,7 @@
# tests. Execute it by invoking "source all.tcl" when running tktest
# in this directory.
#
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -17,4 +17,5 @@ tcltest::configure -loadfile \
[file join [tcltest::testsDirectory] constraints.tcl]
tcltest::configure -singleproc 1
set ErrorOnFailures [info exists env(ERROR_ON_FAILURES)]
+encoding system utf-8
if {[tcltest::runAllTests] && $ErrorOnFailures} {exit 1}
diff --git a/tests/bind.test b/tests/bind.test
index 152fe3e..2685946 100644
--- a/tests/bind.test
+++ b/tests/bind.test
@@ -13,6 +13,9 @@ eval tcltest::configure $argv
tcltest::loadTestedCommands
tk useinputmethods 0
+testConstraint nodeprecated [expr {"nodeprecated" ni [tk::pkgconfig list]}]
+
+
toplevel .t -width 100 -height 50
wm geom .t +0+0
update idletasks
@@ -5541,13 +5544,13 @@ test bind-26.6 {event names: ButtonPress} -setup {
focus -force .t.f
update
} -body {
- bind .t.f <ButtonPress> "set x {event ButtonPress}"
+ bind .t.f <Button> "set x {event Button}"
set x xyzzy
- event generate .t.f <ButtonPress>
+ event generate .t.f <Button>
list $x [bind .t.f]
} -cleanup {
destroy .t.f
-} -result {{event ButtonPress} <Button>}
+} -result {{event Button} <Button>}
test bind-26.7 {event names: ButtonRelease} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -5639,9 +5642,9 @@ test bind-26.13 {event names: KeyPress} -setup {
focus -force .t.f
update
} -body {
- bind .t.f <KeyPress> "set x {event KeyPress}"
+ bind .t.f <Key> "set x {event KeyPress}"
set x xyzzy
- event generate .t.f <KeyPress>
+ event generate .t.f <Key>
list $x [bind .t.f]
} -cleanup {
destroy .t.f
@@ -6017,7 +6020,7 @@ test bind-28.9 {keysym names, Eth -> ETH} -body {
} -cleanup {
destroy .t.f
} -result {<Key-ETH>}
-test bind-28.10 {keysym names, Ooblique -> Oslash} -body {
+test bind-28.10 {keysym names, Ooblique -> Oslash} -constraints nodeprecated -body {
frame .t.f -class Test -width 150 -height 100
bind .t.f <Ooblique> foo
bind .t.f
@@ -6764,7 +6767,7 @@ test bind-33.19 {simulate use of the keyboard to trigger a pattern sequence with
set x {}
} -body {
bind .t.f <Escape><Control-c> { lappend x "Esc_Control-c" }
- bind .t.f <Escape><KeyPress><KeyPress><Control-c> { lappend x "Esc_Key(2)_Control-c" }
+ bind .t.f <Escape><Key><Key><Control-c> { lappend x "Esc_Key(2)_Control-c" }
event generate .t.f <Escape>
event generate .t.f <Alt_L>
event generate .t.f <Control_L>
@@ -6883,7 +6886,7 @@ proc testKey {window event type mods} {
global keyInfo numericKeysym
set keyInfo {}
set numericKeysym {}
- bind $window <KeyPress> {
+ bind $window <Key> {
set keyInfo [format "%K,0x%%X,0x%%X,%A" %N %k]
set numericKeysym %N
}
@@ -6957,8 +6960,8 @@ test bind-35.1 {Key events agree for entry widgets} -constraints {aqua} -setup {
test bind-35.2 {Can bind to function keys} -constraints {aqua} -body {
global keyInfo numericKeysym
- bind . <KeyPress> {}
- bind . <KeyPress> {
+ bind . <Key> {}
+ bind . <Key> {
lappend keyInfo %K
set numericKeysym %N
}
@@ -6976,7 +6979,7 @@ test bind-35.3 {Events agree for modifier keys} -constraints {aqua} -setup {
} -body {
global keyInfo numericalKeysym
set result {}
- bind . <KeyPress> {
+ bind . <Key> {
set keyInfo [format "%K,0x%%X,0x%%X,%A" %N %k]
set numericalKeysym [format "0x%x" %N]
}
diff --git a/tests/canvText.test b/tests/canvText.test
index cd8660e..02bca47 100644
--- a/tests/canvText.test
+++ b/tests/canvText.test
@@ -12,6 +12,7 @@ eval tcltest::configure $argv
tcltest::loadTestedCommands
testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
# Canvas used in 1.* - 17.* tests
canvas .c -width 400 -height 300 -bd 2 -relief sunken
@@ -942,7 +943,7 @@ test canvText-19.1 {patch 1006286, leading space caused wrap under Win32} -setup
destroy .c
} -result {{Yeah } Yeah- 4 4}
-test canvText-20.1 {angled text bounding box} -constraints failsOnUbuntu -setup {
+test canvText-20.1 {angled text bounding box} -constraints {failsOnUbuntu failsOnXQuarz} -setup {
destroy .c
canvas .c
proc transpose {bbox} {
diff --git a/tests/clipboard.test b/tests/clipboard.test
index 81534d5..7c1a506 100644
--- a/tests/clipboard.test
+++ b/tests/clipboard.test
@@ -21,6 +21,8 @@ namespace import ::tcltest::*
eval tcltest::configure $argv
tcltest::loadTestedCommands
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
+
# set up a very large buffer to test INCR retrievals
set longValue ""
foreach i {a b c d e f g j h i j k l m o p q r s t u v w x y z} {
@@ -233,7 +235,7 @@ test clipboard-6.1 {Tk_ClipboardAppend procedure} -setup {
} -cleanup {
clipboard clear
} -returnCodes ok -result {first chunk second chunk}
-test clipboard-6.2 {Tk_ClipboardAppend procedure} -constraints x11 -setup {
+test clipboard-6.2 {Tk_ClipboardAppend procedure} -constraints {x11 failsOnXQuarz} -setup {
clipboard clear
} -body {
setupbg
diff --git a/tests/entry.test b/tests/entry.test
index 7ee50dd..6be21e6 100644
--- a/tests/entry.test
+++ b/tests/entry.test
@@ -11,6 +11,10 @@ namespace import ::tcltest::*
eval tcltest::configure $argv
tcltest::loadTestedCommands
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}]
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
+
# For xscrollcommand
set scrollInfo {}
proc scroll args {
@@ -1701,7 +1705,7 @@ test entry-5.7 {ConfigureEntry procedure} -setup {
test entry-5.8 {ConfigureEntry procedure} -constraints {
- fonts
+ fonts failsOnXQuarz
} -setup {
entry .e -borderwidth 2 -highlightthickness 2
pack .e
@@ -2328,7 +2332,7 @@ test entry-8.17 {DeleteChars procedure} -setup {
} -cleanup {
destroy .e
} -result 4
-test entry-8.18 {DeleteChars procedure} -setup {
+test entry-8.18 {DeleteChars procedure} -constraints failsOnUbuntuNoXft -setup {
entry .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
focus .e
diff --git a/tests/focus.test b/tests/focus.test
index 20d25eb..f60d120 100644
--- a/tests/focus.test
+++ b/tests/focus.test
@@ -12,6 +12,7 @@ tcltest::loadTestedCommands
namespace import -force tcltest::test
testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
proc focusSetup {} {
destroy .t
@@ -310,7 +311,7 @@ in .t.b1 NotifyNonlinear
} .t.b1}
test focus-2.6 {TkFocusFilterEvent procedure, FocusIn events} -constraints {
- unix testwrapper failsOnUbuntu
+ unix testwrapper failsOnUbuntu failsOnXQuarz
} -body {
focus .t.b1
focus .
@@ -322,7 +323,7 @@ test focus-2.6 {TkFocusFilterEvent procedure, FocusIn events} -constraints {
list $x $focusInfo
} -result {.t.b1 {press .t.b1 x}}
test focus-2.7 {TkFocusFilterEvent procedure, FocusOut events} -constraints {
- unix testwrapper failsOnUbuntu
+ unix testwrapper failsOnUbuntu failsOnXQuarz
} -body {
set result {}
foreach detail {NotifyAncestor NotifyInferior NotifyNonlinear
@@ -343,7 +344,7 @@ test focus-2.8 {TkFocusFilterEvent procedure, FocusOut events} -constraints {
focus
} -result {.t.b1}
test focus-2.9 {TkFocusFilterEvent procedure, FocusOut events} -constraints {
- unix testwrapper failsOnUbuntu
+ unix testwrapper failsOnUbuntu failsOnXQuarz
} -body {
focus .t.b1
event gen [testwrapper .] <FocusOut> -detail NotifyAncestor
@@ -601,7 +602,7 @@ cleanupbg
# Test 5.1 fails (before and after update)
test focus-5.1 {ChangeXFocus procedure, don't take focus unless have it} -constraints {
- unix testwrapper secureserver failsOnUbuntu
+ unix testwrapper secureserver failsOnUbuntu failsOnXQuarz
} -body {
setupbg
focusSetup
diff --git a/tests/font.test b/tests/font.test
index efa1d7d..df4046e 100644
--- a/tests/font.test
+++ b/tests/font.test
@@ -14,6 +14,8 @@ tcltest::loadTestedCommands
# Some tests require support for 4-byte UTF-8 sequences
testConstraint fullutf [expr {[format %c 0x010000] != "\uFFFD"}]
testConstraint utfcompat [expr {([string length "\U10000"] == 2) && [package vsatisfies [package provide Tcl] 8]}]
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}]
set defaultfontlist [font names]
@@ -61,9 +63,9 @@ test font-1.1 {TkFontPkgInit} -setup {
} -body {
interp create foo
foo eval {
- load {} Tk
- wm geometry . +0+0
- update
+ load {} Tk
+ wm geometry . +0+0
+ update
}
interp delete foo
} -result {}
@@ -77,25 +79,25 @@ test font-2.1 {TkFontPkgFree} -setup {
# Makes sure that named font was visible only to child interp.
foo eval {
- load {} Tk
- wm geometry . +0+0
- button .b -font {times 16} -text "hi"
- pack .b
- font create wiggles -family courier -underline 1
- update
+ load {} Tk
+ wm geometry . +0+0
+ button .b -font {times 16} -text "hi"
+ pack .b
+ font create wiggles -family courier -underline 1
+ update
}
lappend x [catch {font configure wiggles} msg; set msg]
# Tests cancelling the idle handler for TheWorldHasChanged,
# because app goes away before idle serviced.
foo eval {
- .b config -font wiggles
- font config wiggles -size 24
- destroy .
+ .b config -font wiggles
+ font config wiggles -size 24
+ destroy .
}
lappend x [foo eval {catch {font families} msg; set msg}]
} -cleanup {
- interp delete foo
+ interp delete foo
} -result {{named font "wiggles" doesn't exist} {can't invoke "font" command: application has been destroyed}}
@@ -137,7 +139,7 @@ test font-4.8 {font command: actual: all attributes} -body {
# not (objc > 3) so objPtr = NULL
lindex [font actual {-family times}] 0
} -result {-family}
-test font-4.9 {font command: actual} -constraints {unix noExceed} -body {
+test font-4.9 {font command: actual} -constraints {unix noExceed failsOnUbuntu} -body {
# (objc > 3) so objPtr = objv[3 + skip]
string tolower [font actual {-family times} -family]
} -result {times}
@@ -194,7 +196,7 @@ test font-5.4 {font command: configure: get all options} -setup {
font create xyz -family xyz
lindex [font configure xyz] 1
} -cleanup {
- font delete xyz
+ font delete xyz
} -result xyz
test font-5.5 {font command: configure: get one option} -setup {
clearnondefaultfonts
@@ -202,9 +204,9 @@ test font-5.5 {font command: configure: get one option} -setup {
# (objc == 4) so objPtr = objv[3]
font create xyz -family xyz
font configure xyz -family
- getnondefaultfonts
+ getnondefaultfonts
} -cleanup {
- font delete xyz
+ font delete xyz
} -result xyz
test font-5.6 {font command: configure: update existing font} -setup {
catch {font delete xyz}
@@ -215,7 +217,7 @@ test font-5.6 {font command: configure: update existing font} -setup {
update
font configure xyz -family
} -cleanup {
- font delete xyz
+ font delete xyz
} -result xyz
test font-5.7 {font command: configure: bad option} -setup {
catch {font delete xyz}
@@ -223,7 +225,7 @@ test font-5.7 {font command: configure: bad option} -setup {
font create xyz
font configure xyz -style
} -cleanup {
- font delete xyz
+ font delete xyz
} -returnCodes error -result {bad option "-style": must be -family, -size, -weight, -slant, -underline, or -overstrike}
@@ -243,7 +245,7 @@ test font-6.2 {font command: create: name specified} -setup {
font create xyz
getnondefaultfonts
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {xyz}
test font-6.3 {font command: create: name not really specified} -setup {
clearnondefaultfonts
@@ -285,7 +287,7 @@ test font-6.7 {font command: create: already exists} -setup {
font create xyz
font create xyz
} -cleanup {
- font delete xyz
+ font delete xyz
} -returnCodes error -result {named font "xyz" already exists}
test font-7.1 {font command: delete: arguments} -body {
@@ -294,7 +296,7 @@ test font-7.1 {font command: delete: arguments} -body {
} -returnCodes error -result {wrong # args: should be "font delete fontname ?fontname ...?"}
test font-7.2 {font command: delete: loop test} -setup {
clearnondefaultfonts
- set x {}
+ set x {}
} -body {
# for (i = 2; i < objc; i++)
font create a -underline 1
@@ -310,7 +312,7 @@ test font-7.2 {font command: delete: loop test} -setup {
} -result {{a b c d e} d}
test font-7.3 {font command: delete: loop test} -setup {
clearnondefaultfonts
- set x {}
+ set x {}
} -body {
# (namedHashPtr == NULL) in middle of loop
font create a -underline 1
@@ -343,7 +345,7 @@ test font-7.5 {font command: delete: mark for later deletion} -setup {
font actual xyz
font configure xyz
} -cleanup {
- destroy .t.f
+ destroy .t.f
} -returnCodes error -result {named font "xyz" doesn't exist}
test font-7.6 {font command: delete: mark for later deletion} -setup {
destroy .t.f
@@ -357,7 +359,7 @@ test font-7.6 {font command: delete: mark for later deletion} -setup {
font delete xyz
font actual xyz
catch {font configure xyz}
- .t.f cget -font
+ .t.f cget -font
} -cleanup {
destroy .t.f
} -result xyz
@@ -383,7 +385,7 @@ test font-8.3 {font command: families: arguments} -body {
# (objc - skip != 2) when skip == 2
font families -displayof . xyz
} -returnCodes error -result {wrong # args: should be "font families ?-displayof window?"}
-test font-8.4 {font command: families} -body {
+test font-8.4 {font command: families} -constraints failsOnUbuntu -body {
# TkpGetFontFamilies()
regexp -nocase times [font families]
} -result 1
@@ -515,7 +517,7 @@ test font-12.1 {UpdateDependantFonts procedure: no users} -setup {
font create xyz
font configure xyz -family times
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {}
test font-12.2 {UpdateDependantFonts procedure: pings the widgets} -setup {
destroy .t.f
@@ -534,21 +536,21 @@ test font-12.2 {UpdateDependantFonts procedure: pings the widgets} -setup {
set b2 [winfo reqwidth .t.f]
expr {$a1==$b1 && $a2==$b2}
} -cleanup {
- destroy .t.f
+ destroy .t.f
font delete xyz
} -result 1
test font-13.1 {CreateNamedFont: new named font} -setup {
catch {font delete xyz}
- set x {}
+ set x {}
} -body {
# not (new == 0)
lappend x [getnondefaultfonts]
font create xyz
lappend x [getnondefaultfonts]
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {{} xyz}
test font-13.2 {CreateNamedFont: named font already exists} -setup {
catch {font delete xyz}
@@ -557,7 +559,7 @@ test font-13.2 {CreateNamedFont: named font already exists} -setup {
font create xyz
font create xyz
} -cleanup {
- font delete xyz
+ font delete xyz
} -returnCodes error -result {named font "xyz" already exists}
test font-13.3 {CreateNamedFont: named font already exists} -setup {
catch {font delete xyz}
@@ -566,7 +568,7 @@ test font-13.3 {CreateNamedFont: named font already exists} -setup {
font create xyz
font create xyz
} -cleanup {
- font delete xyz
+ font delete xyz
} -returnCodes error -result {named font "xyz" already exists}
test font-13.4 {CreateNamedFont: recreate "deleted" font} -setup {
destroy .t.f
@@ -581,8 +583,8 @@ test font-13.4 {CreateNamedFont: recreate "deleted" font} -setup {
font create xyz -family courier
font configure xyz -family
} -cleanup {
- font delete xyz
- destroy .t.f
+ font delete xyz
+ destroy .t.f
} -result {courier}
@@ -591,7 +593,7 @@ test font-14.1 {Tk_GetFont procedure} -body {
test font-15.1 {Tk_AllocFontFromObj - converting internal reps} -constraints {
- testfont
+ testfont
} -setup {
destroy .b1 .b2
} -body {
@@ -604,7 +606,7 @@ test font-15.1 {Tk_AllocFontFromObj - converting internal reps} -constraints {
destroy .b1 .b2
} -result {{1 0}}
test font-15.2 {Tk_AllocFontFromObj - discard stale font} -constraints {
- testfont
+ testfont
} -setup {
destroy .b1 .b2
set result {}
@@ -619,7 +621,7 @@ test font-15.2 {Tk_AllocFontFromObj - discard stale font} -constraints {
destroy .b2
} -result {{} {{1 1}}}
test font-15.3 {Tk_AllocFontFromObj - reuse existing font} -constraints {
- testfont
+ testfont
} -setup {
destroy .b1 .b2
set result {}
@@ -642,7 +644,7 @@ test font-15.4 {Tk_AllocFontFromObj procedure: bump ref count} -setup {
.t.f config -font {-family fixed}
lindex [font actual {-family fixed}] 0
} -cleanup {
- destroy .t.f
+ destroy .t.f
} -result {-family}
test font-15.5 {Tk_AllocFontFromObj procedure: get named font} -setup {
destroy .t.f
@@ -654,7 +656,7 @@ test font-15.5 {Tk_AllocFontFromObj procedure: get named font} -setup {
font create xyz
.t.f config -font xyz
} -cleanup {
- destroy .t.f
+ destroy .t.f
font delete xyz
} -result {}
test font-15.6 {Tk_AllocFontFromObj procedure: not a named font} -setup {
@@ -665,7 +667,7 @@ test font-15.6 {Tk_AllocFontFromObj procedure: not a named font} -setup {
# not (namedHashPtr != NULL)
.t.f config -font {times 20}
} -cleanup {
- destroy .t.f
+ destroy .t.f
} -result {-family} -result {}
test font-15.7 {Tk_AllocFontFromObj procedure: get native font} -constraints {
unix
@@ -709,7 +711,7 @@ test font-15.11 {Tk_AllocFontFromObj procedure: get attribute font} -body {
lindex [font actual {plan 9}] 0
} -result {-family}
test font-15.12 {Tk_AllocFontFromObj procedure: setup tab width} -setup {
- destroy .l
+ destroy .l
} -body {
# Tk_MeasureChars(fontPtr, "0", ...)
label .l -bd 0 -padx 0 -highlightthickness 0 -font $fixed -text "a\tb"
@@ -718,7 +720,7 @@ test font-15.12 {Tk_AllocFontFromObj procedure: setup tab width} -setup {
set res2 [expr [font measure $fixed "0"]*9]
expr {$res1 eq $res2}
} -cleanup {
- destroy .l
+ destroy .l
} -result 1
test font-15.13 {Tk_AllocFontFromObj procedure: underline position} -setup {
destroy .t.f
@@ -729,7 +731,7 @@ test font-15.13 {Tk_AllocFontFromObj procedure: underline position} -setup {
.t.f config -text "underline" -font "times -8 underline"
update
} -cleanup {
- destroy .t.f
+ destroy .t.f
} -result {}
@@ -741,7 +743,7 @@ test font-16.1 {Tk_NameOfFont procedure} -setup {
.t.f config -font -family\ fixed
.t.f cget -font
} -cleanup {
- destroy .t.f
+ destroy .t.f
} -result {-family fixed}
@@ -927,7 +929,7 @@ test font-21.5 {Tk_PostscriptFontName procedure: spaces} -constraints {
}
} -result {LucidaBright}
test font-21.6 {Tk_PostscriptFontName procedure: spaces} -constraints {
- x11
+ x11 failsOnUbuntu
} -body {
psfontname "{new century schoolbook} 10"
} -result {NewCenturySchlbk-Roman}
@@ -1449,20 +1451,20 @@ test font-21.66 {Tk_PostscriptFontName procedure: exhaustive} -constraints {
test font-22.1 {Tk_TextWidth procedure} -setup {
- destroy .t.l
+ destroy .t.l
} -body {
- label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \
- -text "0" -font "Courier -12"
- pack .t.l
- set ax [winfo reqwidth .t.l]
+ label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \
+ -text "0" -font "Courier -12"
+ pack .t.l
+ set ax [winfo reqwidth .t.l]
expr {[font measure [.t.l cget -font] "000"] eq $ax*3}
} -cleanup {
- destroy .t.l
+ destroy .t.l
} -result 1
test font-23.1 {Tk_UnderlineChars procedure} -setup {
- destroy .t.t
+ destroy .t.t
} -body {
text .t.t
.t.t insert 1.0 abc\tdefg
@@ -1470,7 +1472,7 @@ test font-23.1 {Tk_UnderlineChars procedure} -setup {
.t.t tag add sel 1.0 end
update
} -cleanup {
- destroy .t.t
+ destroy .t.t
} -result {}
@@ -1487,27 +1489,27 @@ test font-24.1 {Tk_ComputeTextLayout: empty string} -body {
} -result {}
test font-24.2 {Tk_ComputeTextLayout: simple string} -body {
.t.l config -text "000"
- update
- list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] \
- [expr {[winfo reqheight .t.l] eq $ay}]
+ update
+ list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] \
+ [expr {[winfo reqheight .t.l] eq $ay}]
} -result {1 1}
test font-24.3 {Tk_ComputeTextLayout: find special chars} -body {
.t.l config -text "000\n000"
- update
- list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] \
- [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
+ update
+ list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] \
+ [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
} -result {1 1}
test font-24.4 {Tk_ComputeTextLayout: calls Tk_MeasureChars} -body {
.t.l config -text "000\n000"
- update
- list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] \
- [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
+ update
+ list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] \
+ [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
} -result {1 1}
test font-24.5 {Tk_ComputeTextLayout: break line} -body {
.t.l config -text "000\t00000" -wrap [expr 9 * $ax]
- update
- list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 8}]}] \
- [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
+ update
+ list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 8}]}] \
+ [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
} -cleanup {
.t.l config -wrap 0
} -result {1 1}
@@ -1516,26 +1518,26 @@ test font-24.6 {Tk_ComputeTextLayout: normal ended on special char} -body {
} -result {}
test font-24.7 {Tk_ComputeTextLayout: special char was \n} -body {
.t.l config -text "000\n0000"
- update
- list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}] \
- [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
+ update
+ list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}] \
+ [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
} -result {1 1}
test font-24.8 {Tk_ComputeTextLayout: special char was \t} -body {
.t.l config -text "000\t00"
- update
- list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 10}]}] \
- [expr {[winfo reqheight .t.l] eq $ay}]
+ update
+ list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 10}]}] \
+ [expr {[winfo reqheight .t.l] eq $ay}]
} -result {1 1}
test font-24.9 {Tk_ComputeTextLayout: tab didn't cause break} -body {
set x {}
.t.l config -text "000\t000"
- update
+ update
lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 11}]}]
- lappend x [expr {[winfo reqheight .t.l] eq $ay}]
+ lappend x [expr {[winfo reqheight .t.l] eq $ay}]
.t.l config -text "000\t000" -wrap [expr 100 * $ax]
- update
+ update
lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 11}]}]
- lappend x [expr {[winfo reqheight .t.l] eq $ay}]
+ lappend x [expr {[winfo reqheight .t.l] eq $ay}]
return $x
} -cleanup {
.t.l config -wrap 0
@@ -1543,13 +1545,13 @@ test font-24.9 {Tk_ComputeTextLayout: tab didn't cause break} -body {
test font-24.10 {Tk_ComputeTextLayout: tab caused break} -body {
set x {}
.t.l config -text "000\t"
- update
+ update
lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 8}]}]
- lappend x [expr {[winfo reqheight .t.l] eq $ay}]
+ lappend x [expr {[winfo reqheight .t.l] eq $ay}]
.t.l config -text "000\t00" -wrap [expr $ax * 6]
- update
- lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 8}]}]
- lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
+ update
+ lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 8}]}]
+ lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
return $x
} -cleanup {
.t.l config -wrap 0
@@ -1557,13 +1559,13 @@ test font-24.10 {Tk_ComputeTextLayout: tab caused break} -body {
test font-24.11 {Tk_ComputeTextLayout: absorb spaces at eol} -body {
set x {}
.t.l config -text "000 000" -wrap [expr {$ax * 5}]
- update
- lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}]
- lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
+ update
+ lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}]
+ lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
.t.l config -text "000 "
- update
- lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}]
- lappend x [expr {[winfo reqheight .t.l] eq $ay}]
+ update
+ lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}]
+ lappend x [expr {[winfo reqheight .t.l] eq $ay}]
return $x
} -cleanup {
.t.l config -wrap 0
@@ -1571,44 +1573,44 @@ test font-24.11 {Tk_ComputeTextLayout: absorb spaces at eol} -body {
test font-24.12 {Tk_ComputeTextLayout: append non-printing spaces to chunk} -body {
set x {}
.t.l config -text "000 0000" -wrap [expr {$ax * 5}]
- update
- lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}]
- lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
+ update
+ lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}]
+ lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
.t.l config -text "000\t00 0000" -wrap [expr {$ax * 12}]
- update
- lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 10}]}]
- lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
+ update
+ lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 10}]}]
+ lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
return $x
} -cleanup {
.t.l config -wrap 0
} -result {1 1 1 1}
test font-24.13 {Tk_ComputeTextLayout: many lines -> realloc line array} -body {
.t.l config -text "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
- update
- list [expr {[winfo reqwidth .t.l] eq 1}] \
- [expr {[winfo reqheight .t.l] eq [expr {$ay * 129}]}]
+ update
+ list [expr {[winfo reqwidth .t.l] eq 1}] \
+ [expr {[winfo reqheight .t.l] eq [expr {$ay * 129}]}]
} -result {1 1}
test font-24.14 {Tk_ComputeTextLayout: text ended with \n} -body {
set x {}
- .t.l config -text "0000"
- update
- lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}]
- lappend x [expr {[winfo reqheight .t.l] eq $ay}]
- .t.l config -text "0000\n"
- update
- lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}]
- lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
- return $x
+ .t.l config -text "0000"
+ update
+ lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}]
+ lappend x [expr {[winfo reqheight .t.l] eq $ay}]
+ .t.l config -text "0000\n"
+ update
+ lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}]
+ lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
+ set x
} -result {1 1 1 1}
destroy .t.l
test font-24.15 {Tk_ComputeTextLayout: justification} -setup {
set x {}
- destroy .t.c
- canvas .t.c -closeenough 0
- .t.c create text 0 0 -tags text -anchor nw -just left -font "Courier -12"
- pack .t.c
- update
+ destroy .t.c
+ canvas .t.c -closeenough 0
+ .t.c create text 0 0 -tags text -anchor nw -just left -font "Courier -12"
+ pack .t.c
+ update
} -body {
csetup "000\n00000"
.t.c itemconfig text -just left
@@ -1620,7 +1622,7 @@ test font-24.15 {Tk_ComputeTextLayout: justification} -setup {
.t.c itemconfig text -just left
return $x
} -cleanup {
- destroy .t.c
+ destroy .t.c
} -result {2 1 0}
@@ -1632,7 +1634,7 @@ test font-25.1 {Tk_FreeTextLayout procedure} -setup {
.t.f config -text foo
.t.f config -text boo
} -cleanup {
- destroy .t.f
+ destroy .t.f
} -result {}
@@ -1649,7 +1651,7 @@ test font-26.1 {Tk_DrawTextLayout procedure: auto-detect last char} -setup {
} -body {
.t.f config -text foo
} -cleanup {
- destroy .t.f
+ destroy .t.f
} -result {}
test font-26.2 {Tk_DrawTextLayout procedure: multiple chunks} -body {
csetup "000\t00\n000"
@@ -1794,110 +1796,110 @@ pack .t.c
update
test font-30.1 {Tk_DistanceToTextLayout procedure: loop once} -body {
csetup "000\n000\n000"
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x 0 -y 0
return $x
} -cleanup {
- bind all <Enter> {}
+ bind all <Enter> {}
} -result 0
test font-30.2 {Tk_DistanceToTextLayout procedure: loop multiple} -body {
csetup "000\n000\n000"
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x $ax -y $ay
return $x
} -cleanup {
- bind all <Enter> {}
+ bind all <Enter> {}
} -result 5
test font-30.3 {Tk_DistanceToTextLayout procedure: loop to end} -body {
csetup "000\n0\n000"
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x [expr $ax*2] -y $ay
return $x
} -cleanup {
- bind all <Enter> {}
+ bind all <Enter> {}
} -result {}
test font-30.4 {Tk_DistanceToTextLayout procedure: hit a special char (tab)} -body {
csetup "000\t000\n000"
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x [expr $ax*6] -y 0
return $x
} -cleanup {
- bind all <Enter> {}
+ bind all <Enter> {}
} -result 3
test font-30.5 {Tk_DistanceToTextLayout procedure: ignore newline} -body {
csetup "000\n0\n000"
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x [expr $ax*2] -y $ay
return $x
} -cleanup {
- bind all <Enter> {}
+ bind all <Enter> {}
} -result {}
test font-30.6 {Tk_DistanceToTextLayout procedure: ignore spaces at eol} -body {
csetup "000\n000 000000000"
.t.c itemconfig text -width [expr $ax*10]
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x [expr $ax*5] -y $ay
.t.c itemconfig text -width 0
return $x
} -cleanup {
- bind all <Enter> {}
+ bind all <Enter> {}
} -result {}
.t.c itemconfig text -justify center
test font-30.7 {Tk_DistanceToTextLayout procedure: on left side} -body {
csetup "0\n000"
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x 0 -y 0
return $x
} -cleanup {
- bind all <Enter> {}
+ bind all <Enter> {}
} -result {}
test font-30.8 {Tk_DistanceToTextLayout procedure: on right side} -body {
csetup "0\n000"
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x [expr $ax*2] -y 0
return $x
} -cleanup {
- bind all <Enter> {}
+ bind all <Enter> {}
} -result {}
test font-30.9 {Tk_DistanceToTextLayout procedure: inside line} -body {
csetup "0\n000"
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x $ax -y 0
return $x
} -cleanup {
- bind all <Enter> {}
+ bind all <Enter> {}
} -result 0
test font-30.10 {Tk_DistanceToTextLayout procedure: above line} -body {
csetup "0\n000"
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x 0 -y 0
return $x
} -cleanup {
- bind all <Enter> {}
+ bind all <Enter> {}
} -result {}
test font-30.11 {Tk_DistanceToTextLayout procedure: below line} -body {
csetup "000\n0"
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x 0 -y $ay
@@ -1907,7 +1909,7 @@ test font-30.11 {Tk_DistanceToTextLayout procedure: below line} -body {
} -result {}
test font-30.12 {Tk_DistanceToTextLayout procedure: in line} -body {
csetup "0\n000"
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x $ax -y $ay
@@ -1918,13 +1920,13 @@ test font-30.12 {Tk_DistanceToTextLayout procedure: in line} -body {
.t.c itemconfig text -justify left
test font-30.13 {Tk_DistanceToTextLayout procedure: exact hit} -body {
csetup "000"
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x $ax -y 0
return $x
} -cleanup {
- bind all <Enter> {}
+ bind all <Enter> {}
} -result 1
destroy .t.c
@@ -1976,11 +1978,11 @@ destroy .t.c
test font-32.1 {Tk_TextLayoutToPostscript: ensure buffer doesn't overflow} -setup {
- destroy .t.c
- canvas .t.c -closeenough 0
- .t.c create text 0 0 -tags text -anchor nw -just left -font "Courier -12"
- pack .t.c
- update
+ destroy .t.c
+ canvas .t.c -closeenough 0
+ .t.c create text 0 0 -tags text -anchor nw -just left -font "Courier -12"
+ pack .t.c
+ update
} -body {
# If there were a whole bunch of returns or tabs in a row, then the
# temporary buffer could overflow and write on the stack.
@@ -1993,7 +1995,7 @@ test font-32.1 {Tk_TextLayoutToPostscript: ensure buffer doesn't overflow} -setu
set i [string first "(qwerty" $x]
string range $x $i [expr {$i + 278}]
} -cleanup {
- destroy .t.c
+ destroy .t.c
} -result {(qwertyuiopasdfghjklzxcvbnm1234qwertyuiopasdfghjklzxcvbnm)]
[(qwertyuiopasdfghjklzxcvbnm1234qwertyuiopasdfghjklzxcvbnm)]
[()]
@@ -2051,85 +2053,85 @@ test font-34.2 {ConfigAttributesObj procedure: arguments} -setup {
test font-34.3 {ConfigAttributesObj procedure: family} -setup {
catch {font delete xyz}
- set x {}
+ set x {}
} -body {
- font create xyz -family xyz
- lappend x [font config xyz -family]
- font config xyz -family times
- lappend x [font config xyz -family]
+ font create xyz -family xyz
+ lappend x [font config xyz -family]
+ font config xyz -family times
+ lappend x [font config xyz -family]
} -cleanup {
font delete xyz
} -result {xyz times}
test font-34.4 {ConfigAttributesObj procedure: size} -setup {
catch {font delete xyz}
- set x {}
+ set x {}
} -body {
- font create xyz -size 20
- lappend x [font config xyz -size]
- font config xyz -size 40
- lappend x [font config xyz -size]
+ font create xyz -size 20
+ lappend x [font config xyz -size]
+ font config xyz -size 40
+ lappend x [font config xyz -size]
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {20 40}
test font-34.5 {ConfigAttributesObj procedure: weight} -setup {
catch {font delete xyz}
- set x {}
+ set x {}
} -body {
- font create xyz -weight normal
- lappend x [font config xyz -weight]
- font config xyz -weight bold
- lappend x [font config xyz -weight]
+ font create xyz -weight normal
+ lappend x [font config xyz -weight]
+ font config xyz -weight bold
+ lappend x [font config xyz -weight]
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {normal bold}
test font-34.6 {ConfigAttributesObj procedure: slant} -setup {
catch {font delete xyz}
- set x {}
+ set x {}
} -body {
- font create xyz -slant roman
- lappend x [font config xyz -slant]
- font config xyz -slant italic
- lappend x [font config xyz -slant]
+ font create xyz -slant roman
+ lappend x [font config xyz -slant]
+ font config xyz -slant italic
+ lappend x [font config xyz -slant]
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {roman italic}
test font-34.7 {ConfigAttributesObj procedure: underline} -setup {
catch {font delete xyz}
- set x {}
+ set x {}
} -body {
- font create xyz -underline 0
- lappend x [font config xyz -underline]
- font config xyz -underline 1
- lappend x [font config xyz -underline]
+ font create xyz -underline 0
+ lappend x [font config xyz -underline]
+ font config xyz -underline 1
+ lappend x [font config xyz -underline]
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {0 1}
test font-34.8 {ConfigAttributesObj procedure: overstrike} -setup {
catch {font delete xyz}
- set x {}
+ set x {}
} -body {
- font create xyz -overstrike 0
- lappend x [font config xyz -overstrike]
- font config xyz -overstrike 1
- lappend x [font config xyz -overstrike]
+ font create xyz -overstrike 0
+ lappend x [font config xyz -overstrike]
+ font config xyz -overstrike 1
+ lappend x [font config xyz -overstrike]
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {0 1}
test font-34.9 {ConfigAttributesObj procedure: size} -body {
- font create xyz -size xyz
+ font create xyz -size xyz
} -returnCodes error -result {expected integer but got "xyz"}
test font-34.10 {ConfigAttributesObj procedure: weight} -body {
- font create xyz -weight xyz
+ font create xyz -weight xyz
} -returnCodes error -result {bad -weight value "xyz": must be normal, or bold}
test font-34.11 {ConfigAttributesObj procedure: slant} -body {
- font create xyz -slant xyz
+ font create xyz -slant xyz
} -returnCodes error -result {bad -slant value "xyz": must be roman, or italic}
test font-34.12 {ConfigAttributesObj procedure: underline} -body {
- font create xyz -underline xyz
+ font create xyz -underline xyz
} -returnCodes error -result {expected boolean value but got "xyz"}
test font-34.13 {ConfigAttributesObj procedure: overstrike} -body {
- font create xyz -overstrike xyz
+ font create xyz -overstrike xyz
} -returnCodes error -result {expected boolean value but got "xyz"}
@@ -2140,7 +2142,7 @@ test font-35.1 {GetAttributeInfoObj procedure: one attribute} -setup {
font create xyz -family xyz
font config xyz -family
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {xyz}
@@ -2151,7 +2153,7 @@ test font-36.1 {GetAttributeInfoObj procedure: unknown attribute} -setup {
font create xyz
font config xyz -xyz
} -cleanup {
- font delete xyz
+ font delete xyz
} -returnCodes {
error
} -result {bad option "-xyz": must be -family, -size, -weight, -slant, -underline, or -overstrike}
@@ -2164,60 +2166,60 @@ test font-37.1 {GetAttributeInfoObj procedure: all attributes} -setup {
font create xyz -family xyz
font config xyz
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {-family xyz -size 0 -weight normal -slant roman -underline 0 -overstrike 0}
test font-37.2 {GetAttributeInfo procedure: family} -setup {
catch {font delete xyz}
} -body {
- font create xyz -family xyz
- font config xyz -family
+ font create xyz -family xyz
+ font config xyz -family
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {xyz}
test font-37.3 {GetAttributeInfo procedure: size} -setup {
catch {font delete xyz}
- set x {}
+ set x {}
} -body {
- font create xyz -size 20
- font config xyz -size
+ font create xyz -size 20
+ font config xyz -size
} -cleanup {
- font delete xyz
+ font delete xyz
} -result 20
test font-37.4 {GetAttributeInfo procedure: weight} -setup {
catch {font delete xyz}
- set x {}
+ set x {}
} -body {
- font create xyz -weight normal
- font config xyz -weight
+ font create xyz -weight normal
+ font config xyz -weight
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {normal}
test font-37.5 {GetAttributeInfo procedure: slant} -setup {
catch {font delete xyz}
- set x {}
+ set x {}
} -body {
- font create xyz -slant italic
- font config xyz -slant
+ font create xyz -slant italic
+ font config xyz -slant
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {italic}
test font-37.6 {GetAttributeInfo procedure: underline} -setup {
catch {font delete xyz}
- set x {}
+ set x {}
} -body {
- font create xyz -underline yes
- font config xyz -underline
+ font create xyz -underline yes
+ font config xyz -underline
} -cleanup {
- font delete xyz
+ font delete xyz
} -result 1
test font-37.7 {GetAttributeInfo procedure: overstrike} -setup {
catch {font delete xyz}
- set x {}
+ set x {}
} -body {
- font create xyz -overstrike no
- font config xyz -overstrike
+ font create xyz -overstrike no
+ font config xyz -overstrike
} -cleanup {
- font delete xyz
+ font delete xyz
} -result 0
@@ -2256,7 +2258,7 @@ test font-38.10 {ParseFontNameObj procedure: arguments} -body {
font actual {times xyz xyz}
} -returnCodes error -result {expected integer but got "xyz"}
test font-38.11 {ParseFontNameObj procedure: stylelist loop} -constraints {
- unixOrWin
+ unixOrWin failsOnUbuntuNoXft
} -body {
lrange [font actual {times 12 bold italic overstrike underline}] 4 end
} -result {-weight bold -slant italic -underline 1 -overstrike 1}
@@ -2338,21 +2340,21 @@ test font-43.1 {FieldSpecified procedure: specified vs. non-specified} -body {
} -result [font actual {times 0} -family]
-test font-44.1 {TkFontGetPixels: size < 0} -setup {
- set oldscale [tk scaling]
+test font-44.1 {TkFontGetPixels: size < 0} -constraints failsOnUbuntuNoXft -setup {
+ set oldscale [tk scaling]
} -body {
- tk scaling 0.5
+ tk scaling 0.5
font actual {times -12} -size
} -cleanup {
- tk scaling $oldscale
+ tk scaling $oldscale
} -result 24
-test font-44.2 {TkFontGetPoints: size >= 0} -constraints noExceed -setup {
- set oldscale [tk scaling]
+test font-44.2 {TkFontGetPoints: size >= 0} -constraints {noExceed failsOnUbuntuNoXft} -setup {
+ set oldscale [tk scaling]
} -body {
- tk scaling 0.5
+ tk scaling 0.5
font actual {times 12} -size
} -cleanup {
- tk scaling $oldscale
+ tk scaling $oldscale
} -result 12
@@ -2374,12 +2376,12 @@ test font-45.3 {TkFontGetAliasList: match} -constraints {noExceed} -body {
test font-46.1 {font actual, with character, no option, no --} -body {
- font actual {times 10} a
+ font actual {times 10} a
} -match glob -result [list -family [font actual {times 10} -family] -size *\
-slant roman -underline 0 -overstrike 0]
test font-46.2 {font actual, with character introduced by --} -body {
- font actual {times 10} -- -
+ font actual {times 10} -- -
} -match glob -result [list -family [font actual {times 10} -family] -size *\
-slant roman -underline 0 -overstrike 0]
diff --git a/tests/fontchooser.test b/tests/fontchooser.test
index 97ca859..a9f914d 100644
--- a/tests/fontchooser.test
+++ b/tests/fontchooser.test
@@ -6,6 +6,9 @@ package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}]
+
# the following helper functions are related to the functions used
# in winDialog.test where they are used to send messages to the win32
# dialog (hence the wierdness).
@@ -179,7 +182,7 @@ test fontchooser-4.3 {fontchooser -font} -constraints scriptImpl -body {
expr {$::testfont ne {}}
} -result 1
-test fontchooser-4.4 {fontchooser -font} -constraints scriptImpl -body {
+test fontchooser-4.4 {fontchooser -font} -constraints {scriptImpl failsOnUbuntuNoXft} -body {
start {
tk::fontchooser::Configure -command ApplyFont -font {times 14 bold}
tk::fontchooser::Show
diff --git a/tests/grid.test b/tests/grid.test
index 7f66e0d..b033311 100644
--- a/tests/grid.test
+++ b/tests/grid.test
@@ -45,7 +45,7 @@ test grid-1.1 {basic argument checking} -body {
} -returnCodes error -result {wrong # args: should be "grid option arg ?arg ...?"}
test grid-1.2 {basic argument checking} -body {
grid foo bar
-} -returnCodes error -match glob -result {bad option "foo": must be anchor, bbox, columnconfigure, configure, content, forget, info, location, propagate, remove, rowconfigure, *size*}
+} -returnCodes error -result {bad option "foo": must be anchor, bbox, columnconfigure, configure, content, forget, info, location, propagate, remove, rowconfigure, or size}
test grid-1.3 {basic argument checking} -body {
button .b
grid .b -row 0 -column
diff --git a/tests/image.test b/tests/image.test
index 7eaa404..2203b6a 100644
--- a/tests/image.test
+++ b/tests/image.test
@@ -313,11 +313,9 @@ test image-6.1 {Tk_ImageCmd procedure, "types" option} -constraints {
} -body {
image types x
} -returnCodes error -result {wrong # args: should be "image types"}
-test image-6.2 {Tk_ImageCmd procedure, "types" option} -constraints {
- testOldImageType
-} -body {
+test image-6.2 {Tk_ImageCmd procedure, "types" option} -body {
lsort [image types]
-} -result {bitmap oldtest photo test}
+} -match glob -result {bitmap*photo test}
test image-7.1 {Tk_ImageCmd procedure, "width" option} -body {
diff --git a/tests/imgPhoto.test b/tests/imgPhoto.test
index c4b4755..2e7ca4c 100644
--- a/tests/imgPhoto.test
+++ b/tests/imgPhoto.test
@@ -129,7 +129,9 @@ testConstraint hasTeapotPhoto [file exists $teapotPhotoFile]
# let's see if we have the semi-transparent one as well
set transpTeapotPhotoFile [file join [file dirname [info script]] teapotTransparent.png]
testConstraint hasTranspTeapotPhoto [file exists $transpTeapotPhotoFile]
-
+testConstraint needsTcl867 [package vsatisfies [package provide Tcl] 8.6.7-]
+
+
test imgPhoto-1.1 {options for photo images} -body {
image create photo photo1 -width 79 -height 83
list [photo1 cget -width] [photo1 cget -height] \
@@ -264,8 +266,9 @@ test imgPhoto-3.4 {ImgPhotoConfigureModel: -data <ppm>} -constraints {
} -cleanup {
imageCleanup
} -result {20 20}
+# This testcase fails with Tcl < 8.6.7, due to [25842c]
test imgPhoto-3.5 {ImgPhotoConfigureModel: -data <png>} -constraints {
- hasTeapotPhoto
+ hasTeapotPhoto needsTcl867
} -setup {
image create photo photo1 -file $teapotPhotoFile
image create photo photo2
@@ -1332,10 +1335,10 @@ test imgPhoto-4.117 {ImgPhotoCmd data: list colorformat} -setup {
} -body {
photo1 data -format {default -colorformat list}
} -result {{{255 0 0 170} {0 128 0 255}} {{0 0 255 204} {255 255 255 221}}}
+# This testcase fails with Tcl < 8.6.7, due to [25842c]
test imgPhoto-4.118 {ImgPhotoCmd data: using data for new image
results in same image as orignial } -constraints {
- hasTeapotPhoto
- hasTranspTeapotPhoto
+ hasTeapotPhoto hasTranspTeapotPhoto needsTcl867
} -setup {
image create photo teapot -file $teapotPhotoFile
teapot copy teapot -from 50 60 70 80 -shrink
diff --git a/tests/oldpack.test b/tests/oldpack.test
index 35fd0f6..c3676ec 100644
--- a/tests/oldpack.test
+++ b/tests/oldpack.test
@@ -457,10 +457,10 @@ test oldpack-8.2 {syntax errors} -body {
} -returnCodes error -result {wrong # args: should be "pack option arg ?arg ...?"}
test oldpack-8.3 {syntax errors} -body {
pack gorp foo
-} -returnCodes error -match glob -result {bad option "gorp": must be configure, content, forget, info, *propagate*}
+} -returnCodes error -result {bad option "gorp": must be configure, content, forget, info, or propagate}
test oldpack-8.4 {syntax errors} -body {
pack a .pack
-} -returnCodes error -match glob -result {bad option "a": must be configure, content, forget, info, *propagate*}
+} -returnCodes error -result {bad option "a": must be configure, content, forget, info, or propagate}
test oldpack-8.5 {syntax errors} -body {
pack after foobar
} -returnCodes error -result {bad window path name "foobar"}
diff --git a/tests/pack.test b/tests/pack.test
index 02008c7..ba50d78 100644
--- a/tests/pack.test
+++ b/tests/pack.test
@@ -12,6 +12,7 @@ tcltest::loadTestedCommands
namespace import -force tcltest::test
testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
# Create some test windows.
@@ -1361,7 +1362,7 @@ test pack-12.46 {command options and errors} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
pack lousy .pack
-} -returnCodes error -match glob -result {bad option "lousy": must be configure, content, forget, info, *propagate*}
+} -returnCodes error -result {bad option "lousy": must be configure, content, forget, info, or propagate}
test pack-13.1 {window deletion} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d .pack.right .pack.bottom
@@ -1543,7 +1544,7 @@ if {[tk windowingsystem] == "win32"} {
}
test pack-18.1 {unmap content when container unmapped} -constraints {
- tempNotPc failsOnUbuntu
+ tempNotPc failsOnUbuntu failsOnXQuarz
} -setup {
eval destroy [winfo child .pack]
} -body {
@@ -1573,7 +1574,7 @@ test pack-18.1 {unmap content when container unmapped} -constraints {
lappend result [winfo ismapped .pack.a]
} -result {1 0 200 75 0 1}
-test pack-18.2 {unmap content when container unmapped} -constraints failsOnUbuntu -setup {
+test pack-18.2 {unmap content when container unmapped} -constraints {failsOnUbuntu failsOnXQuarz} -setup {
eval destroy [winfo child .pack]
} -body {
# adjust the position of .pack before test to avoid a screen switch
diff --git a/tests/pkgconfig.test b/tests/pkgconfig.test
index e080b91..f07ca0f 100644
--- a/tests/pkgconfig.test
+++ b/tests/pkgconfig.test
@@ -18,7 +18,9 @@ namespace import ::tcltest::*
eval tcltest::configure $argv
tcltest::loadTestedCommands
-test pkgconfig-1.1 {query keys} nonwin {
+testConstraint nodeprecated [expr {"nodeprecated" ni [tk::pkgconfig list]}]
+
+test pkgconfig-1.1 {query keys} nodeprecated {
lsort [::tk::pkgconfig list]
} [list \
64bit bindir,install bindir,runtime debug demodir,install demodir,runtime \
diff --git a/tests/place.test b/tests/place.test
index 3ef1de7..4bf9689 100644
--- a/tests/place.test
+++ b/tests/place.test
@@ -14,6 +14,7 @@ tcltest::loadTestedCommands
testConstraint memory [llength [info commands memory]]
testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
# XXX - This test file is woefully incomplete. At present, only a
# few of the features are tested.
@@ -269,7 +270,7 @@ if {[tk windowingsystem] == "win32"} {
}
}
-test place-8.1 {PlaceStructureProc, mapping and unmapping content} -constraints failsOnUbuntu -setup {
+test place-8.1 {PlaceStructureProc, mapping and unmapping content} -constraints {failsOnUbuntu failsOnXQuarz} -setup {
place forget .t.f2
place forget .t.f
} -body {
@@ -285,7 +286,7 @@ test place-8.1 {PlaceStructureProc, mapping and unmapping content} -constraints
placeUpdate
lappend result [winfo ismapped .t.f2]
} -result {1 0 40 30 0 1}
-test place-8.2 {PlaceStructureProc, mapping and unmapping content} -constraints failsOnUbuntu -setup {
+test place-8.2 {PlaceStructureProc, mapping and unmapping content} -constraints {failsOnUbuntu failsOnXQuarz} -setup {
place forget .t.f2
place forget .t.f
update idletasks
@@ -331,7 +332,7 @@ test place-9.5 {PlaceObjCmd} -setup {
place badopt .foo
} -cleanup {
destroy .foo
-} -returnCodes error -match glob -result {bad option "badopt": must be configure, content, forget, *info*}
+} -returnCodes error -result {bad option "badopt": must be configure, content, forget, or info}
test place-9.6 {PlaceObjCmd, configure errors} -setup {
destroy .foo
} -body {
diff --git a/tests/safe.test b/tests/safe.test
index 5a2cd26..31cb1b7 100644
--- a/tests/safe.test
+++ b/tests/safe.test
@@ -35,7 +35,10 @@ namespace import -force tcltest::test
set hidden_cmds [list bell cd clipboard encoding exec exit \
fconfigure glob grab load menu open pwd selection \
- socket source tcl:encoding:dirs toplevel unload wm]
+ socket source toplevel unload wm]
+if {[package vsatisfies [package provide Tcl] 8.6.7-]} {
+ lappend hidden_cmds tcl:encoding:dirs
+}
if {[package vsatisfies [package provide Tcl] 8.7-]} {
lappend hidden_cmds file tcl:encoding:system tcl:file:tempdir
foreach cmd {
diff --git a/tests/scrollbar.test b/tests/scrollbar.test
index 20ac275..6601099 100644
--- a/tests/scrollbar.test
+++ b/tests/scrollbar.test
@@ -12,6 +12,8 @@ eval tcltest::configure $argv
tcltest::loadTestedCommands
testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
+testConstraint nodeprecated [expr {"nodeprecated" ni [tk::pkgconfig list]}]
proc scroll args {
global scrollInfo
@@ -272,13 +274,13 @@ test scrollbar-3.35 {ScrollbarWidgetCmd procedure, "fraction" option} {
format {%.6g} [.s fraction 4 21]
} [format %.6g [expr {(21.0 - ([winfo height .s] - [getTroughSize .s])/2.0) \
/([getTroughSize .s] - 1)}]]
-test scrollbar-3.36 {ScrollbarWidgetCmd procedure, "fraction" option} {x11 failsOnUbuntu} {
+test scrollbar-3.36 {ScrollbarWidgetCmd procedure, "fraction" option} {x11 failsOnUbuntu failsOnXQuarz} {
format {%.6g} [.s fraction 4 179]
} 1
test scrollbar-3.37 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics} {
format {%.6g} [.s fraction 4 [expr {200 - [testmetrics cyvscroll .s]}]]
} 1
-test scrollbar-3.38 {ScrollbarWidgetCmd procedure, "fraction" option} {x11 failsOnUbuntu} {
+test scrollbar-3.38 {ScrollbarWidgetCmd procedure, "fraction" option} {x11 failsOnUbuntu failsOnXQuarz} {
format {%.6g} [.s fraction 4 178]
} {0.993711}
test scrollbar-3.39 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics win} {
@@ -316,7 +318,7 @@ destroy .t
test scrollbar-3.43 {ScrollbarWidgetCmd procedure, "get" option} {
list [catch {.s get a} msg] $msg
} {1 {wrong # args: should be ".s get"}}
-test scrollbar-3.44 {ScrollbarWidgetCmd procedure, "get" option} {
+test scrollbar-3.44 {ScrollbarWidgetCmd procedure, "get" option} nodeprecated {
.s set 100 10 13 14
.s get
} {100 10 13 14}
@@ -401,27 +403,27 @@ test scrollbar-3.63 {ScrollbarWidgetCmd procedure, "set" option} {
}
set result
} {0.4 0.4}
-test scrollbar-3.64 {ScrollbarWidgetCmd procedure, "set" option} {
+test scrollbar-3.64 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
list [catch {.s set abc def ghi jkl} msg] $msg
} {1 {expected integer but got "abc"}}
-test scrollbar-3.65 {ScrollbarWidgetCmd procedure, "set" option} {
+test scrollbar-3.65 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
list [catch {.s set 1 def ghi jkl} msg] $msg
} {1 {expected integer but got "def"}}
-test scrollbar-3.66 {ScrollbarWidgetCmd procedure, "set" option} {
+test scrollbar-3.66 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
list [catch {.s set 1 2 ghi jkl} msg] $msg
} {1 {expected integer but got "ghi"}}
-test scrollbar-3.67 {ScrollbarWidgetCmd procedure, "set" option} {
+test scrollbar-3.67 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
list [catch {.s set 1 2 3 jkl} msg] $msg
} {1 {expected integer but got "jkl"}}
-test scrollbar-3.68 {ScrollbarWidgetCmd procedure, "set" option} {
+test scrollbar-3.68 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
.s set -10 50 20 30
.s get
} {0 50 0 0}
-test scrollbar-3.69 {ScrollbarWidgetCmd procedure, "set" option} {
+test scrollbar-3.69 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
.s set 100 -10 20 30
.s get
} {100 0 20 30}
-test scrollbar-3.70 {ScrollbarWidgetCmd procedure, "set" option} {
+test scrollbar-3.70 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
.s set 100 50 30 20
.s get
} {100 50 30 30}
@@ -493,7 +495,7 @@ test scrollbar-6.11.2 {ScrollbarPosition procedure} aqua {
# macOS scrollbars have no arrows nowadays
.s identify 8 4
} {trough1}
-test scrollbar-6.12.1 {ScrollbarPosition procedure} {x11 failsOnUbuntu} {
+test scrollbar-6.12.1 {ScrollbarPosition procedure} {x11 failsOnUbuntu failsOnXQuarz} {
.s identify 8 19
} {arrow1}
test scrollbar-6.12.2 {ScrollbarPosition procedure} aqua {
@@ -551,7 +553,7 @@ test scrollbar-6.28 {ScrollbarPosition procedure} {testmetrics win} {
.s identify [expr {[winfo width .s] / 2}] [expr {[winfo height .s]
- [testmetrics cyvscroll .s] - 1}]
} {trough2}
-test scrollbar-6.29.1 {ScrollbarPosition procedure} {x11 failsOnUbuntu} {
+test scrollbar-6.29.1 {ScrollbarPosition procedure} {x11 failsOnUbuntu failsOnXQuarz} {
.s identify 8 180
} {arrow2}
test scrollbar-6.29.2 {ScrollbarPosition procedure} aqua {
@@ -575,7 +577,7 @@ test scrollbar-6.33 {ScrollbarPosition procedure} win {
test scrollbar-6.34 {ScrollbarPosition procedure} unix {
.s identify 4 100
} {trough2}
-test scrollbar-6.35 {ScrollbarPosition procedure} {unix failsOnUbuntu} {
+test scrollbar-6.35 {ScrollbarPosition procedure} {unix failsOnUbuntu failsOnXQuarz} {
.s identify 18 100
} {trough2}
test scrollbar-6.37 {ScrollbarPosition procedure} win {
@@ -614,7 +616,7 @@ test scrollbar-6.43 {ScrollbarPosition procedure} {testmetrics win} {
.t.s identify [expr {int(.4 / [.t.s delta 1 0]) + [testmetrics cxhscroll .t.s]
- 1}] [expr {[winfo height .t.s] / 2}]
} {slider}
-test scrollbar-6.44 {ScrollbarPosition procedure} {unix failsOnUbuntu} {
+test scrollbar-6.44 {ScrollbarPosition procedure} {unix failsOnUbuntu failsOnXQuarz} {
.t.s identify 100 18
} {trough2}
test scrollbar-6.46 {ScrollbarPosition procedure} win {
diff --git a/tests/select.test b/tests/select.test
index 9146397..31d6494 100644
--- a/tests/select.test
+++ b/tests/select.test
@@ -23,6 +23,7 @@ if {![catch {selection get -selection CLIPBOARD_MANAGER -type TARGETS}]} {
testConstraint cliboardManagerPresent 1
}
}
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
global longValue selValue selInfo
@@ -895,7 +896,7 @@ test select-9.1 {SelCvtToX and SelCvtFromX procedures} -setup {
test select-9.2 {SelCvtToX and SelCvtFromX procedures} -setup {
setup
setupbg
-} -constraints x11 -body {
+} -constraints {x11 failsOnUbuntu} -body {
set selValue "1024 0xffff 2048 -2 "
set selInfo ""
selection handle -selection PRIMARY -format INTEGER -type TEST \
@@ -908,7 +909,7 @@ test select-9.2 {SelCvtToX and SelCvtFromX procedures} -setup {
test select-9.3 {SelCvtToX and SelCvtFromX procedures} -setup {
setup
setupbg
-} -constraints x11 -body {
+} -constraints {x11 failsOnUbuntu} -body {
set selValue " "
set selInfo ""
selection handle -selection PRIMARY -format INTEGER -type TEST \
@@ -921,7 +922,7 @@ test select-9.3 {SelCvtToX and SelCvtFromX procedures} -setup {
test select-9.4 {SelCvtToX and SelCvtFromX procedures} -setup {
setup
setupbg
-} -constraints x11 -body {
+} -constraints {x11 failsOnUbuntu} -body {
set selValue "16 foobar 32"
set selInfo ""
selection handle -selection PRIMARY -format INTEGER -type TEST \
@@ -1006,7 +1007,7 @@ test select-10.3 {ConvertSelection procedure} -constraints x11 -setup {
# testing timers
# This one hangs in Exceed
test select-10.4 {ConvertSelection procedure} -constraints {
- x11 noExceed
+ x11 noExceed failsOnUbuntu
} -setup {
setup
setupbg
@@ -1021,7 +1022,7 @@ test select-10.4 {ConvertSelection procedure} -constraints {
lappend result $selInfo
} -result {{selection owner didn't respond} {STRING 0 4000 STRING 4000 4000 STRING 8000 4000 STRING 12000 4000 STRING 16000 4000 STRING 0 4000 STRING 4000 4000}}
test select-10.5 {ConvertSelection procedure, reentrancy issues} -constraints {
- x11
+ x11 failsOnUbuntu
} -setup {
setup
setupbg
@@ -1036,7 +1037,7 @@ test select-10.5 {ConvertSelection procedure, reentrancy issues} -constraints {
lappend result $selInfo
} -result {{PRIMARY selection doesn't exist or form "STRING" not defined} {.f1 STRING 0 4000}}
test select-10.6 {ConvertSelection procedure, reentrancy issues} -constraints {
- x11
+ x11 failsOnUbuntu
} -setup {
setup
setupbg
@@ -1059,7 +1060,7 @@ test select-10.6 {ConvertSelection procedure, reentrancy issues} -constraints {
##############################################################################
# testing reentrancy
-test select-11.1 {TkSelPropProc procedure} -constraints x11 -setup {
+test select-11.1 {TkSelPropProc procedure} -constraints {x11 failsOnUbuntu} -setup {
setup
setupbg
} -body {
diff --git a/tests/spinbox.test b/tests/spinbox.test
index 88294b2..b858988 100644
--- a/tests/spinbox.test
+++ b/tests/spinbox.test
@@ -11,6 +11,9 @@ namespace import ::tcltest::*
eval tcltest::configure $argv
tcltest::loadTestedCommands
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}]
+
# For xscrollcommand
set scrollInfo {}
proc scroll args {
@@ -2618,7 +2621,7 @@ test spinbox-8.17 {DeleteChars procedure} -setup {
} -cleanup {
destroy .e
} -result 4
-test spinbox-8.18 {DeleteChars procedure} -setup {
+test spinbox-8.18 {DeleteChars procedure} -constraints failsOnUbuntuNoXft -setup {
spinbox .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
focus .e
diff --git a/tests/text.test b/tests/text.test
index d830dc2..df2769e 100644
--- a/tests/text.test
+++ b/tests/text.test
@@ -5078,11 +5078,11 @@ test text-22.132 {TextSearchCmd, multiline regexp matching} -body {
void
Tcl_SetObjLength(objPtr, length)
- register Tcl_Obj *objPtr; /* Pointer to object. This object must
- * not currently be shared. */
- register int length; /* Number of bytes desired for string
+ Tcl_Obj *objPtr; /* Pointer to object. This object must
+ * not currently be shared. */
+ int length; /* Number of bytes desired for string
* representation of object, not including
- * terminating null byte. */
+ * terminating null byte. */
\{
char *new;
}
diff --git a/tests/textDisp.test b/tests/textDisp.test
index 4b6535d..69c53b2 100644
--- a/tests/textDisp.test
+++ b/tests/textDisp.test
@@ -12,6 +12,7 @@ tcltest::loadTestedCommands
namespace import -force tcltest::test
testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
# Platform specific procedure for updating the text widget.
@@ -111,8 +112,6 @@ wm positionfrom . user
wm deiconify .
updateText
-testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
-
# Some window managers (like olwm under SunOS 4.1.3) misbehave in a way
# that tends to march windows off the top and left of the screen. If
# this happens, some tests will fail because parts of the window will
@@ -675,7 +674,7 @@ test textDisp-4.7 {UpdateDisplayInfo, filling in extra vertical space} {
updateText
set x
} {8.0 {16.0 17.0 15.0 14.0 13.0 12.0 11.0 10.0 9.0 8.0} {8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0}}
-test textDisp-4.8 {UpdateDisplayInfo, filling in extra vertical space} {
+test textDisp-4.8 {UpdateDisplayInfo, filling in extra vertical space} failsOnXQuarz {
.t delete 1.0 end
.t insert end "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17"
.t yview 16.0
@@ -738,7 +737,7 @@ test textDisp-4.13 {UpdateDisplayInfo, special handling for top/bottom lines} {
updateText
list $tk_textRelayout $tk_textRedraw
} {{11.0 12.0 13.0} {4.0 10.0 11.0 12.0 13.0}}
-test textDisp-4.14 {UpdateDisplayInfo, special handling for top/bottom lines} {
+test textDisp-4.14 {UpdateDisplayInfo, special handling for top/bottom lines} failsOnXQuarz {
.t tag remove x 1.0 end
.t yview 1.0
updateText
@@ -871,7 +870,7 @@ test textDisp-5.2 {DisplayDLine, line resizes during display} {
} [list 30 30]
.t configure -wrap char
-test textDisp-6.1 {scrolling in DisplayText, scroll up} {
+test textDisp-6.1 {scrolling in DisplayText, scroll up} failsOnXQuarz {
.t delete 1.0 end
.t insert 1.0 "Line 1"
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
@@ -1159,7 +1158,7 @@ test textDisp-8.6 {TkTextChanged} {
updateText
list $tk_textRelayout $tk_textRedraw
} {{1.0 1.20 1.40} {1.0 1.20 1.40}}
-test textDisp-8.7 {TkTextChanged} {
+test textDisp-8.7 {TkTextChanged} failsOnXQuarz {
.t delete 1.0 end
.t insert 1.0 "Line 1 is so long that it wraps around, two times"
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
@@ -1181,7 +1180,7 @@ test textDisp-8.8 {TkTextChanged} {
updateText
list $tk_textRelayout $tk_textRedraw
} {2.0 2.0}
-test textDisp-8.9 {TkTextChanged} {
+test textDisp-8.9 {TkTextChanged} failsOnXQuarz {
.t delete 1.0 end
.t insert 1.0 "Line 1 is so long that it wraps around, two times"
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
@@ -1292,7 +1291,7 @@ test textDisp-9.4 {TkTextRedrawTag} failsOnUbuntu {
updateText
list $tk_textRelayout $tk_textRedraw
} {{2.0 2.20} {2.0 2.20 eof}}
-test textDisp-9.5 {TkTextRedrawTag} failsOnUbuntu {
+test textDisp-9.5 {TkTextRedrawTag} {failsOnUbuntu failsOnXQuarz} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4"
@@ -1454,7 +1453,7 @@ test textDisp-11.1 {TkTextSetYView} {
updateText
.t index @0,0
} {30.0}
-test textDisp-11.2 {TkTextSetYView} {
+test textDisp-11.2 {TkTextSetYView} failsOnXQuarz {
.t yview 30.0
updateText
.t yview 32.0
@@ -1468,7 +1467,7 @@ test textDisp-11.3 {TkTextSetYView} {
updateText
list [.t index @0,0] $tk_textRedraw
} {28.0 {28.0 29.0}}
-test textDisp-11.4 {TkTextSetYView} {
+test textDisp-11.4 {TkTextSetYView} failsOnXQuarz {
.t yview 30.0
updateText
.t yview 31.4
@@ -1499,7 +1498,7 @@ test textDisp-11.7 {TkTextSetYView} {
updateText
list [.t index @0,0] $tk_textRedraw
} {21.0 {21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0}}
-test textDisp-11.8 {TkTextSetYView} {
+test textDisp-11.8 {TkTextSetYView} failsOnXQuarz {
.t yview 30.0
updateText
set tk_textRedraw {}
@@ -1507,7 +1506,7 @@ test textDisp-11.8 {TkTextSetYView} {
updateText
list [.t index @0,0] $tk_textRedraw
} {32.0 {40.0 41.0}}
-test textDisp-11.9 {TkTextSetYView} {
+test textDisp-11.9 {TkTextSetYView} failsOnXQuarz {
.t yview 30.0
updateText
set tk_textRedraw {}
@@ -1531,7 +1530,7 @@ test textDisp-11.11 {TkTextSetYView} {
updateText
list [.t index @0,0] $tk_textRedraw
} {191.0 {191.0 192.0 193.0 194.0 195.0 196.0}}
-test textDisp-11.12 {TkTextSetYView, wrapped line is off-screen} {
+test textDisp-11.12 {TkTextSetYView, wrapped line is off-screen} failsOnXQuarz {
.t insert 10.0 "Long line with enough text to wrap\n"
.t yview 1.0
updateText
@@ -2871,7 +2870,7 @@ test textDisp-19.16 {count -ypixels} {
[.t count -ypixels 16.0 "16.0 displaylineend +1c"] \
[.t count -ypixels "16.0 +1 displaylines" "16.0 +4 displaylines +3c"]
} [list [expr {260 + 20 * $fixedDiff}] [expr {260 + 20 * $fixedDiff}] $fixedHeight [expr {2*$fixedHeight}] $fixedHeight [expr {3*$fixedHeight}]]
-test textDisp-19.17 {count -ypixels with indices in elided lines} failsOnUbuntu {
+test textDisp-19.17 {count -ypixels with indices in elided lines} {failsOnUbuntu failsOnXQuarz} {
.t configure -wrap none
.t delete 1.0 end
for {set i 1} {$i < 100} {incr i} {
@@ -2898,7 +2897,7 @@ test textDisp-19.17 {count -ypixels with indices in elided lines} failsOnUbuntu
.t yview 35.0
lappend res [.t count -ypixels 5.0 25.0]
} [list [expr {4 * $fixedHeight}] [expr {3 * $fixedHeight}] 0 0 0 0 0 0 [expr {5 * $fixedHeight}] [expr {- 5 * $fixedHeight}] [expr {2 * $fixedHeight}] [expr {3 * $fixedHeight}] [expr {5 * $fixedHeight}]]
-test textDisp-19.18 {count -ypixels with indices in elided lines} failsOnUbuntu {
+test textDisp-19.18 {count -ypixels with indices in elided lines} {failsOnUbuntu failsOnXQuarz} {
.t configure -wrap none
.t delete 1.0 end
for {set i 1} {$i < 100} {incr i} {
@@ -3415,7 +3414,7 @@ test textDisp-24.24 {TkTextCharLayoutProc, justification and tabs} {textfonts} {
.t tag add x 1.0 end
list [.t bbox 1.0] [.t bbox 1.10]
} [list [list 45 3 7 $fixedHeight] [list 94 3 7 $fixedHeight]]
-test textDisp-24.25 {TkTextCharLayoutProc, justification and tabs} -constraints {textfonts} -setup {
+test textDisp-24.25 {TkTextCharLayoutProc, justification and tabs} -constraints {textfonts failsOnXQuarz} -setup {
text .tt -tabs {40 right} -wrap none -font $fixedFont
pack .tt
} -body {
diff --git a/tests/textTag.test b/tests/textTag.test
index 94db751..e923611 100644
--- a/tests/textTag.test
+++ b/tests/textTag.test
@@ -26,6 +26,9 @@ testConstraint haveFontSizes [expr {
[font actual $bigFont -size] == 24 }
]
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}]
+
destroy .t
text .t -width 20 -height 10
@@ -1342,7 +1345,7 @@ test textTag-16.1 {TkTextPickCurrent procedure} -setup {
} -result {2.1 3.2 3.2 3.2 3.2 3.2 4.3}
test textTag-16.2 {TkTextPickCurrent procedure} -constraints {
- haveFontSizes
+ haveFontSizes failsOnUbuntuNoXft
} -setup {
.t tag delete {*}[.t tag names]
wm geometry . +200+200 ; update
@@ -1438,7 +1441,7 @@ test textTag-16.5 {TkTextPickCurrent procedure} -constraints {
} -result {3.2}
test textTag-16.6 {TkTextPickCurrent procedure} -constraints {
- haveFontSizes
+ haveFontSizes failsOnUbuntuNoXft
} -setup {
foreach i {big a b c d} {
.t tag remove $i 1.0 end
@@ -1460,7 +1463,7 @@ test textTag-16.6 {TkTextPickCurrent procedure} -constraints {
} -result {3.1}
test textTag-16.7 {TkTextPickCurrent procedure} -constraints {
- haveFontSizes
+ haveFontSizes failsOnUbuntuNoXft
} -setup {
foreach i {big a b c d} {
.t tag remove $i 1.0 end
diff --git a/tests/ttk/all.tcl b/tests/ttk/all.tcl
index a75172f..8a75ba7 100644
--- a/tests/ttk/all.tcl
+++ b/tests/ttk/all.tcl
@@ -4,7 +4,7 @@
# tests. Execute it by invoking "source all.tcl" when running tktest
# in this directory.
#
-# Copyright (c) 2007 by the Tk developers.
+# Copyright © 2007 by the Tk developers.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -17,4 +17,5 @@ tcltest::configure -loadfile \
[file join [file dirname [tcltest::testsDirectory]] constraints.tcl]
tcltest::configure -singleproc 1
set ErrorOnFailures [info exists env(ERROR_ON_FAILURES)]
+encoding system utf-8
if {[tcltest::runAllTests] && $ErrorOnFailures} {exit 1}
diff --git a/tests/unixEmbed.test b/tests/unixEmbed.test
index 5d00ccf..151ecf2 100644
--- a/tests/unixEmbed.test
+++ b/tests/unixEmbed.test
@@ -12,6 +12,7 @@ tcltest::loadTestedCommands
namespace import -force tcltest::test
testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
namespace eval ::_test_tmp {}
@@ -990,7 +991,7 @@ test unixEmbed-7.1 {TkpRedirectKeyEvent procedure, forward keystroke} -constrain
# TkpRedirectKeyEvent is not implemented in win or aqua. If someone
# implements it they should change the constraints for this test.
test unixEmbed-7.1a {TkpRedirectKeyEvent procedure, forward keystroke} -constraints {
- unix notAqua
+ unix notAqua failsOnXQuarz
} -setup {
deleteWindows
catch {interp delete child}
@@ -1088,7 +1089,7 @@ test unixEmbed-7.2a {TkpRedirectKeyEvent procedure, don't forward keystroke widt
} -result {{} {{key b}}}
test unixEmbed-8.1 {TkpClaimFocus procedure} -constraints {
- unix notAqua failsOnUbuntu
+ unix notAqua failsOnUbuntu failsOnXQuarz
} -setup {
deleteWindows
} -body {
@@ -1235,7 +1236,7 @@ test unixEmbed-9.2a {EmbedWindowDeleted procedure, check embeddedPtr} -constrain
test unixEmbed-10.1 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -constraints {
- unix failsOnUbuntu
+ unix failsOnUbuntu failsOnXQuarz
} -setup {
deleteWindows
} -body {
@@ -1251,7 +1252,7 @@ test unixEmbed-10.1 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -con
deleteWindows
} -result {150x80+0+0}
test unixEmbed-10.2 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -constraints {
- unix failsOnUbuntu
+ unix failsOnUbuntu failsOnXQuarz
} -setup {
deleteWindows
} -body {
diff --git a/tests/unixFont.test b/tests/unixFont.test
index 524191d..dacfd03 100644
--- a/tests/unixFont.test
+++ b/tests/unixFont.test
@@ -17,6 +17,8 @@ eval tcltest::configure $argv
tcltest::loadTestedCommands
testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}]
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
if {[tk windowingsystem] eq "x11"} {
set xlsf [auto_execok xlsfonts]
@@ -116,7 +118,7 @@ test unixfont-2.8 {TkpGetFontFromAttributes: loop over returned font names} {x11
test unixfont-2.9 {TkpGetFontFromAttributes: reject adobe courier if possible} {x11 noExceed failsOnUbuntu} {
lindex [font actual {-family courier}] 1
} {courier}
-test unixfont-2.10 {TkpGetFontFromAttributes: scalable font found} x11 {
+test unixfont-2.10 {TkpGetFontFromAttributes: scalable font found} {x11 failsOnUbuntuNoXft} {
lindex [font actual {-family courier -size 37}] 3
} 37
test unixfont-2.11 {TkpGetFontFromAttributes: font cannot be loaded} x11 {
@@ -255,7 +257,7 @@ test unixfont-8.3 {AllocFont procedure: can't parse info from name} x11 {
catch {unset fontArray}
set result
} {-family -overstrike -size -slant -underline -weight}
-test unixfont-8.4 {AllocFont procedure: classify characters} {x11 failsOnUbuntu} {
+test unixfont-8.4 {AllocFont procedure: classify characters} {x11 failsOnUbuntu failsOnXQuarz} {
set x 0
incr x [font measure $courier "\u4000"] ;# 6
incr x [font measure $courier "\002"] ;# 4
@@ -266,7 +268,7 @@ test unixfont-8.4 {AllocFont procedure: classify characters} {x11 failsOnUbuntu}
test unixfont-8.5 {AllocFont procedure: setup widths of normal chars} x11 {
font metrics $courier -fixed
} 1
-test unixfont-8.6 {AllocFont procedure: setup widths of special chars} {x11 failsOnUbuntu} {
+test unixfont-8.6 {AllocFont procedure: setup widths of special chars} {x11 failsOnUbuntu failsOnXQuarz} {
set x 0
incr x [font measure $courier "\001"] ;# 4
incr x [font measure $courier "\002"] ;# 4
@@ -294,7 +296,7 @@ test unixfont-8.11 {AllocFont procedure: XA_UNDERLINE_POSITION was 0} x11 {
set x {}
} {}
-test unixfont-9.1 {GetControlCharSubst procedure: 2 chars subst} {x11 failsOnUbuntu} {
+test unixfont-9.1 {GetControlCharSubst procedure: 2 chars subst} {x11 failsOnUbuntu failsOnXQuarz} {
.b.c dchars $t 0 end
.b.c insert $t 0 "0\a0"
set x {}
@@ -303,7 +305,7 @@ test unixfont-9.1 {GetControlCharSubst procedure: 2 chars subst} {x11 failsOnUbu
lappend x [.b.c index $t @[expr $ax*2],0]
lappend x [.b.c index $t @[expr $ax*3],0]
} {0 1 1 2}
-test unixfont-9.2 {GetControlCharSubst procedure: 4 chars subst} {x11 failsOnUbuntu} {
+test unixfont-9.2 {GetControlCharSubst procedure: 4 chars subst} {x11 failsOnUbuntu failsOnXQuarz} {
.b.c dchars $t 0 end
.b.c insert $t 0 "0\0010"
set x {}
diff --git a/tests/unixWm.test b/tests/unixWm.test
index b2b91b7..028c5be 100644
--- a/tests/unixWm.test
+++ b/tests/unixWm.test
@@ -14,6 +14,7 @@ tcltest::loadTestedCommands
namespace import -force ::tk::test:loadTkCommand
testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
proc sleep ms {
global x
@@ -1552,7 +1553,7 @@ test unixWm-44.6 {UpdateGeometryInfo procedure, negative height} unix {
} {100 1}
destroy .t
toplevel .t -width 80 -height 60
-test unixWm-44.7 {UpdateGeometryInfo procedure, computing position} unix {
+test unixWm-44.7 {UpdateGeometryInfo procedure, computing position} {unix failsOnXQuarz} {
tkwait visibility .t
wm overrideredirect .t 1
update
@@ -1562,7 +1563,7 @@ test unixWm-44.7 {UpdateGeometryInfo procedure, computing position} unix {
} [list 5 [expr [winfo screenheight .t] - 70]]
destroy .t
toplevel .t -width 80 -height 60
-test unixWm-44.8 {UpdateGeometryInfo procedure, computing position} unix {
+test unixWm-44.8 {UpdateGeometryInfo procedure, computing position} {unix failsOnXQuarz} {
tkwait visibility .t
wm overrideredirect .t 1
update
@@ -1612,7 +1613,7 @@ test unixWm-45.1 {UpdateSizeHints procedure, grid information} {unix testwrapper
[expr [lindex $property 7]] [expr [lindex $property 8]] \
[expr [lindex $property 9]] [expr [lindex $property 10]]
} {40 30 320 210 10 5}
-test unixWm-45.2 {UpdateSizeHints procedure} {unix testwrapper failsOnUbuntu} {
+test unixWm-45.2 {UpdateSizeHints procedure} {unix testwrapper failsOnUbuntu failsOnXQuarz} {
destroy .t
toplevel .t -width 80 -height 60
wm minsize .t 30 40
@@ -1640,7 +1641,7 @@ test unixWm-45.3 {UpdateSizeHints procedure, grid with menu} {testmenubar testwr
[expr [lindex $property 7]] [expr [lindex $property 8]] \
[expr [lindex $property 9]] [expr [lindex $property 10]]
} {60 40 53 320 233 10 5}
-test unixWm-45.4 {UpdateSizeHints procedure, not resizable with menu} {testmenubar testwrapper failsOnUbuntu} {
+test unixWm-45.4 {UpdateSizeHints procedure, not resizable with menu} {testmenubar testwrapper failsOnUbuntu failsOnXQuarz} {
destroy .t
toplevel .t -width 80 -height 60
frame .t.menu -height 23 -width 50
@@ -1794,7 +1795,7 @@ if {[tk windowingsystem] == "aqua"} {
# Windows are assumed to have a border (invisible in Gnome 3).
set result_50_1 {{} {} .t {} .t2 {} .t2 {} .t}
}
-test unixWm-50.1 {Tk_CoordsToWindow procedure, finding a toplevel, x-coords, title bar} {unix failsOnUbuntu} {
+test unixWm-50.1 {Tk_CoordsToWindow procedure, finding a toplevel, x-coords, title bar} {unix failsOnUbuntu failsOnXQuarz} {
update
toplevel .t -width 300 -height 400 -bg green
wm geom .t +100+100
@@ -2051,7 +2052,7 @@ test unixWm-51.6 {TkWmRestackToplevel procedure, window to be stacked isn't mapp
wm geometry .t2 +0+0
winfo containing 100 100
} {.t}
-test unixWm-51.7 {TkWmRestackToplevel procedure, other window isn't mapped} unix {
+test unixWm-51.7 {TkWmRestackToplevel procedure, other window isn't mapped} {unix failsOnXQuarz} {
foreach w {.t .t2 .t3} {
destroy $w
update
diff --git a/tests/winWm.test b/tests/winWm.test
index 705e355..baf8e3d 100644
--- a/tests/winWm.test
+++ b/tests/winWm.test
@@ -14,6 +14,7 @@ namespace import ::tcltest::*
tcltest::configure {*}$argv
tcltest::loadTestedCommands
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
test winWm-1.1 {TkWmMapWindow} -constraints win -setup {
destroy .t
@@ -485,7 +486,7 @@ test winWm-9.0 "Bug #2799589 - delayed activation of destroyed window" -constrai
rename winwm90$cmd {}
}
destroy .tx .t .sd
-} -result {ok}
+} -result ok
test winWm-9.1 "delayed activation of grabbed destroyed window" -constraints win -setup {
proc winwm91click {w} {
@@ -530,9 +531,9 @@ test winWm-9.1 "delayed activation of grabbed destroyed window" -constraints win
rename winwm91$cmd {}
}
destroy .tx .t .sd
-} -result {ok}
+} -result ok
-test winWm-9.2 "check wm forget for unmapped parent (#3205464,#2967911)" -setup {
+test winWm-9.2 "check wm forget for unmapped parent (#3205464,#2967911)" -constraints failsOnUbuntu -setup {
destroy .t
toplevel .t
set winwm92 {}
@@ -541,15 +542,15 @@ test winWm-9.2 "check wm forget for unmapped parent (#3205464,#2967911)" -setup
} -body {
pack .t.f.x
pack .t.f
- lappend aid [after 2000 {set ::winwm92 timeout}] [after 100 {
+ lappend aid [after 5000 {set ::winwm92 timeout}] [after 500 {
wm manage .t.f
wm iconify .t
- lappend aid [after 100 {
+ lappend aid [after 500 {
wm forget .t.f
wm deiconify .t
- lappend aid [after 100 {
+ lappend aid [after 500 {
pack .t.f
- lappend aid [after 100 {
+ lappend aid [after 500 {
set ::winwm92 [expr {
[winfo rooty .t.f.x] == 0 ? "failed" : "ok"}]}]
}]
diff --git a/tests/winfo.test b/tests/winfo.test
index 13193ef..a247346 100644
--- a/tests/winfo.test
+++ b/tests/winfo.test
@@ -12,6 +12,7 @@ tcltest::configure {*}$argv
tcltest::loadTestedCommands
testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
# eatColors --
# Creates a toplevel window and allocates enough colors in it to
@@ -322,7 +323,7 @@ test winfo-9.6 {"winfo viewable" command} -setup {
} -cleanup {
deleteWindows
} -result {0 0}
-test winfo-9.7 {"winfo viewable" command} -constraints failsOnUbuntu -setup {
+test winfo-9.7 {"winfo viewable" command} -constraints {failsOnUbuntu failsOnXQuarz} -setup {
deleteWindows
} -body {
frame .f1 -width 100 -height 100 -relief raised -bd 2
diff --git a/tests/wm.test b/tests/wm.test
index d5bc733..c1e6cba 100644
--- a/tests/wm.test
+++ b/tests/wm.test
@@ -28,6 +28,7 @@ proc stdWindow {} {
}
testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
# [raise] and [lower] may return before the window manager has completed the
# operation. The raiseDelay procedure idles for a while to give the operation
@@ -1527,7 +1528,7 @@ test wm-stackorder-5.1 {a menu is not a toplevel} -body {
destroy .t
} -result {.t .}
test wm-stackorder-5.2 {A normal toplevel can't be raised above an \
- overrideredirect toplevel on unix} -constraints {x11 failsOnUbuntu} -body {
+ overrideredirect toplevel on unix} -constraints {x11 failsOnUbuntu failsOnXQuarz} -body {
toplevel .t
tkwait visibility .t
wm overrideredirect .t 1
@@ -1551,7 +1552,7 @@ test wm-stackorder-5.2.1 {A normal toplevel can be raised above an \
destroy .t
} -result 1
test wm-stackorder-5.3 {An overrideredirect window\
- can be explicitly lowered} -body {
+ can be explicitly lowered} -constraints failsOnXQuarz -body {
toplevel .t
tkwait visibility .t
wm overrideredirect .t 1
@@ -1726,7 +1727,7 @@ test wm-transient-3.3 {withdraw/deiconify on the toplevel
} -result {withdrawn 0 normal 1}
test wm-transient-4.1 {transient toplevel is withdrawn
- when mapped if toplevel is iconic} -constraints failsOnUbuntu -body {
+ when mapped if toplevel is iconic} -constraints {failsOnUbuntu failsOnXQuarz} -body {
toplevel .top
wm iconify .top
update
@@ -1928,7 +1929,7 @@ test wm-transient-7.5 {Reassign transient, destroy transient} -body {
deleteWindows
}
-test wm-transient-8.1 {transient to withdrawn window, Bug 1163496} -constraints failsOnUbuntu -setup {
+test wm-transient-8.1 {transient to withdrawn window, Bug 1163496} -constraints {failsOnUbuntu failsOnXQuarz} -setup {
deleteWindows
set result {}
} -body {
diff --git a/unix/configure b/unix/configure
index 13c36a9..40bc9db 100755
--- a/unix/configure
+++ b/unix/configure
@@ -4239,7 +4239,7 @@ fi
if test "$GCC" = yes; then :
CFLAGS_OPTIMIZE=-O2
- CFLAGS_WARNING="-Wall -Wextra -Wwrite-strings -Wpointer-arith"
+ CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith"
case "${CC}" in
*++|*++-*)
;;
@@ -6924,7 +6924,7 @@ else
int
main ()
{
-struct passwd pwd; pwd.pw_gecos;
+struct passwd pwd; (void)pwd.pw_gecos;
;
return 0;
}
diff --git a/unix/configure.ac b/unix/configure.ac
index b765f13..f0de585 100644
--- a/unix/configure.ac
+++ b/unix/configure.ac
@@ -230,7 +230,7 @@ AC_CHECK_TYPE([uintptr_t], [
AC_CACHE_CHECK([pw_gecos in struct pwd], tcl_cv_pwd_pw_gecos, [
AC_TRY_COMPILE([#include <pwd.h>],
- [struct passwd pwd; pwd.pw_gecos;],
+ [struct passwd pwd; (void)pwd.pw_gecos;],
tcl_cv_pwd_pw_gecos=yes, tcl_cv_pwd_pw_gecos=no)])
if test $tcl_cv_pwd_pw_gecos = yes; then
AC_DEFINE(HAVE_PW_GECOS, 1, [Does struct password have a pw_gecos field?])
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index 056cf1f..8ee17e1 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -966,7 +966,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
CFLAGS_DEBUG=-g
AS_IF([test "$GCC" = yes], [
CFLAGS_OPTIMIZE=-O2
- CFLAGS_WARNING="-Wall -Wextra -Wwrite-strings -Wpointer-arith"
+ CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith"
case "${CC}" in
*++|*++-*)
;;
@@ -2132,7 +2132,7 @@ AC_DEFUN([SC_TIME_HANDLER], [
fi
AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [
- AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
+ AC_TRY_COMPILE([#include <time.h>], [struct tm tm; (void)tm.tm_gmtoff;],
tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no)])
if test $tcl_cv_member_tm_gmtoff = yes ; then
AC_DEFINE(HAVE_TM_GMTOFF, 1, [Should we use the tm_gmtoff field of struct tm?])
diff --git a/unix/tkUnix.c b/unix/tkUnix.c
index df70cb0..633b057 100644
--- a/unix/tkUnix.c
+++ b/unix/tkUnix.c
@@ -16,7 +16,7 @@
# include <X11/extensions/scrnsaver.h>
# ifdef __APPLE__
/* Support for weak-linked libXss. */
-# define HaveXSSLibrary() (XScreenSaverQueryInfo != NULL)
+# define HaveXSSLibrary() (&XScreenSaverQueryInfo != NULL)
# else
/* Other platforms always link libXss. */
# define HaveXSSLibrary() (1)
diff --git a/unix/tkUnixButton.c b/unix/tkUnixButton.c
index 8d13db7..8d293f6 100644
--- a/unix/tkUnixButton.c
+++ b/unix/tkUnixButton.c
@@ -326,10 +326,8 @@ TkpDrawCheckIndicator(
TkButton *
TkpCreateButton(
- Tk_Window tkwin)
+ TCL_UNUSED(Tk_Window))
{
- (void)tkwin;
-
return (TkButton *)ckalloc(sizeof(UnixButton));
}
@@ -807,8 +805,6 @@ TkpDisplayButton(
butPtr->borderWidth, relief);
}
if (butPtr->highlightWidth > 0) {
- GC gc;
-
if (butPtr->flags & GOT_FOCUS) {
gc = Tk_GCForColor(butPtr->highlightColorPtr, pixmap);
} else {
diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c
index 400e610..60da06b 100644
--- a/unix/tkUnixFont.c
+++ b/unix/tkUnixFont.c
@@ -705,7 +705,7 @@ TkpGetNativeFont(
if (name[0] == '-') {
if (name[1] != '*') {
- char *dash;
+ const char *dash;
dash = strchr(name + 1, '-');
if ((dash == NULL) || (isspace(UCHAR(dash[-1])))) {
@@ -1713,7 +1713,7 @@ InitFont(
* 1/3 the width of a capital I.
*/
- fontPtr->barHeight = fontPtr->widths['I'] / 3;
+ fontPtr->barHeight = fontPtr->widths[(unsigned char)'I'] / 3;
if (fontPtr->barHeight == 0) {
fontPtr->barHeight = 1;
}
@@ -2109,10 +2109,10 @@ FindSubFontForChar(
nameList = ListFonts(fontPtr->display, "*", &numNames);
for (i = 0; i < numNames; i++) {
- fallback = strchr(nameList[i] + 1, '-') + 1;
- strchr(fallback, '-')[0] = '\0';
- if (SeenName(fallback, &ds) == 0) {
- subFontPtr = CanUseFallback(fontPtr, fallback, ch,
+ char *fallbck = strchr(nameList[i] + 1, '-') + 1;
+ strchr(fallbck, '-')[0] = '\0';
+ if (SeenName(fallbck, &ds) == 0) {
+ subFontPtr = CanUseFallback(fontPtr, fallbck, ch,
fixSubFontPtrPtr);
if (subFontPtr != NULL) {
XFreeFontNames(nameList);
diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c
index 243d45f..61e94d5 100644
--- a/unix/tkUnixMenu.c
+++ b/unix/tkUnixMenu.c
@@ -144,10 +144,8 @@ TkpNewMenu(
void
TkpDestroyMenu(
- TkMenu *menuPtr)
+ TCL_UNUSED(TkMenu *))
{
- (void)menuPtr;
-
/*
* Nothing to do.
*/
@@ -172,10 +170,8 @@ TkpDestroyMenu(
void
TkpDestroyMenuEntry(
- TkMenuEntry *mEntryPtr)
+ TCL_UNUSED(TkMenuEntry *))
{
- (void)mEntryPtr;
-
/*
* Nothing to do.
*/
@@ -242,10 +238,8 @@ TkpConfigureMenuEntry(
int
TkpMenuNewEntry(
- TkMenuEntry *mePtr)
+ TCL_UNUSED(TkMenuEntry *))
{
- (void)mePtr;
-
return TCL_OK;
}
@@ -297,14 +291,10 @@ TkpSetWindowMenuBar(
void
TkpSetMainMenubar(
- Tcl_Interp *interp,
- Tk_Window tkwin,
- const char *menuName)
+ TCL_UNUSED(Tcl_Interp *),
+ TCL_UNUSED(Tk_Window),
+ TCL_UNUSED(const char *))
{
- (void)interp;
- (void)tkwin;
- (void)menuName;
-
/*
* Nothing to do.
*/
@@ -332,14 +322,12 @@ static void
GetMenuIndicatorGeometry(
TkMenu *menuPtr, /* The menu we are drawing. */
TkMenuEntry *mePtr, /* The entry we are interested in. */
- Tk_Font tkfont, /* The precalculated font */
- const Tk_FontMetrics *fmPtr,/* The precalculated metrics */
+ TCL_UNUSED(Tk_Font), /* The precalculated font */
+ TCL_UNUSED(const Tk_FontMetrics *),/* The precalculated metrics */
int *widthPtr, /* The resulting width */
int *heightPtr) /* The resulting height */
{
int borderWidth;
- (void)tkfont;
- (void)fmPtr;
if ((mePtr->type == CHECK_BUTTON_ENTRY)
|| (mePtr->type == RADIO_BUTTON_ENTRY)) {
@@ -534,7 +522,7 @@ DrawMenuEntryAccelerator(
if (menuPtr->menuType == MENUBAR) {
left += 5;
}
- Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel,
+ Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel,
mePtr->accelLength, left,
(y + (height + fmPtr->ascent - fmPtr->descent) / 2));
}
@@ -564,17 +552,13 @@ DrawMenuEntryIndicator(
Tk_3DBorder border, /* The background color */
XColor *indicatorColor, /* The color to draw indicators with */
XColor *disableColor, /* The color use use when disabled */
- Tk_Font tkfont, /* The font to draw with */
- const Tk_FontMetrics *fmPtr,/* The font metrics of the font */
+ TCL_UNUSED(Tk_Font), /* The font to draw with */
+ TCL_UNUSED(const Tk_FontMetrics *),/* The font metrics of the font */
int x, /* The left of the entry rect */
int y, /* The top of the entry rect */
- int width, /* Width of menu entry */
+ TCL_UNUSED(int), /* Width of menu entry */
int height) /* Height of menu entry */
{
- (void)tkfont;
- (void)fmPtr;
- (void)width;
-
/*
* Draw check-button indicator.
*/
@@ -637,21 +621,16 @@ DrawMenuEntryIndicator(
static void
DrawMenuSeparator(
TkMenu *menuPtr, /* The menu we are drawing */
- TkMenuEntry *mePtr, /* The entry we are drawing */
+ TCL_UNUSED(TkMenuEntry *), /* The entry we are drawing */
Drawable d, /* The drawable we are using */
- GC gc, /* The gc to draw into */
- Tk_Font tkfont, /* The font to draw with */
- const Tk_FontMetrics *fmPtr,/* The font metrics from the font */
+ TCL_UNUSED(GC), /* The gc to draw into */
+ TCL_UNUSED(Tk_Font), /* The font to draw with */
+ TCL_UNUSED(const Tk_FontMetrics *),/* The font metrics from the font */
int x, int y,
int width, int height)
{
XPoint points[2];
Tk_3DBorder border;
- (void)mePtr;
- (void)gc;
- (void)tkfont;
- (void)fmPtr;
-
if (menuPtr->menuType == MENUBAR) {
return;
}
@@ -870,10 +849,8 @@ DrawMenuUnderline(
Tk_Font tkfont, /* The precalculated font */
const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
int x, int y,
- int width, int height)
+ TCL_UNUSED(int), int height)
{
- (void)width;
-
if (mePtr->labelPtr != NULL) {
int len;
@@ -951,14 +928,13 @@ TkpPostMenu(
int
TkpPostTearoffMenu(
- Tcl_Interp *dummy, /* The interpreter of the menu */
+ TCL_UNUSED(Tcl_Interp *), /* The interpreter of the menu */
TkMenu *menuPtr, /* The menu we are posting */
int x, int y, int index) /* The root X,Y coordinates where the
* specified entry will be posted */
{
int vRootX, vRootY, vRootWidth, vRootHeight;
int result;
- (void)dummy;
if (index >= (int)menuPtr->numEntries) {
index = menuPtr->numEntries - 1;
@@ -1042,17 +1018,13 @@ TkpPostTearoffMenu(
static void
GetMenuSeparatorGeometry(
- TkMenu *menuPtr, /* The menu we are measuring */
- TkMenuEntry *mePtr, /* The entry we are measuring */
- Tk_Font tkfont, /* The precalculated font */
+ TCL_UNUSED(TkMenu *), /* The menu we are measuring */
+ TCL_UNUSED(TkMenuEntry *), /* The entry we are measuring */
+ TCL_UNUSED(Tk_Font), /* The precalculated font */
const Tk_FontMetrics *fmPtr,/* The precalcualted font metrics */
int *widthPtr, /* The resulting width */
int *heightPtr) /* The resulting height */
{
- (void)menuPtr;
- (void)mePtr;
- (void)tkfont;
-
*widthPtr = 0;
*heightPtr = fmPtr->linespace;
}
@@ -1076,14 +1048,12 @@ GetMenuSeparatorGeometry(
static void
GetTearoffEntryGeometry(
TkMenu *menuPtr, /* The menu we are drawing */
- TkMenuEntry *mePtr, /* The entry we are measuring */
+ TCL_UNUSED(TkMenuEntry *), /* The entry we are measuring */
Tk_Font tkfont, /* The precalculated font */
const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
int *widthPtr, /* The resulting width */
int *heightPtr) /* The resulting height */
{
- (void)mePtr;
-
if (menuPtr->menuType != MAIN_MENU) {
*heightPtr = 0;
*widthPtr = 0;
@@ -1119,15 +1089,13 @@ TkpComputeMenubarGeometry(
Tk_FontMetrics menuMetrics, entryMetrics, *fmPtr;
int width, height, i, j, x, y, currentRowHeight, maxWidth;
int maxWindowWidth, lastRowBreak, lastEntry;
- int borderWidth, activeBorderWidth, helpMenuIndex = -1;
+ int activeBorderWidth, helpMenuIndex = -1;
TkMenuEntry *mePtr;
if (menuPtr->tkwin == NULL) {
return;
}
- Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr,
- &borderWidth);
Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr,
&activeBorderWidth);
maxWidth = 0;
@@ -1149,7 +1117,7 @@ TkpComputeMenubarGeometry(
/*
* On the Mac especially, getting font metrics can be quite slow, so
* we want to do it intelligently. We are going to precalculate them
- * and pass them down to all of the measureing and drawing routines.
+ * and pass them down to all of the measuring and drawing routines.
* We will measure the font metrics of the menu once, and if an entry
* has a font set, we will measure it as we come to it, and then we
* decide which set to give the geometry routines.
@@ -1296,21 +1264,17 @@ TkpComputeMenubarGeometry(
static void
DrawTearoffEntry(
TkMenu *menuPtr, /* The menu we are drawing */
- TkMenuEntry *mePtr, /* The entry we are drawing */
+ TCL_UNUSED(TkMenuEntry *), /* The entry we are drawing */
Drawable d, /* The drawable we are drawing into */
- GC gc, /* The gc we are drawing with */
- Tk_Font tkfont, /* The font we are drawing with */
- const Tk_FontMetrics *fmPtr,/* The metrics we are drawing with */
+ TCL_UNUSED(GC), /* The gc we are drawing with */
+ TCL_UNUSED(Tk_Font), /* The font we are drawing with */
+ TCL_UNUSED(const Tk_FontMetrics *),/* The metrics we are drawing with */
int x, int y,
int width, int height)
{
XPoint points[2];
int segmentWidth, maxX;
Tk_3DBorder border;
- (void)mePtr;
- (void)gc;
- (void)tkfont;
- (void)fmPtr;
if (menuPtr->menuType != MAIN_MENU) {
return;
@@ -1355,13 +1319,10 @@ DrawTearoffEntry(
void
TkpInitializeMenuBindings(
- Tcl_Interp *interp, /* The interpreter to set. */
- Tk_BindingTable bindingTable)
+ TCL_UNUSED(Tcl_Interp *), /* The interpreter to set. */
+ TCL_UNUSED(Tk_BindingTable))
/* The table to add to. */
{
- (void)interp;
- (void)bindingTable;
-
/*
* Nothing to do.
*/
@@ -1886,12 +1847,9 @@ TkpComputeStandardMenuGeometry(
void
TkpMenuNotifyToplevelCreate(
- Tcl_Interp *dummy, /* The interp the menu lives in. */
- const char *menuName) /* The name of the menu to reconfigure. */
+ TCL_UNUSED(Tcl_Interp *), /* The interp the menu lives in. */
+ TCL_UNUSED(const char *)) /* The name of the menu to reconfigure. */
{
- (void)dummy;
- (void)menuName;
-
/*
* Nothing to do.
*/
diff --git a/unix/tkUnixMenubu.c b/unix/tkUnixMenubu.c
index 407dc30..062d18e 100644
--- a/unix/tkUnixMenubu.c
+++ b/unix/tkUnixMenubu.c
@@ -25,17 +25,15 @@
* Returns a newly allocated TkMenuButton structure.
*
* Side effects:
- * Registers an event handler for the widget.
+ * None
*
*----------------------------------------------------------------------
*/
TkMenuButton *
TkpCreateMenuButton(
- Tk_Window tkwin)
+ TCL_UNUSED(Tk_Window))
{
- (void)tkwin;
-
return (TkMenuButton *)ckalloc(sizeof(TkMenuButton));
}
@@ -282,8 +280,6 @@ TkpDisplayMenuButton(
mbPtr->borderWidth, mbPtr->relief);
}
if (mbPtr->highlightWidth != 0) {
- GC gc;
-
if (mbPtr->flags & GOT_FOCUS) {
gc = Tk_GCForColor(mbPtr->highlightColorPtr, pixmap);
} else {
diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c
index d277db8..41ba938 100644
--- a/unix/tkUnixRFont.c
+++ b/unix/tkUnixRFont.c
@@ -208,7 +208,7 @@ GetTkFontAttributes(
slant = XFT_SLANT_ROMAN;
}
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
printf("family %s size %d weight %d slant %d\n",
family, (int)size, weight, slant);
#endif /* DEBUG_FONTSEL */
@@ -453,7 +453,7 @@ TkpGetNativeFont(
{
UnixFtFont *fontPtr;
FcPattern *pattern;
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
printf("TkpGetNativeFont %s\n", name);
#endif /* DEBUG_FONTSEL */
@@ -491,7 +491,7 @@ TkpGetFontFromAttributes(
int weight, slant;
UnixFtFont *fontPtr;
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
printf("TkpGetFontFromAttributes %s-%d %d %d\n", faPtr->family,
faPtr->size, faPtr->weight, faPtr->slant);
#endif /* DEBUG_FONTSEL */
@@ -671,7 +671,7 @@ TkpGetSubFonts(
void
TkpGetFontAttrsForChar(
- Tk_Window tkwin, /* Window on the font's display */
+ TCL_UNUSED(Tk_Window), /* Window on the font's display */
Tk_Font tkfont, /* Font to query */
int c, /* Character of interest */
TkFontAttributes *faPtr) /* Output: Font attributes */
@@ -682,7 +682,6 @@ TkpGetFontAttrsForChar(
/* UCS-4 character to map */
XftFont *ftFont = GetFont(fontPtr, ucs4, 0.0);
/* Actual font used to render the character */
- (void)tkwin;
GetTkFontAttributes(ftFont, faPtr);
faPtr->underline = fontPtr->font.fa.underline;
@@ -719,7 +718,7 @@ Tk_MeasureChars(
int clen, curX, newX, curByte, newByte, sawNonSpace;
int termByte = 0, termX = 0, errorFlag = 0;
Tk_ErrorHandler handler;
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
char string[256];
int len = 0;
#endif /* DEBUG_FONTSEL */
@@ -756,7 +755,7 @@ Tk_MeasureChars(
sawNonSpace = 1;
}
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
string[len++] = (char) c;
#endif /* DEBUG_FONTSEL */
ftFont = GetFont(fontPtr, c, 0.0);
@@ -796,7 +795,7 @@ Tk_MeasureChars(
curByte = newByte;
}
Tk_DeleteErrorHandler(handler);
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
string[len] = '\0';
printf("MeasureChars %s length %d bytes %d\n", string, curX, curByte);
#endif /* DEBUG_FONTSEL */
@@ -936,7 +935,7 @@ Tk_DrawChars(
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (fontPtr->ftDraw == 0) {
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
printf("Switch to drawable 0x%x\n", drawable);
#endif /* DEBUG_FONTSEL */
fontPtr->ftDraw = XftDrawCreate(display, drawable,
@@ -1071,7 +1070,7 @@ TkDrawAngledChars(
int originX, originY;
if (fontPtr->ftDraw == 0) {
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
printf("Switch to drawable 0x%x\n", drawable);
#endif /* DEBUG_FONTSEL */
fontPtr->ftDraw = XftDrawCreate(display, drawable,
@@ -1180,7 +1179,7 @@ TkDrawAngledChars(
double sinA = sin(angle * PI/180.0), cosA = cos(angle * PI/180.0);
if (fontPtr->ftDraw == 0) {
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
printf("Switch to drawable 0x%x\n", drawable);
#endif /* DEBUG_FONTSEL */
fontPtr->ftDraw = XftDrawCreate(display, drawable,
diff --git a/unix/tkUnixScale.c b/unix/tkUnixScale.c
index 1b4fefe..a603432 100644
--- a/unix/tkUnixScale.c
+++ b/unix/tkUnixScale.c
@@ -50,10 +50,8 @@ static void DisplayVerticalValue(TkScale *scalePtr,
TkScale *
TkpCreateScale(
- Tk_Window tkwin)
+ TCL_UNUSED(Tk_Window))
{
- (void)tkwin;
-
return (TkScale *)ckalloc(sizeof(TkScale));
}
diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c
index 58c3abc..527bc4c 100644
--- a/unix/tkUnixSelect.c
+++ b/unix/tkUnixSelect.c
@@ -545,7 +545,6 @@ TkSelEventProc(
Atom type;
int format, result;
unsigned long numItems, bytesAfter;
- Tcl_DString ds;
for (retrPtr = pendingRetrievals; ; retrPtr = retrPtr->nextPtr) {
if (retrPtr == NULL) {
@@ -591,6 +590,7 @@ TkSelEventProc(
if ((type == XA_STRING) || (type == dispPtr->textAtom)
|| (type == dispPtr->compoundTextAtom)) {
Tcl_Encoding encoding;
+ Tcl_DString ds;
if (format != 8) {
Tcl_SetObjResult(retrPtr->interp, Tcl_ObjPrintf(
@@ -1522,15 +1522,12 @@ static void
SelCvtFromX8(
char *propPtr, /* Property value from X. */
int numValues, /* Number of 8-bit values in property. */
- Atom type, /* Type of property Should not be XA_STRING
+ TCL_UNUSED(Atom), /* Type of property Should not be XA_STRING
* (if so, don't bother calling this function
* at all). */
- Tk_Window tkwin, /* Window to use for atom conversion. */
+ TCL_UNUSED(Tk_Window), /* Window to use for atom conversion. */
Tcl_DString *dsPtr) /* Where to store the converted string. */
{
- (void)type;
- (void)tkwin;
-
/*
* Convert each long in the property to a string value, which is a
* hexadecimal string. We build the list in a Tcl_DString because this is
diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c
index 6cf711c..92fd8bb 100644
--- a/unix/tkUnixSend.c
+++ b/unix/tkUnixSend.c
@@ -943,7 +943,7 @@ Tk_SetAppName(
int
Tk_SendObjCmd(
- ClientData dummy, /* Information about sender (only dispPtr
+ TCL_UNUSED(void *), /* Information about sender (only dispPtr
* field is used). */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -971,7 +971,6 @@ Tk_SendObjCmd(
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_Interp *localInterp; /* Used when the interpreter to send the
* command to is within the same process. */
- (void)dummy;
/*
* Process options, if any.
@@ -1357,13 +1356,12 @@ TkSendCleanup(
static int
SendInit(
- Tcl_Interp *dummy, /* Interpreter to use for error reporting (no
+ TCL_UNUSED(Tcl_Interp *), /* Interpreter to use for error reporting (no
* errors are ever returned, but the
* interpreter is needed anyway). */
TkDisplay *dispPtr) /* Display to initialize. */
{
XSetWindowAttributes atts;
- (void)dummy;
/*
* Create the window used for communication, and set up an event handler
@@ -1779,13 +1777,12 @@ AppendPropCarefully(
static int
AppendErrorProc(
ClientData clientData, /* Command to mark complete, or NULL. */
- XErrorEvent *errorPtr) /* Information about error. */
+ TCL_UNUSED(XErrorEvent *)) /* Information about error. */
{
PendingCommand *pendingPtr = (PendingCommand *)clientData;
PendingCommand *pcPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- (void)errorPtr;
if (pendingPtr == NULL) {
return 0;
@@ -1878,11 +1875,10 @@ DeleteProc(
static Tk_RestrictAction
SendRestrictProc(
- ClientData dummy, /* Not used. */
+ TCL_UNUSED(void *), /* Not used. */
XEvent *eventPtr) /* Event that just arrived. */
{
TkDisplay *dispPtr;
- (void)dummy;
if (eventPtr->type != PropertyNotify) {
return TK_DEFER_EVENT;
diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c
index 06d908b..13a599e 100644
--- a/unix/tkUnixWm.c
+++ b/unix/tkUnixWm.c
@@ -1181,7 +1181,7 @@ Tk_WmObjCmd(
static int
WmAspectCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -1189,7 +1189,6 @@ WmAspectCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
int numer1, denom1, numer2, denom2;
- (void)tkwin;
if ((objc != 3) && (objc != 7)) {
Tcl_WrongNumArgs(interp, 2, objv,
@@ -1384,14 +1383,13 @@ WmGetAttribute(
static int
WmAttributesCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
int attribute = 0;
- (void)tkwin;
if (objc == 3) { /* wm attributes $win */
Tcl_Obj *result = Tcl_NewListObj(0,0);
@@ -1449,7 +1447,7 @@ WmAttributesCmd(
static int
WmClientCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -1457,7 +1455,6 @@ WmClientCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
const char *argv3;
- (void)tkwin;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?name?");
@@ -1636,7 +1633,7 @@ WmColormapwindowsCmd(
static int
WmCommandCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -1646,7 +1643,6 @@ WmCommandCmd(
const char *argv3;
int cmdArgc;
const char **cmdArgv;
- (void)tkwin;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?value?");
@@ -1706,14 +1702,13 @@ WmCommandCmd(
static int
WmDeiconifyCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
- (void)tkwin;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
@@ -1757,7 +1752,7 @@ WmDeiconifyCmd(
static int
WmFocusmodelCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -1769,7 +1764,6 @@ WmFocusmodelCmd(
enum options {
OPT_ACTIVE, OPT_PASSIVE };
int index;
- (void)tkwin;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?active|passive?");
@@ -1813,17 +1807,13 @@ WmFocusmodelCmd(
static int
WmForgetCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel or Frame to work with */
- Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
- Tcl_Obj *const objv[]) /* Argument objects. */
+ TCL_UNUSED(Tcl_Interp *), /* Current interpreter. */
+ TCL_UNUSED(int), /* Number of arguments. */
+ TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */
{
Tk_Window frameWin = (Tk_Window) winPtr;
- (void)tkwin;
- (void)interp;
- (void)objc;
- (void)objv;
if (Tk_IsTopLevel(frameWin)) {
TkFocusJoin(winPtr);
@@ -1870,7 +1860,7 @@ WmForgetCmd(
static int
WmFrameCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -1879,7 +1869,6 @@ WmFrameCmd(
WmInfo *wmPtr = winPtr->wmInfoPtr;
Window window;
char buf[TCL_INTEGER_SPACE];
- (void)tkwin;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
@@ -1913,7 +1902,7 @@ WmFrameCmd(
static int
WmGeometryCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -1923,7 +1912,6 @@ WmGeometryCmd(
char xSign, ySign;
int width, height;
const char *argv3;
- (void)tkwin;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?newGeometry?");
@@ -1974,7 +1962,7 @@ WmGeometryCmd(
static int
WmGridCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -1982,7 +1970,6 @@ WmGridCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
int reqWidth, reqHeight, widthInc, heightInc;
- (void)tkwin;
if ((objc != 3) && (objc != 7)) {
Tcl_WrongNumArgs(interp, 2, objv,
@@ -2149,7 +2136,7 @@ WmGroupCmd(
static int
WmIconbitmapCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -2158,7 +2145,6 @@ WmIconbitmapCmd(
WmInfo *wmPtr = winPtr->wmInfoPtr;
Pixmap pixmap;
const char *argv3;
- (void)tkwin;
if ((objc < 3) || (objc > 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?bitmap?");
@@ -2210,14 +2196,13 @@ WmIconbitmapCmd(
static int
WmIconifyCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
- (void)tkwin;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
@@ -2339,7 +2324,7 @@ WmIconmaskCmd(
static int
WmIconnameCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -2347,7 +2332,6 @@ WmIconnameCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
const char *argv3;
- (void)tkwin;
if (objc > 4) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?newName?");
@@ -2391,7 +2375,7 @@ WmIconnameCmd(
static int
WmIconphotoCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -2402,7 +2386,6 @@ WmIconphotoCmd(
Tk_PhotoImageBlock block;
int i, size = 0, width, height, index = 0, x, y, isDefault = 0;
unsigned long *iconPropertyData;
- (void)tkwin;
if (objc < 4) {
Tcl_WrongNumArgs(interp, 2, objv,
@@ -2542,7 +2525,7 @@ WmIconphotoCmd(
static int
WmIconpositionCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -2550,7 +2533,6 @@ WmIconpositionCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
int x, y;
- (void)tkwin;
if ((objc != 3) && (objc != 5)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?x y?");
@@ -2720,17 +2702,14 @@ WmIconwindowCmd(
static int
WmManageCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel or Frame to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
- Tcl_Obj *const objv[]) /* Argument objects. */
+ TCL_UNUSED(int), /* Number of arguments. */
+ TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */
{
Tk_Window frameWin = (Tk_Window) winPtr;
WmInfo *wmPtr = winPtr->wmInfoPtr;
- (void)tkwin;
- (void)objc;
- (void)objv;
if (!Tk_IsTopLevel(frameWin)) {
if (!Tk_IsManageable(frameWin)) {
@@ -2785,7 +2764,7 @@ WmManageCmd(
static int
WmMaxsizeCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -2793,7 +2772,6 @@ WmMaxsizeCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
int width, height;
- (void)tkwin;
if ((objc != 3) && (objc != 5)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?");
@@ -2845,7 +2823,7 @@ WmMaxsizeCmd(
static int
WmMinsizeCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -2853,7 +2831,6 @@ WmMinsizeCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
int width, height;
- (void)tkwin;
if ((objc != 3) && (objc != 5)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?");
@@ -2897,7 +2874,7 @@ WmMinsizeCmd(
static int
WmOverrideredirectCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -2905,7 +2882,6 @@ WmOverrideredirectCmd(
{
int boolean, curValue;
XSetWindowAttributes atts;
- (void)tkwin;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?");
@@ -2956,7 +2932,7 @@ WmOverrideredirectCmd(
static int
WmPositionfromCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -2968,7 +2944,6 @@ WmPositionfromCmd(
enum options {
OPT_PROGRAM, OPT_USER };
int index;
- (void)tkwin;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?user/program?");
@@ -3024,7 +2999,7 @@ WmPositionfromCmd(
static int
WmProtocolCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -3035,7 +3010,6 @@ WmProtocolCmd(
Atom protocol;
const char *cmd;
TkSizeT cmdLength;
- (void)tkwin;
if ((objc < 3) || (objc > 5)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?name? ?command?");
@@ -3135,7 +3109,7 @@ WmProtocolCmd(
static int
WmResizableCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -3143,7 +3117,6 @@ WmResizableCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
int width, height;
- (void)tkwin;
if ((objc != 3) && (objc != 5)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?");
@@ -3195,7 +3168,7 @@ WmResizableCmd(
static int
WmSizefromCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -3207,7 +3180,6 @@ WmSizefromCmd(
enum options {
OPT_PROGRAM, OPT_USER };
int index;
- (void)tkwin;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?user|program?");
@@ -3388,7 +3360,7 @@ WmStackorderCmd(
static int
WmStateCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -3400,7 +3372,6 @@ WmStateCmd(
enum options {
OPT_NORMAL, OPT_ICONIC, OPT_WITHDRAWN };
int index;
- (void)tkwin;
if ((objc < 3) || (objc > 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?state?");
@@ -3495,7 +3466,7 @@ WmStateCmd(
static int
WmTitleCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -3503,7 +3474,6 @@ WmTitleCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
const char *argv3;
- (void)tkwin;
if (objc > 4) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?newTitle?");
@@ -3698,14 +3668,13 @@ WmTransientCmd(
static int
WmWithdrawCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
- (void)tkwin;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
@@ -4525,12 +4494,11 @@ WrapperEventProc(
static void
TopLevelReqProc(
- ClientData dummy, /* Not used. */
+ TCL_UNUSED(void *), /* Not used. */
Tk_Window tkwin) /* Information about window. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
WmInfo *wmPtr = winPtr->wmInfoPtr;
- (void)dummy;
if (wmPtr == NULL) {
return;
diff --git a/win/configure b/win/configure
index 686fc48..f75d08c 100755
--- a/win/configure
+++ b/win/configure
@@ -4256,7 +4256,7 @@ $as_echo "using shared flags" >&6; }
CFLAGS_DEBUG=-g
CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
- CFLAGS_WARNING="-Wall -Wextra -Wwrite-strings -Wpointer-arith"
+ CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith"
LDFLAGS_DEBUG=
LDFLAGS_OPTIMIZE=
diff --git a/win/tcl.m4 b/win/tcl.m4
index 4824e8e..a8aab6b 100644
--- a/win/tcl.m4
+++ b/win/tcl.m4
@@ -673,7 +673,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
CFLAGS_DEBUG=-g
CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
- CFLAGS_WARNING="-Wall -Wextra -Wwrite-strings -Wpointer-arith"
+ CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith"
LDFLAGS_DEBUG=
LDFLAGS_OPTIMIZE=
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index e03c50f..40a7b97 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.c
@@ -2329,13 +2329,13 @@ TkpInitializeMenuBindings(
"<KeyRelease-Alt_R>", "tk::WinMenuKey %W %N", 0);
(void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
- "<Alt-KeyPress>", "tk::WinMenuKey %W %N", 0);
+ "<Alt-Key>", "tk::WinMenuKey %W %N", 0);
(void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
"<Alt-KeyRelease>", "tk::WinMenuKey %W %N", 0);
(void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
- "<KeyPress-F10>", "tk::WinMenuKey %W %N", 0);
+ "<Key-F10>", "tk::WinMenuKey %W %N", 0);
(void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
"<KeyRelease-F10>", "tk::WinMenuKey %W %N", 0);
diff --git a/win/tkWinSendCom.c b/win/tkWinSendCom.c
index 536c6c1..2d66862 100644
--- a/win/tkWinSendCom.c
+++ b/win/tkWinSendCom.c
@@ -432,7 +432,7 @@ Async(
static HRESULT
Send(
- TkWinSendCom *obj,
+ TkWinSendCom *comobj,
VARIANT vCmd,
VARIANT *pvResult,
EXCEPINFO *pExcepInfo,
@@ -441,7 +441,7 @@ Send(
HRESULT hr = S_OK;
int result = TCL_OK;
VARIANT v;
- Tcl_Interp *interp = obj->interp;
+ Tcl_Interp *interp = comobj->interp;
Tcl_Obj *scriptPtr;
Tcl_DString ds;
(void)puArgErr;
diff --git a/win/tkWinX.c b/win/tkWinX.c
index 661ad29..f60823b 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -349,12 +349,12 @@ TkWinGetPlatformTheme(void)
* TK_THEME_WIN_CLASSIC could be set even when running under XP if the
* windows classic theme was selected.
*/
- if ((os.dwMajorVersion == 5) && (os.dwMinorVersion == 1)) {
+ if (os.dwMajorVersion == 5 && os.dwMinorVersion >= 1) {
HKEY hKey;
LPCWSTR szSubKey = L"Control Panel\\Appearance";
LPCWSTR szCurrent = L"Current";
DWORD dwSize = 200;
- char pBuffer[200];
+ WCHAR pBuffer[200];
memset(pBuffer, 0, dwSize);
if (RegOpenKeyExW(HKEY_CURRENT_USER, szSubKey, 0L,
@@ -363,7 +363,7 @@ TkWinGetPlatformTheme(void)
} else {
RegQueryValueExW(hKey, szCurrent, NULL, NULL, (LPBYTE) pBuffer, &dwSize);
RegCloseKey(hKey);
- if (strcmp(pBuffer, "Windows Standard") == 0) {
+ if (wcscmp(pBuffer, L"Windows Standard") == 0) {
tkWinTheme = TK_THEME_WIN_CLASSIC;
} else {
tkWinTheme = TK_THEME_WIN_XP;
diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c
index 5ab1967..99e523b 100644
--- a/win/ttkWinXPTheme.c
+++ b/win/ttkWinXPTheme.c
@@ -795,7 +795,7 @@ static const Ttk_ElementSpec TreeIndicatorElementSpec =
TreeIndicatorElementDraw
};
-#if BROKEN_TEXT_ELEMENT
+#ifdef BROKEN_TEXT_ELEMENT
/*
*----------------------------------------------------------------------
@@ -1046,12 +1046,10 @@ static const ElementInfo ElementInfoTable[] = {
{ "Spinbox.downarrow", &SpinboxArrowElementSpec, L"SPIN",
SPNP_DOWN, spinbutton_statemap, NOPAD,
PAD_MARGINS | ((SM_CXVSCROLL << 8) | SM_CYVSCROLL) },
-
-#if BROKEN_TEXT_ELEMENT
+#ifdef BROKEN_TEXT_ELEMENT
{ "Labelframe.text", &TextElementSpec, L"BUTTON",
BP_GROUPBOX, groupbox_statemap, NOPAD,0 },
#endif
-
{ 0,0,0,0,0,NOPAD,0 }
};
#undef PAD