diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | generic/tkColor.c | 2 | ||||
-rw-r--r-- | generic/tkConsole.c | 2 | ||||
-rw-r--r-- | generic/tkInt.h | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXColor.c | 8 | ||||
-rw-r--r-- | macosx/tkMacOSXFont.c | 27 | ||||
-rw-r--r-- | macosx/tkMacOSXWm.c | 2 | ||||
-rw-r--r-- | xlib/xcolors.c | 23 |
8 files changed, 53 insertions, 14 deletions
@@ -2,6 +2,7 @@ * win/tkWinDialog.c: [Bug 1913750]: tk_chooseDirectory -initialdir internationalization problem. + * xlib/xcolors.c: provide _strtoi64 fallback for MSVC6.0 2012-02-15 Jan Nijtmans <nijtmans@users.sf.net> diff --git a/generic/tkColor.c b/generic/tkColor.c index db649d3..3bf4857 100644 --- a/generic/tkColor.c +++ b/generic/tkColor.c @@ -832,7 +832,7 @@ Status TkParseColor( Display * display, /* The display */ Colormap map, /* Color map */ - _Xconst char* spec, /* String to be parsed */ + const char* spec, /* String to be parsed */ XColor * colorPtr) { if (*spec == '#') { diff --git a/generic/tkConsole.c b/generic/tkConsole.c index a59092e..53f49c1 100644 --- a/generic/tkConsole.c +++ b/generic/tkConsole.c @@ -512,7 +512,7 @@ ConsoleOutput( * Assumption is utf-8 Tcl_Encoding is reliably present. */ - CONST char *bytes + const char *bytes = Tcl_ExternalToUtfDString(utf8, buf, toWrite, &ds); int numBytes = Tcl_DStringLength(&ds); Tcl_Obj *cmd = Tcl_NewStringObj("tk::ConsoleOutput", -1); diff --git a/generic/tkInt.h b/generic/tkInt.h index 4faf908..57157da 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -1215,7 +1215,7 @@ MODULE_SCOPE void TkpWarpPointer(TkDisplay *dispPtr); #define TkParseColor XParseColor #else MODULE_SCOPE Status TkParseColor (Display * display, - Colormap map, _Xconst char* spec, + Colormap map, const char* spec, XColor * colorPtr); #endif diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index ebbaec2..82ed9f8 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -266,13 +266,15 @@ GetThemeColor( break; } - *c = CGColorCreateGenericRGB(rgba[0], rgba[1], rgba[2], rgba[3]); + // this attempts to find something roughly fitting for any display +// *c = CGColorCreateGenericRGB(rgba[0], rgba[1], rgba[2], rgba[3]); - /*static CGColorSpaceRef deviceRGBSpace = NULL; + // may be off for non-main display but in most cases better than prev + static CGColorSpaceRef deviceRGBSpace = NULL; if (!deviceRGBSpace) { deviceRGBSpace = CGDisplayCopyColorSpace(CGMainDisplayID()); } - *c = CGColorCreate(deviceRGBSpace, rgba );*/ + *c = CGColorCreate(deviceRGBSpace, rgba ); } return err; } diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c index 305fe53..e4e4e03 100644 --- a/macosx/tkMacOSXFont.c +++ b/macosx/tkMacOSXFont.c @@ -229,7 +229,7 @@ InitFont( NSRect bounds; CGFloat kern = 0.0; NSFontRenderingMode renderingMode = NSFontDefaultRenderingMode; - int ascent, descent, dontAA; + int ascent, descent/*, dontAA*/; static const UniChar ch[] = {'.', 'W', ' ', 0xc4, 0xc1, 0xc2, 0xc3, 0xc7}; /* ., W, Space, Auml, Aacute, Acirc, Atilde, Ccedilla */ #define nCh (sizeof(ch) / sizeof(UniChar)) @@ -244,9 +244,10 @@ InitFont( TkInitFontAttributes(faPtr); } fontPtr->nsFont = nsFont; - dontAA = [nsFont isFixedPitch] && fontPtr->font.fa.size <= 10; - if (antialiasedTextEnabled >= 0 || dontAA) { - renderingMode = (antialiasedTextEnabled == 0 || dontAA) ? + // some don't like antialiasing on fixed-width even if bigger than limit +// dontAA = [nsFont isFixedPitch] && fontPtr->font.fa.size <= 10; + if (antialiasedTextEnabled >= 0/* || dontAA*/) { + renderingMode = (antialiasedTextEnabled == 0/* || dontAA*/) ? NSFontIntegerAdvancementsRenderingMode : NSFontAntialiasedRenderingMode; } @@ -828,7 +829,7 @@ TkpMeasureCharsInContext( typesetter = CTTypesetterCreateWithAttributedString( (CFAttributedStringRef)attributedString); start = Tcl_NumUtfChars(source, rangeStart); - len = Tcl_NumUtfChars(source, rangeStart + rangeLength); + len = Tcl_NumUtfChars(source + rangeStart, rangeLength); if (start > 0) { range.length = start; line = CTTypesetterCreateLine(typesetter, range); @@ -847,13 +848,13 @@ TkpMeasureCharsInContext( index = start; if (flags & TK_WHOLE_WORDS) { - index = CTTypesetterSuggestLineBreak(typesetter, 0, maxWidth); + index = CTTypesetterSuggestLineBreak(typesetter, start, maxWidth); if (index <= start && (flags & TK_AT_LEAST_ONE)) { flags &= ~TK_WHOLE_WORDS; } } if (index <= start && !(flags & TK_WHOLE_WORDS)) { - index = CTTypesetterSuggestClusterBreak(typesetter, 0, maxWidth); + index = CTTypesetterSuggestClusterBreak(typesetter, start, maxWidth); } cs = (index < len || (flags & TK_WHOLE_WORDS)) ? whitespaceCharacterSet : lineendingCharacterSet; @@ -878,6 +879,17 @@ TkpMeasureCharsInContext( width = CTLineGetTypographicBounds(line, NULL, NULL, NULL); CFRelease(line); } + + /* The call to CTTypesetterSuggestClusterBreak above will always + return at least one character regardless of whether it exceeded + it or not. Clean that up now. */ + while (width > maxWidth && !(flags & TK_PARTIAL_OK) && index > start) { + range.length = --index; + line = CTTypesetterCreateLine(typesetter, range); + width = CTLineGetTypographicBounds(line, NULL, NULL, NULL); + CFRelease(line); + } + } CFRelease(typesetter); [attributedString release]; @@ -894,6 +906,7 @@ done: flags & TK_AT_LEAST_ONE ? "atLeastOne " : "", flags & TK_ISOLATE_END ? "isolateEnd " : "", length, fit); +//if (!(rangeLength==1 && rangeStart == 0)) fprintf(stderr, " measure len=%d (max=%d, w=%.0f) from %d (nb=%d): source=\"%s\": index=%d return %d\n",rangeLength,maxLength,width,rangeStart,numBytes, source+rangeStart, index, fit); #endif *lengthPtr = length; return fit; diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index b916de3..f2cb572 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -6306,7 +6306,7 @@ TkMacOSXMakeFullscreen( wmPtr->flags |= WM_FULLSCREEN; } } else { - wmPtr->flags &= ~WM_FULLSCREEN; + wmPtr->flags &= ~WM_FULLSCREEN; } TkMacOSXEnterExitFullscreen(winPtr, [window isKeyWindow]); if (wasFullscreen && !(wmPtr->flags & WM_FULLSCREEN)) { diff --git a/xlib/xcolors.c b/xlib/xcolors.c index 0f3085c..a851660 100644 --- a/xlib/xcolors.c +++ b/xlib/xcolors.c @@ -871,6 +871,29 @@ FindColor( *---------------------------------------------------------------------- */ +#if defined(_MSC_VER) && (_MSC_VER < 1300) +static __int64 +_strtoi64(const char *spec, char **p, int base) +{ + __int64 result = 0; + char c; + while ((c = *spec)) { + if ((c >= '0') && (c <= '9')) { + result = (result << 4) + (c - '0'); + } else if ((c >= 'A') && (c <= 'F')) { + result = (result << 4) + (c + (10 - 'A')); + } else if ((c >= 'a') && (c <= 'f')) { + result = (result << 4) + (c + (10 - 'a')); + } else { + break; + } + ++spec; + } + *p = (char *) spec; + return result; +} +#endif + Status XParseColor( Display *display, |