diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-29 16:06:15 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-29 16:06:15 (GMT) |
commit | 327ab1ecf903217147e6cbbc0f33f4813ca67f56 (patch) | |
tree | 07f0ffc3867c833a32054a8ce6d9163b00d6aebe | |
parent | 2ea9bf03c9d6aff18d5b04582f6f1e9849ce54d1 (diff) | |
parent | b9c54e9e7e755df631f2b4ad860dc1ecc67279fd (diff) | |
download | tk-327ab1ecf903217147e6cbbc0f33f4813ca67f56.zip tk-327ab1ecf903217147e6cbbc0f33f4813ca67f56.tar.gz tk-327ab1ecf903217147e6cbbc0f33f4813ca67f56.tar.bz2 |
Merge trunk
74 files changed, 709 insertions, 617 deletions
diff --git a/.travis.yml b/.travis.yml index d1f6356..6711414 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,8 @@ language: c addons: apt: + sources: + - ubuntu-toolchain-r-test packages: - binutils-mingw-w64-i686 - binutils-mingw-w64-x86-64 @@ -9,7 +11,7 @@ addons: - gcc-mingw-w64-i686 - gcc-mingw-w64-x86-64 - gcc-multilib - - tcl-dev + - tcl8.6-dev - libx11-dev - xvfb homebrew: @@ -19,7 +21,7 @@ addons: - xquartz jobs: include: -# Testing on Linux with various compilers +# Testing on Linux GCC - name: "Linux/GCC/Shared" os: linux dist: focal @@ -31,7 +33,11 @@ jobs: script: &x11gui - make binaries libraries tktest - make install - - make test + - make test-classic >out-classic.txt + - cat out-classic.txt + - make test-ttk >out-ttk.txt + - cat out-ttk.txt + - grep -q "Failed 0" out-ttk.txt - name: "Linux/GCC/Shared: NO_DEPRECATED" os: linux dist: focal @@ -105,29 +111,15 @@ jobs: env: - BUILD_DIR=unix - CFGOPT="CC=g++ CFLAGS=-DTCL_UTF_MAX=6" -# Older versions of GCC... - - name: "Linux/GCC 7/Shared" +# Newer/Older versions of GCC + - name: "Linux/GCC 10/Shared" os: linux dist: focal - compiler: gcc-7 + compiler: gcc-10 addons: apt: - sources: - - ubuntu-toolchain-r-test packages: - - g++-7 - env: - - BUILD_DIR=unix - - name: "Linux/GCC 6/Shared" - os: linux - dist: bionic - compiler: gcc-6 - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-6 + - g++-10 env: - BUILD_DIR=unix - name: "Linux/GCC 5/Shared" @@ -136,13 +128,11 @@ jobs: compiler: gcc-5 addons: apt: - sources: - - ubuntu-toolchain-r-test packages: - g++-5 env: - BUILD_DIR=unix -# Clang +# Testing on Linux Clang - name: "Linux/Clang/Shared" os: linux dist: focal @@ -178,21 +168,21 @@ jobs: - BUILD_DIR=unix - CFGOPT="--enable-symbols" # Testing on Mac, various styles - - name: "macOS/Clang/Xcode 11.7/Shared" + - name: "macOS/Xcode 12/Shared" os: osx - osx_image: xcode11.7 + osx_image: xcode12 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include" - - name: "macOS/Clang++/Xcode 11.7/Shared" + - name: "macOS/Clang++/Xcode 12/Shared" os: osx - osx_image: xcode11.7 + osx_image: xcode12 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib CC=clang++ --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-D__private_extern__=extern" - - name: "macOS/Clang/Xcode 11.7/Shared" + - name: "macOS/Xcode 12/Shared" os: osx - osx_image: xcode11.7 + osx_image: xcode12 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include" @@ -200,27 +190,27 @@ jobs: - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) script: &mactest - make all tktest - - name: "macOS/Clang/Xcode 11.7/Static" + - name: "macOS/Xcode 12/Static" os: osx - osx_image: xcode11.7 + osx_image: xcode12 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua --disable-shared CFLAGS=-I/usr/local/opt/tcl-tk/include" install: - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) script: *mactest - - name: "macOS/Clang/Xcode 11.7/Debug" + - name: "macOS/Xcode 12/Debug" os: osx - osx_image: xcode11.7 + osx_image: xcode12 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua --enable-symbols CFLAGS=-I/usr/local/opt/tcl-tk/include" install: - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) script: *mactest - - name: "macOS/Clang/Xcode 11.7/Shared/XQuartz" + - name: "macOS/Xcode 12/Shared/XQuartz" os: osx - osx_image: xcode11.7 + osx_image: xcode12 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --disable-corefoundation --x-includes=/opt/X11/include --x-libraries=/opt/X11/lib CFLAGS=-I/usr/local/opt/tcl-tk/include" @@ -228,16 +218,16 @@ jobs: - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) script: *mactest # Older MacOS versions - - name: "macOS/Clang/Xcode 11/Shared" + - name: "macOS/Xcode 11/Shared" os: osx - osx_image: xcode11 + osx_image: xcode11.7 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-mmacosx-version-min=10.14" install: - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) script: *mactest - - name: "macOS/Clang/Xcode 10/Shared" + - name: "macOS/Xcode 10/Shared" os: osx osx_image: xcode10.3 addons: @@ -251,7 +241,7 @@ jobs: install: - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) script: *mactest - - name: "macOS/Clang/Xcode 9/Shared" + - name: "macOS/Xcode 9/Shared" os: osx osx_image: xcode9.4 addons: @@ -298,8 +288,6 @@ before_install: install: - mkdir "$HOME/install dir" - ./configure ${CFGOPT} "--prefix=$HOME/install dir" || (cat config.log && exit 1) -before_script: - - export ERROR_ON_FAILURES=1 script: - make all tktest - make install diff --git a/ChangeLog.2004 b/ChangeLog.2004 index b900e7b..9afaa75 100644 --- a/ChangeLog.2004 +++ b/ChangeLog.2004 @@ -3521,7 +3521,7 @@ 2003-02-13 Kevin Kenny <kennykb@users.sourceforge.net> * doc/wish.n: Added language to describe the handling of the - end-of-file character \u001a in script files. [Bug 685505] + end-of-file character \x1A in script files. [Bug 685505] 2003-02-10 Jim Ingham <jingham@apple.com> @@ -303,7 +303,7 @@ row or column, or the largest column or row with a \fB\-minsize\fR, .TP \fBgrid content fI\window\fR ?\fI\-option value\fR? . -If no options are supplied, a list of all of the content in \window\fR +If no options are supplied, a list of all of the content in \fIwindow\fR is returned, most recently managed first. \fIOption\fR can be either \fB\-row\fR or \fB\-column\fR which causes only the content in the row (or column) specified by \fIvalue\fR diff --git a/generic/nanosvg.h b/generic/nanosvg.h index 7bb13d2..3f9548b 100644 --- a/generic/nanosvg.h +++ b/generic/nanosvg.h @@ -45,15 +45,15 @@ extern "C" { // NanoSVG can return the paths in few different units. For example if you want to render an image, you may choose // to get the paths in pixels, or if you are feeding the data into a CNC-cutter, you may want to use millimeters. // -// The units passed to NanoVG should be one of: 'px', 'pt', 'pc' 'mm', 'cm', or 'in'. +// The units passed to NanoSVG should be one of: 'px', 'pt', 'pc' 'mm', 'cm', or 'in'. // DPI (dots-per-inch) controls how the unit conversion is done. // // If you don't know or care about the units stuff, "px" and 96 should get you going. /* Example Usage: - // Load - NSVGImage* image; + // Load SVG + NSVGimage* image; image = nsvgParseFromFile("test.svg", "px", 96); printf("size: %f x %f\n", image->width, image->height); // Use... @@ -255,11 +255,6 @@ static int nsvg__isdigit(char c) return c >= '0' && c <= '9'; } -static int nsvg__isnum(char c) -{ - return strchr("0123456789+-.eE", c) != 0; -} - static NSVG_INLINE float nsvg__minf(float a, float b) { return a < b ? a : b; } static NSVG_INLINE float nsvg__maxf(float a, float b) { return a > b ? a : b; } @@ -795,9 +790,11 @@ static void nsvg__lineTo(NSVGparser* p, float x, float y) static void nsvg__cubicBezTo(NSVGparser* p, float cpx1, float cpy1, float cpx2, float cpy2, float x, float y) { - nsvg__addPoint(p, cpx1, cpy1); - nsvg__addPoint(p, cpx2, cpy2); - nsvg__addPoint(p, x, y); + if (p->npts > 0) { + nsvg__addPoint(p, cpx1, cpy1); + nsvg__addPoint(p, cpx2, cpy2); + nsvg__addPoint(p, x, y); + } } static NSVGattrib* nsvg__getAttr(NSVGparser* p) @@ -867,7 +864,9 @@ static float nsvg__convertToPixels(NSVGparser* p, NSVGcoordinate c, float orig, static NSVGgradientData* nsvg__findGradientData(NSVGparser* p, const char* id) { NSVGgradientData* grad = p->gradients; - while (grad) { + if (id == NULL || *id == '\0') + return NULL; + while (grad != NULL) { if (strcmp(grad->id, id) == 0) return grad; grad = grad->next; @@ -884,19 +883,26 @@ static NSVGgradient* nsvg__createGradient(NSVGparser* p, const char* id, const f NSVGgradient* grad; float ox, oy, sw, sh, sl; int nstops = 0; + int refIter; data = nsvg__findGradientData(p, id); if (data == NULL) return NULL; // TODO: use ref to fill in all unset values too. ref = data; + refIter = 0; while (ref != NULL) { + NSVGgradientData* nextRef = NULL; if (stops == NULL && ref->stops != NULL) { stops = ref->stops; nstops = ref->nstops; break; } - ref = nsvg__findGradientData(p, ref->ref); + nextRef = nsvg__findGradientData(p, ref->ref); + if (nextRef == ref) break; // prevent infite loops on malformed data + ref = nextRef; + refIter++; + if (refIter > 32) break; // prevent infite loops on malformed data } if (stops == NULL) return NULL; @@ -1099,6 +1105,10 @@ static void nsvg__addPath(NSVGparser* p, char closed) if (closed) nsvg__lineTo(p, p->pts[0], p->pts[1]); + // Expect 1 + N*3 points (N = number of cubic bezier segments). + if ((p->npts % 3) != 1) + return; + path = (NSVGpath*)NANOSVG_malloc(sizeof(NSVGpath)); if (path == NULL) goto error; memset(path, 0, sizeof(NSVGpath)); @@ -1531,6 +1541,15 @@ static int nsvg__parseUnits(const char* units) return NSVG_UNITS_USER; } +static int nsvg__isCoordinate(const char* s) +{ + // optional sign + if (*s == '-' || *s == '+') + s++; + // must have at least one digit + return nsvg__isdigit(*s); +} + static NSVGcoordinate nsvg__parseCoordinateRaw(const char* str) { NSVGcoordinate coord = {0, NSVG_UNITS_USER}; @@ -1670,25 +1689,32 @@ static int nsvg__parseRotate(float* xform, const char* str) static void nsvg__parseTransform(float* xform, const char* str) { float t[6]; + int len; nsvg__xformIdentity(xform); while (*str) { if (strncmp(str, "matrix", 6) == 0) - str += nsvg__parseMatrix(t, str); + len = nsvg__parseMatrix(t, str); else if (strncmp(str, "translate", 9) == 0) - str += nsvg__parseTranslate(t, str); + len = nsvg__parseTranslate(t, str); else if (strncmp(str, "scale", 5) == 0) - str += nsvg__parseScale(t, str); + len = nsvg__parseScale(t, str); else if (strncmp(str, "rotate", 6) == 0) - str += nsvg__parseRotate(t, str); + len = nsvg__parseRotate(t, str); else if (strncmp(str, "skewX", 5) == 0) - str += nsvg__parseSkewX(t, str); + len = nsvg__parseSkewX(t, str); else if (strncmp(str, "skewY", 5) == 0) - str += nsvg__parseSkewY(t, str); + len = nsvg__parseSkewY(t, str); else{ ++str; continue; } + if (len != 0) { + str += len; + } else { + ++str; + continue; + } nsvg__xformPremultiply(xform, t); } @@ -1966,8 +1992,11 @@ static int nsvg__getArgsPerElement(char cmd) case 'a': case 'A': return 7; + case 'z': + case 'Z': + return 0; } - return 0; + return -1; } static void nsvg__pathMoveTo(NSVGparser* p, float* cpx, float* cpy, float* args, int rel) @@ -2277,6 +2306,7 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr) float args[10]; int nargs; int rargs = 0; + char initPoint; float cpx, cpy, cpx2, cpy2; const char* tmp[4]; char closedFlag; @@ -2299,13 +2329,14 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr) nsvg__resetPath(p); cpx = 0; cpy = 0; cpx2 = 0; cpy2 = 0; + initPoint = 0; closedFlag = 0; nargs = 0; while (*s) { s = nsvg__getNextPathItem(s, item); if (!*item) break; - if (nsvg__isnum(item[0])) { + if (cmd != '\0' && nsvg__isCoordinate(item)) { if (nargs < 10) args[nargs++] = (float)nsvg__atof(item); if (nargs >= rargs) { @@ -2318,6 +2349,7 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr) cmd = (cmd == 'm') ? 'l' : 'L'; rargs = nsvg__getArgsPerElement(cmd); cpx2 = cpx; cpy2 = cpy; + initPoint = 1; break; case 'l': case 'L': @@ -2367,7 +2399,6 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr) } } else { cmd = item[0]; - rargs = nsvg__getArgsPerElement(cmd); if (cmd == 'M' || cmd == 'm') { // Commit path. if (p->npts > 0) @@ -2376,7 +2407,11 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr) nsvg__resetPath(p); closedFlag = 0; nargs = 0; - } else if (cmd == 'Z' || cmd == 'z') { + } else if (initPoint == 0) { + // Do not allow other commands until initial point has been set (moveTo called once). + cmd = '\0'; + } + if (cmd == 'Z' || cmd == 'z') { closedFlag = 1; // Commit path. if (p->npts > 0) { @@ -2392,6 +2427,12 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr) closedFlag = 0; nargs = 0; } + rargs = nsvg__getArgsPerElement(cmd); + if (rargs == -1) { + // Command not recognized + cmd = '\0'; + rargs = 0; + } } } // Commit path. diff --git a/generic/tkBind.c b/generic/tkBind.c index ec121cd..4ab98f5 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -2164,7 +2164,7 @@ Tk_BindEvent( TkDisplay *dispPtr; TkDisplay *oldDispPtr; Event *curEvent; - TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *)tkwin; BindInfo *bindInfoPtr; Tcl_InterpState interpState; LookupTables *physTables; @@ -2454,7 +2454,6 @@ Tk_BindEvent( LookupTables *virtTables = &bindInfoPtr->virtualEventTable.lookupTables; PatSeq *matchPtr = matchPtrArr[k]; PatSeq *mPtr; - PSList *psl[2]; /* * Note that virtual events cannot promote. @@ -2757,11 +2756,11 @@ CompareModMasks( assert(PSModMaskArr_Size(fstModMaskArr) == PSModMaskArr_Size(sndModMaskArr)); for (i = PSModMaskArr_Size(fstModMaskArr) - 1; i >= 0; --i) { - unsigned fstModMask = *PSModMaskArr_Get(fstModMaskArr, i); - unsigned sndModMask = *PSModMaskArr_Get(sndModMaskArr, i); + unsigned fstiModMask = *PSModMaskArr_Get(fstModMaskArr, i); + unsigned sndiModMask = *PSModMaskArr_Get(sndModMaskArr, i); - if (IsSubsetOf(fstModMask, sndModMask)) { ++sndCount; } - if (IsSubsetOf(sndModMask, fstModMask)) { ++fstCount; } + if (IsSubsetOf(fstiModMask, sndiModMask)) { ++sndCount; } + if (IsSubsetOf(sndiModMask, fstiModMask)) { ++fstCount; } } } diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 1ddf96a..7ec7aec 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -1899,7 +1899,7 @@ GetObjectForOption( switch (optionPtr->specPtr->type) { case TK_OPTION_BOOLEAN: case TK_OPTION_INT: - objPtr = Tcl_NewWideIntObj(*((int *) internalPtr)); + objPtr = Tcl_NewWideIntObj(*((int *)internalPtr)); break; case TK_OPTION_INDEX: if (*((int *) internalPtr) == INT_MIN) { @@ -1920,14 +1920,14 @@ GetObjectForOption( objPtr = Tcl_NewDoubleObj(*((double *) internalPtr)); break; case TK_OPTION_STRING: - objPtr = Tcl_NewStringObj(*((char **) internalPtr), -1); + objPtr = Tcl_NewStringObj(*((char **)internalPtr), -1); break; case TK_OPTION_STRING_TABLE: objPtr = Tcl_NewStringObj(((char **) optionPtr->specPtr->clientData)[ *((int *) internalPtr)], -1); break; case TK_OPTION_COLOR: { - XColor *colorPtr = *((XColor **) internalPtr); + XColor *colorPtr = *((XColor **)internalPtr); if (colorPtr != NULL) { objPtr = Tcl_NewStringObj(Tk_NameOfColor(colorPtr), -1); @@ -1935,7 +1935,7 @@ GetObjectForOption( break; } case TK_OPTION_FONT: { - Tk_Font tkfont = *((Tk_Font *) internalPtr); + Tk_Font tkfont = *((Tk_Font *)internalPtr); if (tkfont != NULL) { objPtr = Tcl_NewStringObj(Tk_NameOfFont(tkfont), -1); @@ -1943,7 +1943,7 @@ GetObjectForOption( break; } case TK_OPTION_STYLE: { - Tk_Style style = *((Tk_Style *) internalPtr); + Tk_Style style = *((Tk_Style *)internalPtr); if (style != NULL) { objPtr = Tcl_NewStringObj(Tk_NameOfStyle(style), -1); @@ -1951,7 +1951,7 @@ GetObjectForOption( break; } case TK_OPTION_BITMAP: { - Pixmap pixmap = *((Pixmap *) internalPtr); + Pixmap pixmap = *((Pixmap *)internalPtr); if (pixmap != None) { objPtr = Tcl_NewStringObj( @@ -1960,7 +1960,7 @@ GetObjectForOption( break; } case TK_OPTION_BORDER: { - Tk_3DBorder border = *((Tk_3DBorder *) internalPtr); + Tk_3DBorder border = *((Tk_3DBorder *)internalPtr); if (border != NULL) { objPtr = Tcl_NewStringObj(Tk_NameOf3DBorder(border), -1); @@ -1968,10 +1968,10 @@ GetObjectForOption( break; } case TK_OPTION_RELIEF: - objPtr = Tcl_NewStringObj(Tk_NameOfRelief(*((int *) internalPtr)), -1); + objPtr = Tcl_NewStringObj(Tk_NameOfRelief(*((int *)internalPtr)), -1); break; case TK_OPTION_CURSOR: { - Tk_Cursor cursor = *((Tk_Cursor *) internalPtr); + Tk_Cursor cursor = *((Tk_Cursor *)internalPtr); if (cursor != NULL) { objPtr = Tcl_NewStringObj( @@ -1981,17 +1981,17 @@ GetObjectForOption( } case TK_OPTION_JUSTIFY: objPtr = Tcl_NewStringObj(Tk_NameOfJustify( - *((Tk_Justify *) internalPtr)), -1); + *((Tk_Justify *)internalPtr)), -1); break; case TK_OPTION_ANCHOR: objPtr = Tcl_NewStringObj(Tk_NameOfAnchor( - *((Tk_Anchor *) internalPtr)), -1); + *((Tk_Anchor *)internalPtr)), -1); break; case TK_OPTION_PIXELS: - objPtr = Tcl_NewWideIntObj(*((int *) internalPtr)); + objPtr = Tcl_NewWideIntObj(*((int *)internalPtr)); break; case TK_OPTION_WINDOW: { - Tk_Window tkwin = *((Tk_Window *) internalPtr); + tkwin = *((Tk_Window *) internalPtr); if (tkwin != NULL) { objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1); diff --git a/generic/tkGrid.c b/generic/tkGrid.c index 067407a..51b9512 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -3361,7 +3361,7 @@ ConfigureContent( */ for (container = (TkWindow *)containerPtr->tkwin; container != NULL; - container = (TkWindow *)TkGetGeomMaster(container)) { + container = (TkWindow *)TkGetContainer(container)) { if (container == (TkWindow *)content) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't put \"%s\" inside \"%s\": would cause management loop", diff --git a/generic/tkInt.decls b/generic/tkInt.decls index 1388367..7886355 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -1030,7 +1030,7 @@ declare 47 aqua { Tk_Window TkpGetCapture(void) } declare 49 aqua { - Tk_Window TkGetTransientMaster(TkWindow *winPtr) + Tk_Window TkMacOSXGetContainer(TkWindow *winPtr) } declare 50 aqua { int TkGenerateButtonEvent(int x, int y, Window window, unsigned int state) diff --git a/generic/tkInt.h b/generic/tkInt.h index 081ba68..61f348d 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -374,7 +374,7 @@ typedef struct TkDisplay { * by that container. */ int geomInit; -#define TkGetGeomMaster(tkwin) (((TkWindow *)tkwin)->maintainerPtr != NULL ? \ +#define TkGetContainer(tkwin) (((TkWindow *)tkwin)->maintainerPtr != NULL ? \ ((TkWindow *)tkwin)->maintainerPtr : ((TkWindow *)tkwin)->parentPtr) /* diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h index 88b36ce..348868b 100644 --- a/generic/tkIntPlatDecls.h +++ b/generic/tkIntPlatDecls.h @@ -244,7 +244,7 @@ EXTERN int TkpIsWindowFloating(void *window); EXTERN Tk_Window TkpGetCapture(void); /* Slot 48 is reserved */ /* 49 */ -EXTERN Tk_Window TkGetTransientMaster(TkWindow *winPtr); +EXTERN Tk_Window TkMacOSXGetContainer(TkWindow *winPtr); /* 50 */ EXTERN int TkGenerateButtonEvent(int x, int y, Window window, unsigned int state); @@ -439,7 +439,7 @@ typedef struct TkIntPlatStubs { int (*tkpIsWindowFloating) (void *window); /* 46 */ Tk_Window (*tkpGetCapture) (void); /* 47 */ void (*reserved48)(void); - Tk_Window (*tkGetTransientMaster) (TkWindow *winPtr); /* 49 */ + Tk_Window (*tkMacOSXGetContainer) (TkWindow *winPtr); /* 49 */ int (*tkGenerateButtonEvent) (int x, int y, Window window, unsigned int state); /* 50 */ void (*tkGenWMDestroyEvent) (Tk_Window tkwin); /* 51 */ void (*tkMacOSXSetDrawingEnabled) (TkWindow *winPtr, int flag); /* 52 */ @@ -694,8 +694,8 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr; #define TkpGetCapture \ (tkIntPlatStubsPtr->tkpGetCapture) /* 47 */ /* Slot 48 is reserved */ -#define TkGetTransientMaster \ - (tkIntPlatStubsPtr->tkGetTransientMaster) /* 49 */ +#define TkMacOSXGetContainer \ + (tkIntPlatStubsPtr->tkMacOSXGetContainer) /* 49 */ #define TkGenerateButtonEvent \ (tkIntPlatStubsPtr->tkGenerateButtonEvent) /* 50 */ #define TkGenWMDestroyEvent \ diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 947d996..9dc9534 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -2130,7 +2130,8 @@ GetMenuIndex( const char *string; if (TkGetIntForIndex(objPtr, menuPtr->numEntries - 1, lastOK, indexPtr) == TCL_OK) { - if (*indexPtr != TCL_INDEX_NONE) { + /* TCL_INDEX_NONE is only accepted if it does not result from a negative number */ + if (*indexPtr != TCL_INDEX_NONE || Tcl_GetString(objPtr)[0] != '-') { if (*indexPtr >= menuPtr->numEntries) { *indexPtr = menuPtr->numEntries - ((lastOK) ? 0 : 1); } @@ -2368,7 +2369,7 @@ MenuAddOrInsert( } if (index == TCL_INDEX_NONE) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "bad index \"%s\"", Tcl_GetString(indexPtr))); + "bad menu entry index \"%s\"", Tcl_GetString(indexPtr))); Tcl_SetErrorCode(interp, "TK", "MENU", "INDEX", NULL); return TCL_ERROR; } diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index 6e9a49e..49c576a 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -775,28 +775,28 @@ FormatConfigValue( result = ""; switch (specPtr->type) { case TK_CONFIG_BOOLEAN: - if (*((int *) ptr) == 0) { + if (*((int *)ptr) == 0) { result = "0"; } else { result = "1"; } break; case TK_CONFIG_INT: - sprintf(buffer, "%d", *((int *) ptr)); + sprintf(buffer, "%d", *((int *)ptr)); result = buffer; break; case TK_CONFIG_DOUBLE: - Tcl_PrintDouble(interp, *((double *) ptr), buffer); + Tcl_PrintDouble(interp, *((double *)ptr), buffer); result = buffer; break; case TK_CONFIG_STRING: - result = (*(char **) ptr); + result = (*(char **)ptr); if (result == NULL) { result = ""; } break; case TK_CONFIG_UID: { - Tk_Uid uid = *((Tk_Uid *) ptr); + Tk_Uid uid = *((Tk_Uid *)ptr); if (uid != NULL) { result = uid; @@ -804,7 +804,7 @@ FormatConfigValue( break; } case TK_CONFIG_COLOR: { - XColor *colorPtr = *((XColor **) ptr); + XColor *colorPtr = *((XColor **)ptr); if (colorPtr != NULL) { result = Tk_NameOfColor(colorPtr); @@ -812,7 +812,7 @@ FormatConfigValue( break; } case TK_CONFIG_FONT: { - Tk_Font tkfont = *((Tk_Font *) ptr); + Tk_Font tkfont = *((Tk_Font *)ptr); if (tkfont != NULL) { result = Tk_NameOfFont(tkfont); @@ -820,7 +820,7 @@ FormatConfigValue( break; } case TK_CONFIG_BITMAP: { - Pixmap pixmap = *((Pixmap *) ptr); + Pixmap pixmap = *((Pixmap *)ptr); if (pixmap != None) { result = Tk_NameOfBitmap(Tk_Display(tkwin), pixmap); @@ -828,7 +828,7 @@ FormatConfigValue( break; } case TK_CONFIG_BORDER: { - Tk_3DBorder border = *((Tk_3DBorder *) ptr); + Tk_3DBorder border = *((Tk_3DBorder *)ptr); if (border != NULL) { result = Tk_NameOf3DBorder(border); @@ -836,11 +836,11 @@ FormatConfigValue( break; } case TK_CONFIG_RELIEF: - result = Tk_NameOfRelief(*((int *) ptr)); + result = Tk_NameOfRelief(*((int *)ptr)); break; case TK_CONFIG_CURSOR: case TK_CONFIG_ACTIVE_CURSOR: { - Tk_Cursor cursor = *((Tk_Cursor *) ptr); + Tk_Cursor cursor = *((Tk_Cursor *)ptr); if (cursor != NULL) { result = Tk_NameOfCursor(Tk_Display(tkwin), cursor); @@ -848,29 +848,27 @@ FormatConfigValue( break; } case TK_CONFIG_JUSTIFY: - result = Tk_NameOfJustify(*((Tk_Justify *) ptr)); + result = Tk_NameOfJustify(*((Tk_Justify *)ptr)); break; case TK_CONFIG_ANCHOR: - result = Tk_NameOfAnchor(*((Tk_Anchor *) ptr)); + result = Tk_NameOfAnchor(*((Tk_Anchor *)ptr)); break; case TK_CONFIG_CAP_STYLE: - result = Tk_NameOfCapStyle(*((int *) ptr)); + result = Tk_NameOfCapStyle(*((int *)ptr)); break; case TK_CONFIG_JOIN_STYLE: - result = Tk_NameOfJoinStyle(*((int *) ptr)); + result = Tk_NameOfJoinStyle(*((int *)ptr)); break; case TK_CONFIG_PIXELS: - sprintf(buffer, "%d", *((int *) ptr)); + sprintf(buffer, "%d", *((int *)ptr)); result = buffer; break; case TK_CONFIG_MM: - Tcl_PrintDouble(interp, *((double *) ptr), buffer); + Tcl_PrintDouble(interp, *((double *)ptr), buffer); result = buffer; break; case TK_CONFIG_WINDOW: { - Tk_Window tkwin; - - tkwin = *((Tk_Window *) ptr); + tkwin = *((Tk_Window *)ptr); if (tkwin != NULL) { result = Tk_PathName(tkwin); } diff --git a/generic/tkPack.c b/generic/tkPack.c index d73de4a..00597b3 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.c @@ -1821,7 +1821,7 @@ ConfigureContent( */ for (container = (TkWindow *)containerPtr->tkwin; container != NULL; - container = (TkWindow *)TkGetGeomMaster(container)) { + container = (TkWindow *)TkGetContainer(container)) { if (container == (TkWindow *)content) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't put \"%s\" inside \"%s\": would cause management loop", diff --git a/generic/tkPkgConfig.c b/generic/tkPkgConfig.c index a3666d4..fe084bf 100644 --- a/generic/tkPkgConfig.c +++ b/generic/tkPkgConfig.c @@ -40,7 +40,7 @@ #ifndef TCL_CFGVAL_ENCODING -#define TCL_CFGVAL_ENCODING "ascii" +#define TCL_CFGVAL_ENCODING "utf-8" #endif /* @@ -84,7 +84,7 @@ # define CFG_PROFILED "0" #endif -#if defined(_WIN32) || defined(__CYGWIN__) +#if defined(_WIN32) # define CFG_FONTSYSTEM "gdi" #elif defined(MAC_OSX_TK) # define CFG_FONTSYSTEM "cocoa" diff --git a/generic/tkPlace.c b/generic/tkPlace.c index 01386a2..7625362 100644 --- a/generic/tkPlace.c +++ b/generic/tkPlace.c @@ -702,7 +702,7 @@ ConfigureContent( */ for (container = (TkWindow *)tkwin; container != NULL; - container = (TkWindow *)TkGetGeomMaster(container)) { + container = (TkWindow *)TkGetContainer(container)) { if (container == (TkWindow *)contentPtr->tkwin) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't put \"%s\" inside \"%s\": would cause management loop", diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 8d863c1..f459fbd 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -625,7 +625,7 @@ static const TkIntPlatStubs tkIntPlatStubs = { TkpIsWindowFloating, /* 46 */ TkpGetCapture, /* 47 */ 0, /* 48 */ - TkGetTransientMaster, /* 49 */ + TkMacOSXGetContainer, /* 49 */ TkGenerateButtonEvent, /* 50 */ TkGenWMDestroyEvent, /* 51 */ TkMacOSXSetDrawingEnabled, /* 52 */ diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c index b95bd9b..a6a5e35 100644 --- a/generic/tkTextBTree.c +++ b/generic/tkTextBTree.c @@ -4592,10 +4592,9 @@ static TkTextSegment * CharCleanupProc( TkTextSegment *segPtr, /* Pointer to first of two adjacent segments * to join. */ - TkTextLine *linePtr) /* Line containing segments (not used). */ + TCL_UNUSED(TkTextLine *)) /* Line containing segments (not used). */ { TkTextSegment *segPtr2, *newPtr; - (void)linePtr; segPtr2 = segPtr->nextPtr; if ((segPtr2 == NULL) || (segPtr2->typePtr != &tkTextCharType)) { @@ -4632,14 +4631,11 @@ CharCleanupProc( static int CharDeleteProc( TkTextSegment *segPtr, /* Segment to delete. */ - TkTextLine *linePtr, /* Line containing segment. */ - int treeGone) /* Non-zero means the entire tree is being + TCL_UNUSED(TkTextLine *), /* Line containing segment. */ + TCL_UNUSED(int)) /* Non-zero means the entire tree is being * deleted, so everything must get cleaned * up. */ { - (void)linePtr; - (void)treeGone; - ckfree(segPtr); return 0; } @@ -4664,10 +4660,8 @@ CharDeleteProc( static void CharCheckProc( TkTextSegment *segPtr, /* Segment to check. */ - TkTextLine *linePtr) /* Line containing segment. */ + TCL_UNUSED(TkTextLine *)) /* Line containing segment. */ { - (void)linePtr; - /* * Make sure that the segment contains the number of characters indicated * by its header, and that the last segment in a line ends in a newline. diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index a28f606..b1c5e17 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -8814,24 +8814,25 @@ TextGetScrollInfoObj( } switch ((enum viewUnits) index) { case VIEW_SCROLL_PAGES: - if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) { - return TKTEXT_SCROLL_ERROR; + if (Tcl_GetIntFromObj(interp, objv[3], intPtr) == TCL_OK) { + return TKTEXT_SCROLL_PAGES; } - return TKTEXT_SCROLL_PAGES; + break; case VIEW_SCROLL_PIXELS: if (Tk_GetPixelsFromObj(interp, textPtr->tkwin, objv[3], - intPtr) != TCL_OK) { - return TKTEXT_SCROLL_ERROR; + intPtr) == TCL_OK) { + return TKTEXT_SCROLL_PIXELS; } - return TKTEXT_SCROLL_PIXELS; + break; case VIEW_SCROLL_UNITS: - if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) { - return TKTEXT_SCROLL_ERROR; + if (Tcl_GetIntFromObj(interp, objv[3], intPtr) == TCL_OK) { + return TKTEXT_SCROLL_UNITS; } - return TKTEXT_SCROLL_UNITS; + break; + default: + Tcl_Panic("unexpected switch fallthrough"); } } - Tcl_Panic("unexpected switch fallthrough"); return TKTEXT_SCROLL_ERROR; } diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c index 9370b92..3657fa6 100644 --- a/generic/tkTextImage.c +++ b/generic/tkTextImage.c @@ -290,8 +290,12 @@ TkTextImageCmd( (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), -1)); } - Tcl_SetObjResult(interp, resultObj); - return TCL_OK; + if (resultObj == NULL) { + return TCL_ERROR; + } else { + Tcl_SetObjResult(interp, resultObj); + return TCL_OK; + } } default: Tcl_Panic("unexpected switch fallthrough"); @@ -447,14 +451,12 @@ EmbImageConfigure( static int EmbImageDeleteProc( TkTextSegment *eiPtr, /* Segment being deleted. */ - TkTextLine *linePtr, /* Line containing segment. */ - int treeGone) /* Non-zero means the entire tree is being + TCL_UNUSED(TkTextLine *), /* Line containing segment. */ + TCL_UNUSED(int)) /* Non-zero means the entire tree is being * deleted, so everything must get cleaned * up. */ { Tcl_HashEntry *hPtr; - (void)linePtr; - (void)treeGone; if (eiPtr->body.ei.image != NULL) { hPtr = Tcl_FindHashEntry(&eiPtr->body.ei.sharedTextPtr->imageTable, @@ -531,17 +533,17 @@ EmbImageCleanupProc( static int EmbImageLayoutProc( TkText *textPtr, /* Text widget being layed out. */ - TkTextIndex *indexPtr, /* Identifies first character in chunk. */ + TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */ TkTextSegment *eiPtr, /* Segment corresponding to indexPtr. */ TkSizeT offset, /* Offset within segPtr corresponding to * indexPtr (always 0). */ int maxX, /* Chunk must not occupy pixels at this * position or higher. */ - TkSizeT maxChars, /* Chunk must not include more than this many + TCL_UNUSED(TkSizeT), /* Chunk must not include more than this many * characters. */ int noCharsYet, /* Non-zero means no characters have been * assigned to this line yet. */ - TkWrapMode wrapMode, /* Wrap mode to use for line: + TCL_UNUSED(TkWrapMode), /* Wrap mode to use for line: * TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or * TEXT_WRAPMODE_WORD. */ TkTextDispChunk *chunkPtr) @@ -550,9 +552,6 @@ EmbImageLayoutProc( * set by the caller. */ { int width, height; - (void)indexPtr; - (void)maxChars; - (void)wrapMode; if (offset != 0) { Tcl_Panic("Non-zero offset in EmbImageLayoutProc"); @@ -622,10 +621,8 @@ EmbImageLayoutProc( static void EmbImageCheckProc( TkTextSegment *eiPtr, /* Segment to check. */ - TkTextLine *linePtr) /* Line containing segment. */ + TCL_UNUSED(TkTextLine *)) /* Line containing segment. */ { - (void)linePtr; - if (eiPtr->nextPtr == NULL) { Tcl_Panic("EmbImageCheckProc: embedded image is last segment in line"); } @@ -665,16 +662,14 @@ EmbImageDisplayProc( * (x-position is in the chunk itself). */ int lineHeight, /* Total height of line. */ int baseline, /* Offset of baseline from y. */ - Display *display, /* Display to use for drawing. */ + TCL_UNUSED(Display *), /* Display to use for drawing. */ Drawable dst, /* Pixmap or window in which to draw */ - int screenY) /* Y-coordinate in text window that + TCL_UNUSED(int)) /* Y-coordinate in text window that * corresponds to y. */ { TkTextSegment *eiPtr = (TkTextSegment *)chunkPtr->clientData; int lineX, imageX, imageY, width, height; Tk_Image image; - (void)display; - (void)screenY; image = eiPtr->body.ei.image; if (image == NULL) { @@ -720,9 +715,9 @@ EmbImageDisplayProc( static void EmbImageBboxProc( - TkText *textPtr, + TCL_UNUSED(TkText *), TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */ - int index, /* Index of desired character within the + TCL_UNUSED(int), /* Index of desired character within the * chunk. */ int y, /* Topmost pixel in area allocated for this * line. */ @@ -738,8 +733,6 @@ EmbImageBboxProc( { TkTextSegment *eiPtr = (TkTextSegment *)chunkPtr->clientData; Tk_Image image; - (void)textPtr; - (void)index; image = eiPtr->body.ei.image; if (image != NULL) { @@ -830,21 +823,18 @@ TkTextImageIndex( static void EmbImageProc( ClientData clientData, /* Pointer to widget record. */ - int x, int y, /* Upper left pixel (within image) that must + TCL_UNUSED(int), /* Upper left pixel (within image) that must * be redisplayed. */ - int width, int height, /* Dimensions of area to redisplay (may be + TCL_UNUSED(int), + TCL_UNUSED(int), /* Dimensions of area to redisplay (may be * <= 0). */ - int imgWidth, int imgHeight)/* New dimensions of image. */ + TCL_UNUSED(int), + TCL_UNUSED(int),/* New dimensions of image. */ + TCL_UNUSED(int)) { TkTextSegment *eiPtr = (TkTextSegment *)clientData; TkTextIndex index; - (void)x; - (void)y; - (void)width; - (void)height; - (void)imgWidth; - (void)imgHeight; index.tree = eiPtr->body.ei.sharedTextPtr->tree; index.linePtr = eiPtr->body.ei.linePtr; diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index 87816f4..d9bf299 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -62,7 +62,7 @@ static void UpdateStringOfTextIndex(Tcl_Obj *objPtr); #define GET_INDEXEPOCH(objPtr) \ (PTR2INT((objPtr)->internalRep.twoPtrValue.ptr2)) #define SET_TEXTINDEX(objPtr, indexPtr) \ - ((objPtr)->internalRep.twoPtrValue.ptr1 = (void *) (indexPtr)) + ((objPtr)->internalRep.twoPtrValue.ptr1 = (void *)(indexPtr)) #define SET_INDEXEPOCH(objPtr, epoch) \ ((objPtr)->internalRep.twoPtrValue.ptr2 = (void *) (size_t) (epoch)) diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c index fe5a892..141e2e5 100644 --- a/generic/tkTextMark.c +++ b/generic/tkTextMark.c @@ -501,16 +501,12 @@ TkTextMarkNameToIndex( static int MarkDeleteProc( - TkTextSegment *segPtr, /* Segment being deleted. */ - TkTextLine *linePtr, /* Line containing segment. */ - int treeGone) /* Non-zero means the entire tree is being + TCL_UNUSED(TkTextSegment *), /* Segment being deleted. */ + TCL_UNUSED(TkTextLine *), /* Line containing segment. */ + TCL_UNUSED(int)) /* Non-zero means the entire tree is being * deleted, so everything must get cleaned * up. */ { - (void)segPtr; - (void)linePtr; - (void)treeGone; - return 1; } @@ -562,29 +558,22 @@ MarkCleanupProc( static int MarkLayoutProc( TkText *textPtr, /* Text widget being layed out. */ - TkTextIndex *indexPtr, /* Identifies first character in chunk. */ + TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */ TkTextSegment *segPtr, /* Segment corresponding to indexPtr. */ - TkSizeT offset, /* Offset within segPtr corresponding to + TCL_UNUSED(TkSizeT), /* Offset within segPtr corresponding to * indexPtr (always 0). */ - int maxX, /* Chunk must not occupy pixels at this + TCL_UNUSED(int), /* Chunk must not occupy pixels at this * position or higher. */ - TkSizeT maxChars, /* Chunk must not include more than this many + TCL_UNUSED(TkSizeT), /* Chunk must not include more than this many * characters. */ - int noCharsYet, /* Non-zero means no characters have been + TCL_UNUSED(int), /* Non-zero means no characters have been * assigned to this line yet. */ - TkWrapMode wrapMode, /* Not used. */ + TCL_UNUSED(TkWrapMode), /* Not used. */ TkTextDispChunk *chunkPtr) /* Structure to fill in with information about * this chunk. The x field has already been * set by the caller. */ { - (void)indexPtr; - (void)offset; - (void)maxX; - (void)maxChars; - (void)noCharsYet; - (void)wrapMode; - if (segPtr != textPtr->insertMarkPtr) { return -1; } @@ -628,15 +617,15 @@ MarkLayoutProc( void TkTextInsertDisplayProc( TkText *textPtr, /* The current text widget. */ - TkTextDispChunk *chunkPtr, /* Chunk that is to be drawn. */ + TCL_UNUSED(TkTextDispChunk *), /* Chunk that is to be drawn. */ int x, /* X-position in dst at which to draw this * chunk (may differ from the x-position in * the chunk because of scrolling). */ int y, /* Y-position at which to draw this chunk in * dst (x-position is in the chunk itself). */ int height, /* Total height of line. */ - int baseline, /* Offset of baseline from y. */ - Display *display, /* Display to use for drawing. */ + TCL_UNUSED(int), /* Offset of baseline from y. */ + TCL_UNUSED(Display *), /* Display to use for drawing. */ Drawable dst, /* Pixmap or window in which to draw chunk. */ int screenY) /* Y-coordinate in text window that * corresponds to y. */ @@ -650,9 +639,6 @@ TkTextInsertDisplayProc( int halfWidth = textPtr->insertWidth/2; int rightSideWidth; int ix = 0, iy = 0, iw = 0, ih = 0, charWidth = 0; - (void)chunkPtr; - (void)baseline; - (void)display; if (textPtr->insertCursorType) { TkTextMarkSegToIndex(textPtr, textPtr->insertMarkPtr, &index); @@ -735,12 +721,9 @@ TkTextInsertDisplayProc( static void InsertUndisplayProc( - TkText *textPtr, /* Overall information about text widget. */ - TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */ + TCL_UNUSED(TkText *), /* Overall information about text widget. */ + TCL_UNUSED(TkTextDispChunk *)) /* Chunk that is about to be freed. */ { - (void)textPtr; - (void)chunkPtr; - return; } diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index b9f64e0..8622b3e 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -576,12 +576,11 @@ EmbWinStructureProc( static void EmbWinRequestProc( ClientData clientData, /* Pointer to record for window item. */ - Tk_Window tkwin) /* Window that changed its desired size. */ + TCL_UNUSED(Tk_Window)) /* Window that changed its desired size. */ { TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData; TkTextSegment *ewPtr = client->parent; TkTextIndex index; - (void)tkwin; index.tree = ewPtr->body.ew.sharedTextPtr->tree; index.linePtr = ewPtr->body.ew.linePtr; @@ -739,15 +738,13 @@ TkTextWinFreeClient( static int EmbWinDeleteProc( TkTextSegment *ewPtr, /* Segment being deleted. */ - TkTextLine *linePtr, /* Line containing segment. */ - int treeGone) /* Non-zero means the entire tree is being + TCL_UNUSED(TkTextLine *), /* Line containing segment. */ + TCL_UNUSED(int)) /* Non-zero means the entire tree is being * deleted, so everything must get cleaned * up. */ { TkTextEmbWindowClient *client; client = ewPtr->body.ew.clients; - (void)linePtr; - (void)treeGone; while (client != NULL) { TkTextEmbWindowClient *next = client->next; @@ -820,17 +817,17 @@ EmbWinCleanupProc( static int EmbWinLayoutProc( TkText *textPtr, /* Text widget being layed out. */ - TkTextIndex *indexPtr, /* Identifies first character in chunk. */ + TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */ TkTextSegment *ewPtr, /* Segment corresponding to indexPtr. */ TkSizeT offset, /* Offset within segPtr corresponding to * indexPtr (always 0). */ int maxX, /* Chunk must not occupy pixels at this * position or higher. */ - TkSizeT maxChars, /* Chunk must not include more than this many + TCL_UNUSED(TkSizeT), /* Chunk must not include more than this many * characters. */ int noCharsYet, /* Non-zero means no characters have been * assigned to this line yet. */ - TkWrapMode wrapMode, /* Wrap mode to use for line: + TCL_UNUSED(TkWrapMode), /* Wrap mode to use for line: * TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or * TEXT_WRAPMODE_WORD. */ TkTextDispChunk *chunkPtr) @@ -840,9 +837,6 @@ EmbWinLayoutProc( { int width, height; TkTextEmbWindowClient *client; - (void)indexPtr; - (void)maxChars; - (void)wrapMode; if (offset != 0) { Tcl_Panic("Non-zero offset in EmbWinLayoutProc"); @@ -1055,10 +1049,8 @@ EmbWinLayoutProc( static void EmbWinCheckProc( TkTextSegment *ewPtr, /* Segment to check. */ - TkTextLine *linePtr) /* Line containing segment. */ + TCL_UNUSED(TkTextLine *)) /* Line containing segment. */ { - (void)linePtr; - if (ewPtr->nextPtr == NULL) { Tcl_Panic("EmbWinCheckProc: embedded window is last segment in line"); } @@ -1092,13 +1084,13 @@ TkTextEmbWinDisplayProc( int x, /* X-position in dst at which to draw this * chunk (differs from the x-position in the * chunk because of scrolling). */ - int y, /* Top of rectangular bounding box for line: + TCL_UNUSED(int), /* Top of rectangular bounding box for line: * tells where to draw this chunk in dst * (x-position is in the chunk itself). */ int lineHeight, /* Total height of line. */ int baseline, /* Offset of baseline from y. */ - Display *display, /* Display to use for drawing (unused). */ - Drawable dst, /* Pixmap or window in which to draw + TCL_UNUSED(Display *), /* Display to use for drawing (unused). */ + TCL_UNUSED(Drawable), /* Pixmap or window in which to draw * (unused). */ int screenY) /* Y-coordinate in text window that * corresponds to y. */ @@ -1107,9 +1099,6 @@ TkTextEmbWinDisplayProc( Tk_Window tkwin; TkTextSegment *ewPtr = (TkTextSegment *)chunkPtr->clientData; TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr); - (void)y; - (void)display; - (void)dst; if (client == NULL) { return; @@ -1236,7 +1225,7 @@ static void EmbWinBboxProc( TkText *textPtr, /* Information about text widget. */ TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */ - int index, /* Index of desired character within the + TCL_UNUSED(int), /* Index of desired character within the * chunk. */ int y, /* Topmost pixel in area allocated for this * line. */ @@ -1253,7 +1242,6 @@ EmbWinBboxProc( Tk_Window tkwin; TkTextSegment *ewPtr = (TkTextSegment *)chunkPtr->clientData; TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr); - (void)index; if (client == NULL) { tkwin = NULL; diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 45ca5e6..eb8e928 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -13,7 +13,7 @@ */ #include "tkInt.h" - +#include "tkPort.h" #ifdef _WIN32 #include "tkWinInt.h" #elif !defined(MAC_OSX_TK) @@ -1642,7 +1642,7 @@ Tk_MapWindow( event.xmap.event = winPtr->window; event.xmap.window = winPtr->window; event.xmap.override_redirect = winPtr->atts.override_redirect; - Tk_HandleEvent(&event); + TkpHandleMapOrUnmap((Tk_Window)winPtr, &event); } /* @@ -1804,7 +1804,7 @@ Tk_UnmapWindow( event.xunmap.event = winPtr->window; event.xunmap.window = winPtr->window; event.xunmap.from_configure = False; - Tk_HandleEvent(&event); + TkpHandleMapOrUnmap((Tk_Window)winPtr, &event); } } diff --git a/library/demos/cscroll.tcl b/library/demos/cscroll.tcl index c0c30ee..f906c7d 100644 --- a/library/demos/cscroll.tcl +++ b/library/demos/cscroll.tcl @@ -56,9 +56,9 @@ for {set i 0} {$i < 20} {incr i} { $c bind all <Enter> "scrollEnter $c" $c bind all <Leave> "scrollLeave $c" $c bind all <Button-1> "scrollButton $c" -bind $c <Button-2> "$c scan mark %x %y" -bind $c <B2-Motion> "$c scan dragto %x %y" if {[tk windowingsystem] eq "aqua"} { + bind $c <Button-3> "$c scan mark %x %y" + bind $c <B3-Motion> "$c scan dragto %x %y" bind $c <MouseWheel> { %W yview scroll [expr {-(%D)}] units } @@ -72,6 +72,8 @@ if {[tk windowingsystem] eq "aqua"} { %W xview scroll [expr {-10 * (%D)}] units } } else { + bind $c <Button-2> "$c scan mark %x %y" + bind $c <B2-Motion> "$c scan dragto %x %y" # We must make sure that positive and negative movements are rounded # equally to integers, avoiding the problem that # (int)1/30 = 0, @@ -80,18 +82,24 @@ if {[tk windowingsystem] eq "aqua"} { # The following code ensure equal +/- behaviour. bind $c <MouseWheel> { if {%D >= 0} { - %W yview scroll [expr {-%D/30}] units + %W yview scroll [expr {%D/-30}] units } else { - %W yview scroll [expr {(29-%D)/30}] units + %W yview scroll [expr {(%D-29)/-30}] units } } + bind $c <Option-MouseWheel> { + %W yview scroll [expr {%D/-3}] units + } bind $c <Shift-MouseWheel> { if {%D >= 0} { - %W xview scroll [expr {-%D/30}] units + %W xview scroll [expr {%D/-30}] units } else { - %W xview scroll [expr {(29-%D)/30}] units + %W xview scroll [expr {(%D-29)/-30}] units } } + bind $c <Shift-Option-MouseWheel> { + %W xview scroll [expr {%D/-3}] units + } } if {[tk windowingsystem] eq "x11"} { diff --git a/library/demos/ctext.tcl b/library/demos/ctext.tcl index 502c9d0..5acc82f 100644 --- a/library/demos/ctext.tcl +++ b/library/demos/ctext.tcl @@ -50,7 +50,11 @@ $c bind text <Return> "textInsert $c \\n" $c bind text <Control-h> "textBs $c" $c bind text <BackSpace> "textBs $c" $c bind text <Delete> "textDel $c" -$c bind text <Button-2> "textPaste $c @%x,%y" +if {[tk windowingsystem] eq "aqua"} { + $c bind text <Button-3> "textPaste $c @%x,%y" +} else { + $c bind text <Button-2> "textPaste $c @%x,%y" +} # Next, create some items that allow the text's anchor position # to be edited. diff --git a/library/demos/floor.tcl b/library/demos/floor.tcl index b5d3c64..37e1b95 100644 --- a/library/demos/floor.tcl +++ b/library/demos/floor.tcl @@ -1359,8 +1359,13 @@ $c bind floor2 <Button-1> "floorDisplay $c 2" $c bind floor3 <Button-1> "floorDisplay $c 3" $c bind room <Enter> "newRoom $c" $c bind room <Leave> {set currentRoom ""} -bind $c <Button-2> "$c scan mark %x %y" -bind $c <B2-Motion> "$c scan dragto %x %y" +if {[tk windowingsystem] eq "aqua"} { + bind $c <Button-3> "$c scan mark %x %y" + bind $c <B3-Motion> "$c scan dragto %x %y" +} else { + bind $c <Button-2> "$c scan mark %x %y" + bind $c <B2-Motion> "$c scan dragto %x %y" +} bind $c <Destroy> "unset currentRoom" set currentRoom "" trace variable currentRoom w "roomChanged $c" diff --git a/library/demos/items.tcl b/library/demos/items.tcl index 30fda5c..545877c 100644 --- a/library/demos/items.tcl +++ b/library/demos/items.tcl @@ -17,7 +17,7 @@ wm iconname $w "Items" positionWindow $w set c $w.frame.c -label $w.msg -font $font -wraplength 5i -justify left -text "This window contains a canvas widget with examples of the various kinds of items supported by canvases. The following operations are supported:\n Button-1 drag:\tmoves item under pointer.\n Button-2 drag:\trepositions view.\n Button-3 drag:\tstrokes out area.\n Ctrl+f:\t\tprints items under area." +label $w.msg -font $font -wraplength 5i -justify left -text "This window contains a canvas widget with examples of the various kinds of items supported by canvases. The following operations are supported:\n Left-Button drag:\tmoves item under pointer.\n Middle-Button drag:\trepositions view.\n Right-Button drag:\tstrokes out area.\n Ctrl+f:\t\tprints items under area." pack $w.msg -side top ## See Code / Dismiss buttons @@ -173,10 +173,17 @@ $c create text 28.5c 17.4c -text Scale: -anchor s $c bind item <Enter> "itemEnter $c" $c bind item <Leave> "itemLeave $c" -bind $c <Button-2> "$c scan mark %x %y" -bind $c <B2-Motion> "$c scan dragto %x %y" -bind $c <Button-3> "itemMark $c %x %y" -bind $c <B3-Motion> "itemStroke $c %x %y" +if {[tk windowingsystem] eq "aqua"} { + bind $c <Button-2> "itemMark $c %x %y" + bind $c <B2-Motion> "itemStroke $c %x %y" + bind $c <Button-3> "$c scan mark %x %y" + bind $c <B3-Motion> "$c scan dragto %x %y" +} else { + bind $c <Button-2> "$c scan mark %x %y" + bind $c <B2-Motion> "$c scan dragto %x %y" + bind $c <Button-3> "itemMark $c %x %y" + bind $c <B3-Motion> "itemStroke $c %x %y" +} bind $c <<NextChar>> "itemsUnderArea $c" bind $c <Button-1> "itemStartDrag $c %x %y" bind $c <B1-Motion> "itemDrag $c %x %y" diff --git a/library/demos/widget b/library/demos/widget index e543846..58da12f 100644 --- a/library/demos/widget +++ b/library/demos/widget @@ -516,7 +516,7 @@ proc invoke index { .t configure -cursor [::ttk::cursor busy] update set demo [string range [lindex $tags $i] 5 end] - uplevel 1 [list source [file join $tk_demoDirectory $demo.tcl]] + uplevel 1 [list source -encoding utf-8 [file join $tk_demoDirectory $demo.tcl]] update .t configure -cursor $cursor @@ -624,6 +624,7 @@ proc showCode w { wm title $top [mc "Demo code: %s" [file join $tk_demoDirectory $file]] wm iconname $top $file set id [open [file join $tk_demoDirectory $file]] + fconfigure $id -encoding utf-8 -eofchar \032 $top.f.text delete 1.0 end $top.f.text insert 1.0 [read $id] $top.f.text mark set insert 1.0 @@ -722,10 +723,10 @@ proc PrintTextWin32 {filename} { proc tkAboutDialog {} { tk_messageBox -icon info -type ok -title [mc "About Widget Demo"] \ -message [mc "Tk widget demonstration application"] -detail \ -"[mc "Copyright \u00a9 %s" {1996-1997 Sun Microsystems, Inc.}] -[mc "Copyright \u00a9 %s" {1997-2000 Ajuba Solutions, Inc.}] -[mc "Copyright \u00a9 %s" {2001-2009 Donal K. Fellows}] -[mc "Copyright \u00a9 %s" {2002-2007 Daniel A. Steffen}]" +"[mc "Copyright \xA9 %s" {1996-1997 Sun Microsystems, Inc.}] +[mc "Copyright \xA9 %s" {1997-2000 Ajuba Solutions, Inc.}] +[mc "Copyright \xA9 %s" {2001-2009 Donal K. Fellows}] +[mc "Copyright \xA9 %s" {2002-2007 Daniel A. Steffen}]" } # Local Variables: diff --git a/library/msgs/da.msg b/library/msgs/da.msg index c302c79..282f919 100644 --- a/library/msgs/da.msg +++ b/library/msgs/da.msg @@ -3,11 +3,11 @@ namespace eval ::tk { ::msgcat::mcset da "&About..." "&Om..." ::msgcat::mcset da "All Files" "Alle filer" ::msgcat::mcset da "Application Error" "Programfejl" - ::msgcat::mcset da "&Blue" "&Bl\u00E5" + ::msgcat::mcset da "&Blue" "&Blå" ::msgcat::mcset da "Cancel" "Annuller" ::msgcat::mcset da "&Cancel" "&Annuller" ::msgcat::mcset da "Cannot change to the directory \"%1\$s\".\nPermission denied." "Kan ikke skifte til katalog \"%1\$s\".\nIngen rettigheder." - ::msgcat::mcset da "Choose Directory" "V\u00E6lg katalog" + ::msgcat::mcset da "Choose Directory" "Vælg katalog" ::msgcat::mcset da "Cl&ear" "&Ryd" ::msgcat::mcset da "&Clear Console" "&Ryd konsolen" ::msgcat::mcset da "Color" "Farve" @@ -31,8 +31,8 @@ namespace eval ::tk { ::msgcat::mcset da "Fi&les:" "Fi&ler:" ::msgcat::mcset da "&Filter" ::msgcat::mcset da "Fil&ter:" - ::msgcat::mcset da "&Green" "&Gr\u00F8n" - ::msgcat::mcset da "&Help" "&Hj\u00E6lp" + ::msgcat::mcset da "&Green" "&Grøn" + ::msgcat::mcset da "&Help" "&Hjælp" ::msgcat::mcset da "Hi" "Hej" ::msgcat::mcset da "&Hide Console" "Skjul &konsol" ::msgcat::mcset da "&Ignore" "&Ignorer" @@ -42,37 +42,37 @@ namespace eval ::tk { ::msgcat::mcset da "&OK" "&O.K." ::msgcat::mcset da "OK" "O.K." ::msgcat::mcset da "Ok" - ::msgcat::mcset da "Open" "\u00C5bn" - ::msgcat::mcset da "&Open" "&\u00C5bn" - ::msgcat::mcset da "Open Multiple Files" "\u00C5bn flere filer" - ::msgcat::mcset da "P&aste" "&Inds\u00E6t" + ::msgcat::mcset da "Open" "Åbn" + ::msgcat::mcset da "&Open" "&Åbn" + ::msgcat::mcset da "Open Multiple Files" "Åbn flere filer" + ::msgcat::mcset da "P&aste" "&Indsæt" ::msgcat::mcset da "&Quit" "&Afslut" - ::msgcat::mcset da "&Red" "&R\u00F8d" + ::msgcat::mcset da "&Red" "&Rød" ::msgcat::mcset da "Replace existing file?" "Erstat eksisterende fil?" ::msgcat::mcset da "&Retry" "&Gentag" ::msgcat::mcset da "&Save" "&Gem" ::msgcat::mcset da "Save As" "Gem som" ::msgcat::mcset da "Save To Log" "Gem i log" - ::msgcat::mcset da "Select Log File" "V\u00E6lg logfil" - ::msgcat::mcset da "Select a file to source" "V\u00E6lg k\u00F8rbar fil" + ::msgcat::mcset da "Select Log File" "Vælg logfil" + ::msgcat::mcset da "Select a file to source" "Vælg kørbar fil" ::msgcat::mcset da "&Selection:" "&Udvalg:" ::msgcat::mcset da "Show &Hidden Directories" "Vis &skjulte kataloger" ::msgcat::mcset da "Show &Hidden Files and Directories" "Vis &skjulte filer og kataloger" ::msgcat::mcset da "Skip Messages" "Overspring beskeder" - ::msgcat::mcset da "&Source..." "&K\u00F8r..." + ::msgcat::mcset da "&Source..." "&Kør..." ::msgcat::mcset da "Tcl Scripts" "Tcl-Skripter" ::msgcat::mcset da "Tcl for Windows" "Tcl for Windows" ::msgcat::mcset da "Text Files" "Tekstfiler" ::msgcat::mcset da "&Yes" "&Ja" ::msgcat::mcset da "abort" "afbryd" - ::msgcat::mcset da "blue" "bl\u00E5" + ::msgcat::mcset da "blue" "blå" ::msgcat::mcset da "cancel" "afbryd" ::msgcat::mcset da "extension" ::msgcat::mcset da "extensions" - ::msgcat::mcset da "green" "gr\u00F8n" + ::msgcat::mcset da "green" "grøn" ::msgcat::mcset da "ignore" "ignorer" ::msgcat::mcset da "ok" - ::msgcat::mcset da "red" "r\u00F8d" + ::msgcat::mcset da "red" "rød" ::msgcat::mcset da "retry" "gentag" ::msgcat::mcset da "yes" "ja" } diff --git a/library/msgs/de.msg b/library/msgs/de.msg index 6dee507..2cf25d2 100644 --- a/library/msgs/de.msg +++ b/library/msgs/de.msg @@ -52,7 +52,7 @@ namespace eval ::tk { ::msgcat::mcset de "Ok" ::msgcat::mcset de "Open" "Öffnen" ::msgcat::mcset de "&Open" "Ö&ffnen" - ::msgcat::mcset de "Open Multiple Files" "Mehrere Dateien \u00F6ffnen" + ::msgcat::mcset de "Open Multiple Files" "Mehrere Dateien Öffnen" ::msgcat::mcset de "P&aste" "E&infügen" ::msgcat::mcset de "&Quit" "&Beenden" ::msgcat::mcset de "&Red" "&Rot" diff --git a/library/text.tcl b/library/text.tcl index 28c6c20..a84ea05 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -581,12 +581,7 @@ proc ::tk::TextButton1 {w x y} { } else { $w mark gravity $anchorname left } - # Allow focus in any case on Windows, because that will let the - # selection be displayed even for state disabled text widgets. - if {[tk windowingsystem] eq "win32" \ - || [$w cget -state] eq "normal"} { - focus $w - } + focus $w if {[$w cget -autoseparators]} { $w edit separator } diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index 2601d6b..bda5f46 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -14,10 +14,9 @@ */ #include "tkMacOSXPrivate.h" - -#include <sys/stat.h> #include <dlfcn.h> #include <objc/objc-auto.h> +#include <sys/stat.h> static char tkLibPath[PATH_MAX + 1] = ""; @@ -284,17 +283,20 @@ TkpInit( if (!initialized) { struct stat st; + Bool shouldOpenConsole = NO; + Bool stdinIsNullish = (!isatty(0) && + (fstat(0, &st) || (S_ISCHR(st.st_mode) && st.st_blocks == 0))); /* * Initialize/check OS version variable for runtime checks. */ - initialized = 1; - #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 # error Mac OS X 10.6 required #endif + initialized = 1; + #ifdef TK_FRAMEWORK /* * When Tk is in a framework, force tcl_findLibrary to look in the @@ -312,16 +314,6 @@ TkpInit( #endif /* - * FIXME: Close stdin & stdout for remote debugging otherwise we will - * fight with gdb for stdin & stdout - */ - - if (getenv("XCNOSTDIN") != NULL) { - close(0); - close(1); - } - - /* * Instantiate our NSApplication object. This needs to be done before * we check whether to open a console window. */ @@ -376,48 +368,52 @@ TkpInit( Tcl_DoOneEvent(TCL_WINDOW_EVENTS | TCL_DONT_WAIT); /* - * If we don't have a TTY or stdin is a special character file of - * length 0, (e.g. /dev/null, which is what Finder sets when double - * clicking Wish) then use the Tk based console interpreter. + * Decide whether to open a console window. If the TK_CONSOLE + * environment variable is not defined we only show the console if + * stdin is not a tty and there is no startup script. */ - if (!isatty(0) && (fstat(0, &st) || (S_ISCHR(st.st_mode) && st.st_blocks == 0))) { - if (getenv("TK_CONSOLE")) { - Tk_InitConsoleChannels(interp); - Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDIN)); - Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDOUT)); - Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDERR)); - - /* - * Only show the console if we don't have a startup script and - * tcl_interactive hasn't been set already. - */ - - if (Tcl_GetStartupScript(NULL) == NULL) { - const char *intvar = Tcl_GetVar2(interp, - "tcl_interactive", NULL, TCL_GLOBAL_ONLY); - - if (intvar == NULL) { - Tcl_SetVar2(interp, "tcl_interactive", NULL, "1", - TCL_GLOBAL_ONLY); - } - } - if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) { - return TCL_ERROR; - } - } else { - - /* - * When launched as a macOS application with no console, - * redirect stderr and stdout to /dev/null. This avoids waiting - * forever for those files to become writable if the underlying - * Tcl program tries to write to them with a puts command. - */ - - FILE *null = fopen("/dev/null", "w"); - dup2(fileno(null), STDOUT_FILENO); - dup2(fileno(null), STDERR_FILENO); + if (getenv("TK_CONSOLE")) { + shouldOpenConsole = YES; + } else if (stdinIsNullish && Tcl_GetStartupScript(NULL) == NULL) { + const char *intvar = Tcl_GetVar2(interp, "tcl_interactive", + NULL, TCL_GLOBAL_ONLY); + if (intvar == NULL) { + Tcl_SetVar2(interp, "tcl_interactive", NULL, "1", + TCL_GLOBAL_ONLY); + } + shouldOpenConsole = YES; + } + if (shouldOpenConsole) { + Tk_InitConsoleChannels(interp); + Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDIN)); + Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDOUT)); + Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDERR)); + if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) { + return TCL_ERROR; } + } else if (stdinIsNullish) { + + /* + * When launched as a macOS application with no console, + * redirect stderr and stdout to /dev/null. This avoids waiting + * forever for those files to become writable if the underlying + * Tcl program tries to write to them with a puts command. + */ + + FILE *null = fopen("/dev/null", "w"); + dup2(fileno(null), STDOUT_FILENO); + dup2(fileno(null), STDERR_FILENO); + } + + /* + * FIXME: Close stdin & stdout for remote debugging if XCNOSTDIN is + * set. Otherwise we will fight with gdb for stdin & stdout + */ + + if (getenv("XCNOSTDIN") != NULL) { + close(0); + close(1); } /* @@ -445,6 +441,10 @@ TkpInit( } } + /* + * Initialization steps that are needed for all interpreters. + */ + if (tkLibPath[0] != '\0') { Tcl_SetVar2(interp, "tk_library", NULL, tkLibPath, TCL_GLOBAL_ONLY); } diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c index 2c6b240..d55ca5a 100644 --- a/macosx/tkMacOSXMouseEvent.c +++ b/macosx/tkMacOSXMouseEvent.c @@ -132,7 +132,7 @@ enum { * [39cbacb9e8]. */ - if (eventType == NSLeftMouseDown || eventType == NSLeftMouseDragged) { + if (eventType == NSLeftMouseDown) { if ([eventWindow respondsToSelector:@selector(mouseInResizeArea)] && [(TKWindow *) eventWindow mouseInResizeArea]) { diff --git a/macosx/tkMacOSXPort.h b/macosx/tkMacOSXPort.h index ab0fadc..61c0d0d 100644 --- a/macosx/tkMacOSXPort.h +++ b/macosx/tkMacOSXPort.h @@ -149,4 +149,12 @@ MODULE_SCOPE unsigned long TkMacOSXRGBPixel(unsigned long red, unsigned long gre unsigned long blue); #define TkpGetPixel(p) (TkMacOSXRGBPixel(p->red >> 8, p->green >> 8, p->blue >> 8)) +/* + * Used by tkWindow.c + */ + +MODULE_SCOPE void TkMacOSXHandleMapOrUnmap(Tk_Window tkwin, XEvent *event); + +#define TkpHandleMapOrUnmap(tkwin, event) TkMacOSXHandleMapOrUnmap(tkwin, event) + #endif /* _TKMACPORT */ diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index 9309b67..a358bde 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -119,14 +119,18 @@ XDestroyWindow( * * XMapWindow -- * - * Map the given X Window to the screen. See X window documentation for - * more details. + * This X11 stub maps the given X11 Window but does not update any of + * the Tk structures describing the window. Tk applications should + * never call this directly, but it is called by Tk_MapWindow and + * Tk_WmMapWindow. * * Results: - * None. + * Returns Success or BadWindow. * * Side effects: - * The subwindow or toplevel may appear on the screen. + * The subwindow or toplevel may appear on the screen. VisibilityNotify + * events are generated. + * * *---------------------------------------------------------------------- */ @@ -142,7 +146,6 @@ XMapWindow( MacDrawable *macWin = (MacDrawable *)window; TkWindow *winPtr = macWin->winPtr; NSWindow *win = TkMacOSXGetNSWindowForDrawable(window); - XEvent event; static Bool initialized = NO; /* @@ -158,7 +161,6 @@ XMapWindow( } display->request++; - winPtr->flags |= TK_MAPPED; if (Tk_IsTopLevel(winPtr)) { if (!Tk_IsEmbedded(winPtr)) { TKContentView *view = [win contentView]; @@ -193,30 +195,7 @@ XMapWindow( TkMacOSXInvalClipRgns((Tk_Window)contWinPtr); TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); } - TkMacOSXInvalClipRgns((Tk_Window)winPtr); - - /* - * We only need to send the MapNotify event for toplevel windows. - */ - - event.xany.serial = LastKnownRequestProcessed(display); - event.xany.send_event = False; - event.xany.display = display; - - event.xmap.window = window; - event.xmap.type = MapNotify; - event.xmap.event = window; - event.xmap.override_redirect = winPtr->atts.override_redirect; - - /* - * To update the mapped status of packed or placed subwindows - * we handle this event immediately and then process the idle - * events that it generates. - */ - - Tk_HandleEvent(&event); - while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {} } else { /* @@ -227,6 +206,11 @@ XMapWindow( TkMacOSXInvalClipRgns((Tk_Window)winPtr->parentPtr); } + /* + * Mark the toplevel as needing to be redrawn, unless the window is being + * mapped while drawing is taking place. + */ + TKContentView *view = [win contentView]; if (view != [NSView focusView]) { [view addTkDirtyRect:[view bounds]]; @@ -237,6 +221,7 @@ XMapWindow( */ if (initialized) { + XEvent event; event.xany.send_event = False; event.xany.display = display; event.xvisibility.type = VisibilityNotify; @@ -287,11 +272,13 @@ NotifyVisibility( * * XUnmapWindow -- * - * Unmap the given X Window to the screen. See X window documentation for - * more details. + * This X11 stub maps the given X11 Window but does not update any of + * The Tk structures describing the window. Tk applications should + * never call this directly, but it is called by Tk_UnmapWindow and + * Tk_WmUnmapWindow. * * Results: - * None. + * Always returns Success or BadWindow. * * Side effects: * The subwindow or toplevel may be removed from the screen. @@ -308,8 +295,10 @@ XUnmapWindow( TkWindow *winPtr = macWin->winPtr; TkWindow *parentPtr = winPtr->parentPtr; NSWindow *win = TkMacOSXGetNSWindowForDrawable(window); - XEvent event; + if (!window) { + return BadWindow; + } display->request++; if (Tk_IsTopLevel(winPtr)) { if (!Tk_IsEmbedded(winPtr) && @@ -318,28 +307,6 @@ XUnmapWindow( [win setExcludedFromWindowsMenu:YES]; } TkMacOSXInvalClipRgns((Tk_Window)winPtr); - - /* - * We only need to send the UnmapNotify event for toplevel windows. - */ - - event.xany.serial = LastKnownRequestProcessed(display); - event.xany.send_event = False; - event.xany.display = display; - - event.xunmap.type = UnmapNotify; - event.xunmap.window = window; - event.xunmap.event = window; - event.xunmap.from_configure = false; - - /* - * To update the mapped status of packed or placed subwindows - * we handle this event immediately and then process the idle - * events that it generates. - */ - - Tk_HandleEvent(&event); - while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {} } else { /* * Rebuild the visRgn clip region for the parent so it will be allowed @@ -355,7 +322,6 @@ XUnmapWindow( TkMacOSXInvalClipRgns((Tk_Window)parentPtr); TkMacOSXUpdateClipRgn(parentPtr); } - winPtr->flags &= ~TK_MAPPED; TKContentView *view = [win contentView]; if (view != [NSView focusView]) { [view addTkDirtyRect:[view bounds]]; diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index 0a8d363..98bec7d 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -1086,7 +1086,7 @@ ConfigureRestrictProc( } /* - * In macOS 10.14 and later his method is called when a user changes between + * In macOS 10.14 and later this method is called when a user changes between * light and dark mode or changes the accent color. The implementation * generates two virtual events. The first is either <<LightAqua>> or * <<DarkAqua>>, depending on the view's current effective appearance. The @@ -1134,6 +1134,7 @@ static const char *const accentNames[] = { } if (!defaultColor) { defaultColor = [NSApp macOSVersion] < 110000 ? "Blue" : "Multicolor"; + preferences = [[NSUserDefaults standardUserDefaults] retain]; /* * AppKit calls this method when the user changes the Accent Color diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index cad005d..5128631 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -746,6 +746,74 @@ TkWmNewWindow( /* *---------------------------------------------------------------------- * + * TkMacOSXHandleMapOrUnmap -- + * + * The mechanism used by a geometry manager to propogate the information + * about which of its content widgets are mapped is to call Tk_MapWindow + * or Tk_UnmapNotify. Those functions generate MapNotify or UnmapNotify + * events and then handle them immediately. Other platforms use + * Tk_HandleEvent to do this. But that does not work correctly on macOS + * due to the fact that the calls to Tk_MapNotify or Tk_UnmapNotify can + * occur in display procedures which are being run in the drawRect method + * of a TKContentView. The events will be processed after drawRect + * returns, but they need to be processed immediately in some cases. + + * This function operates as a macOS alternative to Tk_HandleEvent, for + * processing MapNotify or UnmapNotify events only. It is called by + * Tk_MapWindow, Tk_UnmapWindow, TkWmMapWindow and TkWmUnmapWindow. + * Rather than using Tk_HandleEvent it installs a filter which restricts + * to the MapNotify or UnmapNotify events, it queues the event and then + * processes window events with the filter installed. This allows the + * event to be handled immediately even from within the drawRect method. + * + * Results: + * None. + * + * Side effects: + * Handles a MapNotify or UnMapNotify event. + * + *---------------------------------------------------------------------- + */ +static Tk_RestrictAction +MapUnmapRestrictProc( + TCL_UNUSED(void*), + XEvent *eventPtr) +{ + return (eventPtr->type==MapNotify || eventPtr->type==UnmapNotify ? + TK_PROCESS_EVENT : TK_DEFER_EVENT); +} + +MODULE_SCOPE +void TkMacOSXHandleMapOrUnmap( + Tk_Window tkwin, + XEvent *event) +{ + ClientData oldArg; + Tk_RestrictProc *oldProc; + TkWindow *winPtr = (TkWindow *) tkwin; + const Tk_GeomMgr *geomMgrPtr = winPtr->geomMgrPtr; + + /* + * Sadly, this approach does not work with the "text" geometry manager. + * The mysterious unexplained crash elicited by textDisp-5.2 occurs. So we + * have to check for the "text" manager and revert to using Tk_HandleEvent + * in that case. Hopefully this can be removed when the revised text + * widget is in place. + */ + + if (geomMgrPtr && strcmp(geomMgrPtr->name, "text") == 0) { + Tk_HandleEvent(event); + return; + } + oldProc = Tk_RestrictEvents(MapUnmapRestrictProc, NULL, &oldArg); + Tk_QueueWindowEvent(event, TCL_QUEUE_TAIL); + while (Tcl_DoOneEvent(TCL_WINDOW_EVENTS|TCL_DONT_WAIT)) {} + Tk_RestrictEvents(oldProc, oldArg, &oldArg); +} + +/* + *---------------------------------------------------------------------- + * * TkWmMapWindow -- * * This procedure is invoked to map a top-level window. This module gets @@ -772,6 +840,8 @@ TkWmMapWindow( * mapped. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; + XEvent event; + if (wmPtr->flags & WM_NEVER_MAPPED) { /* * Create the underlying Mac window for this Tk window. @@ -835,10 +905,19 @@ TkWmMapWindow( wmPtr->flags &= ~WM_ABOUT_TO_MAP; /* - * Map the window. + * Map the window and process a MapNotify event for it. */ + winPtr->flags |= TK_MAPPED; XMapWindow(winPtr->display, winPtr->window); + event.xany.serial = LastKnownRequestProcessed(winPtr->display); + event.xany.send_event = False; + event.xany.display = winPtr->display; + event.xmap.window = winPtr->window; + event.xmap.type = MapNotify; + event.xmap.event = winPtr->window; + event.xmap.override_redirect = winPtr->atts.override_redirect; + TkpHandleMapOrUnmap((Tk_Window)winPtr, &event); } /* @@ -863,7 +942,18 @@ TkWmUnmapWindow( TkWindow *winPtr) /* Top-level window that's about to be * unmapped. */ { + XEvent event; + + event.xany.serial = LastKnownRequestProcessed(winPtr->display); + event.xany.send_event = False; + event.xany.display = winPtr->display; + event.xunmap.type = UnmapNotify; + event.xunmap.window = winPtr->window; + event.xunmap.event = winPtr->window; + event.xunmap.from_configure = false; + winPtr->flags &= ~TK_MAPPED; XUnmapWindow(winPtr->display, winPtr->window); + TkpHandleMapOrUnmap((Tk_Window)winPtr, &event); } /* @@ -946,7 +1036,7 @@ TkWmDeadWindow( for (Transient *transientPtr = wmPtr->transientPtr; transientPtr != NULL; transientPtr = transientPtr->nextPtr) { TkWindow *winPtr2 = transientPtr->winPtr; - TkWindow *containerPtr = (TkWindow *)TkGetTransientMaster(winPtr2); + TkWindow *containerPtr = (TkWindow *)TkMacOSXGetContainer(winPtr2); if (containerPtr == winPtr) { wmPtr2 = winPtr2->wmInfoPtr; @@ -1841,7 +1931,7 @@ WmDeiconifyCmd( transientPtr != NULL; transientPtr = transientPtr->nextPtr) { TkWindow *winPtr2 = transientPtr->winPtr; WmInfo *wmPtr2 = winPtr2->wmInfoPtr; - TkWindow *containerPtr = (TkWindow *)TkGetTransientMaster(winPtr2); + TkWindow *containerPtr = (TkWindow *)TkMacOSXGetContainer(winPtr2); if (containerPtr == winPtr) { if ((wmPtr2->hints.initial_state == WithdrawnState) && @@ -2385,7 +2475,7 @@ WmIconifyCmd( for (Transient *transientPtr = wmPtr->transientPtr; transientPtr != NULL; transientPtr = transientPtr->nextPtr) { TkWindow *winPtr2 = transientPtr->winPtr; - TkWindow *containerPtr = (TkWindow *)TkGetTransientMaster(winPtr2); + TkWindow *containerPtr = (TkWindow *)TkMacOSXGetContainer(winPtr2); if (containerPtr == winPtr && winPtr2->wmInfoPtr->hints.initial_state != WithdrawnState) { TkpWmSetState(winPtr2, WithdrawnState); @@ -3815,7 +3905,7 @@ WmWithdrawCmd( for (Transient *transientPtr = wmPtr->transientPtr; transientPtr != NULL; transientPtr = transientPtr->nextPtr) { TkWindow *winPtr2 = transientPtr->winPtr; - TkWindow *containerPtr = (TkWindow *)TkGetTransientMaster(winPtr2); + TkWindow *containerPtr = (TkWindow *)TkMacOSXGetContainer(winPtr2); if (containerPtr == winPtr && winPtr2->wmInfoPtr->hints.initial_state != WithdrawnState) { @@ -5337,7 +5427,7 @@ TkSetWMName( /* *---------------------------------------------------------------------- * - * TkGetTransientMaster -- + * TkMacOSXGetContainer -- * * If the passed window has the TRANSIENT_FOR property set this will * return the container window. Otherwise it will return None. @@ -5352,7 +5442,7 @@ TkSetWMName( */ Tk_Window -TkGetTransientMaster( +TkMacOSXGetContainer( TkWindow *winPtr) { if (winPtr->wmInfoPtr != NULL) { @@ -6943,9 +7033,9 @@ ApplyContainerOverrideChanges( if (parentWindow && parentWindow != containerMacWin) { [parentWindow removeChildWindow:macWindow]; } - + [macWindow orderFront:NSApp]; [containerMacWin addChildWindow:macWindow - ordered:NSWindowAbove]; + ordered:NSWindowAbove]; } } } else { diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 8bc8ef6..1a7ce39 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -256,13 +256,13 @@ static void GetBackgroundColor( CGFloat *rgba) { TkWindow *winPtr = (TkWindow *)tkwin; - TkWindow *containerPtr = (TkWindow *)TkGetGeomMaster(tkwin); + TkWindow *containerPtr = (TkWindow *)TkGetContainer(tkwin); while (containerPtr && containerPtr->privatePtr) { if (containerPtr->privatePtr->flags & TTK_HAS_CONTRASTING_BG) { break; } - containerPtr = (TkWindow *)TkGetGeomMaster(containerPtr); + containerPtr = (TkWindow *)TkGetContainer(containerPtr); } if (containerPtr && containerPtr->privatePtr) { for (int i = 0; i < 4; i++) { diff --git a/tests/bind.test b/tests/bind.test index c96720a..152fe3e 100644 --- a/tests/bind.test +++ b/tests/bind.test @@ -2048,7 +2048,7 @@ test bind-16.35 {ExpandPercents procedure} -constraints { set x } -cleanup { destroy .t.f -} -result {a A { } {\r} {{}} {{}} { } {\$} \\\{ {{}} {{}} \u00e9} +} -result {a A { } {\r} {{}} {{}} { } {\$} \\\{ {{}} {{}} \xE9} test bind-16.36 {ExpandPercents procedure} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f diff --git a/tests/canvText.test b/tests/canvText.test index 60d7857..cd8660e 100644 --- a/tests/canvText.test +++ b/tests/canvText.test @@ -11,6 +11,8 @@ 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)]}] + # Canvas used in 1.* - 17.* tests canvas .c -width 400 -height 300 -bd 2 -relief sunken pack .c @@ -940,7 +942,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} -setup { +test canvText-20.1 {angled text bounding box} -constraints failsOnUbuntu -setup { destroy .c canvas .c proc transpose {bbox} { diff --git a/tests/focus.test b/tests/focus.test index 7da289d..20d25eb 100644 --- a/tests/focus.test +++ b/tests/focus.test @@ -11,6 +11,8 @@ eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + proc focusSetup {} { destroy .t toplevel .t @@ -308,7 +310,7 @@ in .t.b1 NotifyNonlinear } .t.b1} test focus-2.6 {TkFocusFilterEvent procedure, FocusIn events} -constraints { - unix testwrapper + unix testwrapper failsOnUbuntu } -body { focus .t.b1 focus . @@ -320,7 +322,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 + unix testwrapper failsOnUbuntu } -body { set result {} foreach detail {NotifyAncestor NotifyInferior NotifyNonlinear @@ -341,7 +343,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 + unix testwrapper failsOnUbuntu } -body { focus .t.b1 event gen [testwrapper .] <FocusOut> -detail NotifyAncestor @@ -599,7 +601,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 + unix testwrapper secureserver failsOnUbuntu } -body { setupbg focusSetup diff --git a/tests/imgSVGnano.test b/tests/imgSVGnano.test index df827b2..3bee035 100644 --- a/tests/imgSVGnano.test +++ b/tests/imgSVGnano.test @@ -222,6 +222,19 @@ test imgSVGnano-5.0 {image without any of "width", "height" and "viewbox"} -bod rename foo "" } -result {foo} +test imgSVGnano-5.1 {bug ea665e08f3 - too many values in parameters of the transform attribute} -body { + # shall not loop endlessly + image create photo foo -data\ + {<?xml version="1.0"?><!DOCTYPE svg PUBLIC\ + "-//W3C//DTD SVG 1.0//EN\"\ + "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">\ + <svg xmlns="http://www.w3.org/2000/svg">\ + <circle cx="6.5cm" cy="2cm" r="100" transform="skewX(1 1)"/>\ + </g></svg>} +} -cleanup { + rename foo "" +} -result {foo} + };# end of namespace svgnano namespace delete svgnano diff --git a/tests/menu.test b/tests/menu.test index 31bf9a8..babec58 100644 --- a/tests/menu.test +++ b/tests/menu.test @@ -1858,6 +1858,14 @@ test menu-3.70 {MenuWidgetCmd procedure, "xposition" option} -setup { } -cleanup { destroy .m1 } -result {} +test menu-3.71 {MenuWidgetCmd procedure, "index end" option, bug [f3cd942e9e]} -setup { + destroy .m1 +} -body { + menu .m1 + list [.m1 index "end"] +} -cleanup { + destroy .m1 +} -result none test menu-4.1 {TkInvokeMenu: disabled} -setup { diff --git a/tests/pack.test b/tests/pack.test index 5c919ed..02008c7 100644 --- a/tests/pack.test +++ b/tests/pack.test @@ -11,6 +11,7 @@ eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] # Create some test windows. @@ -1542,7 +1543,7 @@ if {[tk windowingsystem] == "win32"} { } test pack-18.1 {unmap content when container unmapped} -constraints { - tempNotPc + tempNotPc failsOnUbuntu } -setup { eval destroy [winfo child .pack] } -body { @@ -1572,7 +1573,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} -setup { +test pack-18.2 {unmap content when container unmapped} -constraints failsOnUbuntu -setup { eval destroy [winfo child .pack] } -body { # adjust the position of .pack before test to avoid a screen switch diff --git a/tests/place.test b/tests/place.test index e811b1a..3ef1de7 100644 --- a/tests/place.test +++ b/tests/place.test @@ -13,6 +13,8 @@ tcltest::loadTestedCommands # Used for constraining memory leak tests testConstraint memory [llength [info commands memory]] +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + # XXX - This test file is woefully incomplete. At present, only a # few of the features are tested. @@ -267,7 +269,7 @@ if {[tk windowingsystem] == "win32"} { } } -test place-8.1 {PlaceStructureProc, mapping and unmapping content} -setup { +test place-8.1 {PlaceStructureProc, mapping and unmapping content} -constraints failsOnUbuntu -setup { place forget .t.f2 place forget .t.f } -body { @@ -283,7 +285,7 @@ test place-8.1 {PlaceStructureProc, mapping and unmapping content} -setup { placeUpdate lappend result [winfo ismapped .t.f2] } -result {1 0 40 30 0 1} -test place-8.2 {PlaceStructureProc, mapping and unmapping content} -setup { +test place-8.2 {PlaceStructureProc, mapping and unmapping content} -constraints failsOnUbuntu -setup { place forget .t.f2 place forget .t.f update idletasks diff --git a/tests/scrollbar.test b/tests/scrollbar.test index 3186f99..20ac275 100644 --- a/tests/scrollbar.test +++ b/tests/scrollbar.test @@ -11,6 +11,8 @@ 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)]}] + proc scroll args { global scrollInfo set scrollInfo $args @@ -270,13 +272,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 { +test scrollbar-3.36 {ScrollbarWidgetCmd procedure, "fraction" option} {x11 failsOnUbuntu} { 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 { +test scrollbar-3.38 {ScrollbarWidgetCmd procedure, "fraction" option} {x11 failsOnUbuntu} { format {%.6g} [.s fraction 4 178] } {0.993711} test scrollbar-3.39 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics win} { @@ -491,7 +493,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 { +test scrollbar-6.12.1 {ScrollbarPosition procedure} {x11 failsOnUbuntu} { .s identify 8 19 } {arrow1} test scrollbar-6.12.2 {ScrollbarPosition procedure} aqua { @@ -549,7 +551,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 { +test scrollbar-6.29.1 {ScrollbarPosition procedure} {x11 failsOnUbuntu} { .s identify 8 180 } {arrow2} test scrollbar-6.29.2 {ScrollbarPosition procedure} aqua { @@ -573,7 +575,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 { +test scrollbar-6.35 {ScrollbarPosition procedure} {unix failsOnUbuntu} { .s identify 18 100 } {trough2} test scrollbar-6.37 {ScrollbarPosition procedure} win { @@ -612,7 +614,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 { +test scrollbar-6.44 {ScrollbarPosition procedure} {unix failsOnUbuntu} { .t.s identify 100 18 } {trough2} test scrollbar-6.46 {ScrollbarPosition procedure} win { diff --git a/tests/send.test b/tests/send.test index 9c4cf04..d3322e5 100644 --- a/tests/send.test +++ b/tests/send.test @@ -15,6 +15,7 @@ eval tcltest::configure $argv tcltest::loadTestedCommands testConstraint xhost [llength [auto_execok xhost]] +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] # Compute a script that will load Tk into a child interpreter. @@ -286,7 +287,7 @@ test send-8.14 {Tk_SendCmd procedure, local interp killed by send} {secureserver catch {interp delete t_s_2} -test send-8.15 {Tk_SendCmd procedure, local interp, error info} {secureserver testsend} { +test send-8.15 {Tk_SendCmd procedure, local interp, error info} {secureserver testsend failsOnUbuntu} { catch {error foo} list [catch {send t_s_1 {if 1 {open bogus_file_name}}} msg] $msg $errorInfo $errorCode } {1 {couldn't open "bogus_file_name": no such file or directory} {couldn't open "bogus_file_name": no such file or directory @@ -296,7 +297,7 @@ test send-8.15 {Tk_SendCmd procedure, local interp, error info} {secureserver te "if 1 {open bogus_file_name}" invoked from within "send t_s_1 {if 1 {open bogus_file_name}}"} {POSIX ENOENT {no such file or directory}}} -test send-8.16 {Tk_SendCmd procedure, bogusCommWindow} {secureserver testsend} { +test send-8.16 {Tk_SendCmd procedure, bogusCommWindow} {secureserver testsend failsOnUbuntu} { testsend prop root InterpRegistry "10234 bogus\n" set result [list [catch {send bogus bogus command} msg] $msg] winfo interps diff --git a/tests/text.test b/tests/text.test index b3e10bc..d830dc2 100644 --- a/tests/text.test +++ b/tests/text.test @@ -5824,7 +5824,7 @@ test text-22.217.1 {elide up to match, with UTF-8 chars before the match} -setup } -body { .t tag configure e -elide 0 .t insert end A {} xyz e bb\n - .t insert end \u00c4 {} xyz e bb + .t insert end \xC4 {} xyz e bb set res {} lappend res [.t search bb 1.0 "1.0 lineend"] lappend res [.t search bb 2.0 "2.0 lineend"] diff --git a/tests/textDisp.test b/tests/textDisp.test index dcc9318..4b6535d 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -11,6 +11,8 @@ eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + # Platform specific procedure for updating the text widget. if {[tk windowingsystem] == "aqua"} { @@ -109,6 +111,8 @@ 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 @@ -285,7 +289,7 @@ test textDisp-2.5 {LayoutDLine, word wrap} {textfonts} { .t insert 1.0 "This isx some sample text for testing." list [.t bbox 1.13] [.t bbox 1.19] [.t bbox 1.20] [.t bbox 1.21] } [list [list 96 5 $fixedWidth $fixedHeight] [list 138 5 $fixedWidth $fixedHeight] [list 145 5 0 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] $fixedWidth $fixedHeight]] -test textDisp-2.6 {LayoutDLine, word wrap} { +test textDisp-2.6 {LayoutDLine, word wrap} failsOnUbuntu { .t configure -wrap word .t delete 1.0 end .t insert 1.0 "This isxxx some sample text for testing." @@ -1188,7 +1192,7 @@ test textDisp-8.9 {TkTextChanged} { updateText list $tk_textRelayout $tk_textRedraw } {{2.0 8.0} {2.0 8.0}} -test textDisp-8.10 {TkTextChanged} { +test textDisp-8.10 {TkTextChanged} failsOnUbuntu { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4" @@ -1248,7 +1252,7 @@ test textDisp-8.13 {TkTextChanged, used to crash, see [06c1433906]} { update idletasks } {} -test textDisp-9.1 {TkTextRedrawTag} { +test textDisp-9.1 {TkTextRedrawTag} failsOnUbuntu { .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" @@ -1266,7 +1270,7 @@ test textDisp-9.2 {TkTextRedrawTag} {textfonts} { updateText list $tk_textRelayout $tk_textRedraw } {{1.0 2.0 2.17} {1.0 2.0 2.17}} -test textDisp-9.3 {TkTextRedrawTag} { +test textDisp-9.3 {TkTextRedrawTag} failsOnUbuntu { .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" @@ -1277,7 +1281,7 @@ test textDisp-9.3 {TkTextRedrawTag} { updateText list $tk_textRelayout $tk_textRedraw } {{2.0 2.20} {2.0 2.20 eof}} -test textDisp-9.4 {TkTextRedrawTag} { +test textDisp-9.4 {TkTextRedrawTag} failsOnUbuntu { .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" @@ -1288,7 +1292,7 @@ test textDisp-9.4 {TkTextRedrawTag} { updateText list $tk_textRelayout $tk_textRedraw } {{2.0 2.20} {2.0 2.20 eof}} -test textDisp-9.5 {TkTextRedrawTag} { +test textDisp-9.5 {TkTextRedrawTag} failsOnUbuntu { .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" @@ -1299,7 +1303,7 @@ test textDisp-9.5 {TkTextRedrawTag} { updateText list $tk_textRelayout $tk_textRedraw } {{2.0 2.20} {2.0 2.20 eof}} -test textDisp-9.6 {TkTextRedrawTag} { +test textDisp-9.6 {TkTextRedrawTag} failsOnUbuntu { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap" @@ -1310,7 +1314,7 @@ test textDisp-9.6 {TkTextRedrawTag} { updateText list $tk_textRelayout $tk_textRedraw } {{2.0 2.20 3.0 3.20} {2.0 2.20 3.0 3.20 eof}} -test textDisp-9.7 {TkTextRedrawTag} { +test textDisp-9.7 {TkTextRedrawTag} failsOnUbuntu { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4" @@ -1868,7 +1872,7 @@ test textDisp-14.5 {TkTextXviewCmd procedure} { test textDisp-14.6 {TkTextXviewCmd procedure} { list [catch {.t xview moveto a} msg] $msg } {1 {expected floating-point number but got "a"}} -test textDisp-14.7 {TkTextXviewCmd procedure} { +test textDisp-14.7 {TkTextXviewCmd procedure} failsOnUbuntu { .t delete 1.0 end .t insert end xxxxxxxxx\n .t insert end "xxxxx xxxxxxxxxxx xxxx xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx\n" @@ -2068,7 +2072,7 @@ test textDisp-16.9 {TkTextYviewCmd procedure, "moveto" option} { test textDisp-16.10 {TkTextYviewCmd procedure, "moveto" option} { list [catch {.t yview moveto gorp} msg] $msg } {1 {expected floating-point number but got "gorp"}} -test textDisp-16.11 {TkTextYviewCmd procedure, "moveto" option} { +test textDisp-16.11 {TkTextYviewCmd procedure, "moveto" option} failsOnUbuntu { .t yview moveto 0.5 .t index @0,0 } {103.0} @@ -2080,21 +2084,21 @@ test textDisp-16.13 {TkTextYviewCmd procedure, "moveto" option} { .t yview moveto 1.1 .t index @0,0 } {191.0} -test textDisp-16.14 {TkTextYviewCmd procedure, "moveto" option} { +test textDisp-16.14 {TkTextYviewCmd procedure, "moveto" option} failsOnUbuntu { .t yview moveto .75 .t index @0,0 } {151.60} -test textDisp-16.15 {TkTextYviewCmd procedure, "moveto" option} { +test textDisp-16.15 {TkTextYviewCmd procedure, "moveto" option} failsOnUbuntu { .t yview moveto .752 .t index @0,0 } {151.60} -test textDisp-16.16 {TkTextYviewCmd procedure, "moveto" option} {textfonts} { +test textDisp-16.16 {TkTextYviewCmd procedure, "moveto" option} textfonts { set count [expr {5 * $bigHeight + 150 * $fixedHeight}] set extra [expr {0.04 * double($fixedDiff * 150) / double($count)}] .t yview moveto [expr {.753 - $extra}] .t index @0,0 } {151.60} -test textDisp-16.17 {TkTextYviewCmd procedure, "moveto" option} { +test textDisp-16.17 {TkTextYviewCmd procedure, "moveto" option} failsOnUbuntu { .t yview moveto .755 .t index @0,0 } {151.80} @@ -2258,7 +2262,7 @@ test textDisp-16.38 {TkTextYviewCmd procedure} { test textDisp-16.39 {TkTextYviewCmd procedure} { list [catch {.t yview scroll 1.3i pixels} msg] $msg } {0 {}} -test textDisp-16.40 {text count -xpixels} { +test textDisp-16.40 {text count -xpixels} failsOnUbuntu { set res {} lappend res [.t count -xpixels 1.0 1.5] \ [.t count -xpixels 1.5 1.0] \ @@ -2570,7 +2574,7 @@ test textDisp-19.7 {GetYView procedure} { updateText set x $scrollInfo } {0.125 0.75} -test textDisp-19.8 {GetYView procedure} { +test textDisp-19.8 {GetYView procedure} failsOnUbuntu { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1" @@ -2867,7 +2871,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} { +test textDisp-19.17 {count -ypixels with indices in elided lines} failsOnUbuntu { .t configure -wrap none .t delete 1.0 end for {set i 1} {$i < 100} {incr i} { @@ -2894,7 +2898,7 @@ test textDisp-19.17 {count -ypixels with indices in elided lines} { .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} { +test textDisp-19.18 {count -ypixels with indices in elided lines} failsOnUbuntu { .t configure -wrap none .t delete 1.0 end for {set i 1} {$i < 100} {incr i} { @@ -2932,28 +2936,28 @@ for {set i 2} {$i <= 200} {incr i} { .t configure -wrap word .t delete 50.0 51.0 .t insert 50.0 "This is a long line, one that will wrap around twice.\n" -test textDisp-20.1 {FindDLine} { +test textDisp-20.1 {FindDLine} failsOnUbuntu { .t yview 48.0 list [.t dlineinfo 46.0] [.t dlineinfo 47.0] [.t dlineinfo 49.0] \ [.t dlineinfo 58.0] } [list {} {} [list 3 [expr {$fixedDiff + 16}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}] -test textDisp-20.2 {FindDLine} { +test textDisp-20.2 {FindDLine} failsOnUbuntu { .t yview 100.0 .t yview -pickplace 53.0 list [.t dlineinfo 50.0] [.t dlineinfo 50.14] [.t dlineinfo 50.21] } [list [list 3 [expr {-1 - $fixedDiff/2}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {-1 - $fixedDiff/2}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {12 + $fixedDiff/2}] 133 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]]] -test textDisp-20.3 {FindDLine} { +test textDisp-20.3 {FindDLine} failsOnUbuntu { .t yview 100.0 .t yview 49.0 list [.t dlineinfo 50.0] [.t dlineinfo 50.24] [.t dlineinfo 57.0] } [list [list 3 [expr {$fixedDiff + 16}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {2*$fixedDiff + 29}] 133 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}] -test textDisp-20.4 {FindDLine} { +test textDisp-20.4 {FindDLine} failsOnUbuntu { .t yview 100.0 .t yview 42.0 list [.t dlineinfo 50.0] [.t dlineinfo 50.24] [.t dlineinfo 50.40] } [list [list 3 [expr {8*$fixedDiff + 107}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {9*$fixedDiff + 120}] 133 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}] .t config -wrap none -test textDisp-20.5 {FindDLine} { +test textDisp-20.5 {FindDLine} failsOnUbuntu { .t yview 100.0 .t yview 48.0 list [.t dlineinfo 50.0] [.t dlineinfo 50.20] [.t dlineinfo 50.40] @@ -3933,7 +3937,7 @@ catch {destroy .t2} .t configure -height 1 updateText -test textDisp-31.1 {line embedded window height update} { +test textDisp-31.1 {line embedded window height update} failsOnUbuntu { set res {} .t delete 1.0 end .t insert end "abcd\nefgh\nijkl\nmnop\nqrst\nuvwx\nyx" @@ -3946,7 +3950,7 @@ test textDisp-31.1 {line embedded window height update} { set res } [list [expr {100 + $fixedHeight * 6}] [expr {100 + $fixedHeight * 6}] [expr {$fixedHeight * 7}]] -test textDisp-31.2 {line update index shifting} { +test textDisp-31.2 {line update index shifting} failsOnUbuntu { set res {} .t.f configure -height 100 updateText @@ -3963,7 +3967,7 @@ test textDisp-31.2 {line update index shifting} { set res } [list [expr {100 + $fixedHeight * 6}] [expr {100 + $fixedHeight * 8}] [expr {$fixedHeight * 9}] [expr {$fixedHeight * 7}] [expr {100 + $fixedHeight * 6}]] -test textDisp-31.3 {line update index shifting} { +test textDisp-31.3 {line update index shifting} failsOnUbuntu { # Should do exactly the same as the above, as long # as we are correctly tagging the correct lines for # recalculation. The 'update' and 'delay' must be @@ -4000,7 +4004,7 @@ test textDisp-31.4 {line embedded image height update} { set res } [list [expr {100 + $fixedHeight * 6}] [expr {100 + $fixedHeight * 6}] [expr {$fixedHeight * 7}]] -test textDisp-31.5 {line update index shifting} { +test textDisp-31.5 {line update index shifting} failsOnUbuntu { set res {} textest configure -height 100 updateText @@ -4017,7 +4021,7 @@ test textDisp-31.5 {line update index shifting} { set res } [list [expr {100 + $fixedHeight * 6}] [expr {100 + $fixedHeight * 8}] [expr {$fixedHeight * 9}] [expr {$fixedHeight * 7}] [expr {100 + $fixedHeight * 6}]] -test textDisp-31.6 {line update index shifting} { +test textDisp-31.6 {line update index shifting} failsOnUbuntu { # Should do exactly the same as the above, as long # as we are correctly tagging the correct lines for # recalculation. The 'update' and 'delay' must be diff --git a/tests/textIndex.test b/tests/textIndex.test index 99a70d6..656542c 100644 --- a/tests/textIndex.test +++ b/tests/textIndex.test @@ -871,7 +871,7 @@ test textIndex-21.9 {text index wordend} { text_test_word worde "x.y" end-1 } 2 test textIndex-21.10 {text index wordend, unicode} { - text_test_word wordend "xyz\u00c7de fg" 0 + text_test_word wordend "xyz\xC7de fg" 0 } 6 test textIndex-21.11 {text index wordend, unicode} { text_test_word wordend "xyz\uc700de fg" 0 @@ -905,7 +905,7 @@ test textIndex-22.10 {text index wordstart} { text_test_word wordstart "one two three" end-5 } 7 test textIndex-22.11 {text index wordstart, unicode} { - text_test_word wordstart "one tw\u00c7o three" 7 + text_test_word wordstart "one tw\xC7o three" 7 } 4 test textIndex-22.12 {text index wordstart, unicode} { text_test_word wordstart "ab\uc700\uc700 cdef ghi" 12 @@ -916,8 +916,8 @@ test textIndex-22.13 {text index wordstart, unicode} { test textIndex-22.14 {text index wordstart, unicode, start index at internal segment start} { catch {destroy .t} text .t - .t insert end "C'est du texte en fran\u00e7ais\n" - .t insert end "\u042D\u0442\u043E\u0020\u0442\u0435\u043A\u0441\u0442\u0020\u043D\u0430\u0020\u0440\u0443\u0441\u0441\u043A\u043E\u043C" + .t insert end "C'est du texte en fran\xE7ais\n" + .t insert end "\u042D\u0442\u043E \u0442\u0435\u043A\u0441\u0442 \u043D\u0430 \u0440\u0443\u0441\u0441\u043A\u043E\u043C" .t mark set insert 1.23 set res [.t index "1.23 wordstart"] .t mark set insert 2.16 diff --git a/tests/textWind.test b/tests/textWind.test index 286964e..03793a4 100644 --- a/tests/textWind.test +++ b/tests/textWind.test @@ -11,6 +11,8 @@ namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + deleteWindows set fixedFont {"Courier" -12} @@ -792,7 +794,7 @@ test textWind-10.6 {EmbWinLayoutProc procedure, error in creating window} -setup {{can't embed .t relative to .t}} \ [list [expr {$padx+5*$fixedWidth}] [expr {$pady+($fixedHeight/2)}] 0 0]] -test textWind-10.7 {EmbWinLayoutProc procedure, error in creating window} -setup { +test textWind-10.7 {EmbWinLayoutProc procedure, error in creating window} -constraints failsOnUbuntu -setup { .t delete 1.0 end destroy .t2 proc bgerror args { diff --git a/tests/ttk/combobox.test b/tests/ttk/combobox.test index 1114777..c2de6ce 100644 --- a/tests/ttk/combobox.test +++ b/tests/ttk/combobox.test @@ -13,7 +13,7 @@ test combobox-1.0 "Combobox tests -- setup" -body { test combobox-1.1 "Bad -values list" -body { .cb configure -values "bad \{list" -} -result "unmatched open brace in list" -returnCodes 1 +} -result "unmatched open brace in list" -returnCodes error test combobox-1.end "Combobox tests -- cleanup" -body { destroy .cb diff --git a/tests/ttk/entry.test b/tests/ttk/entry.test index 5eb4740..a958d90 100644 --- a/tests/ttk/entry.test +++ b/tests/ttk/entry.test @@ -7,6 +7,8 @@ package require tcltest 2.2 namespace import -force tcltest::* loadTestedCommands +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + variable scrollInfo proc scroll args { global scrollInfo @@ -75,7 +77,7 @@ test entry-2.1 "Create entry before scrollbar" -body { -expand false -fill x } -cleanup {destroy .te .tsb} -test entry-2.1.1 "Create entry before scrollbar - scrollbar catches up" -body { +test entry-2.1.1 "Create entry before scrollbar - scrollbar catches up" -constraints failsOnUbuntu -body { pack [ttk::entry .te -xscrollcommand [list .tsb set]] \ -expand true -fill both .te insert end [string repeat "abc" 50] diff --git a/tests/ttk/image.test b/tests/ttk/image.test index ea0ab1d..bb593fc 100644 --- a/tests/ttk/image.test +++ b/tests/ttk/image.test @@ -12,7 +12,7 @@ test image-1.2 "Duplicate element" -setup { ttk::style element create testElement image test.element } -body { ttk::style element create testElement image test.element -} -returnCodes 1 -result "Duplicate element testElement" +} -returnCodes error -result "Duplicate element testElement" test image-2.0 "Deletion of displayed image (label)" -setup { image create photo test.image -width 10 -height 10 diff --git a/tests/ttk/labelframe.test b/tests/ttk/labelframe.test index 1f64d67..9ffffd8 100644 --- a/tests/ttk/labelframe.test +++ b/tests/ttk/labelframe.test @@ -11,22 +11,22 @@ test labelframe-2.1 "Can't use indirect descendant as labelwidget" -body { ttk::frame .lf.t ttk::checkbutton .lf.t.cb .lf configure -labelwidget .lf.t.cb -} -returnCodes 1 -result "can't *" -match glob \ +} -returnCodes error -result "can't *" -match glob \ -cleanup { destroy .lf.t } ; test labelframe-2.2 "Can't use toplevel as labelwidget" -body { toplevel .lf.t .lf configure -labelwidget .lf.t -} -returnCodes 1 -result "can't *" -match glob \ +} -returnCodes error -result "can't *" -match glob \ -cleanup { destroy .lf.t } ; test labelframe-2.3 "Can't use non-windows as -labelwidget" -body { .lf configure -labelwidget BogusWindowName -} -returnCodes 1 -result {bad window path name "BogusWindowName"} +} -returnCodes error -result {bad window path name "BogusWindowName"} test labelframe-2.4 "Can't use nonexistent-windows as -labelwidget" -body { .lf configure -labelwidget .nosuchwindow -} -returnCodes 1 -result {bad window path name ".nosuchwindow"} +} -returnCodes error -result {bad window path name ".nosuchwindow"} ### diff --git a/tests/ttk/notebook.test b/tests/ttk/notebook.test index 5d02bba..d048e3e 100644 --- a/tests/ttk/notebook.test +++ b/tests/ttk/notebook.test @@ -25,11 +25,11 @@ test notebook-1.3 "Cannot add toplevel" -body { .nb add [toplevel .nb.t] } -cleanup { destroy .t.nb -} -returnCodes 1 -match glob -result "can't add .nb.t*" +} -returnCodes error -match glob -result "can't add .nb.t*" test notebook-1.4 "Try to select bad tab" -body { .nb select @6000,6000 -} -returnCodes 1 -match glob -result "* not found" +} -returnCodes error -match glob -result "* not found" # # Now add stuff: diff --git a/tests/ttk/panedwindow.test b/tests/ttk/panedwindow.test index 9d3cf77..528d56b 100644 --- a/tests/ttk/panedwindow.test +++ b/tests/ttk/panedwindow.test @@ -47,7 +47,7 @@ test panedwindow-1.7 "Make sure empty panedwindow still still doesn't crash" -bo test panedwindow-1.8 "Re-forget pane" -body { .pw forget .pw.f1 -} -returnCodes 1 -result ".pw.f1 is not managed by .pw" +} -returnCodes error -result ".pw.f1 is not managed by .pw" test panedwindow-1.end "Cleanup" -body { destroy .pw @@ -119,11 +119,11 @@ test panedwindow-3.0 "configure pane" -body { test panedwindow-3.1 "configure pane -- errors" -body { .pw pane 1 -weight -4 -} -returnCodes 1 -match glob -result "-weight must be nonnegative" +} -returnCodes error -match glob -result "-weight must be nonnegative" test panedwindow-3.2 "add pane -- errors" -body { .pw add [ttk::label .pw.l] -weight -1 -} -returnCodes 1 -match glob -result "-weight must be nonnegative" +} -returnCodes error -match glob -result "-weight must be nonnegative" test panedwindow-3.end "cleanup" -body { destroy .pw } @@ -147,7 +147,7 @@ test panedwindow-4.1 "forget" -body { test panedwindow-4.2 "forget forgotten" -body { .pw forget .pw.l1 -} -returnCodes 1 -result ".pw.l1 is not managed by .pw" +} -returnCodes error -result ".pw.l1 is not managed by .pw" # checkorder $winlist -- # Ensure that Y coordinates windows in $winlist are strictly increasing. diff --git a/tests/ttk/progressbar.test b/tests/ttk/progressbar.test index d3886e7..8e2fdb9 100644 --- a/tests/ttk/progressbar.test +++ b/tests/ttk/progressbar.test @@ -77,7 +77,7 @@ test progressbar-2.5 "error in write trace" -body { trace variable PB w { error "YIPES!" ;# } .pb step set PB ;# NOTREACHED -} -cleanup { unset PB } -returnCodes 1 -match glob -result "*YIPES!" +} -cleanup { unset PB } -returnCodes error -match glob -result "*YIPES!" test progressbar-end "Cleanup" -body { destroy .pb diff --git a/tests/ttk/scrollbar.test b/tests/ttk/scrollbar.test index a0d8065..3af03d5 100644 --- a/tests/ttk/scrollbar.test +++ b/tests/ttk/scrollbar.test @@ -166,7 +166,7 @@ test scale-1.0 "Self-destruction" -body { ttk::scale .s -variable v pack .s ; update .s set 1 ; update -} -returnCodes 1 -match glob -result "*" +} -returnCodes error -match glob -result "*" test scale-2.1 "-state option" -setup { ttk::scale .s diff --git a/tests/ttk/treetags.test b/tests/ttk/treetags.test index 0de6df5..d7fa23a 100644 --- a/tests/ttk/treetags.test +++ b/tests/ttk/treetags.test @@ -171,7 +171,7 @@ test treetags-2.3 "Virtual events delivered to focus item" -body { test treetags-2.4 "Bad events" -body { $tv tag bind bad <Enter> { puts "Entered!" } -} -returnCodes 1 -result "unsupported event <Enter>*" -match glob +} -returnCodes error -result "unsupported event <Enter>*" -match glob test treetags-3.0 "tag configure - set" -body { $tv tag configure tag1 -foreground blue -background red diff --git a/tests/ttk/treeview.test b/tests/ttk/treeview.test index 522e3a8..8e31fe9 100644 --- a/tests/ttk/treeview.test +++ b/tests/ttk/treeview.test @@ -46,33 +46,33 @@ test treeview-1.1 "columns" -body { test treeview-1.2 "Bad columns" -body { #.tv configure -columns {illegal "list"value} ttk::treeview .badtv -columns {illegal "list"value} -} -returnCodes 1 -result "list element in quotes followed by*" -match glob +} -returnCodes error -result "list element in quotes followed by*" -match glob test treeview-1.3 "bad displaycolumns" -body { .tv configure -displaycolumns {a b d} -} -returnCodes 1 -result "Invalid column index d" +} -returnCodes error -result "Invalid column index d" test treeview-1.4 "more bad displaycolumns" -body { .tv configure -displaycolumns {1 2 3} -} -returnCodes 1 -result "Column index 3 out of bounds" +} -returnCodes error -result "Column index 3 out of bounds" test treeview-1.5 "Don't forget to check negative numbers" -body { .tv configure -displaycolumns {1 -2 3} -} -returnCodes 1 -result "Column index -2 out of bounds" +} -returnCodes error -result "Column index -2 out of bounds" # Item creation. # test treeview-2.1 "insert -- not enough args" -body { .tv insert -} -returnCodes 1 -result "wrong # args: *" -match glob +} -returnCodes error -result "wrong # args: *" -match glob test treeview-2.3 "insert -- bad integer index" -body { .tv insert {} badindex -} -returnCodes 1 -result "expected integer *" -match glob +} -returnCodes error -result "expected integer *" -match glob test treeview-2.4 "insert -- bad parent node" -body { .tv insert badparent end -} -returnCodes 1 -result "Item badparent not found" -match glob +} -returnCodes error -result "Item badparent not found" -match glob test treeview-2.5 "insert -- finaly insert a node" -body { .tv insert {} end -id newnode -text "New node" @@ -84,7 +84,7 @@ test treeview-2.6 "insert -- make sure node was inserted" -body { test treeview-2.7 "insert -- prevent duplicate node names" -body { .tv insert {} end -id newnode -} -returnCodes 1 -result "Item newnode already exists" +} -returnCodes error -result "Item newnode already exists" test treeview-2.8 "insert -- new node at end" -body { .tv insert {} end -id lastnode @@ -126,7 +126,7 @@ test treeview-2.13 "insert -- one more at beginning" -body { test treeview-2.14 "insert -- bad options" -body { .tv insert {} end -badoption foo -} -returnCodes 1 -result {unknown option "-badoption"} +} -returnCodes error -result {unknown option "-badoption"} test treeview-2.15 "insert -- at position 0 w/no children" -body { .tv insert newnode 0 -id newnode.n2 -text "Foo" @@ -202,7 +202,7 @@ test treeview-3.11 "Can't detach root item" -body { .tv detach [list {}] update consistencyCheck .tv -} -returnCodes 1 -result "Cannot detach root item" +} -returnCodes error -result "Cannot detach root item" consistencyCheck .tv test treeview-3.12 "Reattach" -body { @@ -275,7 +275,7 @@ test treeview-4.3 "opened - closed node" -body { test treeview-5.1 "item -- error checks" -body { .tv item newnode -text "Bad values" -values "{bad}list" -} -returnCodes 1 -result "list element in braces followed by*" -match glob +} -returnCodes error -result "list element in braces followed by*" -match glob test treeview-5.2 "item -- error leaves options unchanged " -body { .tv item newnode -text @@ -298,11 +298,11 @@ test treeview-5.5 "set cell" -body { test treeview-5.6 "set illegal cell" -body { .tv set newnode #0 YYY -} -returnCodes 1 -result "Display column #0 cannot be set" +} -returnCodes error -result "Display column #0 cannot be set" test treeview-5.7 "set illegal cell" -body { .tv set newnode 3 YY ;# 3 == current #columns -} -returnCodes 1 -result "Column index 3 out of bounds" +} -returnCodes error -result "Column index 3 out of bounds" test treeview-5.8 "set display columns" -body { .tv configure -displaycolumns [list 2 1 0] @@ -318,7 +318,7 @@ test treeview-5.9 "display columns part 2" -body { test treeview-5.10 "cannot set column -id" -body { .tv column #1 -id X -} -returnCodes 1 -result "Attempt to change read-only option" +} -returnCodes error -result "Attempt to change read-only option" test treeview-5.11 "get" -body { .tv set newnode #1 @@ -406,7 +406,7 @@ test treeview-7.1 "move" -body { test treeview-7.2 "illegal move" -body { .tv move d d2 end -} -returnCodes 1 -result "Cannot insert d as descendant of d2" +} -returnCodes error -result "Cannot insert d as descendant of d2" test treeview-7.3 "illegal move has no effect" -body { consistencyCheck .tv @@ -427,7 +427,7 @@ test treeview-7.5 "replace children - precondition" -body { test treeview-7.6 "Replace children - illegal move" -body { .tv children newnode.n1 [list newnode.n1 newnode.n2 newnode.n3] -} -returnCodes 1 -result "Cannot insert newnode.n1 as descendant of newnode.n1" +} -returnCodes error -result "Cannot insert newnode.n1 as descendant of newnode.n1" consistencyCheck .tv @@ -458,7 +458,7 @@ test treeview-8.4 "Selection - clear" -body { test treeview-8.5 "Selection - bad operation" -body { .tv selection badop foo -} -returnCodes 1 -match glob -result {bad selection operation "badop": must be *} +} -returnCodes error -match glob -result {bad selection operation "badop": must be *} test treeview-8.6 "Selection - <<TreeviewSelect>> on selection add" -body { .tv selection set {} diff --git a/tests/ttk/ttk.test b/tests/ttk/ttk.test index ec1a3b6..fdd3eae 100644 --- a/tests/ttk/ttk.test +++ b/tests/ttk/ttk.test @@ -32,7 +32,7 @@ test ttk-6.1 "Self-destructing checkbutton" -body { trace variable sd w [list selfdestruct .sd] update .sd invoke -} -returnCodes 1 +} -returnCodes error test ttk-6.2 "Checkbutton self-destructed" -body { winfo exists .sd } -result 0 @@ -146,7 +146,7 @@ test ttk-1.2 "Check style" -body { test ttk-1.3 "Set bad style" -body { .t configure -style "nosuchstyle" -} -returnCodes 1 -result {Layout nosuchstyle not found} +} -returnCodes error -result {Layout nosuchstyle not found} test ttk-1.4 "Original style preserved" -body { .t cget -style @@ -235,11 +235,11 @@ foreach wc $widgetClasses { # misc. error detection test ttk-3.0 "Bad option" -body { ttk::button .bad -badoption foo -} -returnCodes 1 -result {unknown option "-badoption"} -match glob +} -returnCodes error -result {unknown option "-badoption"} -match glob test ttk-3.1 "Make sure widget command not created" -body { .bad state disabled -} -returnCodes 1 -result {invalid command name ".bad"} -match glob +} -returnCodes error -result {invalid command name ".bad"} -match glob test ttk-3.2 "Propagate errors from variable traces" -body { set A 0 @@ -252,7 +252,7 @@ test ttk-3.2 "Propagate errors from variable traces" -body { test ttk-3.3 "Constructor failure with cursor" -body { ttk::button .b -cursor bottom_right_corner -style BadStyle -} -returnCodes 1 -result "Layout BadStyle not found" +} -returnCodes error -result "Layout BadStyle not found" test ttk-3.4 "SF#2009213" -body { ttk::style configure TScale -sliderrelief {} @@ -388,12 +388,12 @@ test ttk-8.4 "ImageChanged" -body { test ttk-9.1 "Traces on nonexistant namespaces" -body { ttk::checkbutton .tcb -variable foo::bar -} -returnCodes 1 -result "*parent namespace doesn't exist*" -match glob +} -returnCodes error -result "*parent namespace doesn't exist*" -match glob test ttk-9.2 "Traces on nonexistant namespaces II" -body { ttk::checkbutton .tcb -variable X .tcb configure -variable foo::bar -} -returnCodes 1 -result "*parent namespace doesn't exist*" -match glob +} -returnCodes error -result "*parent namespace doesn't exist*" -match glob test ttk-9.3 "Restore saved options on configure error" -body { .tcb cget -variable @@ -458,7 +458,7 @@ test ttk-10.3 "Check class resource" -body { test ttk-10.4 "Try to modify class resource" -body { .f configure -class Bar -} -returnCodes 1 -match glob -result "*read-only option*" +} -returnCodes error -match glob -result "*read-only option*" test ttk-10.5 "Check class resource again" -body { .f cget -class @@ -548,14 +548,14 @@ test ttk-12.4 "-borderwidth frame option" -body { test ttk-13.1 "Custom styles -- bad -style option" -body { ttk::button .tb1 -style badstyle -} -returnCodes 1 -result "*badstyle not found*" -match glob +} -returnCodes error -result "*badstyle not found*" -match glob test ttk-13.4 "Custom styles -- bad -style option" -body { ttk::button .tb1 .tb1 configure -style badstyle } -cleanup { destroy .tb1 -} -returnCodes 1 -result "*badstyle not found*" -match glob +} -returnCodes error -result "*badstyle not found*" -match glob test ttk-13.5 "Custom layouts -- missing element definition" -body { ttk::style layout badstyle { @@ -573,17 +573,17 @@ test ttk-13.5 "Custom layouts -- missing element definition" -body { test ttk-14.1 "-variable in nonexistant namespace" -body { ttk::checkbutton .tw -variable ::nsn::foo -} -returnCodes 1 -result {can't trace *: parent namespace doesn't exist} \ +} -returnCodes error -result {can't trace *: parent namespace doesn't exist} \ -match glob -cleanup { destroy .tw } test ttk-14.2 "-textvariable in nonexistant namespace" -body { ttk::label .tw -textvariable ::nsn::foo -} -returnCodes 1 -result {can't trace *: parent namespace doesn't exist} \ +} -returnCodes error -result {can't trace *: parent namespace doesn't exist} \ -match glob -cleanup { destroy .tw } test ttk-14.3 "-textvariable in nonexistant namespace" -body { ttk::entry .tw -textvariable ::nsn::foo -} -returnCodes 1 -result {can't trace *: parent namespace doesn't exist} \ +} -returnCodes error -result {can't trace *: parent namespace doesn't exist} \ -match glob -cleanup { destroy .tw } test ttk-15.1 {Bug 3062331} -setup { @@ -629,27 +629,27 @@ proc wrong#varargs {varpart args} { test ttk-ensemble-0 "style element create: insufficient args" -body { ttk::style -} -returnCodes 1 -result \ +} -returnCodes error -result \ [wrong#varargs arg ttk::style option] test ttk-ensemble-1 "style element create: insufficient args" -body { ttk::style element -} -returnCodes 1 -result \ +} -returnCodes error -result \ [wrong#varargs arg ttk::style element option] test ttk-ensemble-2 "style element create: insufficient args" -body { ttk::style element create -} -returnCodes 1 -result \ +} -returnCodes error -result \ [wrong#varargs {-option value} ttk::style element create name type] test ttk-ensemble-3 "style element create: insufficient args" -body { ttk::style element create plain.background -} -returnCodes 1 -result \ +} -returnCodes error -result \ [wrong#varargs {-option value} ttk::style element create name type] test ttk-ensemble-4 "style element create: insufficient args" -body { ttk::style element create plain.background from -} -returnCodes 1 -result [wrong#args theme ?element?] +} -returnCodes error -result [wrong#args theme ?element?] test ttk-ensemble-5 "style element create: valid" -body { ttk::style element create plain.background from default diff --git a/tests/unixEmbed.test b/tests/unixEmbed.test index 4372253..5d00ccf 100644 --- a/tests/unixEmbed.test +++ b/tests/unixEmbed.test @@ -11,6 +11,8 @@ eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + namespace eval ::_test_tmp {} # ------------------------------------------------------------------------------ @@ -1086,7 +1088,7 @@ test unixEmbed-7.2a {TkpRedirectKeyEvent procedure, don't forward keystroke widt } -result {{} {{key b}}} test unixEmbed-8.1 {TkpClaimFocus procedure} -constraints { - unix notAqua + unix notAqua failsOnUbuntu } -setup { deleteWindows } -body { @@ -1188,9 +1190,9 @@ test unixEmbed-9.1 {EmbedWindowDeleted procedure, check parentPtr} -constraints deleteWindows } -result {{{XXX .f4 {} {}} {XXX .f3 {} {}} {XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f4 {} {}} {XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f2 {} {}}} {}} test unixEmbed-9.2 {EmbedWindowDeleted procedure, check embeddedPtr} -constraints { - unix testembed notAqua + unix testembed notAqua } -setup { - deleteWindows + deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 @@ -1233,9 +1235,9 @@ test unixEmbed-9.2a {EmbedWindowDeleted procedure, check embeddedPtr} -constrain test unixEmbed-10.1 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -constraints { - unix + unix failsOnUbuntu } -setup { - deleteWindows + deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 @@ -1249,9 +1251,9 @@ 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 + unix failsOnUbuntu } -setup { - deleteWindows + deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 @@ -1266,9 +1268,9 @@ test unixEmbed-10.2 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -con } -result {70x300+0+0} test unixEmbed-11.1 {focus -force works for embedded toplevels} -constraints { - unix + unix } -setup { - deleteWindows + deleteWindows } -body { toplevel .t pack [frame .t.f -container 1 -width 200 -height 200] -fill both @@ -1282,9 +1284,9 @@ test unixEmbed-11.1 {focus -force works for embedded toplevels} -constraints { deleteWindows } -result .embed test unixEmbed-11.2 {mouse coordinates in embedded toplevels} -constraints { - unix pressbutton + unix pressbutton } -setup { - deleteWindows + deleteWindows } -body { toplevel .main set result {} diff --git a/tests/unixFont.test b/tests/unixFont.test index 44e8f56..524191d 100644 --- a/tests/unixFont.test +++ b/tests/unixFont.test @@ -16,6 +16,8 @@ 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)]}] + if {[tk windowingsystem] eq "x11"} { set xlsf [auto_execok xlsfonts] } @@ -69,7 +71,7 @@ proc getsize {} { test unixfont-1.1 {TkpGetNativeFont procedure: not native} {x11 noExceed} { list [catch {font measure {} xyz} msg] $msg } {1 {font "" doesn't exist}} -test unixfont-1.2 {TkpGetNativeFont procedure: native} x11 { +test unixfont-1.2 {TkpGetNativeFont procedure: native} {x11 failsOnUbuntu} { font measure fixed 0 } 6 @@ -78,21 +80,21 @@ test unixfont-2.1 {TkpGetFontFromAttributes procedure: no family} x11 { set x {} } {} test unixfont-2.2 {TkpGetFontFromAttributes procedure: Times relatives} \ - {x11 noExceed hasTimesNew} { + {x11 noExceed hasTimesNew failsOnUbuntu} { set x {} lappend x [lindex [font actual {-family "Times New Roman"}] 1] lappend x [lindex [font actual {-family "New York"}] 1] lappend x [lindex [font actual {-family "Times"}] 1] } {times times times} test unixfont-2.3 {TkpGetFontFromAttributes procedure: Courier relatives} \ - {x11 noExceed hasCourierNew} { + {x11 noExceed hasCourierNew failsOnUbuntu} { set x {} lappend x [lindex [font actual {-family "Courier New"}] 1] lappend x [lindex [font actual {-family "Monaco"}] 1] lappend x [lindex [font actual {-family "Courier"}] 1] } {courier courier courier} test unixfont-2.4 {TkpGetFontFromAttributes procedure: Helvetica relatives} \ - {x11 noExceed hasArial} { + {x11 noExceed hasArial failsOnUbuntu} { set x {} lappend x [lindex [font actual {-family "Arial"}] 1] lappend x [lindex [font actual {-family "Geneva"}] 1] @@ -102,16 +104,16 @@ test unixfont-2.5 {TkpGetFontFromAttributes procedure: fallback} x11 { font actual {-xyz-xyz-*-*-*-*-*-*-*-*-*-*-*-*} set x {} } {} -test unixfont-2.6 {TkpGetFontFromAttributes: fallback to fixed family} x11 { +test unixfont-2.6 {TkpGetFontFromAttributes: fallback to fixed family} {x11 failsOnUbuntu} { lindex [font actual {-family fixed -size 10}] 1 } {fixed} test unixfont-2.7 {TkpGetFontFromAttributes: fixed family not available!} x11 { # no test available } {} -test unixfont-2.8 {TkpGetFontFromAttributes: loop over returned font names} x11 { +test unixfont-2.8 {TkpGetFontFromAttributes: loop over returned font names} {x11 failsOnUbuntu} { lindex [font actual {-family fixed -size 31}] 1 } {fixed} -test unixfont-2.9 {TkpGetFontFromAttributes: reject adobe courier if possible} {x11 noExceed} { +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 { @@ -166,11 +168,11 @@ test unixfont-5.7 {Tk_MeasureChars procedure: already saw space in line} x11 { .b.l config -text "000000 00000" getsize } "[expr $ax*6] [expr $ay*2]" -test unixfont-5.8 {Tk_MeasureChars procedure: internal spaces significant} x11 { +test unixfont-5.8 {Tk_MeasureChars procedure: internal spaces significant} {x11 failsOnUbuntu} { .b.l config -text "00 000 00000" getsize } "[expr $ax*7] [expr $ay*2]" -test unixfont-5.9 {Tk_MeasureChars procedure: TK_PARTIAL_OK} x11 { +test unixfont-5.9 {Tk_MeasureChars procedure: TK_PARTIAL_OK} {x11 failsOnUbuntu} { .b.c dchars $t 0 end .b.c insert $t 0 "0000" .b.c index $t @[expr int($ax*2.5)],1 @@ -186,7 +188,7 @@ test unixfont-5.11 {Tk_MeasureChars: TK_AT_LEAST_ONE + not even one char fit!} x .b.l config -wrap $a set x } "$ax [expr $ay*6]" -test unixfont-5.12 {Tk_MeasureChars procedure: include eol spaces} x11 { +test unixfont-5.12 {Tk_MeasureChars procedure: include eol spaces} {x11 failsOnUbuntu} { .b.l config -text "000 \n000" getsize } "[expr $ax*6] [expr $ay*2]" @@ -253,7 +255,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 { +test unixfont-8.4 {AllocFont procedure: classify characters} {x11 failsOnUbuntu} { set x 0 incr x [font measure $courier "\u4000"] ;# 6 incr x [font measure $courier "\002"] ;# 4 @@ -264,7 +266,7 @@ test unixfont-8.4 {AllocFont procedure: classify characters} x11 { 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 { +test unixfont-8.6 {AllocFont procedure: setup widths of special chars} {x11 failsOnUbuntu} { set x 0 incr x [font measure $courier "\001"] ;# 4 incr x [font measure $courier "\002"] ;# 4 @@ -292,7 +294,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 { +test unixfont-9.1 {GetControlCharSubst procedure: 2 chars subst} {x11 failsOnUbuntu} { .b.c dchars $t 0 end .b.c insert $t 0 "0\a0" set x {} @@ -301,7 +303,7 @@ test unixfont-9.1 {GetControlCharSubst procedure: 2 chars subst} x11 { 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 { +test unixfont-9.2 {GetControlCharSubst procedure: 4 chars subst} {x11 failsOnUbuntu} { .b.c dchars $t 0 end .b.c insert $t 0 "0\0010" set x {} diff --git a/tests/unixSelect.test b/tests/unixSelect.test index d3da806..9bb90cb 100644 --- a/tests/unixSelect.test +++ b/tests/unixSelect.test @@ -115,7 +115,7 @@ test unixSelect-1.1 {TkSelGetSelection procedure: simple i18n text} -constraints } -body { pack [entry .e] update - .e insert 0 \u00fcber + .e insert 0 \xFCber .e selection range 0 end dobg {string length [selection get]} } -cleanup { @@ -131,13 +131,13 @@ test unixSelect-1.2 {TkSelGetSelection procedure: simple i18n text, iso8859-1} - dobg { pack [entry .e] update - .e insert 0 \u00fc\u0444 + .e insert 0 \xFC\u0444 .e selection range 0 end } selection get } -cleanup { cleanupbg -} -result \u00fc? +} -result \xFC? test unixSelect-1.3 {TkSelGetSelection procedure: simple i18n text, iso2022} -constraints { x11 @@ -148,11 +148,11 @@ test unixSelect-1.3 {TkSelGetSelection procedure: simple i18n text, iso2022} -co selection handle -type COMPOUND_TEXT -format COMPOUND_TEXT . \ {handler COMPOUND_TEXT} selection own . - set selValue \u00fc\u0444 + set selValue \xFC\u0444 set selInfo {} set result [dobg { set x [selection get -type COMPOUND_TEXT] - list [string equal \u00fc\u0444 $x] [string length $x] + list [string equal \xFC\u0444 $x] [string length $x] }] lappend result $selInfo } -cleanup { @@ -172,12 +172,12 @@ test unixSelect-1.4 {TkSelGetSelection procedure: INCR i18n text, iso2022} -cons selection handle -type COMPOUND_TEXT -format COMPOUND_TEXT . \ {handler COMPOUND_TEXT} selection own . - set selValue [string repeat x 3999]\u00fc\u0444[string repeat x 3999] + set selValue [string repeat x 3999]\xFC\u0444[string repeat x 3999] set selInfo {} set result [dobg { set x [selection get -type COMPOUND_TEXT] list [string equal \ - [string repeat x 3999]\u00fc\u0444[string repeat x 3999] $x] \ + [string repeat x 3999]\xFC\u0444[string repeat x 3999] $x] \ [string length $x] }] lappend result $selInfo @@ -194,11 +194,11 @@ test unixSelect-1.5 {TkSelGetSelection procedure: simple i18n text, iso2022} -co selection handle -type COMPOUND_TEXT -format COMPOUND_TEXT . \ {handler COMPOUND_TEXT} selection own . - set selValue \u00fc\u0444 + set selValue \xFC\u0444 set selInfo {} set result [dobg { set x [selection get -type COMPOUND_TEXT] - list [string equal \u00fc\u0444 $x] [string length $x] + list [string equal \xFC\u0444 $x] [string length $x] }] lappend result $selInfo } -cleanup { @@ -211,7 +211,7 @@ test unixSelect-1.6 {TkSelGetSelection procedure: INCR i18n text} -constraints { setupbg } -body { dobg [subst -nobackslashes {entry .e; pack .e; update - .e insert 0 \u00fcber$longValue + .e insert 0 \xFCber$longValue .e selection range 0 end}] string length [selection get] } -cleanup { @@ -226,13 +226,13 @@ test unixSelect-1.7 {TkSelGetSelection procedure: INCR i18n text} -constraints { dobg { pack [entry .e] update - .e insert 0 [string repeat x 3999]\u00fc + .e insert 0 [string repeat x 3999]\xFC .e selection range 0 end } selection get } -cleanup { cleanupbg -} -result [string repeat x 3999]\u00fc +} -result [string repeat x 3999]\xFC test unixSelect-1.8 {TkSelGetSelection procedure: INCR i18n text} -constraints { x11 @@ -242,13 +242,13 @@ test unixSelect-1.8 {TkSelGetSelection procedure: INCR i18n text} -constraints { dobg { pack [entry .e] update - .e insert 0 \u00fc[string repeat x 3999] + .e insert 0 \xFC[string repeat x 3999] .e selection range 0 end } selection get } -cleanup { cleanupbg -} -result \u00fc[string repeat x 3999] +} -result \xFC[string repeat x 3999] test unixSelect-1.9 {TkSelGetSelection procedure: INCR i18n text} -constraints { x11 @@ -258,13 +258,13 @@ test unixSelect-1.9 {TkSelGetSelection procedure: INCR i18n text} -constraints { dobg { pack [entry .e] update - .e insert 0 [string repeat x 3999]\u00fc[string repeat x 4000] + .e insert 0 [string repeat x 3999]\xFC[string repeat x 4000] .e selection range 0 end } selection get } -cleanup { cleanupbg -} -result [string repeat x 3999]\u00fc[string repeat x 4000] +} -result [string repeat x 3999]\xFC[string repeat x 4000] # Now some tests to make sure that the right thing is done when # transferring UTF8 selections, to prevent [Bug 614650] and its ilk # from rearing its ugly head again. @@ -277,13 +277,13 @@ test unixSelect-1.10 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const dobg { pack [entry .e] update - .e insert 0 [string repeat x 3999]\u00fc + .e insert 0 [string repeat x 3999]\xFC .e selection range 0 end } selection get -type UTF8_STRING } -cleanup { cleanupbg -} -result [string repeat x 3999]\u00fc +} -result [string repeat x 3999]\xFC test unixSelect-1.11 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints { x11 @@ -293,13 +293,13 @@ test unixSelect-1.11 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const dobg { pack [entry .e] update - .e insert 0 \u00fc[string repeat x 3999] + .e insert 0 \xFC[string repeat x 3999] .e selection range 0 end } selection get -type UTF8_STRING } -cleanup { cleanupbg -} -result \u00fc[string repeat x 3999] +} -result \xFC[string repeat x 3999] test unixSelect-1.12 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints { x11 @@ -309,13 +309,13 @@ test unixSelect-1.12 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const dobg { pack [entry .e] update - .e insert 0 [string repeat x 3999]\u00fc[string repeat x 4000] + .e insert 0 [string repeat x 3999]\xFC[string repeat x 4000] .e selection range 0 end } selection get -type UTF8_STRING } -cleanup { cleanupbg -} -result [string repeat x 3999]\u00fc[string repeat x 4000] +} -result [string repeat x 3999]\xFC[string repeat x 4000] test unixSelect-1.13 {TkSelGetSelection procedure: simple i18n text, utf-8} -constraints { x11 @@ -325,7 +325,7 @@ test unixSelect-1.13 {TkSelGetSelection procedure: simple i18n text, utf-8} -con } -body { pack [entry .e] update - .e insert 0 \u00fcber\u0444 + .e insert 0 \xFCber\u0444 .e selection range 0 end dobg {string length [selection get -type UTF8_STRING]} } -cleanup { @@ -341,13 +341,13 @@ test unixSelect-1.14 {TkSelGetSelection procedure: simple i18n text, utf-8} -con dobg { pack [entry .e] update - .e insert 0 \u00fc\u0444 + .e insert 0 \xFC\u0444 .e selection range 0 end } selection get -type UTF8_STRING } -cleanup { cleanupbg -} -result \u00fc\u0444 +} -result \xFC\u0444 test unixSelect-1.15 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints { x11 @@ -357,13 +357,13 @@ test unixSelect-1.15 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const dobg { pack [entry .e] update - .e insert 0 [string repeat [string repeat \u00c4\u00e4 50]\n 21] + .e insert 0 [string repeat [string repeat \xC4\xE4 50]\n 21] .e selection range 0 end } selection get -type UTF8_STRING } -cleanup { cleanupbg -} -result [string repeat [string repeat \u00c4\u00e4 50]\n 21] +} -result [string repeat [string repeat \xC4\xE4 50]\n 21] test unixSelect-1.16 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints { x11 @@ -373,13 +373,13 @@ test unixSelect-1.16 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const dobg { pack [entry .e] update - .e insert 0 i[string repeat [string repeat \u00c4\u00e4 50]\n 21] + .e insert 0 i[string repeat [string repeat \xC4\xE4 50]\n 21] .e selection range 0 end } selection get -type UTF8_STRING } -cleanup { cleanupbg -} -result i[string repeat [string repeat \u00c4\u00e4 50]\n 21] +} -result i[string repeat [string repeat \xC4\xE4 50]\n 21] test unixSelect-1.17 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints { x11 @@ -389,7 +389,7 @@ test unixSelect-1.17 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const dobg { pack [text .t] update - .t insert 1.0 [string repeat [string repeat \u00c4\u00e4 50]\n 21] + .t insert 1.0 [string repeat [string repeat \xC4\xE4 50]\n 21] # Has to be selected in a separate stage .t tag add sel 1.0 21.end+1c } @@ -397,7 +397,7 @@ test unixSelect-1.17 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const selection get -type UTF8_STRING } -cleanup { cleanupbg -} -result [string repeat [string repeat \u00c4\u00e4 50]\n 21] +} -result [string repeat [string repeat \xC4\xE4 50]\n 21] test unixSelect-1.18 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints { x11 @@ -407,7 +407,7 @@ test unixSelect-1.18 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const dobg { pack [text .t] update - .t insert 1.0 i[string repeat [string repeat \u00c4\u00e4 50]\n 21] + .t insert 1.0 i[string repeat [string repeat \xC4\xE4 50]\n 21] # Has to be selected in a separate stage .t tag add sel 1.0 21.end+1c } @@ -415,7 +415,7 @@ test unixSelect-1.18 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const selection get -type UTF8_STRING } -cleanup { cleanupbg -} -result i[string repeat [string repeat \u00c4\u00e4 50]\n 21] +} -result i[string repeat [string repeat \xC4\xE4 50]\n 21] test unixSelect-1.19 {Automatic UTF8_STRING support for selection handle} -constraints { unix diff --git a/tests/unixWm.test b/tests/unixWm.test index dbb0ea4..b2b91b7 100644 --- a/tests/unixWm.test +++ b/tests/unixWm.test @@ -13,6 +13,8 @@ tcltest::loadTestedCommands namespace import -force ::tk::test:loadTkCommand +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + proc sleep ms { global x after $ms {set x 1} @@ -287,7 +289,7 @@ test unixWm-8.3 {icon windows} unix { toplevel .t -width 100 -height 30 list [catch {wm iconwindow .t b c} msg] $msg } {1 {wrong # args: should be "wm iconwindow window ?pathName?"}} -test unixWm-8.4 {icon windows} unix { +test unixWm-8.4 {icon windows} {unix failsOnUbuntu} { destroy .t destroy .icon toplevel .t -width 100 -height 30 @@ -632,7 +634,7 @@ test unixWm-16.2 {Tk_WmCmd procedure, "deiconify" option} unix { destroy .icon set result } {1 {can't deiconify .icon: it is an icon for .t}} -test unixWm-16.3 {Tk_WmCmd procedure, "deiconify" option} unix { +test unixWm-16.3 {Tk_WmCmd procedure, "deiconify" option} {unix failsOnUbuntu} { wm iconify .t set result {} lappend result [winfo ismapped .t] [wm state .t] @@ -851,7 +853,7 @@ test unixWm-23.4 {Tk_WmCmd procedure, "iconify" option} unix { destroy .t2 set result } {1 {can't iconify ".t2": it is an icon for ".t"}} -test unixWm-23.5 {Tk_WmCmd procedure, "iconify" option} unix { +test unixWm-23.5 {Tk_WmCmd procedure, "iconify" option} {unix failsOnUbuntu} { destroy .t2 toplevel .t2 wm geom .t2 +0+0 @@ -862,7 +864,7 @@ test unixWm-23.5 {Tk_WmCmd procedure, "iconify" option} unix { destroy .t2 set result } 0 -test unixWm-23.6 {Tk_WmCmd procedure, "iconify" option} unix { +test unixWm-23.6 {Tk_WmCmd procedure, "iconify" option} {unix failsOnUbuntu} { destroy .t2 toplevel .t2 wm geom .t2 -0+0 @@ -1433,7 +1435,7 @@ test unixWm-41.4 {ConfigureEvent procedure, synthesized Configure events} unix { # No tests for ReparentEvent or ComputeReparentGeometry; I can't figure # out how to exercise these procedures reliably. -test unixWm-42.1 {WrapperEventProc procedure, map and unmap events} unix { +test unixWm-42.1 {WrapperEventProc procedure, map and unmap events} {unix failsOnUbuntu} { destroy .t toplevel .t -width 400 -height 150 wm geometry .t +0+0 @@ -1610,7 +1612,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} { +test unixWm-45.2 {UpdateSizeHints procedure} {unix testwrapper failsOnUbuntu} { destroy .t toplevel .t -width 80 -height 60 wm minsize .t 30 40 @@ -1638,7 +1640,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} { +test unixWm-45.4 {UpdateSizeHints procedure, not resizable with menu} {testmenubar testwrapper failsOnUbuntu} { destroy .t toplevel .t -width 80 -height 60 frame .t.menu -height 23 -width 50 @@ -1792,7 +1794,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 { +test unixWm-50.1 {Tk_CoordsToWindow procedure, finding a toplevel, x-coords, title bar} {unix failsOnUbuntu} { update toplevel .t -width 300 -height 400 -bg green wm geom .t +100+100 @@ -1957,7 +1959,7 @@ test unixWm-50.8 {Tk_CoordsToWindow procedure, more basics} unix { [winfo containing [expr $x + 350] $y] \ [winfo containing [expr $x + 450] $y] } {.t .t.f .t.f.f .t {}} -test unixWm-50.9 {Tk_CoordsToWindow procedure, unmapped windows} unix { +test unixWm-50.9 {Tk_CoordsToWindow procedure, unmapped windows} {unix failsOnUbuntu} { destroy .t destroy .t2 toplevel .t -width 200 -height 200 -bg green diff --git a/tests/winClipboard.test b/tests/winClipboard.test index 2f72966..45bf484 100644 --- a/tests/winClipboard.test +++ b/tests/winClipboard.test @@ -70,12 +70,12 @@ test winClipboard-1.5 {TkSelGetSelection & TkWinClipboardRender} -constraints { clipboard clear } -body { set map [list "\r" "\\r" "\n" "\\n"] - clipboard append "line 1\u00c7\nline 2" + clipboard append "line 1\xC7\nline 2" list [string map $map [selection get -selection CLIPBOARD]]\ [string map $map [testclipboard]] } -cleanup { clipboard clear -} -result [list "line 1\u00c7\\nline 2" "line 1\u00c7\\nline 2"] +} -result [list "line 1\xC7\\nline 2" "line 1\xC7\\nline 2"] test winClipboard-1.6 {TkSelGetSelection & TkWinClipboardRender} -constraints { win testclipboard diff --git a/tests/winDialog.test b/tests/winDialog.test index 280d69e..abb3a8e 100755 --- a/tests/winDialog.test +++ b/tests/winDialog.test @@ -545,7 +545,7 @@ test winDialog-5.12.3 {tk_getSaveFile: initial directory: .} -constraints { test winDialog-5.12.4 {tk_getSaveFile: initial directory: unicode} -constraints { nt testwinevent } -body { - set dir [tcltest::makeDirectory "\u0167\u00e9\u015d\u0167"] + set dir [tcltest::makeDirectory "\u0167\xE9\u015d\u0167"] unset -nocomplain x start {set x [tk_getSaveFile \ -initialdir $dir \ @@ -631,7 +631,7 @@ test winDialog-5.12.8 {tk_getOpenFile: initial directory: .} -constraints { test winDialog-5.12.9 {tk_getOpenFile: initial directory: unicode} -constraints { nt testwinevent } -body { - set dir [tcltest::makeDirectory "\u0167\u00e9\u015d\u0167"] + set dir [tcltest::makeDirectory "\u0167\xE9\u015d\u0167"] set path [tcltest::makeFile "" testfile $dir] unset -nocomplain x start {set x [tk_getOpenFile \ diff --git a/tests/winMsgbox.test b/tests/winMsgbox.test index 0181103..447a2f6 100644 --- a/tests/winMsgbox.test +++ b/tests/winMsgbox.test @@ -224,14 +224,14 @@ test winMsgbox-2.3 {tk_messageBox message (unicode)} -constraints { } -body { global windowInfo set title "winMsgbox-2.2 [pid]" - set message "\u041f\u043e\u0438\u0441\u043a\u0020\u0441\u0442\u0440\u0430\u043d\u0438\u0446" + set message "\u041f\u043e\u0438\u0441\u043a \u0441\u0442\u0440\u0430\u043d\u0438\u0446" after 100 [list GetWindowInfo $title 2] set r [tk_messageBox -type ok -title $title -message $message] array set info $windowInfo lappend r $info(childtext) } -cleanup { wm deiconify . -} -result [list ok "\u041f\u043e\u0438\u0441\u043a\u0020\u0441\u0442\u0440\u0430\u043d\u0438\u0446"] +} -result [list ok "\u041f\u043e\u0438\u0441\u043a \u0441\u0442\u0440\u0430\u043d\u0438\u0446"] test winMsgbox-2.4 {tk_messageBox message (empty)} -constraints { win getwindowinfo diff --git a/tests/winfo.test b/tests/winfo.test index d39359b..13193ef 100644 --- a/tests/winfo.test +++ b/tests/winfo.test @@ -11,6 +11,8 @@ namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + # eatColors -- # Creates a toplevel window and allocates enough colors in it to # use up all the slots in the colormap. @@ -291,7 +293,7 @@ test winfo-9.2 {"winfo viewable" command} -body { test winfo-9.3 {"winfo viewable" command} -body { winfo viewable . } -result 1 -test winfo-9.4 {"winfo viewable" command} -body { +test winfo-9.4 {"winfo viewable" command} -constraints failsOnUbuntu -body { wm iconify . winfo viewable . } -cleanup { @@ -320,7 +322,7 @@ test winfo-9.6 {"winfo viewable" command} -setup { } -cleanup { deleteWindows } -result {0 0} -test winfo-9.7 {"winfo viewable" command} -setup { +test winfo-9.7 {"winfo viewable" command} -constraints failsOnUbuntu -setup { deleteWindows } -body { frame .f1 -width 100 -height 100 -relief raised -bd 2 diff --git a/tests/wm.test b/tests/wm.test index 6d5e73b..d5bc733 100644 --- a/tests/wm.test +++ b/tests/wm.test @@ -27,6 +27,8 @@ proc stdWindow {} { update } +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + # [raise] and [lower] may return before the window manager has completed the # operation. The raiseDelay procedure idles for a while to give the operation # a chance to complete. @@ -807,7 +809,7 @@ test wm-iconify-2.4.2 {Misc errors} -constraints !win -setup { destroy .t2 .r.f } -result {can't iconify ".t2": it is an embedded window} -test wm-iconify-3.1 {iconify behavior} -body { +test wm-iconify-3.1 {iconify behavior} -constraints failsOnUbuntu -body { toplevel .t2 wm geom .t2 -0+0 update idletasks @@ -1415,7 +1417,7 @@ test wm-stackorder-2.7 {stacking order: no children returns self} -setup { deleteWindows -test wm-stackorder-3.1 {unmapped toplevel} -body { +test wm-stackorder-3.1 {unmapped toplevel} -constraints failsOnUbuntu -body { toplevel .t1 ; update toplevel .t2 ; update wm iconify .t1 @@ -1525,7 +1527,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 -body { + overrideredirect toplevel on unix} -constraints {x11 failsOnUbuntu} -body { toplevel .t tkwait visibility .t wm overrideredirect .t 1 @@ -1724,7 +1726,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} -body { + when mapped if toplevel is iconic} -constraints failsOnUbuntu -body { toplevel .top wm iconify .top update @@ -1736,7 +1738,7 @@ test wm-transient-4.1 {transient toplevel is withdrawn deleteWindows } -result {withdrawn 0} test wm-transient-4.2 {already mapped transient toplevel - is withdrawn if toplevel is iconic} -body { + is withdrawn if toplevel is iconic} -constraints failsOnUbuntu -body { toplevel .top raiseDelay wm iconify .top @@ -1750,7 +1752,7 @@ test wm-transient-4.2 {already mapped transient toplevel deleteWindows } -result {withdrawn 0} test wm-transient-4.3 {iconify/deiconify on the toplevel - does a withdraw/deiconify on the transient} -setup { + does a withdraw/deiconify on the transient} -constraints failsOnUbuntu -setup { set results [list] } -body { toplevel .top @@ -1926,7 +1928,7 @@ test wm-transient-7.5 {Reassign transient, destroy transient} -body { deleteWindows } -test wm-transient-8.1 {transient to withdrawn window, Bug 1163496} -setup { +test wm-transient-8.1 {transient to withdrawn window, Bug 1163496} -constraints failsOnUbuntu -setup { deleteWindows set result {} } -body { @@ -2003,7 +2005,7 @@ test wm-state-2.7 {state change before map} -body { } -cleanup { deleteWindows } -result {iconic} -test wm-state-2.8 {state change after map} -body { +test wm-state-2.8 {state change after map} -constraints failsOnUbuntu -body { toplevel .t update wm state .t iconic @@ -2011,7 +2013,7 @@ test wm-state-2.8 {state change after map} -body { } -cleanup { deleteWindows } -result {iconic} -test wm-state-2.9 {state change after map} -body { +test wm-state-2.9 {state change after map} -constraints failsOnUbuntu -body { toplevel .t update wm iconify .t diff --git a/unix/configure.ac b/unix/configure.ac index 286e7e5..b765f13 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -520,43 +520,6 @@ if test $tk_aqua = no; then fi #-------------------------------------------------------------------- -# Check for libnotify. -#-------------------------------------------------------------------- - -if test $tk_aqua = no; then - AC_MSG_CHECKING([whether to use libnotify]) - AC_ARG_ENABLE(libnotify, - AC_HELP_STRING([--enable-libnotify], - [use libnotify (default: on)]), - [enable_libnotify=$enableval], [enable_libfnotify="default"]) - LIBNOTIFY_CFLAGS="" - LIBNOTIFY_LIBS="" - if test "$enable_libnotify" = "no" ; then - AC_MSG_RESULT([$enable_libnotify]) - else - found_libnotify="yes" - dnl make sure pkg-config says that libnotify is present. - LIBNOTIFY_CFLAGS=`pkg-config --cflags libnotify 2>/dev/null` || found_libnotify="no" - LIBNOTIFY_LIBS=`pkg-config --libs libnotify 2>/dev/null` || found_libnotify="no" - if test "$found_libnotify" = "no" ; then - found_libnotify=yes - LIBNOTIFY_CFLAGS=`pkg-config --cflags libnotify 2>/dev/null` || found_libnotify="no" - LIBNOTIFY_LIBS=`pkg-config --libs libnotify 2>/dev/null` || found_libnotify="no" - fi - AC_MSG_RESULT([$found_libnotify]) - fi - if test $enable_libnotify = "yes" ; then - UNIX_LIBNOTIFY_OBJS=tkUnixSysNotify.o - AC_DEFINE(HAVE_LIBNOTIFY, 1, [Have we turned on libnotify?]) - else - UNIX_LIBNOTIFY_OBJS="" - fi - AC_SUBST(LIBNOTIFY_CFLAGS) - AC_SUBST(LIBNOTIFY_LIBS) - AC_SUBST(UNIX_LIBNOTIFY_OBJS) -fi - -#-------------------------------------------------------------------- # XXX Do this last. # It might modify XLIBSW which could affect other tests. # diff --git a/unix/tkUnixPort.h b/unix/tkUnixPort.h index 347c9d8..7aca5d6 100644 --- a/unix/tkUnixPort.h +++ b/unix/tkUnixPort.h @@ -173,4 +173,10 @@ sprintf((buf), "%#08lx", (unsigned long) (w)) #endif +/* + * Used by tkWindow.c + */ + +#define TkpHandleMapOrUnmap(tkwin, event) Tk_HandleEvent(event) + #endif /* _UNIXPORT */ diff --git a/win/tkWinPort.h b/win/tkWinPort.h index 8df19ed..0118608 100644 --- a/win/tkWinPort.h +++ b/win/tkWinPort.h @@ -125,6 +125,12 @@ | ((p)->green & 0xff00) | (((p)->blue << 8) & 0xff0000)) | 0x20000000) /* + * Used by tkWindow.c + */ + +#define TkpHandleMapOrUnmap(tkwin, event) Tk_HandleEvent(event) + +/* * These calls implement native bitmaps which are not currently * supported under Windows. The macros eliminate the calls. */ |