-- cgit v0.12 From f1d0cc318c6049e7a1be191267286e13efcb29dc Mon Sep 17 00:00:00 2001 From: bll Date: Wed, 7 Oct 2020 15:19:49 +0000 Subject: Add missing -insertcolor, -insertwidth styling options. --- doc/ttk_combobox.n | 2 ++ doc/ttk_entry.n | 2 ++ doc/ttk_spinbox.n | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/doc/ttk_combobox.n b/doc/ttk_combobox.n index 9d0bcc6..37b91aa 100644 --- a/doc/ttk_combobox.n +++ b/doc/ttk_combobox.n @@ -142,6 +142,8 @@ are: .RS Can only be changed when using non-native and non-graphical themes. .RE +\fB\-insertcolor\fP \fIcolor\fP +.br \fB\-insertwidth\fP \fIamount\fP .br \fB\-lightcolor\fP \fIcolor\fP diff --git a/doc/ttk_entry.n b/doc/ttk_entry.n index 4eb67cc..da183f7 100644 --- a/doc/ttk_entry.n +++ b/doc/ttk_entry.n @@ -448,6 +448,8 @@ Some themes use a graphical background and their field background colors cannot .RE \fB\-foreground\fP \fIcolor\fP .br +\fB\-insertcolor\fP \fIcolor\fP +.br \fB\-insertwidth\fP \fIamount\fP .br \fB\-lightcolor\fP \fIcolor\fP diff --git a/doc/ttk_spinbox.n b/doc/ttk_spinbox.n index 9ae9881..d7b7657 100644 --- a/doc/ttk_spinbox.n +++ b/doc/ttk_spinbox.n @@ -107,6 +107,10 @@ value is specified for \fB\-fieldbackground\fP. Otherwise it is ignored. .br \fB\-foreground\fP \fIcolor\fP .br +\fB\-insertcolor\fP \fIcolor\fP +.br +\fB\-insertwidth\fP \fIamount\fP +.br \fB\-lightcolor\fP \fIcolor\fP .br \fB\-padding\fP \fIpadding\fP -- cgit v0.12 From 6f7e7fc3f5a526eb084d266c4fc931a388e23f06 Mon Sep 17 00:00:00 2001 From: culler Date: Wed, 7 Oct 2020 20:43:07 +0000 Subject: Fix [1fa8c3ed8d]: Aqua crash when a window is resized in a display procedure. --- macosx/tkMacOSXSubwindows.c | 4 ++-- macosx/tkMacOSXWindowEvent.c | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index 15081cb..280c041 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -369,7 +369,7 @@ XResizeWindow( r.origin.y += r.size.height - height; r.size.width = width; r.size.height = height; - [w setFrame:[w frameRectForContentRect:r] display:YES]; + [w setFrame:[w frameRectForContentRect:r] display:NO]; } } } else { @@ -426,7 +426,7 @@ XMoveResizeWindow( X + XOff, TkMacOSXZeroScreenHeight() - Y - YOff - Height, Width, Height); - [w setFrame:[w frameRectForContentRect:r] display:YES]; + [w setFrame:[w frameRectForContentRect:r] display:NO]; } } else { MoveResizeWindow(macWin); diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index 5a2809c..ae5190f 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -970,6 +970,14 @@ ConfigureRestrictProc( TkWindow *winPtr = TkMacOSXGetTkWindow(w); Tk_Window tkwin = (Tk_Window)winPtr; + /* + * See ticket [1fa8c3ed8d]. This may not be needed for macOSX 11. + */ + + if(![NSApp isDrawing]) { + return; + } + if (![self inLiveResize] && [w respondsToSelector: @selector (tkLayoutChanged)]) { [(TKWindow *)w tkLayoutChanged]; @@ -1017,7 +1025,6 @@ ConfigureRestrictProc( */ [self generateExposeEvents: [self bounds]]; - [w displayIfNeeded]; /* * Finally, unlock the main autoreleasePool. -- cgit v0.12 From 131eca1c29268703370bf339f09c63b0c756f306 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 8 Oct 2020 13:54:16 +0000 Subject: Make everything compile warning-free using -Wundef --- generic/nanosvg.h | 10 +++++----- generic/ttk/ttkImage.c | 10 +++++----- macosx/Tk-Common.xcconfig | 2 +- macosx/tkMacOSXMouseEvent.c | 2 +- macosx/tkMacOSXNotify.c | 2 +- unix/configure | 2 +- unix/tcl.m4 | 2 +- win/configure | 2 +- win/tcl.m4 | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/generic/nanosvg.h b/generic/nanosvg.h index 768dd20..d762f5a 100644 --- a/generic/nanosvg.h +++ b/generic/nanosvg.h @@ -86,7 +86,7 @@ extern "C" { #endif // float emulation for MS VC6++ compiler -#if (_MSC_VER == 1200) +#if defined(_MSC_VER) && (_MSC_VER == 1200) #define tanf(a) (float)tan(a) #define cosf(a) (float)cos(a) #define sinf(a) (float)sin(a) @@ -99,7 +99,7 @@ extern "C" { #define floorf(a) (float)floor(a) #endif // float emulation for MS VC8++ compiler -#if (_MSC_VER == 1400) +#if defined(_MSC_VER) && (_MSC_VER == 1400) #define fabsf(a) (float)fabs(a) #endif @@ -1157,7 +1157,7 @@ static double nsvg__atof(const char* s) char* cur = (char*)s; char* end = NULL; double res = 0.0, sign = 1.0; -#if (_MSC_VER == 1200) +#if defined(_MSC_VER) && (_MSC_VER == 1200) __int64 intPart = 0, fracPart = 0; #else long long intPart = 0, fracPart = 0; @@ -1175,7 +1175,7 @@ static double nsvg__atof(const char* s) // Parse integer part if (nsvg__isdigit(*cur)) { // Parse digit sequence -#if (_MSC_VER == 1200) +#if defined(_MSC_VER) && (_MSC_VER == 1200) intPart = strtol(cur, &end, 10); #else intPart = strtoll(cur, &end, 10); @@ -1192,7 +1192,7 @@ static double nsvg__atof(const char* s) cur++; // Skip '.' if (nsvg__isdigit(*cur)) { // Parse digit sequence -#if (_MSC_VER == 1200) +#if defined(_MSC_VER) && (_MSC_VER == 1200) fracPart = strtol(cur, &end, 10); #else fracPart = strtoll(cur, &end, 10); diff --git a/generic/ttk/ttkImage.c b/generic/ttk/ttkImage.c index e6ad27d..d745b74 100644 --- a/generic/ttk/ttkImage.c +++ b/generic/ttk/ttkImage.c @@ -263,7 +263,7 @@ typedef struct { /* ClientData for image elements */ Ttk_Padding border; /* Fixed border region */ Ttk_Padding padding; /* Internal padding */ -#if TILE_07_COMPAT +#ifdef TILE_07_COMPAT Ttk_ResourceCache cache; /* Resource cache for images */ Ttk_StateMap imageMap; /* State-based lookup table for images */ #endif @@ -273,7 +273,7 @@ static void FreeImageData(void *clientData) { ImageData *imageData = (ImageData *)clientData; if (imageData->imageSpec) { TtkFreeImageSpec(imageData->imageSpec); } -#if TILE_07_COMPAT +#ifdef TILE_07_COMPAT if (imageData->imageMap) { Tcl_DecrRefCount(imageData->imageMap); } #endif ckfree(clientData); @@ -311,7 +311,7 @@ static void ImageElementDraw( Ttk_Box src, dst; (void)elementRecord; -#if TILE_07_COMPAT +#ifdef TILE_07_COMPAT if (imageData->imageMap) { Tcl_Obj *imageObj = Ttk_StateMapLookup(NULL,imageData->imageMap,state); if (imageObj) { @@ -383,7 +383,7 @@ Ttk_CreateImageElement( imageData->minWidth = imageData->minHeight = -1; imageData->sticky = TTK_FILL_BOTH; imageData->border = imageData->padding = Ttk_UniformPadding(0); -#if TILE_07_COMPAT +#ifdef TILE_07_COMPAT imageData->cache = Ttk_GetResourceCache(interp); imageData->imageMap = 0; #endif @@ -398,7 +398,7 @@ Ttk_CreateImageElement( goto error; } -#if TILE_07_COMPAT +#ifdef TILE_07_COMPAT if (!strcmp("-map", Tcl_GetString(objv[i]))) { imageData->imageMap = objv[i+1]; Tcl_IncrRefCount(imageData->imageMap); diff --git a/macosx/Tk-Common.xcconfig b/macosx/Tk-Common.xcconfig index 0ece048..72ef08a 100644 --- a/macosx/Tk-Common.xcconfig +++ b/macosx/Tk-Common.xcconfig @@ -23,7 +23,7 @@ GCC_NO_COMMON_BLOCKS = YES GCC_DYNAMIC_NO_PIC = YES GCC_VERSION = 4.2 GCC = gcc-$(GCC_VERSION) -WARNING_CFLAGS = -Wall -Wextra -Wshadow -Wwrite-strings -Wpointer-arith -Winit-self -Wcast-align -Wdisabled-optimization -Winline $(WARNING_CFLAGS) +WARNING_CFLAGS = -Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith -Winit-self -Wcast-align -Wdisabled-optimization -Winline $(WARNING_CFLAGS) REZ_RESOURCE_MAP_READ_ONLY = YES APPLICATION_INSTALL_PATH = /Applications/Utilities BINDIR = $(PREFIX)/bin diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c index d55ca5a..359f164 100644 --- a/macosx/tkMacOSXMouseEvent.c +++ b/macosx/tkMacOSXMouseEvent.c @@ -618,7 +618,7 @@ GenerateButtonEvent( int dummy; TkDisplay *dispPtr; -#if UNUSED +#ifdef UNUSED /* * ButtonDown events will always occur in the front window. ButtonUp diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c index 3247ade..e169a7d 100644 --- a/macosx/tkMacOSXNotify.c +++ b/macosx/tkMacOSXNotify.c @@ -156,7 +156,7 @@ void DebugPrintQueue(void) * this block should be removed. */ -# if MAC_OSX_VERSION_MAX_ALLOWED >= 101500 +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101500 if ([theEvent type] == NSAppKitDefined) { static Bool aWindowIsMoving = NO; switch([theEvent subtype]) { diff --git a/unix/configure b/unix/configure index 37a3f64..40bc9db 100755 --- a/unix/configure +++ b/unix/configure @@ -4239,7 +4239,7 @@ fi if test "$GCC" = yes; then : CFLAGS_OPTIMIZE=-O2 - CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wwrite-strings -Wpointer-arith" + CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith" case "${CC}" in *++|*++-*) ;; diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 2cad8fd..8ee17e1 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -966,7 +966,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CFLAGS_DEBUG=-g AS_IF([test "$GCC" = yes], [ CFLAGS_OPTIMIZE=-O2 - CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wwrite-strings -Wpointer-arith" + CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith" case "${CC}" in *++|*++-*) ;; diff --git a/win/configure b/win/configure index c5e4825..f75d08c 100755 --- a/win/configure +++ b/win/configure @@ -4256,7 +4256,7 @@ $as_echo "using shared flags" >&6; } CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" - CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wwrite-strings -Wpointer-arith" + CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith" LDFLAGS_DEBUG= LDFLAGS_OPTIMIZE= diff --git a/win/tcl.m4 b/win/tcl.m4 index 989ea76..a8aab6b 100644 --- a/win/tcl.m4 +++ b/win/tcl.m4 @@ -673,7 +673,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" - CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wwrite-strings -Wpointer-arith" + CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith" LDFLAGS_DEBUG= LDFLAGS_OPTIMIZE= -- cgit v0.12 From c336694fdeda262cf81195e421a91ea40b1101a6 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 8 Oct 2020 13:56:24 +0000 Subject: typo --- macosx/tkMacOSXNotify.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c index 5163e21..b32c635 100644 --- a/macosx/tkMacOSXNotify.c +++ b/macosx/tkMacOSXNotify.c @@ -156,7 +156,7 @@ void DebugPrintQueue(void) * this block should be removed. */ -# if MAC_OSX_VERSION_MAX_ALLOWED >= 101500 +# if MAC_OS_X_VERSION_MAX_ALLOWED >= 101500 if ([theEvent type] == NSAppKitDefined) { static Bool aWindowIsMoving = NO; switch([theEvent subtype]) { -- cgit v0.12 From 611539b46b3f35feff024c8e9c22b8bf93a025d8 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 8 Oct 2020 14:31:23 +0000 Subject: Fix more warnings related to -Wundef. --- generic/tkFont.c | 4 ++-- generic/tkTextDisp.c | 50 +++++++++++++++++++++++++------------------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/generic/tkFont.c b/generic/tkFont.c index 79c8d54..2788b2e 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -2332,7 +2332,7 @@ Tk_DrawTextLayout( numDisplayChars = lastChar; } lastByte = Tcl_UtfAtIndex(chunkPtr->start, numDisplayChars); -#if TK_DRAW_IN_CONTEXT +#ifdef TK_DRAW_IN_CONTEXT TkpDrawCharsInContext(display, drawable, gc, layoutPtr->tkfont, chunkPtr->start, chunkPtr->numBytes, firstByte - chunkPtr->start, lastByte - firstByte, @@ -2402,7 +2402,7 @@ TkDrawAngledTextLayout( numDisplayChars = lastChar; } lastByte = Tcl_UtfAtIndex(chunkPtr->start, numDisplayChars); -#if TK_DRAW_IN_CONTEXT +#ifdef TK_DRAW_IN_CONTEXT dx = cosA * (chunkPtr->x) + sinA * (chunkPtr->y); dy = -sinA * (chunkPtr->x) + cosA * (chunkPtr->y); if (angle == 0.0) { diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index b1c5e17..6e96127 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -440,7 +440,7 @@ typedef struct TextDInfo { * points to one of the following structures: */ -#if !TK_LAYOUT_WITH_BASE_CHUNKS +#if !defined(TK_LAYOUT_WITH_BASE_CHUNKS) typedef struct CharInfo { int numBytes; /* Number of bytes to display. */ @@ -552,7 +552,7 @@ static void CharDisplayProc(TkText *textPtr, static int CharMeasureProc(TkTextDispChunk *chunkPtr, int x); static void CharUndisplayProc(TkText *textPtr, TkTextDispChunk *chunkPtr); -#if TK_LAYOUT_WITH_BASE_CHUNKS +#ifdef TK_LAYOUT_WITH_BASE_CHUNKS static void FinalizeBaseChunk(TkTextDispChunk *additionalChunkPtr); static void FreeBaseChunk(TkTextDispChunk *baseChunkPtr); static int IsSameFGStyle(TextStyle *style1, TextStyle *style2); @@ -1508,7 +1508,7 @@ LayoutDLine( } } -#if TK_LAYOUT_WITH_BASE_CHUNKS +#ifdef TK_LAYOUT_WITH_BASE_CHUNKS if (baseCharChunkPtr != NULL) { int expectedX = ((BaseCharInfo *) baseCharChunkPtr->clientData)->width @@ -1650,7 +1650,7 @@ LayoutDLine( chunkPtr = NULL; } -#if TK_LAYOUT_WITH_BASE_CHUNKS +#ifdef TK_LAYOUT_WITH_BASE_CHUNKS FinalizeBaseChunk(NULL); #endif /* TK_LAYOUT_WITH_BASE_CHUNKS */ if (noCharsYet) { @@ -1709,7 +1709,7 @@ LayoutDLine( segPtr->typePtr->layoutProc(textPtr, &breakIndex, segPtr, byteOffset, maxX, breakByteOffset, 0, wrapMode, breakChunkPtr); -#if TK_LAYOUT_WITH_BASE_CHUNKS +#ifdef TK_LAYOUT_WITH_BASE_CHUNKS FinalizeBaseChunk(NULL); #endif /* TK_LAYOUT_WITH_BASE_CHUNKS */ } @@ -7628,7 +7628,7 @@ TkTextCharLayoutProc( char *p; TkTextSegment *nextPtr; Tk_FontMetrics fm; -#if TK_LAYOUT_WITH_BASE_CHUNKS +#ifdef TK_LAYOUT_WITH_BASE_CHUNKS const char *line; int lineOffset; BaseCharInfo *bciPtr; @@ -7653,7 +7653,7 @@ TkTextCharLayoutProc( p = segPtr->body.chars + byteOffset; tkfont = chunkPtr->stylePtr->sValuePtr->tkfont; -#if TK_LAYOUT_WITH_BASE_CHUNKS +#ifdef TK_LAYOUT_WITH_BASE_CHUNKS if (baseCharChunkPtr == NULL) { baseCharChunkPtr = chunkPtr; bciPtr = ckalloc(sizeof(BaseCharInfo)); @@ -7690,7 +7690,7 @@ TkTextCharLayoutProc( int ch; int chLen = TkUtfToUniChar(p, &ch); -#if TK_LAYOUT_WITH_BASE_CHUNKS +#ifdef TK_LAYOUT_WITH_BASE_CHUNKS bytesThatFit = CharChunkMeasureChars(chunkPtr, line, lineOffset+chLen, lineOffset, -1, chunkPtr->x, -1, 0, &nextX); @@ -7734,7 +7734,7 @@ TkTextCharLayoutProc( bytesThatFit++; } if (bytesThatFit == 0) { -#if TK_LAYOUT_WITH_BASE_CHUNKS +#ifdef TK_LAYOUT_WITH_BASE_CHUNKS chunkPtr->clientData = NULL; if (chunkPtr == baseCharChunkPtr) { baseCharChunkPtr = NULL; @@ -7767,7 +7767,7 @@ TkTextCharLayoutProc( chunkPtr->width = nextX - chunkPtr->x; chunkPtr->breakIndex = -1; -#if !TK_LAYOUT_WITH_BASE_CHUNKS +#if !defined(TK_LAYOUT_WITH_BASE_CHUNKS) ciPtr = (CharInfo *)ckalloc(offsetof(CharInfo, chars) + 1 + bytesThatFit); chunkPtr->clientData = ciPtr; memcpy(ciPtr->chars, p, bytesThatFit); @@ -7778,7 +7778,7 @@ TkTextCharLayoutProc( ciPtr->numBytes--; } -#if TK_LAYOUT_WITH_BASE_CHUNKS +#ifdef TK_LAYOUT_WITH_BASE_CHUNKS /* * Final update for the current base chunk data. */ @@ -7883,7 +7883,7 @@ CharChunkMeasureChars( Tk_Font tkfont = chunkPtr->stylePtr->sValuePtr->tkfont; CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData; -#if !TK_LAYOUT_WITH_BASE_CHUNKS +#if !defined(TK_LAYOUT_WITH_BASE_CHUNKS) if (chars == NULL) { chars = ciPtr->chars; charsLen = ciPtr->numBytes; @@ -7975,7 +7975,7 @@ CharDisplayProc( TextStyle *stylePtr; StyleValues *sValuePtr; int numBytes, offsetBytes, offsetX; -#if TK_DRAW_IN_CONTEXT +#ifdef TK_DRAW_IN_CONTEXT BaseCharInfo *bciPtr; #endif /* TK_DRAW_IN_CONTEXT */ @@ -7987,12 +7987,12 @@ CharDisplayProc( return; } -#if TK_DRAW_IN_CONTEXT +#ifdef TK_DRAW_IN_CONTEXT bciPtr = ciPtr->baseChunkPtr->clientData; numBytes = Tcl_DStringLength(&bciPtr->baseChars); string = Tcl_DStringValue(&bciPtr->baseChars); -#elif TK_LAYOUT_WITH_BASE_CHUNKS +#elif defined(TK_LAYOUT_WITH_BASE_CHUNKS) if (ciPtr->baseChunkPtr != chunkPtr) { /* * Without context drawing only base chunks display their foreground. @@ -8033,7 +8033,7 @@ CharDisplayProc( if (!sValuePtr->elide && (numBytes > offsetBytes) && (stylePtr->fgGC != NULL)) { -#if TK_DRAW_IN_CONTEXT +#ifdef TK_DRAW_IN_CONTEXT int start = ciPtr->baseOffset + offsetBytes; int len = ciPtr->numBytes - offsetBytes; int xDisplacement = x - chunkPtr->x; @@ -8124,7 +8124,7 @@ CharUndisplayProc( CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData; if (ciPtr) { -#if TK_LAYOUT_WITH_BASE_CHUNKS +#ifdef TK_LAYOUT_WITH_BASE_CHUNKS if (chunkPtr == ciPtr->baseChunkPtr) { /* * Basechunks are undisplayed first, when DLines are freed or @@ -8706,7 +8706,7 @@ MeasureChars( if ((maxX >= 0) && (curX >= maxX)) { break; } -#if TK_DRAW_IN_CONTEXT +#ifdef TK_DRAW_IN_CONTEXT start += TkpMeasureCharsInContext(tkfont, source, maxBytes, start - source, special - start, maxX >= 0 ? maxX - curX : -1, flags, &width); @@ -8836,7 +8836,7 @@ TextGetScrollInfoObj( return TKTEXT_SCROLL_ERROR; } -#if TK_LAYOUT_WITH_BASE_CHUNKS +#ifdef TK_LAYOUT_WITH_BASE_CHUNKS /* *---------------------------------------------------------------------- * @@ -8867,7 +8867,7 @@ FinalizeBaseChunk( const char *baseChars; TkTextDispChunk *chunkPtr; CharInfo *ciPtr; -#if TK_DRAW_IN_CONTEXT +#ifdef TK_DRAW_IN_CONTEXT int widthAdjust = 0; int newwidth; #endif /* TK_DRAW_IN_CONTEXT */ @@ -8881,7 +8881,7 @@ FinalizeBaseChunk( for (chunkPtr = baseCharChunkPtr; chunkPtr != NULL; chunkPtr = chunkPtr->nextPtr) { -#if TK_DRAW_IN_CONTEXT +#ifdef TK_DRAW_IN_CONTEXT chunkPtr->x += widthAdjust; #endif /* TK_DRAW_IN_CONTEXT */ @@ -8894,7 +8894,7 @@ FinalizeBaseChunk( } ciPtr->chars = baseChars + ciPtr->baseOffset; -#if TK_DRAW_IN_CONTEXT +#ifdef TK_DRAW_IN_CONTEXT newwidth = 0; CharChunkMeasureChars(chunkPtr, NULL, 0, 0, -1, 0, -1, 0, &newwidth); if (newwidth < chunkPtr->width) { @@ -8908,7 +8908,7 @@ FinalizeBaseChunk( ciPtr = addChunkPtr->clientData; ciPtr->chars = baseChars + ciPtr->baseOffset; -#if TK_DRAW_IN_CONTEXT +#ifdef TK_DRAW_IN_CONTEXT addChunkPtr->x += widthAdjust; CharChunkMeasureChars(addChunkPtr, NULL, 0, 0, -1, 0, -1, 0, &addChunkPtr->width); @@ -9006,7 +9006,7 @@ IsSameFGStyle( return 1; } -#if !TK_DRAW_IN_CONTEXT +#if !defined(TK_DRAW_IN_CONTEXT) if ( #ifdef MAC_OSX_TK !TkMacOSXCompareColors(style1->fgGC->foreground, @@ -9022,7 +9022,7 @@ IsSameFGStyle( sv1 = style1->sValuePtr; sv2 = style2->sValuePtr; -#if TK_DRAW_IN_CONTEXT +#ifdef TK_DRAW_IN_CONTEXT return sv1->tkfont == sv2->tkfont && sv1->offset == sv2->offset; #else return sv1->tkfont == sv2->tkfont -- cgit v0.12 From 10bca5a542048ae2e11701980f2997e26ce28433 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 8 Oct 2020 15:22:22 +0000 Subject: Mark all test-cases failing on XQuarz with constraint "failsOnXQuarz" --- tests/canvText.test | 3 ++- tests/clipboard.test | 4 +++- tests/entry.test | 3 ++- tests/focus.test | 9 +++++---- tests/pack.test | 5 +++-- tests/place.test | 5 +++-- tests/scrollbar.test | 13 +++++++------ tests/textDisp.test | 29 +++++++++++++++-------------- tests/unixEmbed.test | 9 +++++---- tests/unixFont.test | 9 +++++---- tests/unixWm.test | 13 +++++++------ tests/winfo.test | 3 ++- tests/wm.test | 9 +++++---- 13 files changed, 64 insertions(+), 50 deletions(-) diff --git a/tests/canvText.test b/tests/canvText.test index 5ac088d..c0b9075 100644 --- a/tests/canvText.test +++ b/tests/canvText.test @@ -12,6 +12,7 @@ eval tcltest::configure $argv tcltest::loadTestedCommands testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] # Canvas used in 1.* - 17.* tests canvas .c -width 400 -height 300 -bd 2 -relief sunken @@ -942,7 +943,7 @@ test canvText-19.1 {patch 1006286, leading space caused wrap under Win32} -setup destroy .c } -result {{Yeah } Yeah- 4 4} -test canvText-20.1 {angled text bounding box} -constraints failsOnUbuntu -setup { +test canvText-20.1 {angled text bounding box} -constraints {failsOnUbuntu failsOnXQuarz} -setup { destroy .c canvas .c proc transpose {bbox} { diff --git a/tests/clipboard.test b/tests/clipboard.test index 81534d5..7c1a506 100644 --- a/tests/clipboard.test +++ b/tests/clipboard.test @@ -21,6 +21,8 @@ namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands +testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] + # set up a very large buffer to test INCR retrievals set longValue "" foreach i {a b c d e f g j h i j k l m o p q r s t u v w x y z} { @@ -233,7 +235,7 @@ test clipboard-6.1 {Tk_ClipboardAppend procedure} -setup { } -cleanup { clipboard clear } -returnCodes ok -result {first chunk second chunk} -test clipboard-6.2 {Tk_ClipboardAppend procedure} -constraints x11 -setup { +test clipboard-6.2 {Tk_ClipboardAppend procedure} -constraints {x11 failsOnXQuarz} -setup { clipboard clear } -body { setupbg diff --git a/tests/entry.test b/tests/entry.test index 4463b9b..a557e91 100644 --- a/tests/entry.test +++ b/tests/entry.test @@ -13,6 +13,7 @@ tcltest::loadTestedCommands testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}] +testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] # For xscrollcommand set scrollInfo {} @@ -1687,7 +1688,7 @@ test entry-5.7 {ConfigureEntry procedure} -setup { test entry-5.8 {ConfigureEntry procedure} -constraints { - fonts + fonts failsOnXQuarz } -setup { entry .e -borderwidth 2 -highlightthickness 2 pack .e diff --git a/tests/focus.test b/tests/focus.test index 2760255..3bdf778 100644 --- a/tests/focus.test +++ b/tests/focus.test @@ -12,6 +12,7 @@ tcltest::loadTestedCommands namespace import -force tcltest::test testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] proc focusSetup {} { destroy .t @@ -310,7 +311,7 @@ in .t.b1 NotifyNonlinear } .t.b1} test focus-2.6 {TkFocusFilterEvent procedure, FocusIn events} -constraints { - unix testwrapper failsOnUbuntu + unix testwrapper failsOnUbuntu failsOnXQuarz } -body { focus .t.b1 focus . @@ -322,7 +323,7 @@ test focus-2.6 {TkFocusFilterEvent procedure, FocusIn events} -constraints { list $x $focusInfo } -result {.t.b1 {press .t.b1 x}} test focus-2.7 {TkFocusFilterEvent procedure, FocusOut events} -constraints { - unix testwrapper failsOnUbuntu + unix testwrapper failsOnUbuntu failsOnXQuarz } -body { set result {} foreach detail {NotifyAncestor NotifyInferior NotifyNonlinear @@ -343,7 +344,7 @@ test focus-2.8 {TkFocusFilterEvent procedure, FocusOut events} -constraints { focus } -result {.t.b1} test focus-2.9 {TkFocusFilterEvent procedure, FocusOut events} -constraints { - unix testwrapper failsOnUbuntu + unix testwrapper failsOnUbuntu failsOnXQuarz } -body { focus .t.b1 event gen [testwrapper .] -detail NotifyAncestor @@ -601,7 +602,7 @@ cleanupbg # Test 5.1 fails (before and after update) test focus-5.1 {ChangeXFocus procedure, don't take focus unless have it} -constraints { - unix testwrapper secureserver failsOnUbuntu + unix testwrapper secureserver failsOnUbuntu failsOnXQuarz } -body { setupbg focusSetup diff --git a/tests/pack.test b/tests/pack.test index 9fd8035..1f40083 100644 --- a/tests/pack.test +++ b/tests/pack.test @@ -12,6 +12,7 @@ tcltest::loadTestedCommands namespace import -force tcltest::test testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] # Create some test windows. @@ -1560,7 +1561,7 @@ if {[tk windowingsystem] == "win32"} { } test pack-18.1 {unmap content when container unmapped} -constraints { - tempNotPc failsOnUbuntu + tempNotPc failsOnUbuntu failsOnXQuarz } -setup { eval destroy [winfo child .pack] } -body { @@ -1591,7 +1592,7 @@ test pack-18.1 {unmap content when container unmapped} -constraints { lappend result [winfo ismapped .pack.a] } -result {1 0 200 75 0 1} -test pack-18.2 {unmap content when container unmapped} -constraints failsOnUbuntu -setup { +test pack-18.2 {unmap content when container unmapped} -constraints {failsOnUbuntu failsOnXQuarz} -setup { eval destroy [winfo child .pack] } -body { diff --git a/tests/place.test b/tests/place.test index 840ffca..9408b72 100644 --- a/tests/place.test +++ b/tests/place.test @@ -14,6 +14,7 @@ tcltest::loadTestedCommands testConstraint memory [llength [info commands memory]] testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] # XXX - This test file is woefully incomplete. At present, only a # few of the features are tested. @@ -269,7 +270,7 @@ if {[tk windowingsystem] == "win32"} { } } -test place-8.1 {PlaceStructureProc, mapping and unmapping content} -constraints failsOnUbuntu -setup { +test place-8.1 {PlaceStructureProc, mapping and unmapping content} -constraints {failsOnUbuntu failsOnXQuarz} -setup { place forget .t.f2 place forget .t.f } -body { @@ -285,7 +286,7 @@ test place-8.1 {PlaceStructureProc, mapping and unmapping content} -constraints placeUpdate lappend result [winfo ismapped .t.f2] } -result {1 0 40 30 0 1} -test place-8.2 {PlaceStructureProc, mapping and unmapping content} -constraints failsOnUbuntu -setup { +test place-8.2 {PlaceStructureProc, mapping and unmapping content} -constraints {failsOnUbuntu failsOnXQuarz} -setup { place forget .t.f2 place forget .t.f update idletasks diff --git a/tests/scrollbar.test b/tests/scrollbar.test index 4963cf8..62d15c8 100644 --- a/tests/scrollbar.test +++ b/tests/scrollbar.test @@ -12,6 +12,7 @@ eval tcltest::configure $argv tcltest::loadTestedCommands testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] proc scroll args { global scrollInfo @@ -272,13 +273,13 @@ test scrollbar-3.35 {ScrollbarWidgetCmd procedure, "fraction" option} { format {%.6g} [.s fraction 4 21] } [format %.6g [expr {(21.0 - ([winfo height .s] - [getTroughSize .s])/2.0) \ /([getTroughSize .s] - 1)}]] -test scrollbar-3.36 {ScrollbarWidgetCmd procedure, "fraction" option} {x11 failsOnUbuntu} { +test scrollbar-3.36 {ScrollbarWidgetCmd procedure, "fraction" option} {x11 failsOnUbuntu failsOnXQuarz} { format {%.6g} [.s fraction 4 179] } {1} test scrollbar-3.37 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics} { format {%.6g} [.s fraction 4 [expr {200 - [testmetrics cyvscroll .s]}]] } {1} -test scrollbar-3.38 {ScrollbarWidgetCmd procedure, "fraction" option} {x11 failsOnUbuntu} { +test scrollbar-3.38 {ScrollbarWidgetCmd procedure, "fraction" option} {x11 failsOnUbuntu failsOnXQuarz} { format {%.6g} [.s fraction 4 178] } {0.993711} test scrollbar-3.39 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics win} { @@ -493,7 +494,7 @@ test scrollbar-6.11.2 {ScrollbarPosition procedure} aqua { # macOS scrollbars have no arrows nowadays .s identify 8 4 } {trough1} -test scrollbar-6.12.1 {ScrollbarPosition procedure} {x11 failsOnUbuntu} { +test scrollbar-6.12.1 {ScrollbarPosition procedure} {x11 failsOnUbuntu failsOnXQuarz} { .s identify 8 19 } {arrow1} test scrollbar-6.12.2 {ScrollbarPosition procedure} aqua { @@ -551,7 +552,7 @@ test scrollbar-6.28 {ScrollbarPosition procedure} {testmetrics win} { .s identify [expr {[winfo width .s] / 2}] [expr {[winfo height .s] - [testmetrics cyvscroll .s] - 1}] } {trough2} -test scrollbar-6.29.1 {ScrollbarPosition procedure} {x11 failsOnUbuntu} { +test scrollbar-6.29.1 {ScrollbarPosition procedure} {x11 failsOnUbuntu failsOnXQuarz} { .s identify 8 180 } {arrow2} test scrollbar-6.29.2 {ScrollbarPosition procedure} aqua { @@ -575,7 +576,7 @@ test scrollbar-6.33 {ScrollbarPosition procedure} win { test scrollbar-6.34 {ScrollbarPosition procedure} unix { .s identify 4 100 } {trough2} -test scrollbar-6.35 {ScrollbarPosition procedure} {unix failsOnUbuntu} { +test scrollbar-6.35 {ScrollbarPosition procedure} {unix failsOnUbuntu failsOnXQuarz} { .s identify 18 100 } {trough2} test scrollbar-6.37 {ScrollbarPosition procedure} win { @@ -614,7 +615,7 @@ test scrollbar-6.43 {ScrollbarPosition procedure} {testmetrics win} { .t.s identify [expr {int(.4 / [.t.s delta 1 0]) + [testmetrics cxhscroll .t.s] - 1}] [expr {[winfo height .t.s] / 2}] } {slider} -test scrollbar-6.44 {ScrollbarPosition procedure} {unix failsOnUbuntu} { +test scrollbar-6.44 {ScrollbarPosition procedure} {unix failsOnUbuntu failsOnXQuarz} { .t.s identify 100 18 } {trough2} test scrollbar-6.46 {ScrollbarPosition procedure} win { diff --git a/tests/textDisp.test b/tests/textDisp.test index 39d50d0..f64dd88 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -12,6 +12,7 @@ tcltest::loadTestedCommands namespace import -force tcltest::test testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] # Platform specific procedure for updating the text widget. @@ -665,7 +666,7 @@ test textDisp-4.7 {UpdateDisplayInfo, filling in extra vertical space} { updateText set x } {8.0 {16.0 17.0 15.0 14.0 13.0 12.0 11.0 10.0 9.0 8.0} {8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0}} -test textDisp-4.8 {UpdateDisplayInfo, filling in extra vertical space} { +test textDisp-4.8 {UpdateDisplayInfo, filling in extra vertical space} failsOnXQuarz { .t delete 1.0 end .t insert end "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17" .t yview 16.0 @@ -728,7 +729,7 @@ test textDisp-4.13 {UpdateDisplayInfo, special handling for top/bottom lines} { updateText list $tk_textRelayout $tk_textRedraw } {{11.0 12.0 13.0} {4.0 10.0 11.0 12.0 13.0}} -test textDisp-4.14 {UpdateDisplayInfo, special handling for top/bottom lines} { +test textDisp-4.14 {UpdateDisplayInfo, special handling for top/bottom lines} failsOnXQuarz { .t tag remove x 1.0 end .t yview 1.0 updateText @@ -861,7 +862,7 @@ test textDisp-5.2 {DisplayDLine, line resizes during display} { } [list 30 30] .t configure -wrap char -test textDisp-6.1 {scrolling in DisplayText, scroll up} { +test textDisp-6.1 {scrolling in DisplayText, scroll up} failsOnXQuarz { .t delete 1.0 end .t insert 1.0 "Line 1" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { @@ -1149,7 +1150,7 @@ test textDisp-8.6 {TkTextChanged} { updateText list $tk_textRelayout $tk_textRedraw } {{1.0 1.20 1.40} {1.0 1.20 1.40}} -test textDisp-8.7 {TkTextChanged} { +test textDisp-8.7 {TkTextChanged} failsOnXQuarz { .t delete 1.0 end .t insert 1.0 "Line 1 is so long that it wraps around, two times" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { @@ -1171,7 +1172,7 @@ test textDisp-8.8 {TkTextChanged} { updateText list $tk_textRelayout $tk_textRedraw } {2.0 2.0} -test textDisp-8.9 {TkTextChanged} { +test textDisp-8.9 {TkTextChanged} failsOnXQuarz { .t delete 1.0 end .t insert 1.0 "Line 1 is so long that it wraps around, two times" foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} { @@ -1282,7 +1283,7 @@ test textDisp-9.4 {TkTextRedrawTag} failsOnUbuntu { updateText list $tk_textRelayout $tk_textRedraw } {{2.0 2.20} {2.0 2.20 eof}} -test textDisp-9.5 {TkTextRedrawTag} failsOnUbuntu { +test textDisp-9.5 {TkTextRedrawTag} {failsOnUbuntu failsOnXQuarz} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4" @@ -1444,7 +1445,7 @@ test textDisp-11.1 {TkTextSetYView} { updateText .t index @0,0 } {30.0} -test textDisp-11.2 {TkTextSetYView} { +test textDisp-11.2 {TkTextSetYView} failsOnXQuarz { .t yview 30.0 updateText .t yview 32.0 @@ -1458,7 +1459,7 @@ test textDisp-11.3 {TkTextSetYView} { updateText list [.t index @0,0] $tk_textRedraw } {28.0 {28.0 29.0}} -test textDisp-11.4 {TkTextSetYView} { +test textDisp-11.4 {TkTextSetYView} failsOnXQuarz { .t yview 30.0 updateText .t yview 31.4 @@ -1489,7 +1490,7 @@ test textDisp-11.7 {TkTextSetYView} { updateText list [.t index @0,0] $tk_textRedraw } {21.0 {21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0}} -test textDisp-11.8 {TkTextSetYView} { +test textDisp-11.8 {TkTextSetYView} failsOnXQuarz { .t yview 30.0 updateText set tk_textRedraw {} @@ -1497,7 +1498,7 @@ test textDisp-11.8 {TkTextSetYView} { updateText list [.t index @0,0] $tk_textRedraw } {32.0 {40.0 41.0}} -test textDisp-11.9 {TkTextSetYView} { +test textDisp-11.9 {TkTextSetYView} failsOnXQuarz { .t yview 30.0 updateText set tk_textRedraw {} @@ -1521,7 +1522,7 @@ test textDisp-11.11 {TkTextSetYView} { updateText list [.t index @0,0] $tk_textRedraw } {191.0 {191.0 192.0 193.0 194.0 195.0 196.0}} -test textDisp-11.12 {TkTextSetYView, wrapped line is off-screen} { +test textDisp-11.12 {TkTextSetYView, wrapped line is off-screen} failsOnXQuarz { .t insert 10.0 "Long line with enough text to wrap\n" .t yview 1.0 updateText @@ -2863,7 +2864,7 @@ test textDisp-19.16 {count -ypixels} { [.t count -ypixels 16.0 "16.0 displaylineend +1c"] \ [.t count -ypixels "16.0 +1 displaylines" "16.0 +4 displaylines +3c"] } [list [expr {260 + 20 * $fixedDiff}] [expr {260 + 20 * $fixedDiff}] $fixedHeight [expr {2*$fixedHeight}] $fixedHeight [expr {3*$fixedHeight}]] -test textDisp-19.17 {count -ypixels with indices in elided lines} failsOnUbuntu { +test textDisp-19.17 {count -ypixels with indices in elided lines} {failsOnUbuntu failsOnXQuarz} { .t configure -wrap none .t delete 1.0 end for {set i 1} {$i < 100} {incr i} { @@ -2890,7 +2891,7 @@ test textDisp-19.17 {count -ypixels with indices in elided lines} failsOnUbuntu .t yview 35.0 lappend res [.t count -ypixels 5.0 25.0] } [list [expr {4 * $fixedHeight}] [expr {3 * $fixedHeight}] 0 0 0 0 0 0 [expr {5 * $fixedHeight}] [expr {- 5 * $fixedHeight}] [expr {2 * $fixedHeight}] [expr {3 * $fixedHeight}] [expr {5 * $fixedHeight}]] -test textDisp-19.18 {count -ypixels with indices in elided lines} failsOnUbuntu { +test textDisp-19.18 {count -ypixels with indices in elided lines} {failsOnUbuntu failsOnXQuarz} { .t configure -wrap none .t delete 1.0 end for {set i 1} {$i < 100} {incr i} { @@ -3407,7 +3408,7 @@ test textDisp-24.24 {TkTextCharLayoutProc, justification and tabs} {textfonts} { .t tag add x 1.0 end list [.t bbox 1.0] [.t bbox 1.10] } [list [list 45 3 7 $fixedHeight] [list 94 3 7 $fixedHeight]] -test textDisp-24.25 {TkTextCharLayoutProc, justification and tabs} -constraints {textfonts} -setup { +test textDisp-24.25 {TkTextCharLayoutProc, justification and tabs} -constraints {textfonts failsOnXQuarz} -setup { text .tt -tabs {40 right} -wrap none -font $fixedFont pack .tt } -body { diff --git a/tests/unixEmbed.test b/tests/unixEmbed.test index 578075e..f859150 100644 --- a/tests/unixEmbed.test +++ b/tests/unixEmbed.test @@ -12,6 +12,7 @@ tcltest::loadTestedCommands namespace import -force tcltest::test testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] namespace eval ::_test_tmp {} @@ -990,7 +991,7 @@ test unixEmbed-7.1 {TkpRedirectKeyEvent procedure, forward keystroke} -constrain # TkpRedirectKeyEvent is not implemented in win or aqua. If someone # implements it they should change the constraints for this test. test unixEmbed-7.1a {TkpRedirectKeyEvent procedure, forward keystroke} -constraints { - unix notAqua + unix notAqua failsOnXQuarz } -setup { deleteWindows catch {interp delete child} @@ -1088,7 +1089,7 @@ test unixEmbed-7.2a {TkpRedirectKeyEvent procedure, don't forward keystroke widt } -result {{} {{key b}}} test unixEmbed-8.1 {TkpClaimFocus procedure} -constraints { - unix notAqua failsOnUbuntu + unix notAqua failsOnUbuntu failsOnXQuarz } -setup { deleteWindows } -body { @@ -1235,7 +1236,7 @@ test unixEmbed-9.2a {EmbedWindowDeleted procedure, check embeddedPtr} -constrain test unixEmbed-10.1 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -constraints { - unix failsOnUbuntu + unix failsOnUbuntu failsOnXQuarz } -setup { deleteWindows } -body { @@ -1251,7 +1252,7 @@ test unixEmbed-10.1 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -con deleteWindows } -result {150x80+0+0} test unixEmbed-10.2 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -constraints { - unix failsOnUbuntu + unix failsOnUbuntu failsOnXQuarz } -setup { deleteWindows } -body { diff --git a/tests/unixFont.test b/tests/unixFont.test index 86fb5bf..ee9eb02 100644 --- a/tests/unixFont.test +++ b/tests/unixFont.test @@ -18,6 +18,7 @@ tcltest::loadTestedCommands testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}] +testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] if {[tk windowingsystem] eq "x11"} { set xlsf [auto_execok xlsfonts] @@ -256,7 +257,7 @@ test unixfont-8.3 {AllocFont procedure: can't parse info from name} x11 { catch {unset fontArray} set result } {-family -overstrike -size -slant -underline -weight} -test unixfont-8.4 {AllocFont procedure: classify characters} {x11 failsOnUbuntu} { +test unixfont-8.4 {AllocFont procedure: classify characters} {x11 failsOnUbuntu failsOnXQuarz} { set x 0 incr x [font measure $courier "\u4000"] ;# 6 incr x [font measure $courier "\002"] ;# 4 @@ -267,7 +268,7 @@ test unixfont-8.4 {AllocFont procedure: classify characters} {x11 failsOnUbuntu} test unixfont-8.5 {AllocFont procedure: setup widths of normal chars} x11 { font metrics $courier -fixed } {1} -test unixfont-8.6 {AllocFont procedure: setup widths of special chars} {x11 failsOnUbuntu} { +test unixfont-8.6 {AllocFont procedure: setup widths of special chars} {x11 failsOnUbuntu failsOnXQuarz} { set x 0 incr x [font measure $courier "\001"] ;# 4 incr x [font measure $courier "\002"] ;# 4 @@ -295,7 +296,7 @@ test unixfont-8.11 {AllocFont procedure: XA_UNDERLINE_POSITION was 0} x11 { set x {} } {} -test unixfont-9.1 {GetControlCharSubst procedure: 2 chars subst} {x11 failsOnUbuntu} { +test unixfont-9.1 {GetControlCharSubst procedure: 2 chars subst} {x11 failsOnUbuntu failsOnXQuarz} { .b.c dchars $t 0 end .b.c insert $t 0 "0\a0" set x {} @@ -304,7 +305,7 @@ test unixfont-9.1 {GetControlCharSubst procedure: 2 chars subst} {x11 failsOnUbu lappend x [.b.c index $t @[expr $ax*2],0] lappend x [.b.c index $t @[expr $ax*3],0] } {0 1 1 2} -test unixfont-9.2 {GetControlCharSubst procedure: 4 chars subst} {x11 failsOnUbuntu} { +test unixfont-9.2 {GetControlCharSubst procedure: 4 chars subst} {x11 failsOnUbuntu failsOnXQuarz} { .b.c dchars $t 0 end .b.c insert $t 0 "0\0010" set x {} diff --git a/tests/unixWm.test b/tests/unixWm.test index bdca89b..47b65fd 100644 --- a/tests/unixWm.test +++ b/tests/unixWm.test @@ -14,6 +14,7 @@ tcltest::loadTestedCommands namespace import -force ::tk::test:loadTkCommand testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] proc sleep ms { global x @@ -1552,7 +1553,7 @@ test unixWm-44.6 {UpdateGeometryInfo procedure, negative height} unix { } {100 1} destroy .t toplevel .t -width 80 -height 60 -test unixWm-44.7 {UpdateGeometryInfo procedure, computing position} unix { +test unixWm-44.7 {UpdateGeometryInfo procedure, computing position} {unix failsOnXQuarz} { tkwait visibility .t wm overrideredirect .t 1 update @@ -1562,7 +1563,7 @@ test unixWm-44.7 {UpdateGeometryInfo procedure, computing position} unix { } [list 5 [expr [winfo screenheight .t] - 70]] destroy .t toplevel .t -width 80 -height 60 -test unixWm-44.8 {UpdateGeometryInfo procedure, computing position} unix { +test unixWm-44.8 {UpdateGeometryInfo procedure, computing position} {unix failsOnXQuarz} { tkwait visibility .t wm overrideredirect .t 1 update @@ -1612,7 +1613,7 @@ test unixWm-45.1 {UpdateSizeHints procedure, grid information} {unix testwrapper [expr [lindex $property 7]] [expr [lindex $property 8]] \ [expr [lindex $property 9]] [expr [lindex $property 10]] } {40 30 320 210 10 5} -test unixWm-45.2 {UpdateSizeHints procedure} {unix testwrapper failsOnUbuntu} { +test unixWm-45.2 {UpdateSizeHints procedure} {unix testwrapper failsOnUbuntu failsOnXQuarz} { destroy .t toplevel .t -width 80 -height 60 wm minsize .t 30 40 @@ -1640,7 +1641,7 @@ test unixWm-45.3 {UpdateSizeHints procedure, grid with menu} {testmenubar testwr [expr [lindex $property 7]] [expr [lindex $property 8]] \ [expr [lindex $property 9]] [expr [lindex $property 10]] } {60 40 53 320 233 10 5} -test unixWm-45.4 {UpdateSizeHints procedure, not resizable with menu} {testmenubar testwrapper failsOnUbuntu} { +test unixWm-45.4 {UpdateSizeHints procedure, not resizable with menu} {testmenubar testwrapper failsOnUbuntu failsOnXQuarz} { destroy .t toplevel .t -width 80 -height 60 frame .t.menu -height 23 -width 50 @@ -1794,7 +1795,7 @@ if {[tk windowingsystem] == "aqua"} { # Windows are assumed to have a border (invisible in Gnome 3). set result_50_1 {{} {} .t {} .t2 {} .t2 {} .t} } -test unixWm-50.1 {Tk_CoordsToWindow procedure, finding a toplevel, x-coords, title bar} {unix failsOnUbuntu} { +test unixWm-50.1 {Tk_CoordsToWindow procedure, finding a toplevel, x-coords, title bar} {unix failsOnUbuntu failsOnXQuarz} { update toplevel .t -width 300 -height 400 -bg green wm geom .t +100+100 @@ -2051,7 +2052,7 @@ test unixWm-51.6 {TkWmRestackToplevel procedure, window to be stacked isn't mapp wm geometry .t2 +0+0 winfo containing 100 100 } {.t} -test unixWm-51.7 {TkWmRestackToplevel procedure, other window isn't mapped} unix { +test unixWm-51.7 {TkWmRestackToplevel procedure, other window isn't mapped} {unix failsOnXQuarz} { foreach w {.t .t2 .t3} { destroy $w update diff --git a/tests/winfo.test b/tests/winfo.test index 51be80d..b50c70a 100644 --- a/tests/winfo.test +++ b/tests/winfo.test @@ -12,6 +12,7 @@ tcltest::configure {*}$argv tcltest::loadTestedCommands testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] # eatColors -- # Creates a toplevel window and allocates enough colors in it to @@ -322,7 +323,7 @@ test winfo-9.6 {"winfo viewable" command} -setup { } -cleanup { deleteWindows } -result {0 0} -test winfo-9.7 {"winfo viewable" command} -constraints failsOnUbuntu -setup { +test winfo-9.7 {"winfo viewable" command} -constraints {failsOnUbuntu failsOnXQuarz} -setup { deleteWindows } -body { frame .f1 -width 100 -height 100 -relief raised -bd 2 diff --git a/tests/wm.test b/tests/wm.test index 1bf56da..08c7943 100644 --- a/tests/wm.test +++ b/tests/wm.test @@ -28,6 +28,7 @@ proc stdWindow {} { } testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] # [raise] and [lower] may return before the window manager has completed the # operation. The raiseDelay procedure idles for a while to give the operation @@ -1527,7 +1528,7 @@ test wm-stackorder-5.1 {a menu is not a toplevel} -body { destroy .t } -result {.t .} test wm-stackorder-5.2 {A normal toplevel can't be raised above an \ - overrideredirect toplevel on unix} -constraints {x11 failsOnUbuntu} -body { + overrideredirect toplevel on unix} -constraints {x11 failsOnUbuntu failsOnXQuarz} -body { toplevel .t tkwait visibility .t wm overrideredirect .t 1 @@ -1551,7 +1552,7 @@ test wm-stackorder-5.2.1 {A normal toplevel can be raised above an \ destroy .t } -result 1 test wm-stackorder-5.3 {An overrideredirect window\ - can be explicitly lowered} -body { + can be explicitly lowered} -constraints failsOnXQuarz -body { toplevel .t tkwait visibility .t wm overrideredirect .t 1 @@ -1726,7 +1727,7 @@ test wm-transient-3.3 {withdraw/deiconify on the toplevel } -result {withdrawn 0 normal 1} test wm-transient-4.1 {transient toplevel is withdrawn - when mapped if toplevel is iconic} -constraints failsOnUbuntu -body { + when mapped if toplevel is iconic} -constraints {failsOnUbuntu failsOnXQuarz} -body { toplevel .top wm iconify .top update @@ -1928,7 +1929,7 @@ test wm-transient-7.5 {Reassign transient, destroy transient} -body { deleteWindows } -test wm-transient-8.1 {transient to withdrawn window, Bug 1163496} -constraints failsOnUbuntu -setup { +test wm-transient-8.1 {transient to withdrawn window, Bug 1163496} -constraints {failsOnUbuntu failsOnXQuarz} -setup { deleteWindows set result {} } -body { -- cgit v0.12 From b65c340a10683ce423ea0d8c63b1c2af9065757f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 8 Oct 2020 16:55:40 +0000 Subject: A few NULL <-> None mistakes, more usage of TCL_UNUSED and implicit type-casts --- unix/tkUnixFont.c | 83 ++++++++++++++++++++++++++---------------------------- unix/tkUnixRFont.c | 20 ++++++------- 2 files changed, 50 insertions(+), 53 deletions(-) diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index 234b282..bd83a5e 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.c @@ -17,8 +17,8 @@ * The preferred font encodings. */ -static const char *const encodingList[] = { - "iso8859-1", "jis0208", "jis0212", NULL +static const char encodingList[][10] = { + "iso8859-1", "jis0208", "jis0212" }; /* @@ -193,7 +193,7 @@ static const EncodingAlias encodingAliases[] = { * Functions used only in this file. */ -static void FontPkgCleanup(ClientData clientData); +static void FontPkgCleanup(void *clientData); static FontFamily * AllocFontFamily(Display *display, XFontStruct *fontStructPtr, int base); static SubFont * CanUseFallback(UnixFont *fontPtr, @@ -203,7 +203,7 @@ static SubFont * CanUseFallbackWithAliases(UnixFont *fontPtr, const char *fallbackName, int ch, Tcl_DString *nameTriedPtr, SubFont **fixSubFontPtrPtr); -static int ControlUtfProc(ClientData clientData, const char *src, +static int ControlUtfProc(void *clientData, const char *src, int srcLen, int flags, Tcl_EncodingState*statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); @@ -238,11 +238,11 @@ static unsigned RankAttributes(FontAttributes *wantPtr, static void ReleaseFont(UnixFont *fontPtr); static void ReleaseSubFont(Display *display, SubFont *subFontPtr); static int SeenName(const char *name, Tcl_DString *dsPtr); -static int Ucs2beToUtfProc(ClientData clientData, const char*src, +static int Ucs2beToUtfProc(void *clientData, const char*src, int srcLen, int flags, Tcl_EncodingState*statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); -static int UtfToUcs2beProc(ClientData clientData, const char*src, +static int UtfToUcs2beProc(void *clientData, const char*src, int srcLen, int flags, Tcl_EncodingState*statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); @@ -267,9 +267,9 @@ static int UtfToUcs2beProc(ClientData clientData, const char*src, static void FontPkgCleanup( - ClientData clientData) + TCL_UNUSED(void *)) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->controlFamily.encoding != NULL) { @@ -306,9 +306,9 @@ FontPkgCleanup( void TkpFontPkgInit( - TkMainInfo *mainPtr) /* The application being created. */ + TCL_UNUSED(TkMainInfo *)) /* The application being created. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); SubFont dummy; int i; @@ -362,11 +362,11 @@ TkpFontPkgInit( static int ControlUtfProc( - ClientData clientData, /* Not used. */ + TCL_UNUSED(void *), /* Not used. */ const char *src, /* Source string in UTF-8. */ int srcLen, /* Source string length in bytes. */ - int flags, /* Conversion control flags. */ - Tcl_EncodingState *statePtr,/* Place for conversion routine to store state + TCL_UNUSED(int), /* Conversion control flags. */ + TCL_UNUSED(Tcl_EncodingState *),/* Place for conversion routine to store state * information used during a piecewise * conversion. Contents of statePtr are * initialized and/or reset by conversion @@ -390,8 +390,8 @@ ControlUtfProc( const char *srcStart, *srcEnd; char *dstStart, *dstEnd; int ch, result; - static char hexChars[] = "0123456789abcdef"; - static char mapChars[] = { + static const char hexChars[] = "0123456789abcdef"; + static const char mapChars[] = { 0, 0, 0, 0, 0, 0, 0, 'a', 'b', 't', 'n', 'v', 'f', 'r' }; @@ -460,11 +460,11 @@ ControlUtfProc( static int Ucs2beToUtfProc( - ClientData clientData, /* Not used. */ + TCL_UNUSED(void *), /* Not used. */ const char *src, /* Source string in Unicode. */ int srcLen, /* Source string length in bytes. */ int flags, /* Conversion control flags. */ - Tcl_EncodingState *statePtr,/* Place for conversion routine to store state + TCL_UNUSED(Tcl_EncodingState *),/* Place for conversion routine to store state * information used during a piecewise * conversion. Contents of statePtr are * initialized and/or reset by conversion @@ -556,12 +556,12 @@ Ucs2beToUtfProc( static int UtfToUcs2beProc( - ClientData clientData, /* TableEncodingData that specifies + TCL_UNUSED(void *), /* TableEncodingData that specifies * encoding. */ const char *src, /* Source string in UTF-8. */ int srcLen, /* Source string length in bytes. */ int flags, /* Conversion control flags. */ - Tcl_EncodingState *statePtr,/* Place for conversion routine to store state + TCL_UNUSED(Tcl_EncodingState *),/* Place for conversion routine to store state * information used during a piecewise * conversion. Contents of statePtr are * initialized and/or reset by conversion @@ -705,7 +705,7 @@ TkpGetNativeFont( if (name[0] == '-') { if (name[1] != '*') { - char *dash; + const char *dash; dash = strchr(name + 1, '-'); if ((dash == NULL) || (isspace(UCHAR(dash[-1])))) { @@ -720,7 +720,7 @@ TkpGetNativeFont( } fontStructPtr = CreateClosestFont(tkwin, &fa.fa, &fa.xa); } - fontPtr = ckalloc(sizeof(UnixFont)); + fontPtr = (UnixFont *)ckalloc(sizeof(UnixFont)); InitFont(tkwin, fontStructPtr, fontPtr); return (TkFont *) fontPtr; @@ -776,7 +776,7 @@ TkpGetFontFromAttributes( fontPtr = (UnixFont *) tkFontPtr; if (fontPtr == NULL) { - fontPtr = ckalloc(sizeof(UnixFont)); + fontPtr = (UnixFont *)ckalloc(sizeof(UnixFont)); } else { ReleaseFont(fontPtr); } @@ -839,7 +839,7 @@ TkpGetFontFamilies( Tcl_Interp *interp, /* Interp to hold result. */ Tk_Window tkwin) /* For display to query. */ { - int i, new, numNames; + int i, isNew, numNames; char *family, **nameList; Tcl_HashTable familyTable; Tcl_HashEntry *hPtr; @@ -868,14 +868,14 @@ TkpGetFontFamilies( continue; /* See comment above. */ } *familyEnd = '\0'; - Tcl_CreateHashEntry(&familyTable, family, &new); + Tcl_CreateHashEntry(&familyTable, family, &isNew); } XFreeFontNames(nameList); hPtr = Tcl_FirstHashEntry(&familyTable, &search); resultPtr = Tcl_NewObj(); while (hPtr != NULL) { - strPtr = Tcl_NewStringObj(Tcl_GetHashKey(&familyTable, hPtr), -1); + strPtr = Tcl_NewStringObj((const char *)Tcl_GetHashKey(&familyTable, hPtr), -1); Tcl_ListObjAppendElement(NULL, resultPtr, strPtr); hPtr = Tcl_NextHashEntry(&search); } @@ -1203,7 +1203,7 @@ TkpMeasureCharsInContext( Tk_Font tkfont, /* Font in which characters will be drawn. */ const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. */ - int numBytes, /* Maximum number of bytes to consider from + TCL_UNUSED(int), /* Maximum number of bytes to consider from * source string in all. */ int rangeStart, /* Index of first byte to measure. */ int rangeLength, /* Length of range to measure in bytes. */ @@ -1225,7 +1225,6 @@ TkpMeasureCharsInContext( int *lengthPtr) /* Filled with x-location just after the * terminating character. */ { - (void) numBytes; /*unused*/ return Tk_MeasureChars(tkfont, source + rangeStart, rangeLength, maxLength, flags, lengthPtr); } @@ -1400,7 +1399,7 @@ TkpDrawCharsInContext( * is passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ - int numBytes, /* Number of bytes in string. */ + TCL_UNUSED(int), /* Number of bytes in string. */ int rangeStart, /* Index of first byte to draw. */ int rangeLength, /* Length of range to draw in bytes. */ int x, int y) /* Coordinates at which to place origin of the @@ -1409,8 +1408,6 @@ TkpDrawCharsInContext( { int widthUntilStart; - (void) numBytes; /*unused*/ - Tk_MeasureChars(tkfont, source, rangeStart, -1, 0, &widthUntilStart); Tk_DrawChars(display, drawable, gc, tkfont, source + rangeStart, rangeLength, x+widthUntilStart, y); @@ -1610,7 +1607,7 @@ InitFont( UnixFont *fontPtr) /* Filled with information constructed from * the above arguments. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); unsigned long value; int minHi, maxHi, minLo, maxLo, fixed, width, limit, i, n; @@ -1716,7 +1713,7 @@ InitFont( * 1/3 the width of a capital I. */ - fontPtr->barHeight = fontPtr->widths['I'] / 3; + fontPtr->barHeight = fontPtr->widths[(unsigned char)'I'] / 3; if (fontPtr->barHeight == 0) { fontPtr->barHeight = 1; } @@ -1857,13 +1854,13 @@ AllocFontFamily( Display *display, /* Display in which font will be used. */ XFontStruct *fontStructPtr, /* Screen font whose FontFamily is to be * returned. */ - int base) /* Non-zero if this font family is to be used + TCL_UNUSED(int)) /* Non-zero if this font family is to be used * in the base font of a font object. */ { FontFamily *familyPtr; FontAttributes fa; Tcl_Encoding encoding; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); GetFontAttributes(display, fontStructPtr, &fa); @@ -1882,7 +1879,7 @@ AllocFontFamily( } } - familyPtr = ckalloc(sizeof(FontFamily)); + familyPtr = (FontFamily *)ckalloc(sizeof(FontFamily)); memset(familyPtr, 0, sizeof(FontFamily)); familyPtr->nextPtr = tsdPtr->fontFamilyList; tsdPtr->fontFamilyList = familyPtr; @@ -1939,7 +1936,7 @@ FreeFontFamily( FontFamily *familyPtr) /* The FontFamily to delete. */ { FontFamily **familyPtrPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); int i; @@ -2252,10 +2249,10 @@ FontMapLoadPage( Tcl_Encoding encoding; XFontStruct *fontStructPtr; XCharStruct *widths; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); - subFontPtr->fontMap[row] = ckalloc(FONTMAP_BITSPERPAGE / 8); + subFontPtr->fontMap[row] = (char *)ckalloc(FONTMAP_BITSPERPAGE / 8); memset(subFontPtr->fontMap[row], 0, FONTMAP_BITSPERPAGE / 8); if (subFontPtr->familyPtr == &tsdPtr->controlFamily) { @@ -2493,7 +2490,7 @@ CanUseFallback( numEncodings = 0; Tcl_DStringInit(&dsEncodings); - charset = NULL; /* lint, since numNames must be > 0 to get here. */ + charset = NULL; /* numNames must be > 0 to get here. */ retry: bestIdx[0] = -1; @@ -2587,7 +2584,7 @@ CanUseFallback( * make a copy. */ - nameList = ckalloc(numNames * sizeof(char *)); + nameList = (char **)ckalloc(numNames * sizeof(char *)); memcpy(nameList, nameListOrig, numNames * sizeof(char *)); } nameList[nameIdx] = NULL; @@ -2632,7 +2629,7 @@ CanUseFallback( if (fontPtr->numSubFonts >= SUBFONT_SPACE) { SubFont *newPtr; - newPtr = ckalloc(sizeof(SubFont) * (fontPtr->numSubFonts + 1)); + newPtr = (SubFont *)ckalloc(sizeof(SubFont) * (fontPtr->numSubFonts + 1)); memcpy(newPtr, fontPtr->subFontArray, fontPtr->numSubFonts * sizeof(SubFont)); if (fixSubFontPtrPtr != NULL) { @@ -2722,7 +2719,7 @@ RankAttributes( penalty += diff; } if (gotPtr->xa.charset != wantPtr->xa.charset) { - int i; + size_t i; const char *gotAlias, *wantAlias; penalty += 65000; @@ -2730,7 +2727,7 @@ RankAttributes( wantAlias = GetEncodingAlias(wantPtr->xa.charset); if (strcmp(gotAlias, wantAlias) != 0) { penalty += 30000; - for (i = 0; encodingList[i] != NULL; i++) { + for (i = 0; i < sizeof(encodingList)/sizeof(encodingList[0]); i++) { if (strcmp(gotAlias, encodingList[i]) == 0) { penalty -= 30000; break; diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index cac6f8e..f57eaa5 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -262,9 +262,9 @@ FinishedWithFont( static int InitFontErrorProc( ClientData clientData, - XErrorEvent *errorPtr) + TCL_UNUSED(XErrorEvent *)) { - int *errorFlagPtr = (int *) clientData; + int *errorFlagPtr = (int *)clientData; if (errorFlagPtr != NULL) { *errorFlagPtr = 1; @@ -286,7 +286,7 @@ InitFont( Tk_ErrorHandler handler; if (!fontPtr) { - fontPtr = ckalloc(sizeof(UnixFtFont)); + fontPtr = (UnixFtFont *)ckalloc(sizeof(UnixFtFont)); } FcConfigSubstitute(0, pattern, FcMatchPattern); @@ -304,7 +304,7 @@ InitFont( fontPtr->fontset = set; fontPtr->pattern = pattern; - fontPtr->faces = ckalloc(set->nfont * sizeof(UnixFtFace)); + fontPtr->faces = (UnixFtFace *)ckalloc(set->nfont * sizeof(UnixFtFace)); fontPtr->nfaces = set->nfont; /* @@ -666,7 +666,7 @@ TkpGetSubFonts( void TkpGetFontAttrsForChar( - Tk_Window tkwin, /* Window on the font's display */ + TCL_UNUSED(Tk_Window), /* Window on the font's display */ Tk_Font tkfont, /* Font to query */ int c, /* Character of interest */ TkFontAttributes *faPtr) /* Output: Font attributes */ @@ -945,7 +945,7 @@ Tk_DrawChars( } XGetGCValues(display, gc, GCForeground, &values); xftcolor = LookUpColor(display, fontPtr, values.foreground); - if (tsdPtr->clipRegion != None) { + if (tsdPtr->clipRegion != NULL) { XftDrawSetClip(fontPtr->ftDraw, tsdPtr->clipRegion); } nspec = 0; @@ -995,7 +995,7 @@ Tk_DrawChars( } doUnderlineStrikeout: - if (tsdPtr->clipRegion != None) { + if (tsdPtr->clipRegion != NULL) { XftDrawSetClip(fontPtr->ftDraw, NULL); } if (fontPtr->font.fa.underline != 0) { @@ -1087,7 +1087,7 @@ TkDrawAngledChars( nglyph = 0; currentFtFont = NULL; - originX = originY = 0; /* lint */ + originX = originY = 0; while (numBytes > 0) { XftFont *ftFont; @@ -1189,7 +1189,7 @@ TkDrawAngledChars( } XGetGCValues(display, gc, GCForeground, &values); xftcolor = LookUpColor(display, fontPtr, values.foreground); - if (tsdPtr->clipRegion != None) { + if (tsdPtr->clipRegion != NULL) { XftDrawSetClip(fontPtr->ftDraw, tsdPtr->clipRegion); } nspec = 0; @@ -1241,7 +1241,7 @@ TkDrawAngledChars( #endif /* XFT_HAS_FIXED_ROTATED_PLACEMENT */ doUnderlineStrikeout: - if (tsdPtr->clipRegion != None) { + if (tsdPtr->clipRegion != NULL) { XftDrawSetClip(fontPtr->ftDraw, NULL); } if (fontPtr->font.fa.underline || fontPtr->font.fa.overstrike) { -- cgit v0.12 From 5bdd278d66f4ea89994c76013f0e52f7662f1cc4 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 8 Oct 2020 19:24:28 +0000 Subject: Some more -Wundef warnings --- unix/tkUnixRFont.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index e10d320..41ba938 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -208,7 +208,7 @@ GetTkFontAttributes( slant = XFT_SLANT_ROMAN; } -#if DEBUG_FONTSEL +#ifdef DEBUG_FONTSEL printf("family %s size %d weight %d slant %d\n", family, (int)size, weight, slant); #endif /* DEBUG_FONTSEL */ @@ -453,7 +453,7 @@ TkpGetNativeFont( { UnixFtFont *fontPtr; FcPattern *pattern; -#if DEBUG_FONTSEL +#ifdef DEBUG_FONTSEL printf("TkpGetNativeFont %s\n", name); #endif /* DEBUG_FONTSEL */ @@ -491,7 +491,7 @@ TkpGetFontFromAttributes( int weight, slant; UnixFtFont *fontPtr; -#if DEBUG_FONTSEL +#ifdef DEBUG_FONTSEL printf("TkpGetFontFromAttributes %s-%d %d %d\n", faPtr->family, faPtr->size, faPtr->weight, faPtr->slant); #endif /* DEBUG_FONTSEL */ @@ -718,7 +718,7 @@ Tk_MeasureChars( int clen, curX, newX, curByte, newByte, sawNonSpace; int termByte = 0, termX = 0, errorFlag = 0; Tk_ErrorHandler handler; -#if DEBUG_FONTSEL +#ifdef DEBUG_FONTSEL char string[256]; int len = 0; #endif /* DEBUG_FONTSEL */ @@ -755,7 +755,7 @@ Tk_MeasureChars( sawNonSpace = 1; } -#if DEBUG_FONTSEL +#ifdef DEBUG_FONTSEL string[len++] = (char) c; #endif /* DEBUG_FONTSEL */ ftFont = GetFont(fontPtr, c, 0.0); @@ -795,7 +795,7 @@ Tk_MeasureChars( curByte = newByte; } Tk_DeleteErrorHandler(handler); -#if DEBUG_FONTSEL +#ifdef DEBUG_FONTSEL string[len] = '\0'; printf("MeasureChars %s length %d bytes %d\n", string, curX, curByte); #endif /* DEBUG_FONTSEL */ @@ -935,7 +935,7 @@ Tk_DrawChars( Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (fontPtr->ftDraw == 0) { -#if DEBUG_FONTSEL +#ifdef DEBUG_FONTSEL printf("Switch to drawable 0x%x\n", drawable); #endif /* DEBUG_FONTSEL */ fontPtr->ftDraw = XftDrawCreate(display, drawable, @@ -1070,7 +1070,7 @@ TkDrawAngledChars( int originX, originY; if (fontPtr->ftDraw == 0) { -#if DEBUG_FONTSEL +#ifdef DEBUG_FONTSEL printf("Switch to drawable 0x%x\n", drawable); #endif /* DEBUG_FONTSEL */ fontPtr->ftDraw = XftDrawCreate(display, drawable, @@ -1179,7 +1179,7 @@ TkDrawAngledChars( double sinA = sin(angle * PI/180.0), cosA = cos(angle * PI/180.0); if (fontPtr->ftDraw == 0) { -#if DEBUG_FONTSEL +#ifdef DEBUG_FONTSEL printf("Switch to drawable 0x%x\n", drawable); #endif /* DEBUG_FONTSEL */ fontPtr->ftDraw = XftDrawCreate(display, drawable, -- cgit v0.12