From e1bfe977169f9b112ee0a0093eafa78f788629b5 Mon Sep 17 00:00:00 2001 From: culler Date: Mon, 9 Nov 2020 13:32:29 +0000 Subject: Fix [f9fa926666] on macOS only: crash when creating a label whose text is a single emoji. --- generic/tkGet.c | 5 +++ macosx/tkMacOSXColor.c | 94 ++------------------------------------------------ xlib/xgc.c | 32 +---------------- 3 files changed, 9 insertions(+), 122 deletions(-) diff --git a/generic/tkGet.c b/generic/tkGet.c index f2aed2c..989584e 100644 --- a/generic/tkGet.c +++ b/generic/tkGet.c @@ -694,6 +694,11 @@ TkGetDoublePixels( char *end; double d; + if (!tkwin) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad screen")); + Tcl_SetErrorCode(interp, "TK", "VALUE", "FRACTIONAL_PIXELS", NULL); + return TCL_ERROR; + } d = strtod((char *) string, &end); if (end == string) { goto error; diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index 5f549b1..d3c76e5 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -485,89 +485,6 @@ TkSetMacColor( /* *---------------------------------------------------------------------- * - * TkpInitGCCache, TkpFreeGCCache, CopyCachedColor, SetCachedColor -- - * - * Maintain a per-GC cache of previously converted CGColorRefs - * - * Results: - * None resp. retained CGColorRef for CopyCachedColor() - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -void -TkpInitGCCache( - GC gc) -{ - bzero(TkpGetGCCache(gc), sizeof(TkpGCCache)); -} - -void -TkpFreeGCCache( - GC gc) -{ - TkpGCCache *gcCache = TkpGetGCCache(gc); - - if (gcCache->cachedForegroundColor) { - CFRelease(gcCache->cachedForegroundColor); - } - if (gcCache->cachedBackgroundColor) { - CFRelease(gcCache->cachedBackgroundColor); - } -} - -static CGColorRef -CopyCachedColor( - GC gc, - unsigned long pixel) -{ - TkpGCCache *gcCache = TkpGetGCCache(gc); - CGColorRef cgColor = NULL; - - if (gcCache) { - if (gcCache->cachedForeground == pixel) { - cgColor = gcCache->cachedForegroundColor; - } else if (gcCache->cachedBackground == pixel) { - cgColor = gcCache->cachedBackgroundColor; - } - if (cgColor) { - CFRetain(cgColor); - } - } - return cgColor; -} - -static void -SetCachedColor( - GC gc, - unsigned long pixel, - CGColorRef cgColor) -{ - TkpGCCache *gcCache = TkpGetGCCache(gc); - - if (gcCache && cgColor) { - if (gc->foreground == pixel) { - if (gcCache->cachedForegroundColor) { - CFRelease(gcCache->cachedForegroundColor); - } - gcCache->cachedForegroundColor = (CGColorRef) CFRetain(cgColor); - gcCache->cachedForeground = pixel; - } else if (gc->background == pixel) { - if (gcCache->cachedBackgroundColor) { - CFRelease(gcCache->cachedBackgroundColor); - } - gcCache->cachedBackgroundColor = (CGColorRef) CFRetain(cgColor); - gcCache->cachedBackground = pixel; - } - } -} - -/* - *---------------------------------------------------------------------- - * * TkMacOSXCreateCGColor -- * * Creates a CGColorRef from a X style pixel value. @@ -586,11 +503,8 @@ TkMacOSXCreateCGColor( GC gc, unsigned long pixel) /* Pixel value to convert. */ { - CGColorRef cgColor = CopyCachedColor(gc, pixel); - - if (!cgColor && TkSetMacColor(pixel, &cgColor)) { - SetCachedColor(gc, pixel, cgColor); - } + CGColorRef cgColor; + TkSetMacColor(pixel, &cgColor); return cgColor; } @@ -683,9 +597,7 @@ TkMacOSXSetColorInContext( context, kHIThemeOrientationNormal); break; default: - if (SetCGColorComponents(entry, pixel, &cgColor)){ - SetCachedColor(gc, pixel, cgColor); - } + SetCGColorComponents(entry, pixel, &cgColor); break; } } diff --git a/xlib/xgc.c b/xlib/xgc.c index c0dbe84..56753c3 100644 --- a/xlib/xgc.c +++ b/xlib/xgc.c @@ -16,9 +16,6 @@ #if !defined(MAC_OSX_TK) # include -# define TkpInitGCCache(gc) -# define TkpFreeGCCache(gc) -# define TkpGetGCCache(gc) #else # include # include @@ -33,10 +30,7 @@ typedef struct { XGCValues gc; char dash[MAX_DASH_LIST_SIZE]; -#ifdef MAC_OSX_TK - TkpGCCache cache; -#endif -} XGCValuesWithCache; +} XGCValuesWithDash; /* *---------------------------------------------------------------------- @@ -161,32 +155,9 @@ XCreateGC( clip_mask->type = TKP_CLIP_PIXMAP; clip_mask->value.pixmap = values->clip_mask; } - TkpInitGCCache(gp); - return gp; } -#ifdef MAC_OSX_TK -/* - *---------------------------------------------------------------------- - * - * TkpGetGCCache -- - * - * Results: - * Pointer to the TkpGCCache at the end of the GC. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -TkpGCCache* -TkpGetGCCache(GC gc) { - return (gc ? &((XGCValuesWithCache *)gc)->cache : NULL); -} -#endif - /* *---------------------------------------------------------------------- * @@ -268,7 +239,6 @@ int XFreeGC( if (gc != NULL) { FreeClipMask(gc); - TkpFreeGCCache(gc); ckfree(gc); } return Success; -- cgit v0.12 From 167c8ef54e27e04346e18429ebc4688b954bf3ee Mon Sep 17 00:00:00 2001 From: marc_culler Date: Mon, 9 Nov 2020 14:47:48 +0000 Subject: Correct one name replacement that accidentally was omitted. --- xlib/xgc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xlib/xgc.c b/xlib/xgc.c index 56753c3..fd1083b 100644 --- a/xlib/xgc.c +++ b/xlib/xgc.c @@ -114,7 +114,7 @@ XCreateGC( * initialization. */ - gp = (GC)ckalloc(sizeof(XGCValuesWithCache)); + gp = (GC)ckalloc(sizeof(XGCValuesWithDash)); if (!gp) { return NULL; } -- cgit v0.12 From 4621757eccd06843ee0a0b7b6d35f0e673ac6f25 Mon Sep 17 00:00:00 2001 From: marc_culler Date: Mon, 9 Nov 2020 16:06:51 +0000 Subject: Remove some more unneeded code. --- macosx/tkMacOSXColor.c | 52 ++++++++++-------------------------------------- macosx/tkMacOSXFont.c | 3 +-- macosx/tkMacOSXPrivate.h | 1 - 3 files changed, 11 insertions(+), 45 deletions(-) diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index d3c76e5..82fc572 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -282,6 +282,7 @@ GetRGBA( if (!sRGB) { sRGB = [NSColorSpace sRGBColorSpace]; } + switch (entry->type) { case rgbColor: rgba[0] = ((pixel >> 16) & 0xff) / 255.0; @@ -455,22 +456,21 @@ TkMacOSXInDarkMode(Tk_Window tkwin) * Sets the components of a CGColorRef from an XColor pixel value. The * pixel value is used to look up the color in the system color table, and * then SetCGColorComponents is called with the table entry and the pixel - * value. + * value. The parameter macColor should be a pointer to a CGColorRef. * * Results: * Returns false if the color is not found, true otherwise. * * Side effects: - * The variable macColor is set to a new CGColorRef, the caller is - * responsible for releasing it! + * The CGColorRef referenced by the variable macColor may be modified. * *---------------------------------------------------------------------- */ int TkSetMacColor( - unsigned long pixel, /* Pixel value to convert. */ - void *macColor) /* CGColorRef to modify. */ + unsigned long pixel, /* Pixel value to convert. */ + void *macColor) /* CGColorRef to modify. */ { CGColorRef *color = (CGColorRef*)macColor; SystemColorDatum *entry = GetEntryFromPixel(pixel); @@ -485,32 +485,6 @@ TkSetMacColor( /* *---------------------------------------------------------------------- * - * TkMacOSXCreateCGColor -- - * - * Creates a CGColorRef from a X style pixel value. - * - * Results: - * Returns NULL if not a real pixel, CGColorRef otherwise. - * - * Side effects: - * None - * - *---------------------------------------------------------------------- - */ - -CGColorRef -TkMacOSXCreateCGColor( - GC gc, - unsigned long pixel) /* Pixel value to convert. */ -{ - CGColorRef cgColor; - TkSetMacColor(pixel, &cgColor); - return cgColor; -} - -/* - *---------------------------------------------------------------------- - * * TkMacOSXGetNSColor -- * * Creates an autoreleased NSColor from a X style pixel value. @@ -530,19 +504,13 @@ TkMacOSXGetNSColor( GC gc, unsigned long pixel) /* Pixel value to convert. */ { - CGColorRef cgColor = TkMacOSXCreateCGColor(gc, pixel); + CGColorRef cgColor; NSColor *nsColor = nil; - if (cgColor) { - NSColorSpace *colorSpace = [[NSColorSpace alloc] - initWithCGColorSpace:CGColorGetColorSpace(cgColor)]; - - nsColor = [NSColor colorWithColorSpace:colorSpace - components:CGColorGetComponents(cgColor) - count:CGColorGetNumberOfComponents(cgColor)]; - [colorSpace release]; - CFRelease(cgColor); - } + TkSetMacColor(pixel, &cgColor); + nsColor = [NSColor colorWithColorSpace:sRGB + components:CGColorGetComponents(cgColor) + count:CGColorGetNumberOfComponents(cgColor)]; return nsColor; } diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c index 34dc8c2..37d4eab 100644 --- a/macosx/tkMacOSXFont.c +++ b/macosx/tkMacOSXFont.c @@ -1208,10 +1208,9 @@ TkpDrawAngledCharsInContext( } context = drawingContext.context; - fg = TkMacOSXCreateCGColor(gc, gc->foreground); + TkSetMacColor(gc->foreground, &fg); attributes = [fontPtr->nsAttributes mutableCopy]; [attributes setObject:(id)fg forKey:(id)kCTForegroundColorAttributeName]; - CFRelease(fg); nsFont = [attributes objectForKey:NSFontAttributeName]; [nsFont setInContext:GET_NSCONTEXT(context, NO)]; CGContextSetTextMatrix(context, CGAffineTransformIdentity); diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index 9617712..8e57641 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -269,7 +269,6 @@ MODULE_SCOPE NSImage* TkMacOSXGetNSImageFromTkImage(Display *display, Tk_Image image, int width, int height); MODULE_SCOPE NSImage* TkMacOSXGetNSImageFromBitmap(Display *display, Pixmap bitmap, GC gc, int width, int height); -MODULE_SCOPE CGColorRef TkMacOSXCreateCGColor(GC gc, unsigned long pixel); MODULE_SCOPE NSColor* TkMacOSXGetNSColor(GC gc, unsigned long pixel); MODULE_SCOPE NSFont* TkMacOSXNSFontForFont(Tk_Font tkfont); MODULE_SCOPE NSDictionary* TkMacOSXNSFontAttributesForFont(Tk_Font tkfont); -- cgit v0.12 From 060a521ec9c5662b438ce1e23f69e5bf5d68fe4a Mon Sep 17 00:00:00 2001 From: marc_culler Date: Mon, 9 Nov 2020 16:56:14 +0000 Subject: Finish removing GCCache and remove some more platform specific code in xgc.c --- macosx/tkMacOSXInt.h | 15 --------------- xlib/xgc.c | 9 ++------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/macosx/tkMacOSXInt.h b/macosx/tkMacOSXInt.h index 278fcac..61771a0 100644 --- a/macosx/tkMacOSXInt.h +++ b/macosx/tkMacOSXInt.h @@ -117,21 +117,6 @@ typedef struct { MODULE_SCOPE TkMacOSXEmbedHandler *tkMacOSXEmbedHandler; /* - * GC CGColorRef cache for tkMacOSXColor.c - */ - -typedef struct { - unsigned long cachedForeground; - CGColorRef cachedForegroundColor; - unsigned long cachedBackground; - CGColorRef cachedBackgroundColor; -} TkpGCCache; - -MODULE_SCOPE TkpGCCache *TkpGetGCCache(GC gc); -MODULE_SCOPE void TkpInitGCCache(GC gc); -MODULE_SCOPE void TkpFreeGCCache(GC gc); - -/* * Undef compatibility platform types defined above. */ diff --git a/xlib/xgc.c b/xlib/xgc.c index fd1083b..043e322 100644 --- a/xlib/xgc.c +++ b/xlib/xgc.c @@ -13,13 +13,8 @@ */ #include "tkInt.h" - -#if !defined(MAC_OSX_TK) -# include -#else -# include -# include -# include +#include +#if defined(MAC_OSX_TK) # define Cursor XCursor # define Region XRegion #endif -- cgit v0.12 From e63244bd811de08cb2d0214c7d36edd9a6a92103 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 12 Nov 2020 10:32:53 +0000 Subject: Fix "make install" on cygwin, broken due to implib name change (see: [https://core.tcl-lang.org/tcl/info/fe52ae7a4d41e60b]) --- unix/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index 86ea005..d0804fb 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -749,7 +749,7 @@ install-binaries: $(TK_STUB_LIB_FILE) $(TK_LIB_FILE) ${WISH_EXE} @if test -f "tk${MAJOR_VERSION}${MINOR_VERSION}.dll"; then \ $(INSTALL_LIBRARY) "tk${MAJOR_VERSION}${MINOR_VERSION}.dll" "$(DLL_INSTALL_DIR)";\ chmod 555 "$(DLL_INSTALL_DIR)/tk${MAJOR_VERSION}${MINOR_VERSION}.dll";\ - $(INSTALL_LIBRARY) "../win/libtk${MAJOR_VERSION}${MINOR_VERSION}.a" "$(LIB_INSTALL_DIR)";\ + $(INSTALL_LIBRARY) "../win/libtk${MAJOR_VERSION}${MINOR_VERSION}.dll.a" "$(LIB_INSTALL_DIR)";\ chmod 555 "$(LIB_INSTALL_DIR)/libtk${MAJOR_VERSION}${MINOR_VERSION}.a";\ fi @echo "Installing ${WISH_EXE} as $(BIN_INSTALL_DIR)/wish$(VERSION)${EXE_SUFFIX}" -- cgit v0.12 From 77b05d51020d4aea58e378ebb8dd1991e894d06f Mon Sep 17 00:00:00 2001 From: marc_culler Date: Sat, 14 Nov 2020 22:10:23 +0000 Subject: Correct an indeterminacy in the implementation of systemSelectedTabTextColor --- macosx/tkMacOSXColor.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index 82fc572..38b401b 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -324,6 +324,8 @@ GetRGBA( int OSVersion = [NSApp macOSVersion]; if (OSVersion > 100600 && OSVersion < 110000) { color = [[NSColor whiteColor] colorUsingColorSpace:sRGB]; + } else { + color = [[NSColor textColor] colorUsingColorSpace:sRGB]; } } else { color = [[NSColor valueForKey:entry->selector] colorUsingColorSpace:sRGB]; -- cgit v0.12 From e7be12248b18066f8c5e2c51d595ca3c88d3254c Mon Sep 17 00:00:00 2001 From: marc_culler Date: Sun, 15 Nov 2020 17:32:15 +0000 Subject: The selected text background issues appeared in 8.6 too. Cherrypick the fix. --- library/ttk/aquaTheme.tcl | 63 +++++++++++++++++------------------------------ macosx/tkMacOSXColor.h | 1 + 2 files changed, 24 insertions(+), 40 deletions(-) diff --git a/library/ttk/aquaTheme.tcl b/library/ttk/aquaTheme.tcl index 8bba226..51c3e49 100644 --- a/library/ttk/aquaTheme.tcl +++ b/library/ttk/aquaTheme.tcl @@ -35,21 +35,38 @@ namespace eval ttk::theme::aqua { ttk::style configure TMenubutton -anchor center -padding {2 0 0 2} ttk::style configure Toolbutton -anchor center + # For Entry, Combobox and Spinbox widgets the selected text background + # is the "Highlight color" selected in preferences when the widget + # has focus. It is a gray color when the widget does not have focus or + # the window does not have focus. (The background state implies !focus + # so we only need to specify !focus.) + # Entry - ttk::style configure TEntry \ - -foreground systemTextColor \ - -background systemTextBackgroundColor ttk::style map TEntry \ -foreground { disabled systemDisabledControlTextColor } \ - -selectforeground { - background systemTextColor + -selectbackground { + !focus systemUnemphasizedSelectedTextBackgroundColor + } + + # Combobox: + ttk::style map TCombobox \ + -foreground { + disabled systemDisabledControlTextColor } \ -selectbackground { - background systemTextBackgroundColor + !focus systemUnemphasizedSelectedTextBackgroundColor } + # Spinbox + ttk::style map TSpinbox \ + -foreground { + disabled systemDisabledControlTextColor + } \ + -selectbackground { + !focus systemUnemphasizedSelectedTextBackgroundColor + } # Workaround for #1100117: # Actually, on Aqua we probably shouldn't stipple images in @@ -67,40 +84,6 @@ namespace eval ttk::theme::aqua { disabled systemDisabledControlTextColor selected systemSelectedTabTextColor} - # Combobox: - ttk::style configure TCombobox \ - -foreground systemTextColor \ - -background systemTransparent - ttk::style map TCombobox \ - -foreground { - disabled systemDisabledControlTextColor - } \ - -selectforeground { - background systemTextColor - } \ - -selectbackground { - background systemTransparent - } - - # Spinbox - ttk::style configure TSpinbox \ - -foreground systemTextColor \ - -background systemTextBackgroundColor \ - -selectforeground systemSelectedTextColor \ - -selectbackground systemSelectedTextBackgroundColor - ttk::style map TSpinbox \ - -foreground { - disabled systemDisabledControlTextColor - } \ - -selectforeground { - !active systemTextColor - } \ - -selectbackground { - !active systemTextBackgroundColor - !focus systemTextBackgroundColor - focus systemSelectedTextBackgroundColor - } - # Treeview: ttk::style configure Heading \ -font TkHeadingFont \ diff --git a/macosx/tkMacOSXColor.h b/macosx/tkMacOSXColor.h index e27500d..5a57c88 100644 --- a/macosx/tkMacOSXColor.h +++ b/macosx/tkMacOSXColor.h @@ -249,6 +249,7 @@ static SystemColorDatum systemColorData[] = { {"LinkColor", semantic, 0, "blueColor", 0, NULL }, {"PlaceholderTextColor", semantic, 0, "grayColor", 0, NULL }, {"SeparatorColor", semantic, 0, "grayColor", 0, NULL }, +{"UnemphasizedSelectedTextBackgroundColor", semantic, 0, "grayColor", 0, NULL }, {NULL, 0, 0, NULL, 0, NULL } }; -- cgit v0.12 From 4a755ae2c40c3164a67508cfdfbba153fe1a900e Mon Sep 17 00:00:00 2001 From: marc_culler Date: Sun, 15 Nov 2020 21:05:55 +0000 Subject: Use systemUnemphasizedSelectedTextBackgroundColor as the INACTIVE_SELECT_BG default. --- macosx/tkMacOSXDefault.h | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/macosx/tkMacOSXDefault.h b/macosx/tkMacOSXDefault.h index 4e73ac9..29b672a 100644 --- a/macosx/tkMacOSXDefault.h +++ b/macosx/tkMacOSXDefault.h @@ -42,7 +42,7 @@ #define ACTIVE_FG "systemTextColor" #define SELECT_BG "systemSelectedTextBackgroundColor" #define SELECT_FG "systemSelectedTextColor" -#define INACTIVE_SELECT_BG "systemSelectedTextBackgroundColor" +#define INACTIVE_SELECT_BG "systemUnemphasizedSelectedTextBackgroundColor" #define TROUGH "#c3c3c3" #define INDICATOR "#b03060" #define DISABLED "#a3a3a3" @@ -88,19 +88,9 @@ #define DEF_BUTTON_ON_VALUE "1" #define DEF_BUTTON_TRISTATE_VALUE "" #define DEF_BUTTON_OVER_RELIEF "" -//#if TK_MAC_BUTTON_USE_COMPATIBILITY_METRICS -//#define DEF_BUTTON_PADX "12" -//#define DEF_BUTTON_PADX_NOCM "1" -//#else #define DEF_BUTTON_PADX "1" -//#endif #define DEF_LABCHKRAD_PADX "1" -//#if TK_MAC_BUTTON_USE_COMPATIBILITY_METRICS -//#define DEF_BUTTON_PADY "3" -//#define DEF_BUTTON_PADY_NOCM "1" -//#else #define DEF_BUTTON_PADY "1" -//#endif #define DEF_LABCHKRAD_PADY "1" #define DEF_BUTTON_RELIEF "flat" #define DEF_LABCHKRAD_RELIEF "flat" -- cgit v0.12 From 10ad6cb31e294f4e49fd86f89e20e95d0d7dc8b0 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 16 Nov 2020 08:09:44 +0000 Subject: Since all demo's are in utf-8 (actually: ASCII), just use this encoding directly --- library/demos/bind.tcl | 12 ++--- library/demos/tclIndex | 118 ++++++++++++++++++++++++------------------------- library/demos/widget | 2 +- library/msgs/es.msg | 4 +- library/msgs/ru.msg | 4 +- 5 files changed, 70 insertions(+), 70 deletions(-) diff --git a/library/demos/bind.tcl b/library/demos/bind.tcl index d9bc22f..b7e8f87 100644 --- a/library/demos/bind.tcl +++ b/library/demos/bind.tcl @@ -67,12 +67,12 @@ foreach tag {d1 d2 d3 d4 d5 d6} { $w.text tag bind $tag "$w.text tag configure $tag $normal" } # Main widget program sets variable tk_demoDirectory -$w.text tag bind d1 <1> {source [file join $tk_demoDirectory items.tcl]} -$w.text tag bind d2 <1> {source [file join $tk_demoDirectory plot.tcl]} -$w.text tag bind d3 <1> {source [file join $tk_demoDirectory ctext.tcl]} -$w.text tag bind d4 <1> {source [file join $tk_demoDirectory arrow.tcl]} -$w.text tag bind d5 <1> {source [file join $tk_demoDirectory ruler.tcl]} -$w.text tag bind d6 <1> {source [file join $tk_demoDirectory cscroll.tcl]} +$w.text tag bind d1 <1> {source -encoding utf-8 [file join $tk_demoDirectory items.tcl]} +$w.text tag bind d2 <1> {source -encoding utf-8 [file join $tk_demoDirectory plot.tcl]} +$w.text tag bind d3 <1> {source -encoding utf-8 [file join $tk_demoDirectory ctext.tcl]} +$w.text tag bind d4 <1> {source -encoding utf-8 [file join $tk_demoDirectory arrow.tcl]} +$w.text tag bind d5 <1> {source -encoding utf-8 [file join $tk_demoDirectory ruler.tcl]} +$w.text tag bind d6 <1> {source -encoding utf-8 [file join $tk_demoDirectory cscroll.tcl]} $w.text mark set insert 0.0 $w.text configure -state disabled diff --git a/library/demos/tclIndex b/library/demos/tclIndex index 86a72e2..cdb2f2c 100644 --- a/library/demos/tclIndex +++ b/library/demos/tclIndex @@ -6,62 +6,62 @@ # element name is the name of a command and the value is # a script that loads the command. -set auto_index(arrowSetup) [list source [file join $dir arrow.tcl]] -set auto_index(arrowMove1) [list source [file join $dir arrow.tcl]] -set auto_index(arrowMove2) [list source [file join $dir arrow.tcl]] -set auto_index(arrowMove3) [list source [file join $dir arrow.tcl]] -set auto_index(textLoadFile) [list source [file join $dir search.tcl]] -set auto_index(textSearch) [list source [file join $dir search.tcl]] -set auto_index(textToggle) [list source [file join $dir search.tcl]] -set auto_index(itemEnter) [list source [file join $dir items.tcl]] -set auto_index(itemLeave) [list source [file join $dir items.tcl]] -set auto_index(itemMark) [list source [file join $dir items.tcl]] -set auto_index(itemStroke) [list source [file join $dir items.tcl]] -set auto_index(itemsUnderArea) [list source [file join $dir items.tcl]] -set auto_index(itemStartDrag) [list source [file join $dir items.tcl]] -set auto_index(itemDrag) [list source [file join $dir items.tcl]] -set auto_index(butPress) [list source [file join $dir items.tcl]] -set auto_index(loadDir) [list source [file join $dir image2.tcl]] -set auto_index(loadImage) [list source [file join $dir image2.tcl]] -set auto_index(rulerMkTab) [list source [file join $dir ruler.tcl]] -set auto_index(rulerNewTab) [list source [file join $dir ruler.tcl]] -set auto_index(rulerSelectTab) [list source [file join $dir ruler.tcl]] -set auto_index(rulerMoveTab) [list source [file join $dir ruler.tcl]] -set auto_index(rulerReleaseTab) [list source [file join $dir ruler.tcl]] -set auto_index(mkTextConfig) [list source [file join $dir ctext.tcl]] -set auto_index(textEnter) [list source [file join $dir ctext.tcl]] -set auto_index(textInsert) [list source [file join $dir ctext.tcl]] -set auto_index(textPaste) [list source [file join $dir ctext.tcl]] -set auto_index(textB1Press) [list source [file join $dir ctext.tcl]] -set auto_index(textB1Move) [list source [file join $dir ctext.tcl]] -set auto_index(textBs) [list source [file join $dir ctext.tcl]] -set auto_index(textDel) [list source [file join $dir ctext.tcl]] -set auto_index(bitmapRow) [list source [file join $dir bitmap.tcl]] -set auto_index(scrollEnter) [list source [file join $dir cscroll.tcl]] -set auto_index(scrollLeave) [list source [file join $dir cscroll.tcl]] -set auto_index(scrollButton) [list source [file join $dir cscroll.tcl]] -set auto_index(textWindOn) [list source [file join $dir twind.tcl]] -set auto_index(textWindOff) [list source [file join $dir twind.tcl]] -set auto_index(textWindPlot) [list source [file join $dir twind.tcl]] -set auto_index(embPlotDown) [list source [file join $dir twind.tcl]] -set auto_index(embPlotMove) [list source [file join $dir twind.tcl]] -set auto_index(textWindDel) [list source [file join $dir twind.tcl]] -set auto_index(embDefBg) [list source [file join $dir twind.tcl]] -set auto_index(floorDisplay) [list source [file join $dir floor.tcl]] -set auto_index(newRoom) [list source [file join $dir floor.tcl]] -set auto_index(roomChanged) [list source [file join $dir floor.tcl]] -set auto_index(bg1) [list source [file join $dir floor.tcl]] -set auto_index(bg2) [list source [file join $dir floor.tcl]] -set auto_index(bg3) [list source [file join $dir floor.tcl]] -set auto_index(fg1) [list source [file join $dir floor.tcl]] -set auto_index(fg2) [list source [file join $dir floor.tcl]] -set auto_index(fg3) [list source [file join $dir floor.tcl]] -set auto_index(setWidth) [list source [file join $dir hscale.tcl]] -set auto_index(plotDown) [list source [file join $dir plot.tcl]] -set auto_index(plotMove) [list source [file join $dir plot.tcl]] -set auto_index(puzzleSwitch) [list source [file join $dir puzzle.tcl]] -set auto_index(setHeight) [list source [file join $dir vscale.tcl]] -set auto_index(showMessageBox) [list source [file join $dir msgbox.tcl]] -set auto_index(setColor) [list source [file join $dir clrpick.tcl]] -set auto_index(setColor_helper) [list source [file join $dir clrpick.tcl]] -set auto_index(fileDialog) [list source [file join $dir filebox.tcl]] +set auto_index(arrowSetup) [list source -encoding utf-8 [file join $dir arrow.tcl]] +set auto_index(arrowMove1) [list source -encoding utf-8 [file join $dir arrow.tcl]] +set auto_index(arrowMove2) [list source -encoding utf-8 [file join $dir arrow.tcl]] +set auto_index(arrowMove3) [list source -encoding utf-8 [file join $dir arrow.tcl]] +set auto_index(textLoadFile) [list source -encoding utf-8 [file join $dir search.tcl]] +set auto_index(textSearch) [list source -encoding utf-8 [file join $dir search.tcl]] +set auto_index(textToggle) [list source -encoding utf-8 [file join $dir search.tcl]] +set auto_index(itemEnter) [list source -encoding utf-8 [file join $dir items.tcl]] +set auto_index(itemLeave) [list source -encoding utf-8 [file join $dir items.tcl]] +set auto_index(itemMark) [list source -encoding utf-8 [file join $dir items.tcl]] +set auto_index(itemStroke) [list source -encoding utf-8 [file join $dir items.tcl]] +set auto_index(itemsUnderArea) [list source -encoding utf-8 [file join $dir items.tcl]] +set auto_index(itemStartDrag) [list source -encoding utf-8 [file join $dir items.tcl]] +set auto_index(itemDrag) [list source -encoding utf-8 [file join $dir items.tcl]] +set auto_index(butPress) [list source -encoding utf-8 [file join $dir items.tcl]] +set auto_index(loadDir) [list source -encoding utf-8 [file join $dir image2.tcl]] +set auto_index(loadImage) [list source -encoding utf-8 [file join $dir image2.tcl]] +set auto_index(rulerMkTab) [list source -encoding utf-8 [file join $dir ruler.tcl]] +set auto_index(rulerNewTab) [list source -encoding utf-8 [file join $dir ruler.tcl]] +set auto_index(rulerSelectTab) [list source -encoding utf-8 [file join $dir ruler.tcl]] +set auto_index(rulerMoveTab) [list source -encoding utf-8 [file join $dir ruler.tcl]] +set auto_index(rulerReleaseTab) [list source -encoding utf-8 [file join $dir ruler.tcl]] +set auto_index(mkTextConfig) [list source -encoding utf-8 [file join $dir ctext.tcl]] +set auto_index(textEnter) [list source -encoding utf-8 [file join $dir ctext.tcl]] +set auto_index(textInsert) [list source -encoding utf-8 [file join $dir ctext.tcl]] +set auto_index(textPaste) [list source -encoding utf-8 [file join $dir ctext.tcl]] +set auto_index(textB1Press) [list source -encoding utf-8 [file join $dir ctext.tcl]] +set auto_index(textB1Move) [list source -encoding utf-8 [file join $dir ctext.tcl]] +set auto_index(textBs) [list source -encoding utf-8 [file join $dir ctext.tcl]] +set auto_index(textDel) [list source -encoding utf-8 [file join $dir ctext.tcl]] +set auto_index(bitmapRow) [list source -encoding utf-8 [file join $dir bitmap.tcl]] +set auto_index(scrollEnter) [list source -encoding utf-8 [file join $dir cscroll.tcl]] +set auto_index(scrollLeave) [list source -encoding utf-8 [file join $dir cscroll.tcl]] +set auto_index(scrollButton) [list source -encoding utf-8 [file join $dir cscroll.tcl]] +set auto_index(textWindOn) [list source -encoding utf-8 [file join $dir twind.tcl]] +set auto_index(textWindOff) [list source -encoding utf-8 [file join $dir twind.tcl]] +set auto_index(textWindPlot) [list source -encoding utf-8 [file join $dir twind.tcl]] +set auto_index(embPlotDown) [list source -encoding utf-8 [file join $dir twind.tcl]] +set auto_index(embPlotMove) [list source -encoding utf-8 [file join $dir twind.tcl]] +set auto_index(textWindDel) [list source -encoding utf-8 [file join $dir twind.tcl]] +set auto_index(embDefBg) [list source -encoding utf-8 [file join $dir twind.tcl]] +set auto_index(floorDisplay) [list source -encoding utf-8 [file join $dir floor.tcl]] +set auto_index(newRoom) [list source -encoding utf-8 [file join $dir floor.tcl]] +set auto_index(roomChanged) [list source -encoding utf-8 [file join $dir floor.tcl]] +set auto_index(bg1) [list source -encoding utf-8 [file join $dir floor.tcl]] +set auto_index(bg2) [list source -encoding utf-8 [file join $dir floor.tcl]] +set auto_index(bg3) [list source -encoding utf-8 [file join $dir floor.tcl]] +set auto_index(fg1) [list source -encoding utf-8 [file join $dir floor.tcl]] +set auto_index(fg2) [list source -encoding utf-8 [file join $dir floor.tcl]] +set auto_index(fg3) [list source -encoding utf-8 [file join $dir floor.tcl]] +set auto_index(setWidth) [list source -encoding utf-8 [file join $dir hscale.tcl]] +set auto_index(plotDown) [list source -encoding utf-8 [file join $dir plot.tcl]] +set auto_index(plotMove) [list source -encoding utf-8 [file join $dir plot.tcl]] +set auto_index(puzzleSwitch) [list source -encoding utf-8 [file join $dir puzzle.tcl]] +set auto_index(setHeight) [list source -encoding utf-8 [file join $dir vscale.tcl]] +set auto_index(showMessageBox) [list source -encoding utf-8 [file join $dir msgbox.tcl]] +set auto_index(setColor) [list source -encoding utf-8 [file join $dir clrpick.tcl]] +set auto_index(setColor_helper) [list source -encoding utf-8 [file join $dir clrpick.tcl]] +set auto_index(fileDialog) [list source -encoding utf-8 [file join $dir filebox.tcl]] diff --git a/library/demos/widget b/library/demos/widget index 88d55c6..d6dcd54 100644 --- a/library/demos/widget +++ b/library/demos/widget @@ -519,7 +519,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 diff --git a/library/msgs/es.msg b/library/msgs/es.msg index ceb12d6..c7001bb 100644 --- a/library/msgs/es.msg +++ b/library/msgs/es.msg @@ -1,7 +1,7 @@ namespace eval ::tk { ::msgcat::mcset es "&Abort" "&Abortar" ::msgcat::mcset es "&About..." "&Acerca de ..." - ::msgcat::mcset es "All Files" "Todos los archivos" + ::msgcat::mcset es "All Files" "Todos los archivos" ::msgcat::mcset es "Application Error" "Error de la aplicaci\u00f3n" ::msgcat::mcset es "&Blue" "&Azul" ::msgcat::mcset es "&Cancel" "&Cancelar" @@ -59,7 +59,7 @@ namespace eval ::tk { ::msgcat::mcset es "Tcl Scripts" "Scripts Tcl" ::msgcat::mcset es "Tcl for Windows" "Tcl para Windows" ::msgcat::mcset es "Text Files" "Archivos de texto" - ::msgcat::mcset es "&Yes" "&S\u00ed" + ::msgcat::mcset es "&Yes" "&S\u00ed" ::msgcat::mcset es "abort" "abortar" ::msgcat::mcset es "blue" "azul" ::msgcat::mcset es "cancel" "cancelar" diff --git a/library/msgs/ru.msg b/library/msgs/ru.msg index 9f6aa80..b003e7f 100644 --- a/library/msgs/ru.msg +++ b/library/msgs/ru.msg @@ -17,7 +17,7 @@ namespace eval ::tk { ::msgcat::mcset ru "Details >>" "\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 >>" ::msgcat::mcset ru "Directory \"%1\$s\" does not exist." "\u041a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \"%1\$s\" \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442." ::msgcat::mcset ru "&Directory:" "&\u041a\u0430\u0442\u0430\u043b\u043e\u0433:" - ::msgcat::mcset ru "Error: %1\$s" "\u041e\u0448\u0438\u0431\u043a\u0430: %1\$s" + ::msgcat::mcset ru "Error: %1\$s" "\u041e\u0448\u0438\u0431\u043a\u0430: %1\$s" ::msgcat::mcset ru "Exit" "\u0412\u044b\u0445\u043e\u0434" ::msgcat::mcset ru "File \"%1\$s\" already exists.\nDo you want to overwrite it?" \ "\u0424\u0430\u0439\u043b \"%1\$s\" \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.\n\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0435\u0433\u043e?" @@ -33,7 +33,7 @@ namespace eval ::tk { ::msgcat::mcset ru "Hi" "\u041f\u0440\u0438\u0432\u0435\u0442" ::msgcat::mcset ru "Hide Console" "\u0421\u043f\u0440\u044f\u0442\u0430\u0442\u044c \u043a\u043e\u043d\u0441\u043e\u043b\u044c" ::msgcat::mcset ru "&Ignore" "&\u0418\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c" - ::msgcat::mcset ru "Invalid file name \"%1\$s\"." "\u041d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \"%1\$s\"." + ::msgcat::mcset ru "Invalid file name \"%1\$s\"." "\u041d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \"%1\$s\"." ::msgcat::mcset ru "Log Files" "\u0424\u0430\u0439\u043b\u044b \u0436\u0443\u0440\u043d\u0430\u043b\u0430" ::msgcat::mcset ru "&No" "&\u041d\u0435\u0442" ::msgcat::mcset ru "&OK" "&\u041e\u041a" -- cgit v0.12 From 82180c0e02b1d5f7e5fa81672d90f741281dbbff Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 16 Nov 2020 08:26:51 +0000 Subject: Second argument of Tcl_StaticPackage() should always be Titlecase. Synced from this commit in Tcl: [d8e520bee8e1a287] --- unix/tkAppInit.c | 2 ++ win/winMain.c | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/unix/tkAppInit.c b/unix/tkAppInit.c index 422b9e1..8ea1b4e 100644 --- a/unix/tkAppInit.c +++ b/unix/tkAppInit.c @@ -93,10 +93,12 @@ Tcl_AppInit( if (Tcl_Init(interp) == TCL_ERROR) { return TCL_ERROR; } + if (Tk_Init(interp) == TCL_ERROR) { return TCL_ERROR; } Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit); + #ifdef TK_TEST if (Tktest_Init(interp) == TCL_ERROR) { return TCL_ERROR; diff --git a/win/winMain.c b/win/winMain.c index 01a5e23..bf39ec5 100644 --- a/win/winMain.c +++ b/win/winMain.c @@ -28,7 +28,7 @@ int _CRT_glob = 0; extern Tcl_PackageInitProc Tktest_Init; #endif /* TK_TEST */ -#if defined(STATIC_BUILD) && TCL_USE_STATIC_PACKAGES +#if defined(STATIC_BUILD) && defined(TCL_USE_STATIC_PACKAGES) && TCL_USE_STATIC_PACKAGES extern Tcl_PackageInitProc Registry_Init; extern Tcl_PackageInitProc Dde_Init; extern Tcl_PackageInitProc Dde_SafeInit; @@ -176,16 +176,16 @@ Tcl_AppInit( goto error; } } -#if defined(STATIC_BUILD) && TCL_USE_STATIC_PACKAGES +#if defined(STATIC_BUILD) && defined(TCL_USE_STATIC_PACKAGES) && TCL_USE_STATIC_PACKAGES if (Registry_Init(interp) == TCL_ERROR) { goto error; } - Tcl_StaticPackage(interp, "registry", Registry_Init, NULL); + Tcl_StaticPackage(interp, "Registry", Registry_Init, NULL); if (Dde_Init(interp) == TCL_ERROR) { goto error; } - Tcl_StaticPackage(interp, "dde", Dde_Init, NULL); + Tcl_StaticPackage(interp, "Dde", Dde_Init, NULL); #endif #ifdef TK_TEST -- cgit v0.12 From 27d4c308ee4bd6b569ac727a4debd855e90de90e Mon Sep 17 00:00:00 2001 From: culler Date: Tue, 17 Nov 2020 18:19:47 +0000 Subject: Fix [635167af14]: black menu entries -- see if this is fixed by intializing all automatic MacPixels to 0. --- macosx/tkMacOSXColor.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index 38b401b..6d5eb92 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -177,7 +177,7 @@ TkMacOSXRGBPixel( unsigned long green, unsigned long blue) { - MacPixel p; + MacPixel p = 0; p.pixel.colortype = rgbColor; p.pixel.value = ((red & 0xff) << 16) | ((green & 0xff) << 8) | @@ -207,7 +207,7 @@ MODULE_SCOPE unsigned long TkMacOSXClearPixel( void) { - MacPixel p; + MacPixel p = 0; p.pixel.value = 0; p.pixel.colortype = clearColor; return p.ulong; @@ -236,7 +236,7 @@ SystemColorDatum* GetEntryFromPixel( unsigned long pixel) { - MacPixel p; + MacPixel p = 0; int index = rgbColorIndex; p.ulong = pixel; @@ -314,6 +314,10 @@ GetRGBA( } } break; + case clearColor: + rgba[0] = rgba[1] = rgba[2] = 1.0; + rgba[3] = 0; + break; case semantic: if (entry->index == controlAccentIndex && useFakeAccentColor) { #if MAC_OS_X_VERSION_MIN_REQUIRED < 101400 @@ -332,8 +336,6 @@ GetRGBA( } [color getComponents: rgba]; break; - case clearColor: - rgba[3] = 0; case HIText: #ifdef __LP64__ color = [[NSColor textColor] colorUsingColorSpace:sRGB]; @@ -635,7 +637,7 @@ TkpGetColor( if (strncasecmp(name, "system", 6) == 0) { Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&systemColors, name + 6); - MacPixel p; + MacPixel p = 0; if (hPtr != NULL) { SystemColorDatum *entry = (SystemColorDatum *)Tcl_GetHashValue(hPtr); -- cgit v0.12 From 0050bf7b52205d79ae1721df9921a8a65ad38c4f Mon Sep 17 00:00:00 2001 From: culler Date: Tue, 17 Nov 2020 18:37:31 +0000 Subject: I think I am supposed to add braces. --- macosx/tkMacOSXColor.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index 6d5eb92..543f1d5 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -177,7 +177,7 @@ TkMacOSXRGBPixel( unsigned long green, unsigned long blue) { - MacPixel p = 0; + MacPixel p = {0}; p.pixel.colortype = rgbColor; p.pixel.value = ((red & 0xff) << 16) | ((green & 0xff) << 8) | @@ -207,7 +207,7 @@ MODULE_SCOPE unsigned long TkMacOSXClearPixel( void) { - MacPixel p = 0; + MacPixel p = {0}; p.pixel.value = 0; p.pixel.colortype = clearColor; return p.ulong; @@ -236,7 +236,7 @@ SystemColorDatum* GetEntryFromPixel( unsigned long pixel) { - MacPixel p = 0; + MacPixel p = {0}; int index = rgbColorIndex; p.ulong = pixel; @@ -637,7 +637,7 @@ TkpGetColor( if (strncasecmp(name, "system", 6) == 0) { Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&systemColors, name + 6); - MacPixel p = 0; + MacPixel p = {0}; if (hPtr != NULL) { SystemColorDatum *entry = (SystemColorDatum *)Tcl_GetHashValue(hPtr); -- cgit v0.12 From 9d94caca32ae897acbb3fb2e32f97f8cb81f2de8 Mon Sep 17 00:00:00 2001 From: culler Date: Tue, 17 Nov 2020 20:51:51 +0000 Subject: Try initializing menus a bit later and dealing with menu item background color. --- macosx/tkMacOSXColor.h | 2 +- macosx/tkMacOSXDefault.h | 21 ++++++++-------- macosx/tkMacOSXInit.c | 30 ++++++++++++++-------- macosx/tkMacOSXMenu.c | 65 ++++++++++++++++++++++++++++-------------------- 4 files changed, 69 insertions(+), 49 deletions(-) diff --git a/macosx/tkMacOSXColor.h b/macosx/tkMacOSXColor.h index 5a57c88..0f4518d 100644 --- a/macosx/tkMacOSXColor.h +++ b/macosx/tkMacOSXColor.h @@ -89,7 +89,7 @@ typedef struct { static SystemColorDatum systemColorData[] = { {"Pixel", rgbColor, 0, NULL, 0, NULL }, -{"Transparent", clearColor, 0, NULL, 0, NULL }, +{"Transparent", clearColor, 0, NULL, 0, NULL }, {"Highlight", HIBrush, kThemeBrushPrimaryHighlightColor, NULL, 0, NULL }, {"HighlightSecondary", HIBrush, kThemeBrushSecondaryHighlightColor, NULL, 0, NULL }, diff --git a/macosx/tkMacOSXDefault.h b/macosx/tkMacOSXDefault.h index 29b672a..af0a06b 100644 --- a/macosx/tkMacOSXDefault.h +++ b/macosx/tkMacOSXDefault.h @@ -46,6 +46,7 @@ #define TROUGH "#c3c3c3" #define INDICATOR "#b03060" #define DISABLED "#a3a3a3" +#define IGNORED "#abcdef" /* * Defaults for labels, buttons, checkbuttons, and radiobuttons: @@ -297,23 +298,23 @@ * Defaults for menus overall: */ -#define DEF_MENU_ACTIVE_BG_COLOR "systemMenuActive" -#define DEF_MENU_ACTIVE_BG_MONO BLACK +#define DEF_MENU_ACTIVE_BG_COLOR IGNORED +#define DEF_MENU_ACTIVE_BG_MONO IGNORED #define DEF_MENU_ACTIVE_BORDER_WIDTH "0" -#define DEF_MENU_ACTIVE_FG_COLOR "systemMenuActiveText" -#define DEF_MENU_ACTIVE_FG_MONO WHITE -#define DEF_MENU_BG_COLOR "systemMenu" -#define DEF_MENU_BG_MONO WHITE +#define DEF_MENU_ACTIVE_FG_COLOR IGNORED +#define DEF_MENU_ACTIVE_FG_MONO IGNORED +#define DEF_MENU_BG_COLOR "#000001" /* Detects custom bg. */ +#define DEF_MENU_BG_MONO IGNORED #define DEF_MENU_BORDER_WIDTH "0" #define DEF_MENU_CURSOR "arrow" -#define DEF_MENU_DISABLED_FG_COLOR "systemMenuDisabled" +#define DEF_MENU_DISABLED_FG_COLOR IGNORED #define DEF_MENU_DISABLED_FG_MONO "" #define DEF_MENU_FONT "menu" /* special: see tkMacOSXMenu.c */ -#define DEF_MENU_FG "systemMenuText" +#define DEF_MENU_FG "#010000" /* Detects custom fg. */ #define DEF_MENU_POST_COMMAND "" #define DEF_MENU_RELIEF "flat" -#define DEF_MENU_SELECT_COLOR "systemMenuActive" -#define DEF_MENU_SELECT_MONO BLACK +#define DEF_MENU_SELECT_COLOR IGNORED +#define DEF_MENU_SELECT_MONO IGNORED #define DEF_MENU_TAKE_FOCUS "0" #define DEF_MENU_TEAROFF "0" #define DEF_MENU_TEAROFF_CMD NULL diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index 06ff367..996fc05 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -103,29 +103,37 @@ static int TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip, #endif [self _setupWindowNotifications]; [self _setupApplicationNotifications]; +} + +-(void)applicationDidFinishLaunching:(NSNotification *)notification +{ + (void)notification; + + /* + * Initialize event processing. + */ + + TkMacOSXInitAppleEvents(_eventInterp); /* - * Construct the menu bar. + * Initialize the graphics context. */ - _defaultMainMenu = nil; - [self _setupMenus]; + TkMacOSXUseAntialiasedText(_eventInterp, -1); + TkMacOSXInitCGDrawing(_eventInterp, TRUE, 0); /* - * Initialize event processing. + * Construct the menu bar. */ - TkMacOSXInitAppleEvents(_eventInterp); + _defaultMainMenu = nil; + [self _setupMenus]; /* - * Initialize the graphics context. + * Initialize graphics. */ + TkMacOSXUseAntialiasedText(_eventInterp, -1); TkMacOSXInitCGDrawing(_eventInterp, TRUE, 0); -} - --(void)applicationDidFinishLaunching:(NSNotification *)notification -{ - (void)notification; /* * It is not safe to force activation of the NSApp until this method is diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 3d5a996..ee05eb5 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -95,6 +95,12 @@ static int gNoTkMenus = 0; /* This is used by Tk_MacOSXTurnOffMenus as * the flag that Tk is not to draw any * menus. */ static int inPostMenu = 0; + +/* + * These colors are never used. We compare current settings with these to + * detect whether they have been changed from the default. + */ + static unsigned long defaultBg = 0, defaultFg = 0; static SInt32 menuMarkColumnWidth = 0, menuIconTrailingEdgeMargin = 0; static SInt32 menuTextLeadingEdgeMargin = 0, menuTextTrailingEdgeMargin = 0; @@ -320,12 +326,6 @@ TKBackgroundLoop *backgroundLoop = nil; if (menuPtr && mePtr) { Tcl_Interp *interp = menuPtr->interp; - /* - * Add time for errors to fire if necessary. This is sub-optimal - * but avoids issues with Tcl/Cocoa event loop integration. - */ - - //Tcl_Sleep(100); Tcl_Preserve(interp); Tcl_Preserve(menuPtr); @@ -693,7 +693,8 @@ TkpConfigureMenuEntry( NSString *keyEquivalent = @""; NSUInteger modifierMask = NSCommandKeyMask; NSMenu *submenu = nil; - NSDictionary *attributes; + NSDictionary *fontAttributes; + NSMutableDictionary *attributes; int imageWidth, imageHeight; GC gc = (mePtr->textGC ? mePtr->textGC : mePtr->menuPtr->textGC); Tcl_Obj *fontPtr = (mePtr->fontPtr ? mePtr->fontPtr : @@ -711,9 +712,7 @@ TkpConfigureMenuEntry( &imageHeight); image = TkMacOSXGetNSImageFromBitmap(mePtr->menuPtr->display, bitmap, gc, imageWidth, imageHeight); - if (gc->foreground == defaultFg) { - [image setTemplate:YES]; - } + [image setTemplate:YES]; } [menuItem setImage:image]; if ((!image || mePtr->compound != COMPOUND_NONE) && mePtr->labelPtr && @@ -727,23 +726,36 @@ TkpConfigureMenuEntry( } } [menuItem setTitle:title]; - if (strcmp(Tcl_GetString(fontPtr), "menu") || gc->foreground != defaultFg - || gc->background != defaultBg) { - attributes = TkMacOSXNSFontAttributesForFont(Tk_GetFontFromObj( - mePtr->menuPtr->tkwin, fontPtr)); - if (gc->foreground != defaultFg || gc->background != defaultBg) { - NSColor *color = TkMacOSXGetNSColor(gc, - gc->foreground!=defaultFg? gc->foreground:gc->background); - - attributes = [[attributes mutableCopy] autorelease]; - [(NSMutableDictionary *) attributes setObject:color - forKey:NSForegroundColorAttributeName]; - } - if (attributes) { - attributedTitle = [[[NSAttributedString alloc] - initWithString:title attributes:attributes] autorelease]; - } + fontAttributes = TkMacOSXNSFontAttributesForFont(Tk_GetFontFromObj( + mePtr->menuPtr->tkwin, fontPtr)); + attributes = [fontAttributes mutableCopy]; + if (gc->foreground != defaultFg) { + + /* + * Apple's default foreground color changes to white when the menuitem is + * selected. If a custom foreground color is used then the color will be + * the same for selected and unselected menu items. + */ + + NSColor *fgcolor = TkMacOSXGetNSColor(gc, gc->foreground); + [attributes setObject:fgcolor + forKey:NSForegroundColorAttributeName]; } + if (gc->background != defaultBg) { + + /* + * Setting a background color looks awful. But setting the background should + * not be the same as setting the foreground. As a compromise, if the background + * color is set we draw an underline in that color. + */ + NSColor *bgcolor = TkMacOSXGetNSColor(gc, gc->background); + [attributes setObject:bgcolor + forKey:NSUnderlineColorAttributeName]; + [attributes setObject:[NSNumber numberWithInt:NSUnderlineStyleDouble] + forKey:NSUnderlineStyleAttributeName]; + } + attributedTitle = [[[NSAttributedString alloc] + initWithString:title attributes:attributes] autorelease]; [menuItem setAttributedTitle:attributedTitle]; [menuItem setEnabled:!(mePtr->state == ENTRY_DISABLED)]; [menuItem setState:((mePtr->type == CHECK_BUTTON_ENTRY || @@ -1696,7 +1708,6 @@ void TkpMenuInit(void) { TkColor *tkColPtr; - NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; #define observe(n, s) \ -- cgit v0.12 From 517cab46b3a8d51a7a7c35be459168dadf549cd8 Mon Sep 17 00:00:00 2001 From: culler Date: Tue, 17 Nov 2020 22:26:10 +0000 Subject: Make the menu demo look like the old one, by using -foreground instead of -background in aqua. --- library/demos/menu.tcl | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/library/demos/menu.tcl b/library/demos/menu.tcl index 6989523..56a29da 100644 --- a/library/demos/menu.tcl +++ b/library/demos/menu.tcl @@ -144,9 +144,17 @@ $m entryconfigure "Does almost nothing" -bitmap questhead -compound left \ set m $w.menu.colors $w.menu add cascade -label "Colors" -menu $m -underline 1 menu $m -tearoff 1 -foreach i {red orange yellow green blue} { - $m add command -label $i -background $i -command [list \ - puts "You invoked \"$i\"" ] +if {[tk windowingsystem] eq "aqua"} { + # In aqua, changing the background actually adds a colored underline. + foreach i {red orange yellow green blue} { + $m add command -label $i -foreground $i -command [list \ + puts "You invoked \"$i\"" ] + } +} else { + foreach i {red orange yellow green blue} { + $m add command -label $i -background $i -command [list \ + puts "You invoked \"$i\"" ] + } } $w configure -menu $w.menu -- cgit v0.12 From 611b219cbd36c037048c5cce30fd6b32474495cf Mon Sep 17 00:00:00 2001 From: culler Date: Wed, 18 Nov 2020 14:47:47 +0000 Subject: Test using an underline to indicate background color. --- generic/tkMenu.c | 4 +++ macosx/tkMacOSXMenu.c | 75 +++++++++++++++++++++++++++------------------------ 2 files changed, 44 insertions(+), 35 deletions(-) diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 1cd7a16..1d7c38d 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -1492,6 +1492,7 @@ MenuWorldChanged( for (i = 0; i < menuPtr->numEntries; i++) { TkMenuConfigureEntryDrawOptions(menuPtr->entries[i], menuPtr->entries[i]->index); + fprintf(stderr, "MenuWorldChanged: calling TkpConfigureMenuEntry %d\n", i); TkpConfigureMenuEntry(menuPtr->entries[i]); } TkEventuallyRecomputeMenu(menuPtr); @@ -1873,6 +1874,7 @@ PostProcessEntry( } } + fprintf(stderr, "PostProcessEntry: calling TkpConfigureMenuEntry\n"); if (TkpConfigureMenuEntry(mePtr) != TCL_OK) { return TCL_ERROR; } @@ -2534,6 +2536,7 @@ MenuVarProc( Tcl_TraceVar2(interp, name, NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, MenuVarProc, clientData); + fprintf(stderr, "MenuVarProc: Calling TkpConfigureMenuEntry\n"); TkpConfigureMenuEntry(mePtr); TkEventuallyRedrawMenu(menuPtr, NULL); return NULL; @@ -2563,6 +2566,7 @@ MenuVarProc( } else { return NULL; } + fprintf(stderr, "MenuVarProc: Calling TkpConfigureMenuEntry (2)\n"); TkpConfigureMenuEntry(mePtr); TkEventuallyRedrawMenu(menuPtr, mePtr); return NULL; diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index ee05eb5..e42ae3e 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -409,7 +409,7 @@ TKBackgroundLoop *backgroundLoop = nil; (void)menu; if (_tkMenu) { - //RecursivelyClearActiveMenu(_tkMenu); + // RecursivelyClearActiveMenu(_tkMenu); GenerateMenuSelectEvent((TKMenu *)[self supermenu], [self itemInSupermenu]); } @@ -472,8 +472,8 @@ TKBackgroundLoop *backgroundLoop = nil; } backgroundLoop = [[TKBackgroundLoop alloc] init]; [backgroundLoop start]; - //TkMacOSXClearMenubarActive(); - //TkMacOSXPreprocessMenu(); + // TkMacOSXClearMenubarActive(); + // TkMacOSXPreprocessMenu(); } - (void) menuEndTracking: (NSNotification *) notification @@ -725,45 +725,49 @@ TkpConfigureMenuEntry( [title substringToIndex:[title length] - 3], 0x2026]; } } - [menuItem setTitle:title]; - fontAttributes = TkMacOSXNSFontAttributesForFont(Tk_GetFontFromObj( - mePtr->menuPtr->tkwin, fontPtr)); - attributes = [fontAttributes mutableCopy]; - if (gc->foreground != defaultFg) { + if ([title length]) { + fontAttributes = TkMacOSXNSFontAttributesForFont(Tk_GetFontFromObj( + mePtr->menuPtr->tkwin, fontPtr)); + attributes = [fontAttributes mutableCopy]; + if (gc->foreground != defaultFg) { - /* - * Apple's default foreground color changes to white when the menuitem is - * selected. If a custom foreground color is used then the color will be - * the same for selected and unselected menu items. - */ + /* + * Apple's default foreground color changes to white when the menuitem is + * selected. If a custom foreground color is used then the color will be + * the same for selected and unselected menu items. + */ - NSColor *fgcolor = TkMacOSXGetNSColor(gc, gc->foreground); - [attributes setObject:fgcolor - forKey:NSForegroundColorAttributeName]; - } - if (gc->background != defaultBg) { + NSColor *fgcolor = TkMacOSXGetNSColor(gc, gc->foreground); + [attributes setObject:fgcolor + forKey:NSForegroundColorAttributeName]; + } + if (gc->background != defaultBg) { - /* - * Setting a background color looks awful. But setting the background should - * not be the same as setting the foreground. As a compromise, if the background - * color is set we draw an underline in that color. - */ - NSColor *bgcolor = TkMacOSXGetNSColor(gc, gc->background); - [attributes setObject:bgcolor - forKey:NSUnderlineColorAttributeName]; - [attributes setObject:[NSNumber numberWithInt:NSUnderlineStyleDouble] - forKey:NSUnderlineStyleAttributeName]; + /* + * Setting a background color looks awful. But setting the background should + * not be the same as setting the foreground. As a compromise, if the background + * color is set we draw an underline in that color. + */ + NSColor *bgcolor = TkMacOSXGetNSColor(gc, gc->background); + [attributes setObject:bgcolor + forKey:NSUnderlineColorAttributeName]; + [attributes setObject:[NSNumber numberWithInt:NSUnderlineStyleDouble] + forKey:NSUnderlineStyleAttributeName]; + } + attributedTitle = [[NSAttributedString alloc] + initWithString:title + attributes:attributes]; + [menuItem setAttributedTitle:attributedTitle]; } - attributedTitle = [[[NSAttributedString alloc] - initWithString:title attributes:attributes] autorelease]; - [menuItem setAttributedTitle:attributedTitle]; - [menuItem setEnabled:!(mePtr->state == ENTRY_DISABLED)]; + fprintf(stderr, "Item %s has tk state %x apple enabled %d\n", + title.UTF8String, mePtr->state, [menuItem isEnabled]); + [menuItem setEnabled:(mePtr->state & ENTRY_DISABLED) == 0 || [title length] == 0]; [menuItem setState:((mePtr->type == CHECK_BUTTON_ENTRY || - mePtr->type == RADIO_BUTTON_ENTRY) && mePtr->indicatorOn && - (mePtr->entryFlags & ENTRY_SELECTED) ? NSOnState : NSOffState)]; + mePtr->type == RADIO_BUTTON_ENTRY) && mePtr->indicatorOn && + (mePtr->entryFlags & ENTRY_SELECTED) ? NSOnState : NSOffState)]; if (mePtr->type != CASCADE_ENTRY && mePtr->accelPtr && mePtr->accelLength) { keyEquivalent = ParseAccelerator(Tcl_GetString(mePtr->accelPtr), - &modifierMask); + &modifierMask); } [menuItem setKeyEquivalent:keyEquivalent]; [menuItem setKeyEquivalentModifierMask:modifierMask]; @@ -776,6 +780,7 @@ TkpConfigureMenuEntry( CheckForSpecialMenu(menuRefPtr->menuPtr); submenu = (TKMenu *) menuRefPtr->menuPtr->platformData; if ([submenu supermenu] && [menuItem submenu] != submenu) { + /* * This happens during a clone, where the parent menu is * cloned before its children, so just ignore this temprary -- cgit v0.12 From 1ba04ba305622a60b6975ce3780696310b158ec5 Mon Sep 17 00:00:00 2001 From: culler Date: Wed, 18 Nov 2020 14:53:26 +0000 Subject: Back out accidental commit --- generic/tkMenu.c | 4 --- macosx/tkMacOSXMenu.c | 75 ++++++++++++++++++++++++--------------------------- 2 files changed, 35 insertions(+), 44 deletions(-) diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 1d7c38d..1cd7a16 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -1492,7 +1492,6 @@ MenuWorldChanged( for (i = 0; i < menuPtr->numEntries; i++) { TkMenuConfigureEntryDrawOptions(menuPtr->entries[i], menuPtr->entries[i]->index); - fprintf(stderr, "MenuWorldChanged: calling TkpConfigureMenuEntry %d\n", i); TkpConfigureMenuEntry(menuPtr->entries[i]); } TkEventuallyRecomputeMenu(menuPtr); @@ -1874,7 +1873,6 @@ PostProcessEntry( } } - fprintf(stderr, "PostProcessEntry: calling TkpConfigureMenuEntry\n"); if (TkpConfigureMenuEntry(mePtr) != TCL_OK) { return TCL_ERROR; } @@ -2536,7 +2534,6 @@ MenuVarProc( Tcl_TraceVar2(interp, name, NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, MenuVarProc, clientData); - fprintf(stderr, "MenuVarProc: Calling TkpConfigureMenuEntry\n"); TkpConfigureMenuEntry(mePtr); TkEventuallyRedrawMenu(menuPtr, NULL); return NULL; @@ -2566,7 +2563,6 @@ MenuVarProc( } else { return NULL; } - fprintf(stderr, "MenuVarProc: Calling TkpConfigureMenuEntry (2)\n"); TkpConfigureMenuEntry(mePtr); TkEventuallyRedrawMenu(menuPtr, mePtr); return NULL; diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index e42ae3e..ee05eb5 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -409,7 +409,7 @@ TKBackgroundLoop *backgroundLoop = nil; (void)menu; if (_tkMenu) { - // RecursivelyClearActiveMenu(_tkMenu); + //RecursivelyClearActiveMenu(_tkMenu); GenerateMenuSelectEvent((TKMenu *)[self supermenu], [self itemInSupermenu]); } @@ -472,8 +472,8 @@ TKBackgroundLoop *backgroundLoop = nil; } backgroundLoop = [[TKBackgroundLoop alloc] init]; [backgroundLoop start]; - // TkMacOSXClearMenubarActive(); - // TkMacOSXPreprocessMenu(); + //TkMacOSXClearMenubarActive(); + //TkMacOSXPreprocessMenu(); } - (void) menuEndTracking: (NSNotification *) notification @@ -725,49 +725,45 @@ TkpConfigureMenuEntry( [title substringToIndex:[title length] - 3], 0x2026]; } } - if ([title length]) { - fontAttributes = TkMacOSXNSFontAttributesForFont(Tk_GetFontFromObj( - mePtr->menuPtr->tkwin, fontPtr)); - attributes = [fontAttributes mutableCopy]; - if (gc->foreground != defaultFg) { + [menuItem setTitle:title]; + fontAttributes = TkMacOSXNSFontAttributesForFont(Tk_GetFontFromObj( + mePtr->menuPtr->tkwin, fontPtr)); + attributes = [fontAttributes mutableCopy]; + if (gc->foreground != defaultFg) { - /* - * Apple's default foreground color changes to white when the menuitem is - * selected. If a custom foreground color is used then the color will be - * the same for selected and unselected menu items. - */ + /* + * Apple's default foreground color changes to white when the menuitem is + * selected. If a custom foreground color is used then the color will be + * the same for selected and unselected menu items. + */ - NSColor *fgcolor = TkMacOSXGetNSColor(gc, gc->foreground); - [attributes setObject:fgcolor - forKey:NSForegroundColorAttributeName]; - } - if (gc->background != defaultBg) { + NSColor *fgcolor = TkMacOSXGetNSColor(gc, gc->foreground); + [attributes setObject:fgcolor + forKey:NSForegroundColorAttributeName]; + } + if (gc->background != defaultBg) { - /* - * Setting a background color looks awful. But setting the background should - * not be the same as setting the foreground. As a compromise, if the background - * color is set we draw an underline in that color. - */ - NSColor *bgcolor = TkMacOSXGetNSColor(gc, gc->background); - [attributes setObject:bgcolor - forKey:NSUnderlineColorAttributeName]; - [attributes setObject:[NSNumber numberWithInt:NSUnderlineStyleDouble] - forKey:NSUnderlineStyleAttributeName]; - } - attributedTitle = [[NSAttributedString alloc] - initWithString:title - attributes:attributes]; - [menuItem setAttributedTitle:attributedTitle]; + /* + * Setting a background color looks awful. But setting the background should + * not be the same as setting the foreground. As a compromise, if the background + * color is set we draw an underline in that color. + */ + NSColor *bgcolor = TkMacOSXGetNSColor(gc, gc->background); + [attributes setObject:bgcolor + forKey:NSUnderlineColorAttributeName]; + [attributes setObject:[NSNumber numberWithInt:NSUnderlineStyleDouble] + forKey:NSUnderlineStyleAttributeName]; } - fprintf(stderr, "Item %s has tk state %x apple enabled %d\n", - title.UTF8String, mePtr->state, [menuItem isEnabled]); - [menuItem setEnabled:(mePtr->state & ENTRY_DISABLED) == 0 || [title length] == 0]; + attributedTitle = [[[NSAttributedString alloc] + initWithString:title attributes:attributes] autorelease]; + [menuItem setAttributedTitle:attributedTitle]; + [menuItem setEnabled:!(mePtr->state == ENTRY_DISABLED)]; [menuItem setState:((mePtr->type == CHECK_BUTTON_ENTRY || - mePtr->type == RADIO_BUTTON_ENTRY) && mePtr->indicatorOn && - (mePtr->entryFlags & ENTRY_SELECTED) ? NSOnState : NSOffState)]; + mePtr->type == RADIO_BUTTON_ENTRY) && mePtr->indicatorOn && + (mePtr->entryFlags & ENTRY_SELECTED) ? NSOnState : NSOffState)]; if (mePtr->type != CASCADE_ENTRY && mePtr->accelPtr && mePtr->accelLength) { keyEquivalent = ParseAccelerator(Tcl_GetString(mePtr->accelPtr), - &modifierMask); + &modifierMask); } [menuItem setKeyEquivalent:keyEquivalent]; [menuItem setKeyEquivalentModifierMask:modifierMask]; @@ -780,7 +776,6 @@ TkpConfigureMenuEntry( CheckForSpecialMenu(menuRefPtr->menuPtr); submenu = (TKMenu *) menuRefPtr->menuPtr->platformData; if ([submenu supermenu] && [menuItem submenu] != submenu) { - /* * This happens during a clone, where the parent menu is * cloned before its children, so just ignore this temprary -- cgit v0.12 From ae6a133a8d5afca88ae4c374a1798b37305cce52 Mon Sep 17 00:00:00 2001 From: culler Date: Wed, 18 Nov 2020 22:58:23 +0000 Subject: Fix [7185d26cf4]: macOS menu items before separators in special menus are disabled. --- macosx/tkMacOSXMenu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 3d5a996..29085a0 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -785,17 +785,17 @@ TkpConfigureMenuEntry( int i = 0; NSArray *itemArray = [submenu itemArray]; - for (NSMenuItem *item in itemArray) { TkMenuEntry *submePtr = menuRefPtr->menuPtr->entries[i]; /* - * Work around an apparent bug where itemArray can have - * more items than the menu's entries[] array. + * if this is a special menu in a menubar, skip the + * first item, which will have been added by the system + * and will be unknown to Tk. */ - if (i >= (int) menuRefPtr->menuPtr->numEntries) { - break; + if (mePtr->entryFlags && i == 0) { + continue; } [item setEnabled: !(submePtr->state == ENTRY_DISABLED)]; i++; -- cgit v0.12 From 384b6205935ca524509e9c3736c2d71af17b1a28 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 19 Nov 2020 14:21:02 +0000 Subject: First shot at github actions Linux build --- .github/workflows/linux-build.yml | 47 +++++++++++++++++++++++++++++++++++++++ .travis.yml | 1 + 2 files changed, 48 insertions(+) create mode 100644 .github/workflows/linux-build.yml diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml new file mode 100644 index 0000000..3974499 --- /dev/null +++ b/.github/workflows/linux-build.yml @@ -0,0 +1,47 @@ +name: Linux +on: [push] +jobs: + gcc: + runs-on: ubuntu-latest + strategy: + matrix: + cfgopt: + - "" + - "--disable-shared" + - "--disable-xft" + - "--disable-xss" + - "--enable-symbols" + defaults: + run: + shell: bash + working-directory: unix + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Prepare + run: touch ../doc/man.macros tkStubInit.c;sudo apt-get install tcl8.6-dev libx11-dev libxss-dev + working-directory: generic + - name: Configure ${{ matrix.cfgopt }} + run: | + mkdir "${HOME}/install" + ./configure ${CFGOPT} "--prefix=$HOME/install" || (cat config.log && exit 1) + env: + CFGOPT: ${{ matrix.cfgopt }} + - name: Build + run: | + make binaries libraries + - name: Build Test Harness + run: | + make tktest +# - name: Run Tests +# run: | +# make test + - name: Test-Drive Installation + run: | + make install + - name: Create Distribution Package + run: | + make dist + - name: Convert Documentation to HTML + run: | + make html-tk diff --git a/.travis.yml b/.travis.yml index 6fd1194..e8da2cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ addons: - gcc-multilib - tcl8.6-dev - libx11-dev + - libxss-dev - xvfb homebrew: packages: -- cgit v0.12 From fc5fd5cb8a45e236e7bdc80cf6e1042e57f3474c Mon Sep 17 00:00:00 2001 From: marc_culler Date: Thu, 19 Nov 2020 14:29:01 +0000 Subject: Better fix, for special menus other than Help: iterate through Tk menu entries, not NSMenuItems. --- macosx/tkMacOSXMenu.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 29085a0..db1d5eb 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -783,22 +783,10 @@ TkpConfigureMenuEntry( * re-enable the entries here. */ - int i = 0; - NSArray *itemArray = [submenu itemArray]; - for (NSMenuItem *item in itemArray) { + for (int i = 0; i < menuRefPtr->menuPtr->numEntries; i++) { TkMenuEntry *submePtr = menuRefPtr->menuPtr->entries[i]; - - /* - * if this is a special menu in a menubar, skip the - * first item, which will have been added by the system - * and will be unknown to Tk. - */ - - if (mePtr->entryFlags && i == 0) { - continue; - } - [item setEnabled: !(submePtr->state == ENTRY_DISABLED)]; - i++; + NSMenuItem *item = (NSMenuItem *) mePtr->platformEntryData; + [item setEnabled: submePtr->state != ENTRY_DISABLED]; } } } -- cgit v0.12 From 695fc0ede6cd32b2756d31f774d04ae117d9dbcb Mon Sep 17 00:00:00 2001 From: marc_culler Date: Thu, 19 Nov 2020 15:19:02 +0000 Subject: Edit comments --- macosx/tkMacOSXMenu.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index db1d5eb..5583bbf 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -745,7 +745,7 @@ TkpConfigureMenuEntry( } } [menuItem setAttributedTitle:attributedTitle]; - [menuItem setEnabled:!(mePtr->state == ENTRY_DISABLED)]; + [menuItem setEnabled:(mePtr->state != ENTRY_DISABLED)]; [menuItem setState:((mePtr->type == CHECK_BUTTON_ENTRY || mePtr->type == RADIO_BUTTON_ENTRY) && mePtr->indicatorOn && (mePtr->entryFlags & ENTRY_SELECTED) ? NSOnState : NSOffState)]; @@ -778,15 +778,17 @@ TkpConfigureMenuEntry( if ([menuItem isEnabled]) { /* - * This menuItem might have been previously disabled (XXX: - * track this), which would have disabled entries; we must - * re-enable the entries here. + * This menuItem might have been previously disabled which + * would have disabled all of its entries; we must re-enable the + * entries here. It is important to iterate though the Tk + * entries, not the NSMenuItems, since some NSMenuItems may + * have been added by the system. See [7185d26cf4]. */ for (int i = 0; i < menuRefPtr->menuPtr->numEntries; i++) { TkMenuEntry *submePtr = menuRefPtr->menuPtr->entries[i]; NSMenuItem *item = (NSMenuItem *) mePtr->platformEntryData; - [item setEnabled: submePtr->state != ENTRY_DISABLED]; + [item setEnabled:(submePtr->state != ENTRY_DISABLED)]; } } } @@ -1831,13 +1833,15 @@ TkpComputeMenubarGeometry( * TkpDrawMenuEntry -- * * Draws the given menu entry at the given coordinates with the given - * attributes. + * attributes. This is a no-op on macOS since the menus are drawn by + * the Apple window manager, which also handles all events related to + * selecting menu items. * * Results: * None. * * Side effects: - * X Server commands are executed to display the menu entry. + * None * *---------------------------------------------------------------------- */ @@ -1857,6 +1861,7 @@ TkpDrawMenuEntry( TCL_UNUSED(int)) /* Whether or not to draw the cascade arrow * for cascade items. */ { + fprintf(stderr, "TkpDrawMenuEntry\n"); } #pragma mark Obsolete -- cgit v0.12 From 2af3aa72d32e9caf8366dde38d1fa8c8e6eb4557 Mon Sep 17 00:00:00 2001 From: marc_culler Date: Thu, 19 Nov 2020 16:11:25 +0000 Subject: Edit comments some more. Remove a testing print statement. --- macosx/tkMacOSXMenu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 5583bbf..102ab2a 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -1835,7 +1835,9 @@ TkpComputeMenubarGeometry( * Draws the given menu entry at the given coordinates with the given * attributes. This is a no-op on macOS since the menus are drawn by * the Apple window manager, which also handles all events related to - * selecting menu items. + * selecting menu items. This function is only called for tearoff + * menus, which are not supported on macOS but do get drawn as nearly + * invisible 1 pixel wide windows on macOS * * Results: * None. @@ -1861,7 +1863,6 @@ TkpDrawMenuEntry( TCL_UNUSED(int)) /* Whether or not to draw the cascade arrow * for cascade items. */ { - fprintf(stderr, "TkpDrawMenuEntry\n"); } #pragma mark Obsolete -- cgit v0.12 From 14ad08440d4685add2fb7ba440f4ab828153c5e8 Mon Sep 17 00:00:00 2001 From: culler Date: Thu, 19 Nov 2020 18:47:57 +0000 Subject: Implement option 3 - ignore menu colors on macOS. --- doc/menu.n | 18 ++++++++++-------- library/demos/menu.tcl | 11 +++++++++-- macosx/tkMacOSXMenu.c | 33 ++++++++++++++++----------------- 3 files changed, 35 insertions(+), 27 deletions(-) diff --git a/doc/menu.n b/doc/menu.n index 338ce6a..e08448a 100644 --- a/doc/menu.n +++ b/doc/menu.n @@ -40,7 +40,7 @@ top. If so, it will exist as entry 0 of the menu and the other entries will number starting at 1. The default menu bindings arrange for the menu to be torn off when the tear-off entry is invoked. -This option is ignored under Aqua/Mac OS X, where menus cannot +This option is ignored under Aqua/MacOS, where menus cannot be torn off. .OP \-tearoffcommand tearOffCommand TearOffCommand If this option has a non-empty value, then it specifies a Tcl command @@ -54,7 +54,7 @@ and menu \fB.x.y\fR is torn off to create a new menu \fB.x.tearoff1\fR, then the command .QW "\fBa b .x.y .x.tearoff1\fR" will be invoked. -This option is ignored under Aqua/Mac OS X, where menus cannot +This option is ignored under Aqua/MacOS, where menus cannot be torn off. .OP \-title title Title The string will be used to title the window created when this menu is @@ -523,8 +523,8 @@ supported by all entry types. \fB\-activebackground \fIvalue\fR . Specifies a background color to use for displaying this entry when it -is active. -If this option is specified as an empty string (the default), then the +is active. This option is ignored on Aqua/MacOS. +If it is specified as an empty string (the default), then the \fB\-activebackground\fR option for the overall menu is used. If the \fBtk_strictMotif\fR variable has been set to request strict Motif compliance, then this option is ignored and the \fB\-background\fR @@ -534,7 +534,7 @@ This option is not available for separator or tear-off entries. \fB\-activeforeground \fIvalue\fR . Specifies a foreground color to use for displaying this entry when it -is active. +is active. This option is ignored on Aqua/macOS. If this option is specified as an empty string (the default), then the \fB\-activeforeground\fR option for the overall menu is used. This option is not available for separator or tear-off entries. @@ -552,7 +552,8 @@ for separator or tear-off entries. . Specifies a background color to use for displaying this entry when it is in the normal state (neither active nor disabled). -If this option is specified as an empty string (the default), then the +This option is ignored on Aqua/macOS. +If it is specified as an empty string (the default), then the \fB\-background\fR option for the overall menu is used. This option is not available for separator or tear-off entries. .TP @@ -573,7 +574,7 @@ This option is not available for separator or tear-off entries. When this option is zero, the entry appears below the previous entry. When this option is one, the entry appears at the top of a new column in the menu. -This option is ignored on Aqua/Mac OS X, where menus are always a single +This option is ignored on Aqua/macOS, where menus are always a single column. .TP \fB\-command \fIvalue\fR @@ -603,7 +604,8 @@ This option is not available for separator or tear-off entries. . Specifies a foreground color to use for displaying this entry when it is in the normal state (neither active nor disabled). -If this option is specified as an empty string (the default), then the +This option is ignored on Aqua/macOS. +If it is specified as an empty string (the default), then the \fB\-foreground\fR option for the overall menu is used. This option is not available for separator or tear-off entries. .TP diff --git a/library/demos/menu.tcl b/library/demos/menu.tcl index 56a29da..62991f3 100644 --- a/library/demos/menu.tcl +++ b/library/demos/menu.tcl @@ -145,9 +145,16 @@ set m $w.menu.colors $w.menu add cascade -label "Colors" -menu $m -underline 1 menu $m -tearoff 1 if {[tk windowingsystem] eq "aqua"} { - # In aqua, changing the background actually adds a colored underline. + # Aqua ignores the -background and -foreground options, but a compound + # button can be used for selecting colors. foreach i {red orange yellow green blue} { - $m add command -label $i -foreground $i -command [list \ + image create photo image_$i -height 16 -width 16 + image_$i put black -to 0 0 16 1 + image_$i put black -to 0 1 1 16 + image_$i put black -to 0 15 16 16 + image_$i put black -to 15 1 16 16 + image_$i put $i -to 1 1 15 15 + $m add command -label $i -image image_$i -compound left -command [list \ puts "You invoked \"$i\"" ] } } else { diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index ee05eb5..a28553d 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -725,38 +725,37 @@ TkpConfigureMenuEntry( [title substringToIndex:[title length] - 3], 0x2026]; } } + + [menuItem setTitle:title]; fontAttributes = TkMacOSXNSFontAttributesForFont(Tk_GetFontFromObj( mePtr->menuPtr->tkwin, fontPtr)); attributes = [fontAttributes mutableCopy]; - if (gc->foreground != defaultFg) { - /* - * Apple's default foreground color changes to white when the menuitem is - * selected. If a custom foreground color is used then the color will be - * the same for selected and unselected menu items. - */ +#if 0 + + /* + * The -background and -foreground options are now ignored in Aqua. + * See ticket [635167af14]. + */ + if (gc->foreground != defaultFg) { NSColor *fgcolor = TkMacOSXGetNSColor(gc, gc->foreground); [attributes setObject:fgcolor forKey:NSForegroundColorAttributeName]; } if (gc->background != defaultBg) { - - /* - * Setting a background color looks awful. But setting the background should - * not be the same as setting the foreground. As a compromise, if the background - * color is set we draw an underline in that color. - */ NSColor *bgcolor = TkMacOSXGetNSColor(gc, gc->background); [attributes setObject:bgcolor - forKey:NSUnderlineColorAttributeName]; - [attributes setObject:[NSNumber numberWithInt:NSUnderlineStyleDouble] - forKey:NSUnderlineStyleAttributeName]; + forKey:NSBackgroundColorAttributeName]; } - attributedTitle = [[[NSAttributedString alloc] - initWithString:title attributes:attributes] autorelease]; + +#endif + + attributedTitle = [[NSAttributedString alloc] initWithString:title + attributes:attributes]; [menuItem setAttributedTitle:attributedTitle]; + [menuItem setEnabled:!(mePtr->state == ENTRY_DISABLED)]; [menuItem setState:((mePtr->type == CHECK_BUTTON_ENTRY || mePtr->type == RADIO_BUTTON_ENTRY) && mePtr->indicatorOn && -- cgit v0.12 From 55d9f1fa1befa6bf7727ab077d3a1982d7328beb Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 20 Nov 2020 10:22:52 +0000 Subject: Fix [ec3f444cfd]: typo in tkInt.h? --- generic/tkInt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tkInt.h b/generic/tkInt.h index b169ad6..006d999 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -883,7 +883,7 @@ typedef struct { char trans_chars[XMaxTransChars]; /* translated characters */ unsigned char nbytes; -#elif !defined(MAC_OSC_TK) +#elif !defined(MAC_OSX_TK) char *charValuePtr; /* A pointer to a string that holds the key's * %A substitution text (before backslash * adding), or NULL if that has not been -- cgit v0.12 From 0afc15120b641d296506f932dddb14601558b95f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 20 Nov 2020 12:10:57 +0000 Subject: Second shot at github actions Linux build --- .github/workflows/linux-build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 3974499..de234fd 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -2,7 +2,7 @@ name: Linux on: [push] jobs: gcc: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: matrix: cfgopt: @@ -19,12 +19,12 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Prepare - run: touch ../doc/man.macros tkStubInit.c;sudo apt-get install tcl8.6-dev libx11-dev libxss-dev + run: touch ../doc/man.macros tkStubInit.c;sudo apt-get install tcl8.6-dev libxss-dev working-directory: generic - name: Configure ${{ matrix.cfgopt }} run: | mkdir "${HOME}/install" - ./configure ${CFGOPT} "--prefix=$HOME/install" || (cat config.log && exit 1) + ./configure ${CFGOPT} "--prefix=$HOME/install" -with-tcl=/usr/lib/tcl8.6 || (cat config.log && exit 1) env: CFGOPT: ${{ matrix.cfgopt }} - name: Build @@ -42,6 +42,6 @@ jobs: - name: Create Distribution Package run: | make dist - - name: Convert Documentation to HTML - run: | - make html-tk +# - name: Convert Documentation to HTML +# run: | +# make html-tk -- cgit v0.12 From 899fc193d72b84d11dfc2c0d824524f6430238a6 Mon Sep 17 00:00:00 2001 From: marc_culler Date: Fri, 20 Nov 2020 14:27:54 +0000 Subject: Correction to the state synchronization loop -- many thanks to anonymous --- macosx/tkMacOSXMenu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 102ab2a..84c665b 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -787,7 +787,7 @@ TkpConfigureMenuEntry( for (int i = 0; i < menuRefPtr->menuPtr->numEntries; i++) { TkMenuEntry *submePtr = menuRefPtr->menuPtr->entries[i]; - NSMenuItem *item = (NSMenuItem *) mePtr->platformEntryData; + NSMenuItem *item = (NSMenuItem *) submePtr->platformEntryData; [item setEnabled:(submePtr->state != ENTRY_DISABLED)]; } } -- cgit v0.12 From 59e8254d87e875d999e5b6ed667f418abdb94169 Mon Sep 17 00:00:00 2001 From: dkf Date: Fri, 20 Nov 2020 15:09:17 +0000 Subject: Advanced build; this one works and is full function --- .github/workflows/linux-build.yml | 164 ++++++++++++++++++++++++++++++++------ unix/tkConfig.h.in | 25 +++++- 2 files changed, 159 insertions(+), 30 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index de234fd..fc16e31 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -1,47 +1,159 @@ -name: Linux +name: Linux Build and Test on: [push] +defaults: + run: + shell: bash + working-directory: tk/unix +env: + ERROR_ON_FAILURES: 1 jobs: - gcc: - runs-on: ubuntu-20.04 + build: + runs-on: ubuntu-latest strategy: matrix: - cfgopt: + compiler: + - "gcc" + - "clang" + symbols: + - "no" + - "mem" + disables: - "" - "--disable-shared" - "--disable-xft" - "--disable-xss" - - "--enable-symbols" - defaults: - run: - shell: bash - working-directory: unix steps: - name: Checkout uses: actions/checkout@v2 - - name: Prepare - run: touch ../doc/man.macros tkStubInit.c;sudo apt-get install tcl8.6-dev libxss-dev - working-directory: generic - - name: Configure ${{ matrix.cfgopt }} + with: + path: tk + - name: Checkout Tcl + uses: actions/checkout@v2 + with: + repository: tcltk/tcl + ref: core-8-branch + path: tcl + - name: Setup Environment (compiler=${{ matrix.compiler }}) run: | - mkdir "${HOME}/install" - ./configure ${CFGOPT} "--prefix=$HOME/install" -with-tcl=/usr/lib/tcl8.6 || (cat config.log && exit 1) + sudo apt-get install tcl8.6-dev libx11-dev libxss-dev + mkdir "$HOME/install dir" + touch tk/doc/man.macros tk/generic/tkStubInit.c + echo "TEST_INSTALL_DIR=$HOME/install dir" >> $GITHUB_ENV + echo "CFGOPT=$CFGOPT --with-tcl=/usr/lib/tcl8.6" >> $GITHUB_ENV + echo "CC=$COMPILER" >> $GITHUB_ENV + echo "TOOL_DIR=$(cd tcl/tools;pwd)" >> $GITHUB_ENV + echo "BUILD_CONFIG_ID=$OPTS" >> $GITHUB_ENV + working-directory: "." env: - CFGOPT: ${{ matrix.cfgopt }} + CFGOPT: --enable-symbols=${{ matrix.symbols }} ${{ matrix.disables }} + COMPILER: ${{ matrix.compiler }} + OPTS: ${{ matrix.compiler }}-${{ matrix.symbols }}${{ matrix.disables }} + - name: Configure (symbols=${{ matrix.symbols }} opts=${{ matrix.disables }}) + run: | + ./configure $CFGOPT "--prefix=$TEST_INSTALL_DIR" || { + cat config.log + echo "::error::Failure during Configure" + exit 1 + } - name: Build run: | - make binaries libraries + make binaries libraries || { + echo "::error::Failure during Build" + exit 1 + } - name: Build Test Harness run: | - make tktest -# - name: Run Tests -# run: | -# make test + make tktest || { + echo "::error::Failure during Build" + exit 1 + } - name: Test-Drive Installation run: | - make install + make install || { + echo "::error::Failure during Install" + exit 1 + } - name: Create Distribution Package run: | - make dist -# - name: Convert Documentation to HTML -# run: | -# make html-tk + make dist || { + echo "::error::Failure during Distribute" + exit 1 + } + - name: Convert Documentation to HTML + run: | + make html-tk TOOL_DIR=$TOOL_DIR || { + echo "::error::Failure during Distribute" + exit 1 + } + - name: Discover Version ID + if: ${{ env.BUILD_CONFIG_ID == 'gcc-no' }} + run: | + cd /tmp/dist + echo "VERSION=`ls -d tk* | sed 's/tk//'`" >> $GITHUB_ENV + - name: Upload Source Distribution + if: ${{ env.BUILD_CONFIG_ID == 'gcc-no' }} + uses: actions/upload-artifact@v2 + with: + name: Tk ${{ env.VERSION }} Source distribution (unofficial) + path: | + /tmp/dist/tk* + !/tmp/dist/tk*/html/** + - name: Upload Documentation Distribution + if: ${{ env.BUILD_CONFIG_ID == 'gcc-no' }} + uses: actions/upload-artifact@v2 + with: + name: Tk ${{ env.VERSION }} HTML documentation (unofficial) + path: /tmp/dist/tk*/html + test: + runs-on: ubuntu-latest + strategy: + matrix: + compiler: + - "gcc" + symbols: + - "no" + - "mem" + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + path: tk + - name: Setup Environment (compiler=${{ matrix.compiler }}) + run: | + sudo apt-get install tcl8.6-dev libx11-dev libxss-dev xvfb + mkdir "$HOME/install dir" + touch tk/doc/man.macros tk/generic/tkStubInit.c + echo "TEST_INSTALL_DIR=$HOME/install dir" >> $GITHUB_ENV + echo "CFGOPT=$CFGOPT --with-tcl=/usr/lib/tcl8.6" >> $GITHUB_ENV + echo "CC=$COMPILER" >> $GITHUB_ENV + working-directory: "." + env: + CFGOPT: --enable-symbols=${{ matrix.symbols }} + COMPILER: ${{ matrix.compiler }} + - name: Configure (symbols=${{ matrix.symbols }}) + run: | + ./configure $CFGOPT "--prefix=$TEST_INSTALL_DIR" || { + cat config.log + echo "::error::Failure during Configure" + exit 1 + } + - name: Build + run: | + make binaries libraries tktest || { + echo "::error::Failure during Build" + exit 1 + } + - name: Run Tests + run: | + xvfb-run --auto-servernum make test-classic | tee out-classic.txt || { + echo "::error::Failure during Test" + exit 1 + } + xvfb-run --auto-servernum make test-ttk | tee out-ttk.txt || { + echo "::error::Failure during Test" + exit 1 + } + cat out-classic.txt out-ttk.txt | grep -q "Failed 0" || { + echo "::error::Failure during Test" + exit 1 + } diff --git a/unix/tkConfig.h.in b/unix/tkConfig.h.in index 918f9c2..eb1d61e 100644 --- a/unix/tkConfig.h.in +++ b/unix/tkConfig.h.in @@ -4,6 +4,9 @@ #ifndef _TKCONFIG #define _TKCONFIG +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + /* Is pthread_attr_get_np() declared in ? */ #undef ATTRGETNP_NOT_DECLARED @@ -19,6 +22,9 @@ /* Do we have access to Darwin CoreFoundation.framework? */ #undef HAVE_COREFOUNDATION +/* Is 'DIR64' in ? */ +#undef HAVE_DIR64 + /* Do we have the intptr_t type? */ #undef HAVE_INTPTR_T @@ -145,6 +151,9 @@ /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME +/* Define to the home page for this package. */ +#undef PACKAGE_URL + /* Define to the version of this package. */ #undef PACKAGE_VERSION @@ -193,9 +202,17 @@ /* Do we want to use the threaded memory allocator? */ #undef USE_THREAD_ALLOC -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -#undef WORDS_BIGENDIAN +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif /* Are Darwin SUSv3 extensions available? */ #undef _DARWIN_C_SOURCE @@ -244,7 +261,7 @@ /* Define to `int' if does not define. */ #undef pid_t -/* Define to `unsigned' if does not define. */ +/* Define to `unsigned int' if does not define. */ #undef size_t /* Do we want to use the strtod() in compat? */ -- cgit v0.12 From ea389baf3f559f8c876aa05e5d358f7b2f2e3a1a Mon Sep 17 00:00:00 2001 From: dkf Date: Fri, 20 Nov 2020 15:23:42 +0000 Subject: Test build for Windows --- .github/workflows/win-build.yml | 43 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/win-build.yml diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml new file mode 100644 index 0000000..c05d404 --- /dev/null +++ b/.github/workflows/win-build.yml @@ -0,0 +1,43 @@ +name: Windows Build and Test +on: [push] +env: + ERROR_ON_FAILURES: 1 +jobs: + MSVC: + runs-on: windows-latest + defaults: + run: + shell: powershell + working-directory: win + # Using powershell means we need to explicitly stop on failure + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Init MSVC + uses: ilammy/msvc-dev-cmd@v1 + - name: Install Tcl + run: | + &choco install -y magicsplat-tcl-tk + if ($lastexitcode -ne 0) { + throw "choco exit code: $lastexitcode" + } + - name: Build + run: | + &nmake -f makefile.vc all + if ($lastexitcode -ne 0) { + throw "nmake exit code: $lastexitcode" + } + - name: Build Test Harness + run: | + &nmake -f makefile.vc tktest + if ($lastexitcode -ne 0) { + throw "nmake exit code: $lastexitcode" + } + - name: Run Tests + run: | + &nmake -f makefile.vc test + if ($lastexitcode -ne 0) { + throw "nmake exit code: $lastexitcode" + } + env: + CI_BUILD_WITH_MSVC: 1 -- cgit v0.12 From eb2febde5db4795e43470d20e4d35b856f875466 Mon Sep 17 00:00:00 2001 From: dkf Date: Fri, 20 Nov 2020 15:28:46 +0000 Subject: Added MSYS build+test --- .github/workflows/win-build.yml | 44 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml index c05d404..21841a4 100644 --- a/.github/workflows/win-build.yml +++ b/.github/workflows/win-build.yml @@ -41,3 +41,47 @@ jobs: } env: CI_BUILD_WITH_MSVC: 1 + MSYS-gcc: + runs-on: windows-latest + defaults: + run: + shell: bash + working-directory: win + strategy: + matrix: + symbols: + - "no" + - "mem" + - "all" + # Using powershell means we need to explicitly stop on failure + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Install MSYS2, Make and Tcl + run: choco install -y msys2 make magicsplat-tcl-tk + - name: Prepare + run: | + touch tkStubInit.c + mkdir "${HOME}/install dir" + working-directory: generic + - name: Configure (symbols=${{ matrix.symbols }}) + run: | + ./configure ${CFGOPT} "--prefix=$HOME/install dir" || { + cat config.log + echo "::error::Failure during Configure" + exit 1 + } + env: + CFGOPT: --enable-64bit --enable-symbols=${{ matrix.symbols }} + - name: Build + run: | + make all tktest || { + echo "::error::Failure during Build" + exit 1 + } + - name: Run Tests + run: | + make test || { + echo "::error::Failure during Test" + exit 1 + } -- cgit v0.12 From 235ca69ece1a4a34ee0ecc5af640e3d1d75a2662 Mon Sep 17 00:00:00 2001 From: dkf Date: Fri, 20 Nov 2020 15:40:07 +0000 Subject: Test build for macOS --- .github/workflows/mac-build.yml | 76 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/mac-build.yml diff --git a/.github/workflows/mac-build.yml b/.github/workflows/mac-build.yml new file mode 100644 index 0000000..bd8cee1 --- /dev/null +++ b/.github/workflows/mac-build.yml @@ -0,0 +1,76 @@ +name: macOS Build and Test +on: [push] +env: + ERROR_ON_FAILURES: 1 +jobs: + with-Xcode: + runs-on: macos-latest + defaults: + run: + shell: bash + working-directory: macosx + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Prepare + run: touch tkStubInit.c + working-directory: generic + - name: Build + run: make all + - name: Run Tests + run: make test styles=develop + env: + MAC_CI: 1 + Unix-like: + runs-on: macos-latest + strategy: + matrix: + symbols: + - "no" + - "mem" + dtrace: + - "no" + - "yes" + defaults: + run: + shell: bash + working-directory: unix + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Prepare + run: | + touch tkStubInit.c + mkdir "$HOME/install dir" + working-directory: generic + - name: Configure (symbols=${{ matrix.symbols }} dtrace=${{ matrix.dtrace }}) + # Note that macOS is always a 64 bit platform + run: | + ./configure --enable-64bit ${CFGOPT} "--prefix=$HOME/install dir" || { + cat config.log + echo "::error::Failure during Configure" + exit 1 + } + env: + CFGOPT: --enable-symbols=${{ matrix.symbols }} --enable-dtrace=${{ matrix.dtrace }} + - name: Build + run: | + make all tktest || { + echo "::error::Failure during Build" + exit 1 + } + - name: Run Tests + run: | + make test || { + echo "::error::Failure during Test" + exit 1 + } + env: + MAC_CI: 1 + - name: Trial Installation + run: | + make install || { + cat config.log + echo "::error::Failure during Install" + exit 1 + } -- cgit v0.12 From 178e558637579b4055c7c22f05069d654f09ab2f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 20 Nov 2020 16:07:10 +0000 Subject: Use shorter workflow "name". Use ubuntu-20.04 because ubuntu-latest will soon (any day now) be ubuntu-20.04 --- .github/workflows/linux-build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index fc16e31..901105e 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -1,4 +1,4 @@ -name: Linux Build and Test +name: Linux on: [push] defaults: run: @@ -8,7 +8,7 @@ env: ERROR_ON_FAILURES: 1 jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: matrix: compiler: @@ -105,7 +105,7 @@ jobs: name: Tk ${{ env.VERSION }} HTML documentation (unofficial) path: /tmp/dist/tk*/html test: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: matrix: compiler: -- cgit v0.12 From a6c1ce56ebc91c013dfc23d88b40c9deb0ebe31b Mon Sep 17 00:00:00 2001 From: marc_culler Date: Fri, 20 Nov 2020 18:15:59 +0000 Subject: Remove two duplicate lines of code. --- macosx/tkMacOSXInit.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index 996fc05..b89fb57 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -129,13 +129,6 @@ static int TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip, [self _setupMenus]; /* - * Initialize graphics. - */ - - TkMacOSXUseAntialiasedText(_eventInterp, -1); - TkMacOSXInitCGDrawing(_eventInterp, TRUE, 0); - - /* * It is not safe to force activation of the NSApp until this method is * called. Activating too early can cause the menu bar to be unresponsive. * The call to activateIgnoringOtherApps was moved here to avoid this. -- cgit v0.12 From f25fa4b384c028e8a0edf3556c25ded664432a66 Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 21 Nov 2020 15:37:17 +0000 Subject: Testing with msys now operational --- .github/workflows/win-build.yml | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml index 21841a4..ebc0be9 100644 --- a/.github/workflows/win-build.yml +++ b/.github/workflows/win-build.yml @@ -57,16 +57,38 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - - name: Install MSYS2, Make and Tcl - run: choco install -y msys2 make magicsplat-tcl-tk + - name: Checkout + uses: actions/checkout@v2 + with: + repository: tcltk/tcl + ref: core-8-branch + path: tcl + - name: Install MSYS2, Make + run: choco install -y msys2 make - name: Prepare run: | touch tkStubInit.c - mkdir "${HOME}/install dir" + mkdir "${HOME}/install_dir" + echo "INSTALL_DIR=${HOME}/install_dir" >> $GITHUB_ENV working-directory: generic + - name: Configure and Build Tcl + run: | + ./configure ${CFGOPT} "--prefix=$INSTALL_DIR" || { + cat config.log + echo "::warning::Failure during Tcl Configure" + exit 1 + } + make all install || { + echo "::warning::Failure during Tcl Build" + exit 1 + } + echo "TCL_CONFIG_PATH=`pwd`" >> $GITHUB_ENV + env: + CFGOPT: --enable-64bit --enable-symbols=${{ matrix.symbols }} + working-directory: tcl/win - name: Configure (symbols=${{ matrix.symbols }}) run: | - ./configure ${CFGOPT} "--prefix=$HOME/install dir" || { + ./configure ${CFGOPT} "--prefix=$HOME/INSTALL_DIR" "--with-tcl=$TCL_CONFIG_PATH" || { cat config.log echo "::error::Failure during Configure" exit 1 @@ -81,7 +103,15 @@ jobs: } - name: Run Tests run: | - make test || { + make test-classic | tee out-classic.txt || { + echo "::error::Failure during Test" + exit 1 + } + make test-ttk | tee out-ttk.txt || { + echo "::error::Failure during Test" + exit 1 + } + cat out-classic.txt out-ttk.txt | grep -q "Failed [1-9]" && { echo "::error::Failure during Test" exit 1 } -- cgit v0.12 From e693b79d85cfff6f930f424c4874121f22786f4a Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 21 Nov 2020 16:14:50 +0000 Subject: MSVC now runs tests --- .github/workflows/win-build.yml | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml index ebc0be9..d026aa0 100644 --- a/.github/workflows/win-build.yml +++ b/.github/workflows/win-build.yml @@ -8,19 +8,35 @@ jobs: defaults: run: shell: powershell - working-directory: win + working-directory: tk/win # Using powershell means we need to explicitly stop on failure steps: - name: Checkout uses: actions/checkout@v2 + with: + path: tk + - name: Checkout + uses: actions/checkout@v2 + with: + repository: tcltk/tcl + ref: core-8-branch + path: tcl + - name: Make Install Location + working-directory: . + shell: bash + run: | + mkdir install + cd install + echo "INSTALLDIR=`pwd`" >> $GITHUB_ENV - name: Init MSVC uses: ilammy/msvc-dev-cmd@v1 - - name: Install Tcl + - name: Build Tcl run: | - &choco install -y magicsplat-tcl-tk + &nmake -f makefile.vc release install if ($lastexitcode -ne 0) { - throw "choco exit code: $lastexitcode" + throw "nmake exit code: $lastexitcode" } + working-directory: tcl/win - name: Build run: | &nmake -f makefile.vc all @@ -41,6 +57,18 @@ jobs: } env: CI_BUILD_WITH_MSVC: 1 + - name: Build Help + run: | + &nmake -f makefile.vc htmlhelp + if ($lastexitcode -ne 0) { + throw "nmake exit code: $lastexitcode" + } + - name: Install + run: | + &nmake -f makefile.vc install + if ($lastexitcode -ne 0) { + throw "nmake exit code: $lastexitcode" + } MSYS-gcc: runs-on: windows-latest defaults: -- cgit v0.12 From 6c04d6a60084b078712b32de154a9e2235183bbc Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 21 Nov 2020 16:31:27 +0000 Subject: Now the testing causes the build to fail when a test fails. As it should be. --- .github/workflows/win-build.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml index d026aa0..924b0b7 100644 --- a/.github/workflows/win-build.yml +++ b/.github/workflows/win-build.yml @@ -51,12 +51,21 @@ jobs: } - name: Run Tests run: | - &nmake -f makefile.vc test - if ($lastexitcode -ne 0) { - throw "nmake exit code: $lastexitcode" + nmake -f makefile.vc test-classic | tee out-classic.txt || { + echo "::error::Failure during Test" + exit 1 + } + nmake -f makefile.vc test-ttk | tee out-ttk.txt || { + echo "::error::Failure during Test" + exit 1 + } + cat out-classic.txt out-ttk.txt | grep -q "Failed [1-9]" && { + echo "::error::Failure during Test" + exit 1 } env: CI_BUILD_WITH_MSVC: 1 + shell: bash - name: Build Help run: | &nmake -f makefile.vc htmlhelp -- cgit v0.12 From 59c2a3fde8d685aa1a4267f0dc943c6e61ff4cee Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 21 Nov 2020 16:32:52 +0000 Subject: Shorten name --- .github/workflows/win-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml index 924b0b7..6c02a9e 100644 --- a/.github/workflows/win-build.yml +++ b/.github/workflows/win-build.yml @@ -1,4 +1,4 @@ -name: Windows Build and Test +name: Windows on: [push] env: ERROR_ON_FAILURES: 1 -- cgit v0.12 From cc103187fd9e876ecb4a6fcf4455d18454913768 Mon Sep 17 00:00:00 2001 From: dkf Date: Sun, 22 Nov 2020 00:34:36 +0000 Subject: My kingdom for a simple working headless Xserver! The key was: 1. Using Xquartz to get the headers 2. Running Xvfb from that package (we want to be headless) 3. An amazing hack from https://discussions.apple.com/thread/3989835, by "Gratino": > I had the same issue where X11/XQuartz would not start because /tmp/.{X11,ICE,font}-unix were not created properly as an unprivileged user (me). They were removed (along with everything else) from /tmp on startup. > > I resolved the issue by putting this line at the bottom of my /etc/rc.local file (runs as root on bootup): > > /opt/X11/lib/X11/xinit/privileged_startx.d/10-tmpdirs > > thus the needed dirs are created at bootup by root and all is well. It turns out (from much experimentation) that this is an issue when installing Xquartz in a Github Actions workflow, as we don't want to reboot the image yet the installation assumes that that's what we'll do. Not many people have hit this before, but that's because they're not trying to do headless X11-enabled testing with macOS. We're world leaders in awful kluges! 4. Miscellaneous small hacks, of course. --- .github/workflows/mac-build.yml | 130 +++++++++++++++++++++++++++++++++------- 1 file changed, 109 insertions(+), 21 deletions(-) diff --git a/.github/workflows/mac-build.yml b/.github/workflows/mac-build.yml index bd8cee1..2760be9 100644 --- a/.github/workflows/mac-build.yml +++ b/.github/workflows/mac-build.yml @@ -1,4 +1,4 @@ -name: macOS Build and Test +name: macOS on: [push] env: ERROR_ON_FAILURES: 1 @@ -8,17 +8,45 @@ jobs: defaults: run: shell: bash - working-directory: macosx + working-directory: tk/macosx steps: - - name: Checkout + - name: Check out Tk uses: actions/checkout@v2 - - name: Prepare - run: touch tkStubInit.c - working-directory: generic + with: + path: tk + - name: Check out Tcl + uses: actions/checkout@v2 + with: + repository: tcltk/tcl + ref: core-8-branch + path: tcl + - name: Prepare checked out repositories + run: | + touch tk/generic/tkStubInit.c + mkdir build + echo "BUILD_DIR=`cd build && pwd`" >> $GITHUB_ENV + echo "DESTDIR=`cd build && pwd`" >> $GITHUB_ENV + working-directory: . + - name: Build Tcl + run: | + make all + working-directory: tcl/macosx - name: Build - run: make all + run: | + make all install || { + echo "::error::Failure during Build" + exit 1 + } - name: Run Tests - run: make test styles=develop + run: | + make test styles=develop | tee out-tests.txt || { + echo "::error::Failure during Test" + exit 1 + } + cat out-tests.txt | grep -q "Failed[[:space:]][[:space:]]*[1-9]" && { + echo "::error::Failure during Test" + exit 1 + } env: MAC_CI: 1 Unix-like: @@ -26,24 +54,61 @@ jobs: strategy: matrix: symbols: - - "no" - - "mem" - dtrace: - - "no" - - "yes" + - 'no' + - 'mem' + options: + - '--enable-aqua' + - '--disable-aqua' defaults: run: shell: bash - working-directory: unix + working-directory: tk/unix steps: - - name: Checkout + - name: Check out Tk uses: actions/checkout@v2 - - name: Prepare + with: + path: tk + - name: Check out Tcl + uses: actions/checkout@v2 + with: + repository: tcltk/tcl + ref: core-8-branch + path: tcl + - name: Prepare checked out repositories run: | touch tkStubInit.c mkdir "$HOME/install dir" - working-directory: generic - - name: Configure (symbols=${{ matrix.symbols }} dtrace=${{ matrix.dtrace }}) + echo "USE_XVFB=$SET_DISPLAY" >> $GITHUB_ENV + working-directory: tk/generic + env: + SET_DISPLAY: ${{ contains(matrix.options, '--disable-aqua') }} + - name: Add X11 (if required) + if: ${{ env.USE_XVFB }} + # This involves black magic + run: | + brew cask install xquartz + sudo /opt/X11/lib/X11/xinit/privileged_startx.d/10-tmpdirs || true + working-directory: . + - name: Build Tcl + # Note that macOS is always a 64 bit platform + run: | + ./configure --enable-64bit ${CFGOPT} "--prefix=$HOME/install dir" || { + cat config.log + echo "::error::Failure during Tcl Configure" + exit 1 + } + make all || { + echo "::error::Failure during Tcl Build" + exit 1 + } + make install || { + echo "::error::Failure during Tcl Install" + exit 1 + } + working-directory: tcl/unix + env: + CFGOPT: --enable-symbols=${{ matrix.symbols }} + - name: Configure (symbols=${{ matrix.symbols }} ${{matrix.options }}) # Note that macOS is always a 64 bit platform run: | ./configure --enable-64bit ${CFGOPT} "--prefix=$HOME/install dir" || { @@ -52,7 +117,7 @@ jobs: exit 1 } env: - CFGOPT: --enable-symbols=${{ matrix.symbols }} --enable-dtrace=${{ matrix.dtrace }} + CFGOPT: --enable-symbols=${{ matrix.symbols }} ${{matrix.options }} - name: Build run: | make all tktest || { @@ -61,13 +126,36 @@ jobs: } - name: Run Tests run: | - make test || { + if [ $USE_XVFB == true ]; then + function runXvfb { + PATH=$PATH:/opt/X11/bin + Xvfb $1 & + XVFB_PID=$! + echo Launched Xvfb $1 as process $XVFB_PID >&2 + trap "echo killing process $XVFB_PID... >&2; kill $XVFB_PID" 0 + export DISPLAY=$1 + sleep 2 + } + else + function runXvfb { + : do nothing + } + fi + ( runXvfb :0; make test-classic; exit $? ) | tee out-classic.txt || { + echo "::error::Failure during Test" + exit 1 + } + ( runXvfb :0; make test-ttk; exit $? ) | tee out-ttk.txt || { + echo "::error::Failure during Test" + exit 1 + } + cat out-classic.txt out-ttk.txt | grep -q "Failed[[:space:]][[:space:]]*[1-9]" && { echo "::error::Failure during Test" exit 1 } env: MAC_CI: 1 - - name: Trial Installation + - name: Carry out trial installation run: | make install || { cat config.log -- cgit v0.12 From e02e1dd873a053c3cd75ad61fcc798be27392557 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 23 Nov 2020 07:51:06 +0000 Subject: Tk 8.5 only builds with Tcl 8.5 or 8.6, not with Tcl 8.7 --- .github/workflows/linux-build.yml | 2 +- .github/workflows/mac-build.yml | 4 ++-- .github/workflows/win-build.yml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 901105e..5c4722e 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -31,7 +31,7 @@ jobs: uses: actions/checkout@v2 with: repository: tcltk/tcl - ref: core-8-branch + ref: core-8-5-branch path: tcl - name: Setup Environment (compiler=${{ matrix.compiler }}) run: | diff --git a/.github/workflows/mac-build.yml b/.github/workflows/mac-build.yml index 2760be9..f115aa3 100644 --- a/.github/workflows/mac-build.yml +++ b/.github/workflows/mac-build.yml @@ -18,7 +18,7 @@ jobs: uses: actions/checkout@v2 with: repository: tcltk/tcl - ref: core-8-branch + ref: core-8-5-branch path: tcl - name: Prepare checked out repositories run: | @@ -72,7 +72,7 @@ jobs: uses: actions/checkout@v2 with: repository: tcltk/tcl - ref: core-8-branch + ref: core-8-5-branch path: tcl - name: Prepare checked out repositories run: | diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml index 6c02a9e..37ad7e1 100644 --- a/.github/workflows/win-build.yml +++ b/.github/workflows/win-build.yml @@ -19,7 +19,7 @@ jobs: uses: actions/checkout@v2 with: repository: tcltk/tcl - ref: core-8-branch + ref: core-8-5-branch path: tcl - name: Make Install Location working-directory: . @@ -98,7 +98,7 @@ jobs: uses: actions/checkout@v2 with: repository: tcltk/tcl - ref: core-8-branch + ref: core-8-5-branch path: tcl - name: Install MSYS2, Make run: choco install -y msys2 make -- cgit v0.12 From 3acc3fa16194242d5c2699b32871a3e91c1595be Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 23 Nov 2020 09:42:02 +0000 Subject: Account for test-cases which we already know are failing on Ubuntu --- tests/bitmap.test | 2 +- tests/border.test | 2 +- tests/canvText.test | 2 +- tests/cursor.test | 2 +- tests/focus.test | 2 +- tests/font.test | 2 +- tests/pack.test | 2 +- tests/place.test | 2 +- tests/scrollbar.test | 2 +- tests/send.test | 2 +- tests/textDisp.test | 2 +- tests/textWind.test | 2 +- tests/unixFont.test | 2 +- tests/unixWm.test | 2 +- tests/winfo.test | 2 +- tests/wm.test | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/bitmap.test b/tests/bitmap.test index b0f0503..2b74c13 100644 --- a/tests/bitmap.test +++ b/tests/bitmap.test @@ -10,7 +10,7 @@ package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands -testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] test bitmap-1.1 {Tk_AllocBitmapFromObj - converting internal reps} testbitmap { set x gray25 diff --git a/tests/border.test b/tests/border.test index 7899cd9..33bdfd0 100644 --- a/tests/border.test +++ b/tests/border.test @@ -14,7 +14,7 @@ if {[testConstraint pseudocolor8]} { wm geom .t +0+0 } -testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] test border-1.1 {Tk_AllocBorderFromObj - converting internal reps} testborder { set x orange diff --git a/tests/canvText.test b/tests/canvText.test index 77eb735..f943525 100644 --- a/tests/canvText.test +++ b/tests/canvText.test @@ -21,7 +21,7 @@ set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*" set ay [font metrics $font -linespace] set ax [font measure $font 0] -testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] foreach test { {-anchor nw nw xyz {bad anchor position "xyz": must be n, ne, e, se, s, sw, w, nw, or center}} diff --git a/tests/cursor.test b/tests/cursor.test index 2a1d274..90c308e 100644 --- a/tests/cursor.test +++ b/tests/cursor.test @@ -10,7 +10,7 @@ package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands -testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] test cursor-1.1 {Tk_AllocCursorFromObj - converting internal reps} {testcursor} { set x watch diff --git a/tests/focus.test b/tests/focus.test index 62e00c8..7a35aa4 100644 --- a/tests/focus.test +++ b/tests/focus.test @@ -13,7 +13,7 @@ tcltest::loadTestedCommands button .b -text .b -relief raised -bd 2 pack .b -testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] proc focusSetup {} { catch {destroy .t} diff --git a/tests/font.test b/tests/font.test index 37e5739..a35c4db 100644 --- a/tests/font.test +++ b/tests/font.test @@ -17,7 +17,7 @@ update idletasks set defaultfontlist [font names] -testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] proc getnondefaultfonts {} { global defaultfontlist diff --git a/tests/pack.test b/tests/pack.test index a71fe7b..b75d5b2 100644 --- a/tests/pack.test +++ b/tests/pack.test @@ -10,7 +10,7 @@ package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands -testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] # Utility procedures: diff --git a/tests/place.test b/tests/place.test index e8419ea..07524fe 100644 --- a/tests/place.test +++ b/tests/place.test @@ -11,7 +11,7 @@ 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)]}] +testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] # XXX - This test file is woefully incomplete. At present, only a # few of the features are tested. diff --git a/tests/scrollbar.test b/tests/scrollbar.test index e69e1d2..5de464d 100644 --- a/tests/scrollbar.test +++ b/tests/scrollbar.test @@ -38,7 +38,7 @@ proc getTroughSize {w} { } } -testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] # XXX Note: this test file is woefully incomplete. Right now there are # only bits and pieces of tests. Please make this file more complete diff --git a/tests/send.test b/tests/send.test index 5bd1ade..fbf1555 100644 --- a/tests/send.test +++ b/tests/send.test @@ -15,7 +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)]}] +testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] # Compute a script that will load Tk into a child interpreter. diff --git a/tests/textDisp.test b/tests/textDisp.test index 520b26b..8285fa8 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -79,7 +79,7 @@ wm positionfrom . user wm deiconify . update -testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] # 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 diff --git a/tests/textWind.test b/tests/textWind.test index 8d81647..344687f 100644 --- a/tests/textWind.test +++ b/tests/textWind.test @@ -45,7 +45,7 @@ wm minsize . 1 1 wm positionfrom . user wm deiconify . -testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] test textWind-1.1 {basic tests of options} {fonts} { .t delete 1.0 end diff --git a/tests/unixFont.test b/tests/unixFont.test index f4cc3dd..5c22e3a 100644 --- a/tests/unixFont.test +++ b/tests/unixFont.test @@ -45,7 +45,7 @@ toplevel .b wm geom .b +0+0 update idletasks -testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] # Font should be fixed width and have chars missing below char 32, so can # test control char expansion and missing character code. diff --git a/tests/unixWm.test b/tests/unixWm.test index cd6394d..48f3e47 100644 --- a/tests/unixWm.test +++ b/tests/unixWm.test @@ -13,7 +13,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 failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] proc sleep ms { global x diff --git a/tests/winfo.test b/tests/winfo.test index b393b1a..ff7f23d 100644 --- a/tests/winfo.test +++ b/tests/winfo.test @@ -35,7 +35,7 @@ proc eatColors {w {options ""}} { update } -testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] # XXX - This test file is woefully incomplete. At present, only a # few of the winfo options are tested. diff --git a/tests/wm.test b/tests/wm.test index eeeea8d..ab2a7cc 100644 --- a/tests/wm.test +++ b/tests/wm.test @@ -27,7 +27,7 @@ proc stdWindow {} { update } -testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] # [raise] and [lower] may return before the window manager has completed the # operation. The raiseDelay procedure idles for a while to give the operation -- cgit v0.12 From a4e015529e6cb91f37bc48b5c80c3b24649186b9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 23 Nov 2020 11:44:42 +0000 Subject: Add 8.5 build status to README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index cf03af1..a9b50b4 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,10 @@ This is the **Tk 8.5.19** source distribution. You can get any source release of Tk from [our distribution site](https://sourceforge.net/projects/tcl/files/Tcl/). +Build Status: 8.5.19 +[![Build and Test Status: Linux 8.5](https://github.com/tcltk/tk/workflows/Linux/badge.svg?branch=core-8-5-branch)](https://github.com/tcltk/tk/actions?query=workflow%3A%22Linux%22+branch%3Acore-8-5-branch) +[![Build and Test Status: Windows 8.5](https://github.com/tcltk/tk/workflows/Windows/badge.svg?branch=core-8-5-branch)](https://github.com/tcltk/tk/actions?query=workflow%3A%22Windows%22+branch%3Acore-8-5-branch) +[![Build and Test Status: macOS 8.5](https://github.com/tcltk/tk/workflows/macOS/badge.svg?branch=core-8-5-branch)](https://github.com/tcltk/tk/actions?query=workflow%3A%22macOS%22+branch%3Acore-8-5-branch) ## 1. Introduction -- cgit v0.12 From abdf41d31c15013b28a2b342c5d4b941882a9c03 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 23 Nov 2020 12:07:14 +0000 Subject: See if we can build 8.5 on older github actions hardware (as Tcl 8.5 is no longer kept up-to-date for newer hardware) --- .github/workflows/linux-build.yml | 12 ++++++------ .github/workflows/mac-build.yml | 4 ++-- .github/workflows/win-build.yml | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 5c4722e..653e46f 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -8,7 +8,7 @@ env: ERROR_ON_FAILURES: 1 jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-18.04 strategy: matrix: compiler: @@ -35,11 +35,11 @@ jobs: path: tcl - name: Setup Environment (compiler=${{ matrix.compiler }}) run: | - sudo apt-get install tcl8.6-dev libx11-dev libxss-dev + sudo apt-get install tcl8.5-dev libx11-dev libxss-dev mkdir "$HOME/install dir" touch tk/doc/man.macros tk/generic/tkStubInit.c echo "TEST_INSTALL_DIR=$HOME/install dir" >> $GITHUB_ENV - echo "CFGOPT=$CFGOPT --with-tcl=/usr/lib/tcl8.6" >> $GITHUB_ENV + echo "CFGOPT=$CFGOPT --with-tcl=/usr/lib/tcl8.5" >> $GITHUB_ENV echo "CC=$COMPILER" >> $GITHUB_ENV echo "TOOL_DIR=$(cd tcl/tools;pwd)" >> $GITHUB_ENV echo "BUILD_CONFIG_ID=$OPTS" >> $GITHUB_ENV @@ -105,7 +105,7 @@ jobs: name: Tk ${{ env.VERSION }} HTML documentation (unofficial) path: /tmp/dist/tk*/html test: - runs-on: ubuntu-20.04 + runs-on: ubuntu-18.04 strategy: matrix: compiler: @@ -120,11 +120,11 @@ jobs: path: tk - name: Setup Environment (compiler=${{ matrix.compiler }}) run: | - sudo apt-get install tcl8.6-dev libx11-dev libxss-dev xvfb + sudo apt-get install tcl8.5-dev libx11-dev libxss-dev xvfb mkdir "$HOME/install dir" touch tk/doc/man.macros tk/generic/tkStubInit.c echo "TEST_INSTALL_DIR=$HOME/install dir" >> $GITHUB_ENV - echo "CFGOPT=$CFGOPT --with-tcl=/usr/lib/tcl8.6" >> $GITHUB_ENV + echo "CFGOPT=$CFGOPT --with-tcl=/usr/lib/tcl8.5" >> $GITHUB_ENV echo "CC=$COMPILER" >> $GITHUB_ENV working-directory: "." env: diff --git a/.github/workflows/mac-build.yml b/.github/workflows/mac-build.yml index f115aa3..bbf7190 100644 --- a/.github/workflows/mac-build.yml +++ b/.github/workflows/mac-build.yml @@ -4,7 +4,7 @@ env: ERROR_ON_FAILURES: 1 jobs: with-Xcode: - runs-on: macos-latest + runs-on: macos-10.15 defaults: run: shell: bash @@ -50,7 +50,7 @@ jobs: env: MAC_CI: 1 Unix-like: - runs-on: macos-latest + runs-on: macos-10.15 strategy: matrix: symbols: diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml index 37ad7e1..dffbb5a 100644 --- a/.github/workflows/win-build.yml +++ b/.github/workflows/win-build.yml @@ -4,7 +4,7 @@ env: ERROR_ON_FAILURES: 1 jobs: MSVC: - runs-on: windows-latest + runs-on: windows-2016 defaults: run: shell: powershell @@ -79,7 +79,7 @@ jobs: throw "nmake exit code: $lastexitcode" } MSYS-gcc: - runs-on: windows-latest + runs-on: windows-2016 defaults: run: shell: bash -- cgit v0.12 From bfda3dc9d27412361fcb6a6377ab7d2ba767a4cd Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 23 Nov 2020 14:02:13 +0000 Subject: Fix "make install" on Cygwin. Build github actions on windows-2019/macos-11.0 explicitly. --- .github/workflows/mac-build.yml | 4 ++-- .github/workflows/win-build.yml | 4 ++-- unix/Makefile.in | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/mac-build.yml b/.github/workflows/mac-build.yml index 247414a..ebd6342 100644 --- a/.github/workflows/mac-build.yml +++ b/.github/workflows/mac-build.yml @@ -4,7 +4,7 @@ env: ERROR_ON_FAILURES: 1 jobs: with-Xcode: - runs-on: macos-latest + runs-on: macos-11.0 defaults: run: shell: bash @@ -50,7 +50,7 @@ jobs: env: MAC_CI: 1 Unix-like: - runs-on: macos-latest + runs-on: macos-11.0 strategy: matrix: symbols: diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml index 518ffd5..87f824f 100644 --- a/.github/workflows/win-build.yml +++ b/.github/workflows/win-build.yml @@ -4,7 +4,7 @@ env: ERROR_ON_FAILURES: 1 jobs: MSVC: - runs-on: windows-latest + runs-on: windows-2019 defaults: run: shell: powershell @@ -79,7 +79,7 @@ jobs: throw "nmake exit code: $lastexitcode" } MSYS-gcc: - runs-on: windows-latest + runs-on: windows-2019 defaults: run: shell: bash diff --git a/unix/Makefile.in b/unix/Makefile.in index d0804fb..f8c7309 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -750,7 +750,7 @@ install-binaries: $(TK_STUB_LIB_FILE) $(TK_LIB_FILE) ${WISH_EXE} $(INSTALL_LIBRARY) "tk${MAJOR_VERSION}${MINOR_VERSION}.dll" "$(DLL_INSTALL_DIR)";\ chmod 555 "$(DLL_INSTALL_DIR)/tk${MAJOR_VERSION}${MINOR_VERSION}.dll";\ $(INSTALL_LIBRARY) "../win/libtk${MAJOR_VERSION}${MINOR_VERSION}.dll.a" "$(LIB_INSTALL_DIR)";\ - chmod 555 "$(LIB_INSTALL_DIR)/libtk${MAJOR_VERSION}${MINOR_VERSION}.a";\ + chmod 555 "$(LIB_INSTALL_DIR)/libtk${MAJOR_VERSION}${MINOR_VERSION}.dll.a";\ fi @echo "Installing ${WISH_EXE} as $(BIN_INSTALL_DIR)/wish$(VERSION)${EXE_SUFFIX}" @$(INSTALL_PROGRAM) ${WISH_EXE} "$(BIN_INSTALL_DIR)/wish$(VERSION)${EXE_SUFFIX}" -- cgit v0.12 From a5aa741c8f9282058212d28850e31a99198da14b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 24 Nov 2020 11:56:23 +0000 Subject: No need to install libx11-dev in github actions: It's already there --- .github/workflows/linux-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 4619f91..adb8d43 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -35,7 +35,7 @@ jobs: path: tcl - name: Setup Environment (compiler=${{ matrix.compiler }}) run: | - sudo apt-get install tcl8.5-dev libx11-dev libxss-dev + sudo apt-get install tcl8.5-dev libxss-dev mkdir "$HOME/install" touch tk/doc/man.macros tk/generic/tkStubInit.c echo "TEST_INSTALL_DIR=$HOME/install" >> $GITHUB_ENV @@ -120,7 +120,7 @@ jobs: path: tk - name: Setup Environment (compiler=${{ matrix.compiler }}) run: | - sudo apt-get install tcl8.5-dev libx11-dev libxss-dev xvfb + sudo apt-get install tcl8.5-dev libxss-dev xvfb mkdir "$HOME/install" touch tk/doc/man.macros tk/generic/tkStubInit.c echo "TEST_INSTALL_DIR=$HOME/install" >> $GITHUB_ENV -- cgit v0.12 From 6aa906fda2243df845ad149d6af16582f766e2f4 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 24 Nov 2020 12:14:37 +0000 Subject: Environment variable $TEST_INSTALL_DIR doesn't work this way, if it contains a space --- .github/workflows/linux-build.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index e886409..7bbbef9 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -38,7 +38,6 @@ jobs: sudo apt-get install tcl8.6-dev libxss-dev mkdir "$HOME/install dir" touch tk/doc/man.macros tk/generic/tkStubInit.c - echo "TEST_INSTALL_DIR=$HOME/install dir" >> $GITHUB_ENV echo "CFGOPT=$CFGOPT --with-tcl=/usr/lib/tcl8.6" >> $GITHUB_ENV echo "CC=$COMPILER" >> $GITHUB_ENV echo "TOOL_DIR=$(cd tcl/tools;pwd)" >> $GITHUB_ENV @@ -50,7 +49,7 @@ jobs: OPTS: ${{ matrix.compiler }}-${{ matrix.symbols }}${{ matrix.disables }} - name: Configure (symbols=${{ matrix.symbols }} opts=${{ matrix.disables }}) run: | - ./configure $CFGOPT "--prefix=$TEST_INSTALL_DIR" || { + ./configure $CFGOPT "--prefix=$HOME/install dir" || { cat config.log echo "::error::Failure during Configure" exit 1 @@ -123,7 +122,6 @@ jobs: sudo apt-get install tcl8.6-dev libxss-dev xvfb mkdir "$HOME/install dir" touch tk/doc/man.macros tk/generic/tkStubInit.c - echo "TEST_INSTALL_DIR=$HOME/install dir" >> $GITHUB_ENV echo "CFGOPT=$CFGOPT --with-tcl=/usr/lib/tcl8.6" >> $GITHUB_ENV echo "CC=$COMPILER" >> $GITHUB_ENV working-directory: "." @@ -132,7 +130,7 @@ jobs: COMPILER: ${{ matrix.compiler }} - name: Configure (symbols=${{ matrix.symbols }}) run: | - ./configure $CFGOPT "--prefix=$TEST_INSTALL_DIR" || { + ./configure $CFGOPT "--prefix=$HOME/install dir" || { cat config.log echo "::error::Failure during Configure" exit 1 -- cgit v0.12 From bad9520f9929fb5a81be88852fc7f6b171a57bec Mon Sep 17 00:00:00 2001 From: marc_culler Date: Tue, 24 Nov 2020 17:10:20 +0000 Subject: Fix [4a40c6cace]: On Aqua managed widgets are drawn with their former offset. Patch from Christopher Chavez. --- macosx/tkMacOSXWm.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 719f1f6..c100d38 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -2868,9 +2868,9 @@ WmIconwindowCmd( static int WmManageCmd( - TCL_UNUSED(Tk_Window), /* Main window of the application. */ - TkWindow *winPtr, /* Toplevel or Frame to work with */ - Tcl_Interp *interp, /* Current interpreter. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ + TkWindow *winPtr, /* Toplevel or Frame to work with */ + Tcl_Interp *interp, /* Current interpreter. */ TCL_UNUSED(int), /* Number of arguments. */ TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */ { @@ -2888,6 +2888,16 @@ WmManageCmd( Tcl_SetErrorCode(interp, "TK", "WM", "MANAGE", NULL); return TCL_ERROR; } + + /* + * Draw the managed widget at the top left corner of its toplevel. + * See [4a40c6cace]. + */ + + winPtr->changes.x -= macWin->xOff; + winPtr->changes.y -= macWin->yOff; + XMoveWindow(winPtr->display, winPtr->window, 0, 0); + TkFocusSplit(winPtr); Tk_UnmapWindow(frameWin); if (wmPtr == NULL) { -- cgit v0.12 From 81728deb9467f0558a60e204c44d9bea0c65b184 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 25 Nov 2020 12:06:06 +0000 Subject: Handle (hopefully) failing testcases on github actions for Windows and MacOS --- .github/workflows/mac-build.yml | 6 +++--- .github/workflows/win-build.yml | 8 +++++--- tests/frame.test | 5 ++++- tests/safe.test | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/mac-build.yml b/.github/workflows/mac-build.yml index bbf7190..6921f7a 100644 --- a/.github/workflows/mac-build.yml +++ b/.github/workflows/mac-build.yml @@ -77,7 +77,7 @@ jobs: - name: Prepare checked out repositories run: | touch tkStubInit.c - mkdir "$HOME/install dir" + mkdir "$HOME/install" echo "USE_XVFB=$SET_DISPLAY" >> $GITHUB_ENV working-directory: tk/generic env: @@ -92,7 +92,7 @@ jobs: - name: Build Tcl # Note that macOS is always a 64 bit platform run: | - ./configure --enable-64bit ${CFGOPT} "--prefix=$HOME/install dir" || { + ./configure --enable-64bit ${CFGOPT} "--prefix=$HOME/install" || { cat config.log echo "::error::Failure during Tcl Configure" exit 1 @@ -111,7 +111,7 @@ jobs: - name: Configure (symbols=${{ matrix.symbols }} ${{matrix.options }}) # Note that macOS is always a 64 bit platform run: | - ./configure --enable-64bit ${CFGOPT} "--prefix=$HOME/install dir" || { + ./configure --enable-64bit ${CFGOPT} "--prefix=$HOME/install" || { cat config.log echo "::error::Failure during Configure" exit 1 diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml index dffbb5a..77a5e80 100644 --- a/.github/workflows/win-build.yml +++ b/.github/workflows/win-build.yml @@ -3,7 +3,7 @@ on: [push] env: ERROR_ON_FAILURES: 1 jobs: - MSVC: + msvc: runs-on: windows-2016 defaults: run: @@ -22,9 +22,11 @@ jobs: ref: core-8-5-branch path: tcl - name: Make Install Location - working-directory: . + working-directory: tcl shell: bash run: | + echo "TCLDIR=`pwd`" >> $GITHUB_ENV + cd .. mkdir install cd install echo "INSTALLDIR=`pwd`" >> $GITHUB_ENV @@ -78,7 +80,7 @@ jobs: if ($lastexitcode -ne 0) { throw "nmake exit code: $lastexitcode" } - MSYS-gcc: + gcc: runs-on: windows-2016 defaults: run: diff --git a/tests/frame.test b/tests/frame.test index 9bb3377..5da29a0 100644 --- a/tests/frame.test +++ b/tests/frame.test @@ -11,6 +11,9 @@ package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands +testConstraint notWinCI [expr { + ($::tcl_platform(platform) ne "windows") || ![info exists ::env(CI)]}] + # eatColors -- # Creates a toplevel window and allocates enough colors in it to # use up all the slots in the colormap. @@ -158,7 +161,7 @@ test frame-2.4 {toplevel configuration options} { } {1 {bad window path name "bogus"}} set default "[winfo visual .] [winfo depth .]" if {$tcl_platform(platform) == "windows"} { -test frame-2.5 {toplevel configuration options} { +test frame-2.5 {toplevel configuration options} notWinCI { catch {destroy .t} toplevel .t -width 200 -height 100 wm geometry .t +0+0 diff --git a/tests/safe.test b/tests/safe.test index 914adaa..b7edb1b 100644 --- a/tests/safe.test +++ b/tests/safe.test @@ -50,7 +50,7 @@ test safe-1.2 {Safe Tk loading into an interpreter} -setup { lsort [interp hidden a] } -cleanup { safe::interpDelete a -} -match glob -result {bell cd clipboard encoding exec exit fconfigure*glob grab load menu open pwd selection send socket source*toplevel unload wm} +} -match glob -result {bell cd clipboard encoding exec exit fconfigure*glob grab load menu open pwd selection*socket source*toplevel unload wm} test safe-1.3 {Safe Tk loading into an interpreter} -setup { catch {safe::interpDelete a} } -body { -- cgit v0.12 From 434b29a6e98f9fe1000d27e554aca83533494b54 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 26 Nov 2020 09:01:06 +0000 Subject: Use powershell to set GITHUB_ENV: Need Windows file path here --- .github/workflows/win-build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml index 77a5e80..504037d 100644 --- a/.github/workflows/win-build.yml +++ b/.github/workflows/win-build.yml @@ -23,7 +23,6 @@ jobs: path: tcl - name: Make Install Location working-directory: tcl - shell: bash run: | echo "TCLDIR=`pwd`" >> $GITHUB_ENV cd .. -- cgit v0.12 From 406ecbaca2f8679799702c6e40fadba9d8bfd914 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 26 Nov 2020 09:11:24 +0000 Subject: Don't bother --enable-aqua builds for Tcl 8.5: Not supported any more --- .github/workflows/mac-build.yml | 49 +---------------------------------------- 1 file changed, 1 insertion(+), 48 deletions(-) diff --git a/.github/workflows/mac-build.yml b/.github/workflows/mac-build.yml index 6921f7a..fb546a7 100644 --- a/.github/workflows/mac-build.yml +++ b/.github/workflows/mac-build.yml @@ -3,53 +3,7 @@ on: [push] env: ERROR_ON_FAILURES: 1 jobs: - with-Xcode: - runs-on: macos-10.15 - defaults: - run: - shell: bash - working-directory: tk/macosx - steps: - - name: Check out Tk - uses: actions/checkout@v2 - with: - path: tk - - name: Check out Tcl - uses: actions/checkout@v2 - with: - repository: tcltk/tcl - ref: core-8-5-branch - path: tcl - - name: Prepare checked out repositories - run: | - touch tk/generic/tkStubInit.c - mkdir build - echo "BUILD_DIR=`cd build && pwd`" >> $GITHUB_ENV - echo "DESTDIR=`cd build && pwd`" >> $GITHUB_ENV - working-directory: . - - name: Build Tcl - run: | - make all - working-directory: tcl/macosx - - name: Build - run: | - make all install || { - echo "::error::Failure during Build" - exit 1 - } - - name: Run Tests - run: | - make test styles=develop | tee out-tests.txt || { - echo "::error::Failure during Test" - exit 1 - } - cat out-tests.txt | grep -q "Failed[[:space:]][[:space:]]*[1-9]" && { - echo "::error::Failure during Test" - exit 1 - } - env: - MAC_CI: 1 - Unix-like: + clang: runs-on: macos-10.15 strategy: matrix: @@ -57,7 +11,6 @@ jobs: - 'no' - 'mem' options: - - '--enable-aqua' - '--disable-aqua' defaults: run: -- cgit v0.12 From e81d3c31c528aa39ad06d6a4bc00d8cc2dd53a73 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 27 Nov 2020 15:43:39 +0000 Subject: Fix github actions windows build with --enable-sysmbols=mem --- win/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/Makefile.in b/win/Makefile.in index e2b4dd9..f6b5f14 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -136,7 +136,7 @@ TK_STUB_LIB_FILE = @TK_STUB_LIB_FILE@ TK_LIB_FILE = @TK_LIB_FILE@ TK_DLL_FILE = @TK_DLL_FILE@ TEST_DLL_FILE = tktest$(VER)${DLLSUFFIX} -TEST_LIB_FILE = @LIBPREFIX@tktest$(VER)${DLLSUFFIX}${LIBSUFFIX} +TEST_LIB_FILE = @LIBPREFIX@tktest$(VER)${DLLSUFFIX}.a SHARED_LIBRARIES = $(TK_DLL_FILE) $(TK_STUB_LIB_FILE) STATIC_LIBRARIES = $(TK_LIB_FILE) -- cgit v0.12 From 0a285fcaf244a2e4abcfdb7cd9f914923edb0524 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 27 Nov 2020 15:49:14 +0000 Subject: Attempt to fix winDialog-5.12.7 --- .github/workflows/win-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml index 4784933..5893fb6 100644 --- a/.github/workflows/win-build.yml +++ b/.github/workflows/win-build.yml @@ -106,6 +106,7 @@ jobs: - name: Prepare run: | touch tkStubInit.c + touch "${HOME}/forWinDialog-5.12.7" mkdir "${HOME}/install_dir" echo "INSTALL_DIR=${HOME}/install_dir" >> $GITHUB_ENV working-directory: generic -- cgit v0.12 From 0adf148ff42d702fb719fe7616ac837c0fd17b55 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 27 Nov 2020 16:08:44 +0000 Subject: Fix frame-2.8 testcase on mingw --- generic/tkFrame.c | 2 +- win/makefile.vc | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/generic/tkFrame.c b/generic/tkFrame.c index 1112f81..54ba8e8 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -806,7 +806,7 @@ FrameWidgetObjCmd( || ((c == 'v') && (strncmp(arg, "-visual", (unsigned)length) == 0))) { -#ifdef SUPPORT_CONFIG_EMBEDDED +#ifdef _WIN32 if (c == 'u') { const char *string = Tcl_GetString(objv[i+1]); diff --git a/win/makefile.vc b/win/makefile.vc index 84c4e81..b53d2c0 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -307,7 +307,6 @@ PRJ_INCLUDES = -I"$(BITMAPDIR)" -I"$(XLIBDIR)" CONFIG_DEFS =/DSTDC_HEADERS=1 /DHAVE_SYS_TYPES_H=1 /DHAVE_SYS_STAT_H=1 \ /DHAVE_STDLIB_H=1 /DHAVE_STRING_H=1 /DHAVE_MEMORY_H=1 \ /DHAVE_STRINGS_H=1 \ - /DSUPPORT_CONFIG_EMBEDDED \ !if $(HAVE_UXTHEME_H) /DHAVE_UXTHEME_H=1 \ !endif -- cgit v0.12 From 358a59e8d3ad7127315dbc2853dd253532014b47 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 29 Nov 2020 20:36:00 +0000 Subject: Remove duplicate and unused macro. TkGetGeomMaster is TkGetContainer, this was a leftover. --- generic/tkInt.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/generic/tkInt.h b/generic/tkInt.h index 006d999..a98b6d6 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -370,8 +370,6 @@ typedef struct TkDisplay { #define TkGetContainer(tkwin) (((TkWindow *)tkwin)->maintainerPtr != NULL ? \ ((TkWindow *)tkwin)->maintainerPtr : ((TkWindow *)tkwin)->parentPtr) -#define TkGetGeomMaster(tkwin) (((TkWindow *)tkwin)->maintainerPtr != NULL ? \ - ((TkWindow *)tkwin)->maintainerPtr : ((TkWindow *)tkwin)->parentPtr) /* * Information used by tkGet.c only: -- cgit v0.12 From 388c648cd73beb602f64b0af4537ca6771224bf7 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 30 Nov 2020 17:11:50 +0000 Subject: Sync README.md with Tcl 8.6 --- README.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 35ae215..efa1c31 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,9 @@ This is the **Tk 8.6.10** source distribution. You can get any source release of Tk from [our distribution site](https://sourceforge.net/projects/tcl/files/Tcl/). -Build Status: 8.6.10 -[![Build and Test Status: Linux 8.6](https://github.com/tcltk/tk/workflows/Linux/badge.svg?branch=core-8-6-branch)](https://github.com/tcltk/tk/actions?query=workflow%3A%22Linux%22+branch%3Acore-8-6-branch) -[![Build and Test Status: Windows 8.6](https://github.com/tcltk/tk/workflows/Windows/badge.svg?branch=core-8-6-branch)](https://github.com/tcltk/tk/actions?query=workflow%3A%22Windows%22+branch%3Acore-8-6-branch) -[![Build and Test Status: macOS 8.6](https://github.com/tcltk/tk/workflows/macOS/badge.svg?branch=core-8-6-branch)](https://github.com/tcltk/tk/actions?query=workflow%3A%22macOS%22+branch%3Acore-8-6-branch) +[![Build Status](https://github.com/tcltk/tk/workflows/Linux/badge.svg?branch=core-8-6-branch)](https://github.com/tcltk/tk/actions?query=workflow%3A%22Linux%22+branch%3Acore-8-6-branch) +[![Build Status](https://github.com/tcltk/tk/workflows/Windows/badge.svg?branch=core-8-6-branch)](https://github.com/tcltk/tk/actions?query=workflow%3A%22Windows%22+branch%3Acore-8-6-branch) +[![Build Status](https://github.com/tcltk/tk/workflows/macOS/badge.svg?branch=core-8-6-branch)](https://github.com/tcltk/tk/actions?query=workflow%3A%22macOS%22+branch%3Acore-8-6-branch) ## 1. Introduction @@ -22,13 +21,13 @@ historical record of all changes to Tk. Tk is maintained, enhanced, and distributed freely by the Tcl community. Source code development and tracking of bug reports and feature requests -takes place at [core.tcl-lang.org](https://core.tcl-lang.org/). +take place at [core.tcl-lang.org](https://core.tcl-lang.org/). Tcl/Tk release and mailing list services are [hosted by SourceForge](https://sourceforge.net/projects/tcl/) with the Tcl Developer Xchange hosted at [www.tcl-lang.org](https://www.tcl-lang.org). -Tk is a freely available open source package. You can do virtually +Tk is a freely available open-source package. You can do virtually anything you like with it, such as modifying it, redistributing it, and selling it either in whole or in part. See the file `license.terms` for complete information. -- cgit v0.12 From ee2b3bf1f8dde21c17795d277a8b708b8a29b8c0 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 1 Dec 2020 08:59:53 +0000 Subject: Sync unix/tcl.m4 with Tcl --- unix/configure | 4 ++-- unix/tcl.m4 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/unix/configure b/unix/configure index 4a68870..43e9d1a 100755 --- a/unix/configure +++ b/unix/configure @@ -5146,7 +5146,7 @@ fi CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; - CYGWIN_*|MINGW32*) + CYGWIN_*|MINGW32_*|MSYS_*) SHLIB_CFLAGS="" SHLIB_LD='${CC} -shared' SHLIB_SUFFIX=".dll" @@ -7068,7 +7068,7 @@ fi case $system in AIX-*) ;; BSD/OS*) ;; - CYGWIN_*|MINGW32_*) ;; + CYGWIN_*|MINGW32_*|MSYS_*) ;; IRIX*) ;; NetBSD-*|DragonFly-*|FreeBSD-*|OpenBSD-*) ;; Darwin-*) ;; diff --git a/unix/tcl.m4 b/unix/tcl.m4 index f4a3b8a..b01901b 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1247,7 +1247,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; - CYGWIN_*|MINGW32*) + CYGWIN_*|MINGW32_*|MSYS_*) SHLIB_CFLAGS="" SHLIB_LD='${CC} -shared' SHLIB_SUFFIX=".dll" @@ -2060,7 +2060,7 @@ dnl # preprocessing tests use only CPPFLAGS. case $system in AIX-*) ;; BSD/OS*) ;; - CYGWIN_*|MINGW32_*) ;; + CYGWIN_*|MINGW32_*|MSYS_*) ;; IRIX*) ;; NetBSD-*|DragonFly-*|FreeBSD-*|OpenBSD-*) ;; Darwin-*) ;; -- cgit v0.12 From 07850a4b2aed6dbaa1b3b4764fbddca31e084b93 Mon Sep 17 00:00:00 2001 From: culler Date: Fri, 4 Dec 2020 02:40:32 +0000 Subject: Fix [3ef77f434e]: Combobox focus ring is missing in Dark Mode. --- macosx/ttkMacOSXTheme.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 1e7797d..b4ba894 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -1872,19 +1872,24 @@ static Ttk_ElementSpec EntryElementSpec = { * 1 pixel to account for the fact that the button is not centered. */ -static Ttk_Padding ComboboxPadding = {4, 2, 20, 2}; +static Ttk_Padding ComboboxPadding = {4, 4, 20, 4}; +static Ttk_Padding DarkComboboxPadding = {6, 6, 22, 6}; static void ComboboxElementSize( TCL_UNUSED(void *), TCL_UNUSED(void *), - TCL_UNUSED(Tk_Window), + Tk_Window tkwin, int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { *minWidth = 24; *minHeight = 23; - *paddingPtr = ComboboxPadding; + if (TkMacOSXInDarkMode(tkwin)) { + *paddingPtr = DarkComboboxPadding; + } else { + *paddingPtr = ComboboxPadding; + } } static void ComboboxElementDraw( @@ -1905,19 +1910,24 @@ static void ComboboxElementDraw( }; BEGIN_DRAWING(d) - bounds.origin.y += 1; if (TkMacOSXInDarkMode(tkwin)) { - bounds.size.height += 1; + bounds = CGRectInset(bounds, 3, 3); + if (state & TTK_STATE_FOCUS) { + DrawDarkFocusRing(bounds, dc.context); + } DrawDarkButton(bounds, info.kind, state, dc.context); - } else if ([NSApp macOSVersion] > 100800) { - if ((state & TTK_STATE_BACKGROUND) && - !(state & TTK_STATE_DISABLED)) { - NSColor *background = [NSColor textBackgroundColor]; - CGRect innerBounds = CGRectInset(bounds, 1, 2); - SolidFillRoundedRectangle(dc.context, innerBounds, 4, background); + } else { + if ([NSApp macOSVersion] > 100800) { + if ((state & TTK_STATE_BACKGROUND) && + !(state & TTK_STATE_DISABLED)) { + NSColor *background = [NSColor textBackgroundColor]; + CGRect innerBounds = CGRectInset(bounds, 1, 4); + bounds.origin.y += 1; + SolidFillRoundedRectangle(dc.context, innerBounds, 4, background); + } } + ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL); } - ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL); END_DRAWING } -- cgit v0.12 From f5312f21552eeb863f2d46fec33b0e4d4fc2173d Mon Sep 17 00:00:00 2001 From: culler Date: Fri, 4 Dec 2020 20:20:48 +0000 Subject: Fix segfault introduced by the fix for [4a40c6cace]. --- macosx/tkMacOSXWm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index c100d38..942a6f8 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -2894,9 +2894,11 @@ WmManageCmd( * See [4a40c6cace]. */ - winPtr->changes.x -= macWin->xOff; - winPtr->changes.y -= macWin->yOff; - XMoveWindow(winPtr->display, winPtr->window, 0, 0); + if (macWin) { + winPtr->changes.x -= macWin->xOff; + winPtr->changes.y -= macWin->yOff; + XMoveWindow(winPtr->display, winPtr->window, 0, 0); + } TkFocusSplit(winPtr); Tk_UnmapWindow(frameWin); -- cgit v0.12