From 65e305a5d25787b4bb488df76c786c3f5dd65ae6 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 8 Dec 2024 17:23:21 +0000 Subject: [PATCH] (backport): Merge tip-706 following positive vote by the TCT --- doc/MeasureChar.3 | 36 +++++++++++++++++++++++++++++------- generic/tk.decls | 30 ++++++++++++++++++++++++++++++ generic/tk.h | 5 +++-- generic/tkDecls.h | 30 ++++++++++++++++++++++++++++++ generic/tkFont.c | 14 +++++++------- generic/tkInt.h | 24 ++---------------------- generic/tkMessage.c | 2 +- generic/tkObj.c | 2 +- generic/tkStubInit.c | 5 +++++ generic/tkTextDisp.c | 10 +++++----- macosx/tkMacOSXDraw.c | 2 +- macosx/tkMacOSXFont.c | 14 +++++++------- macosx/tkMacOSXInit.c | 2 +- macosx/tkMacOSXNotify.c | 2 +- macosx/tkMacOSXWindowEvent.c | 4 ++-- tests/wm.test | 4 ++-- unix/tkUnixFont.c | 12 ++++++------ unix/tkUnixRFont.c | 8 ++++---- win/Makefile.in | 4 ++-- win/makefile.vc | 4 ++-- win/tkWinFont.c | 12 ++++++------ 21 files changed, 147 insertions(+), 79 deletions(-) diff --git a/doc/MeasureChar.3 b/doc/MeasureChar.3 index 3959978274..1f56839858 100644 --- a/doc/MeasureChar.3 +++ b/doc/MeasureChar.3 @@ -8,21 +8,29 @@ .so man.macros .BS .SH NAME -Tk_MeasureChars, Tk_TextWidth, Tk_DrawChars, Tk_UnderlineChars \- routines to measure and display simple single-line strings. +Tk_MeasureChars, Tk_MeasureCharsInContext, Tk_TextWidth, Tk_DrawChars, Tk_DrawCharsInContext, +Tk_UnderlineChars, Tk_UnderlineCharsInContext \- routines to measure and display simple single-line strings. .SH SYNOPSIS .nf \fB#include \fR .sp int -\fBTk_MeasureChars(\fItkfont, string, numBytes, maxPixels, flags, lengthPtr\fB)\fR +\fBTk_MeasureChars\fR(\fItkfont, string, numBytes, maxPixels, flags, lengthPtr\fR) .sp int -\fBTk_TextWidth(\fItkfont, string, numBytes\fB)\fR +\fBTk_MeasureCharsInContext\fR(\fItkfont, string, numBytes, rangeStart, rangeLength, maxPixels, flags, lengthPtr\fR) .sp -\fBTk_DrawChars(\fIdisplay, drawable, gc, tkfont, string, numBytes, x, y\fB)\fR +int +\fBTk_TextWidth\fR(\fItkfont, string, numBytes\fR) +.sp +\fBTk_DrawChars\fR(\fIdisplay, drawable, gc, tkfont, string, numBytes, x, y\fR) .sp -\fBTk_UnderlineChars(\fIdisplay, drawable, gc, tkfont, string, x, y, firstByte, lastByte\fB)\fR +\fBTk_DrawCharsInContext\fR(\fIdisplay, drawable, gc, tkfont, string, numBytes, rangeStart, rangeLength, x, y\fR) .sp +\fBTk_UnderlineChars\fR(\fIdisplay, drawable, gc, tkfont, string, x, y, firstByte, lastByte\fR) +.sp +\fBTk_UnderlineCharsInContext\fR(\fIdisplay, drawable, gc, tkfont, string, numBytes, x, y, firstByte, lastByte\fR) +.fi .SH ARGUMENTS .AS "const char" firstChar .AP Tk_Font tkfont in @@ -48,10 +56,13 @@ otherwise, a character must fit completely to be considered. \fBTK_WHOLE_WORDS\fR means stop on a word boundary, if possible. If \fBTK_AT_LEAST_ONE\fR is set, it means return at least one character even if no characters could fit in the length given by \fImaxPixels\fR. If -\fBTK_AT_LEAST_ONE\fR is set and \fBTK_WHOLE_WORDS\fR is also set, it means that if -not even one word fits on the line, return the first few letters of the +\fBTK_AT_LEAST_ONE\fR is set and \fBTK_WHOLE_WORDS\fR is also set, it means +that if not even one word fits on the line, return the first few letters of the word that did fit; if not even one letter of the word fit, then the first letter will still be returned. +\fBTK_ISOLATE_END\fR means that the last character should not be considered in +context with the rest of the string (used for breaking lines, with the +Tk_*InContext variants of the functions only). .AP int *lengthPtr out Filled with the number of pixels occupied by the number of characters returned as the result of \fBTk_MeasureChars\fR. @@ -72,6 +83,10 @@ The index of the first byte of the first character to underline in the The index of the first byte of the last character up to which the underline will be drawn. The character specified by \fIlastByte\fR will not itself be underlined. +.AP int rangeStart in +Index of first byte to draw or to measure. +.AP int rangeLength in +Length of range to draw or to measure, in bytes. .BE .SH DESCRIPTION .PP @@ -121,6 +136,13 @@ have been displayed previously by \fBTk_DrawChars\fR); it just draws the underline. This procedure is used to underline a few characters without having to construct an underlined font. To produce natively underlined text, the appropriate underlined font should be constructed and used. +.PP +\fBTk_MeasureCharsInContext\fR, \fBTk_DrawCharsInContext\fR, +\fBTk_UnderlineCharsInContext\fR are variants of respectively +\fBTk_MeasureChars\fR, \fBTk_DrawChars\fR and \fBTk_UnderlineChars\fR, +but with access to all the characters on the line for context. Except +on macOS, this context isn't actually consulted (meaning the out of +context variants are called). .SH "SEE ALSO" font(n), FontId(3) .SH KEYWORDS diff --git a/generic/tk.decls b/generic/tk.decls index c52d9d11ea..cd484993da 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -1069,6 +1069,9 @@ declare 273 { void Tk_CreateOldPhotoImageFormat(const Tk_PhotoImageFormat *formatPtr) } +# ----- BASELINE -- FOR -- 8.6.0 ----- # + + # TIP#580 declare 274 { int Tk_AlwaysShowSelection(Tk_Window tkwin) @@ -1134,6 +1137,33 @@ declare 290 { Window Tk_MakeWindow(Tk_Window tkwin, Window parent) } +# ----- BASELINE -- FOR -- 9.0.0 ----- # + +# TIP#706 +declare 291 { + void Tk_UnderlineCharsInContext(Display *display, + Drawable drawable, GC gc, Tk_Font tkfont, + const char *string, Tcl_Size numBytes, int x, int y, + Tcl_Size firstByte, Tcl_Size lastByte) +} +declare 292 { + void Tk_DrawCharsInContext(Display * display, + Drawable drawable, GC gc, Tk_Font tkfont, + const char *string, Tcl_Size numBytes, Tcl_Size rangeStart, + Tcl_Size rangeLength, int x, int y) +} +declare 293 { + int Tk_MeasureCharsInContext(Tk_Font tkfont, + const char *string, Tcl_Size numBytes, Tcl_Size rangeStart, + Tcl_Size rangeLength, int maxPixels, int flags, + int *lengthPtr) +} + +# ----- BASELINE -- FOR -- 8.7.0 / 9.0.1 ----- # + +declare 294 { + void TkUnusedStubEntry(void) +} # Define the platform specific public Tk interface. These functions are # only available on the designated platform. diff --git a/generic/tk.h b/generic/tk.h index 08dbdd4d9a..85576f0acb 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -17,7 +17,7 @@ #define _TK #include -#if (TCL_MAJOR_VERSION < 8) || (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 6) +#if (TCL_MAJOR_VERSION < 8) || (defined(TCL_MINOR_VERSION) && (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 6)) # error Tk 8.7 must be compiled with tcl.h from Tcl 8.6 or better #endif @@ -146,7 +146,7 @@ typedef struct Tk_StyledElement_ *Tk_StyledElement; typedef const char *Tk_Uid; -#if (TCL_MAJOR_VERSION < 9) && (TCL_MINOR_VERSION < 7) +#if (TCL_MAJOR_VERSION < 9) && defined(TCL_MINOR_VERSION) && (TCL_MINOR_VERSION < 7) # ifndef Tcl_Size # define Tcl_Size int # endif @@ -585,6 +585,7 @@ typedef struct Tk_FontMetrics { #define TK_WHOLE_WORDS 1 #define TK_AT_LEAST_ONE 2 #define TK_PARTIAL_OK 4 +#define TK_ISOLATE_END 32 /* * Flags passed to Tk_ComputeTextLayout: diff --git a/generic/tkDecls.h b/generic/tkDecls.h index a6f332d6bc..5d684f5cff 100644 --- a/generic/tkDecls.h +++ b/generic/tkDecls.h @@ -925,6 +925,24 @@ EXTERN void Tk_Get3DBorderColors(Tk_3DBorder border, XColor *lightColorPtr); /* 290 */ EXTERN Window Tk_MakeWindow(Tk_Window tkwin, Window parent); +/* 291 */ +EXTERN void Tk_UnderlineCharsInContext(Display *display, + Drawable drawable, GC gc, Tk_Font tkfont, + const char *string, Tcl_Size numBytes, int x, + int y, Tcl_Size firstByte, Tcl_Size lastByte); +/* 292 */ +EXTERN void Tk_DrawCharsInContext(Display *display, + Drawable drawable, GC gc, Tk_Font tkfont, + const char *string, Tcl_Size numBytes, + Tcl_Size rangeStart, Tcl_Size rangeLength, + int x, int y); +/* 293 */ +EXTERN int Tk_MeasureCharsInContext(Tk_Font tkfont, + const char *string, Tcl_Size numBytes, + Tcl_Size rangeStart, Tcl_Size rangeLength, + int maxPixels, int flags, int *lengthPtr); +/* 294 */ +EXTERN void TkUnusedStubEntry(void); typedef struct { const struct TkPlatStubs *tkPlatStubs; @@ -1228,6 +1246,10 @@ typedef struct TkStubs { Tk_Window (*tk_GetOtherWindow) (Tk_Window tkwin); /* 288 */ void (*tk_Get3DBorderColors) (Tk_3DBorder border, XColor *bgColorPtr, XColor *darkColorPtr, XColor *lightColorPtr); /* 289 */ Window (*tk_MakeWindow) (Tk_Window tkwin, Window parent); /* 290 */ + void (*tk_UnderlineCharsInContext) (Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *string, Tcl_Size numBytes, int x, int y, Tcl_Size firstByte, Tcl_Size lastByte); /* 291 */ + void (*tk_DrawCharsInContext) (Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *string, Tcl_Size numBytes, Tcl_Size rangeStart, Tcl_Size rangeLength, int x, int y); /* 292 */ + int (*tk_MeasureCharsInContext) (Tk_Font tkfont, const char *string, Tcl_Size numBytes, Tcl_Size rangeStart, Tcl_Size rangeLength, int maxPixels, int flags, int *lengthPtr); /* 293 */ + void (*tkUnusedStubEntry) (void); /* 294 */ } TkStubs; extern const TkStubs *tkStubsPtr; @@ -1822,6 +1844,14 @@ extern const TkStubs *tkStubsPtr; (tkStubsPtr->tk_Get3DBorderColors) /* 289 */ #define Tk_MakeWindow \ (tkStubsPtr->tk_MakeWindow) /* 290 */ +#define Tk_UnderlineCharsInContext \ + (tkStubsPtr->tk_UnderlineCharsInContext) /* 291 */ +#define Tk_DrawCharsInContext \ + (tkStubsPtr->tk_DrawCharsInContext) /* 292 */ +#define Tk_MeasureCharsInContext \ + (tkStubsPtr->tk_MeasureCharsInContext) /* 293 */ +#define TkUnusedStubEntry \ + (tkStubsPtr->tkUnusedStubEntry) /* 294 */ #endif /* defined(USE_TK_STUBS) */ diff --git a/generic/tkFont.c b/generic/tkFont.c index c1973e1d69..3e63d9d56b 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -1855,7 +1855,7 @@ Tk_TextWidth( /* *--------------------------------------------------------------------------- * - * Tk_UnderlineChars, TkUnderlineCharsInContext -- + * Tk_UnderlineChars, Tk_UnderlineCharsInContext -- * * These procedures draw an underline for a given range of characters in * a given string. They don't draw the characters (which are assumed to @@ -1891,12 +1891,12 @@ Tk_UnderlineChars( Tcl_Size lastByte) /* Index of first byte after the last * character. */ { - TkUnderlineCharsInContext(display, drawable, gc, tkfont, string, + Tk_UnderlineCharsInContext(display, drawable, gc, tkfont, string, lastByte, x, y, firstByte, lastByte); } void -TkUnderlineCharsInContext( +Tk_UnderlineCharsInContext( Display *display, /* Display on which to draw. */ Drawable drawable, /* Window or pixmap in which to draw. */ GC gc, /* Graphics context for actually drawing @@ -1916,9 +1916,9 @@ TkUnderlineCharsInContext( TkFont *fontPtr = (TkFont *) tkfont; int startX, endX; - TkpMeasureCharsInContext(tkfont, string, numBytes, 0, firstByte, -1, 0, + Tk_MeasureCharsInContext(tkfont, string, numBytes, 0, firstByte, -1, 0, &startX); - TkpMeasureCharsInContext(tkfont, string, numBytes, 0, lastByte, -1, 0, + Tk_MeasureCharsInContext(tkfont, string, numBytes, 0, lastByte, -1, 0, &endX); XFillRectangle(display, drawable, gc, x + startX, @@ -2342,7 +2342,7 @@ Tk_DrawTextLayout( } lastByte = TkUtfAtIndex(chunkPtr->start, numDisplayChars); #ifdef TK_DRAW_IN_CONTEXT - TkpDrawCharsInContext(display, drawable, gc, layoutPtr->tkfont, + Tk_DrawCharsInContext(display, drawable, gc, layoutPtr->tkfont, chunkPtr->start, chunkPtr->numBytes, firstByte - chunkPtr->start, lastByte - firstByte, x+chunkPtr->x, y+chunkPtr->y); @@ -2415,7 +2415,7 @@ TkDrawAngledTextLayout( dx = cosA * (chunkPtr->x) + sinA * (chunkPtr->y); dy = -sinA * (chunkPtr->x) + cosA * (chunkPtr->y); if (angle == 0.0) { - TkpDrawCharsInContext(display, drawable, gc, + Tk_DrawCharsInContext(display, drawable, gc, layoutPtr->tkfont, chunkPtr->start, chunkPtr->numBytes, firstByte - chunkPtr->start, lastByte - firstByte, (int)(x + dx), (int)(y + dy)); diff --git a/generic/tkInt.h b/generic/tkInt.h index 56f61fea37..76c1dcdf8a 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -75,7 +75,7 @@ # endif #endif -#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 7) +#if (TCL_MAJOR_VERSION == 8) && defined(TCL_MINOR_VERSION) && (TCL_MINOR_VERSION < 7) # define Tcl_WCharToUtfDString ((char * (*)(const WCHAR *, int, Tcl_DString *))Tcl_UniCharToUtfDString) # define Tcl_UtfToWCharDString ((WCHAR * (*)(const char *, int, Tcl_DString *))Tcl_UtfToUniCharDString) # define Tcl_Char16ToUtfDString Tcl_UniCharToUtfDString @@ -118,7 +118,7 @@ # define TKFLEXARRAY 1 #endif -#if !defined(Tcl_GetParent) && (TCL_MAJOR_VERSION < 9) && (TCL_MINOR_VERSION < 7) +#if !defined(Tcl_GetParent) && (TCL_MAJOR_VERSION < 9) && defined(TCL_MINOR_VERSION) && (TCL_MINOR_VERSION < 7) # define Tcl_GetParent Tcl_GetMaster #endif @@ -1057,14 +1057,6 @@ typedef struct TkpClipMask { #define TK_GRAB_ANCESTOR 2 #define TK_GRAB_EXCLUDED 3 -/* - * Additional flag for TkpMeasureCharsInContext. Coordinate with other flags - * for this routine, but don't make public until TkpMeasureCharsInContext is - * made public, too. - */ - -#define TK_ISOLATE_END 32 - /* * The macro below is used to modify a "char" value (e.g. by casting it to an * unsigned character) so that it can be used safely with macros such as @@ -1309,22 +1301,10 @@ MODULE_SCOPE int TkParsePadAmount(Tcl_Interp *interp, int *pad1Ptr, int *pad2Ptr); MODULE_SCOPE void TkFocusSplit(TkWindow *winPtr); MODULE_SCOPE void TkFocusJoin(TkWindow *winPtr); -MODULE_SCOPE void TkpDrawCharsInContext(Display * display, - Drawable drawable, GC gc, Tk_Font tkfont, - const char *source, Tcl_Size numBytes, Tcl_Size rangeStart, - Tcl_Size rangeLength, int x, int y); MODULE_SCOPE void TkpDrawAngledCharsInContext(Display * display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, Tcl_Size numBytes, Tcl_Size rangeStart, Tcl_Size rangeLength, double x, double y, double angle); -MODULE_SCOPE int TkpMeasureCharsInContext(Tk_Font tkfont, - const char *source, Tcl_Size numBytes, Tcl_Size rangeStart, - Tcl_Size rangeLength, int maxLength, int flags, - int *lengthPtr); -MODULE_SCOPE void TkUnderlineCharsInContext(Display *display, - Drawable drawable, GC gc, Tk_Font tkfont, - const char *string, Tcl_Size numBytes, int x, int y, - Tcl_Size firstByte, Tcl_Size lastByte); MODULE_SCOPE void TkpGetFontAttrsForChar(Tk_Window tkwin, Tk_Font tkfont, int c, struct TkFontAttributes *faPtr); MODULE_SCOPE void TkpDrawFrameEx(Tk_Window tkwin, Drawable drawable, diff --git a/generic/tkMessage.c b/generic/tkMessage.c index ecef302d02..5c5589ca24 100644 --- a/generic/tkMessage.c +++ b/generic/tkMessage.c @@ -117,7 +117,7 @@ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - DEF_MESSAGE_BORDER_WIDTH, TCL_INDEX_NONE, + DEF_MESSAGE_BORDER_WIDTH, TCL_INDEX_NONE, offsetof(Message, borderWidth), 0, 0, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_MESSAGE_CURSOR, TCL_INDEX_NONE, offsetof(Message, cursor), diff --git a/generic/tkObj.c b/generic/tkObj.c index 40c24438a7..b283f5177c 100644 --- a/generic/tkObj.c +++ b/generic/tkObj.c @@ -116,7 +116,7 @@ extern const TclIntStubs *tclIntStubsPtr; # define Tcl_GetIntForIndex(interp, obj, max, ptr) ((tclIntStubsPtr->tclGetIntForIndex == NULL)? \ ((int (*)(Tcl_Interp*, Tcl_Obj *, int, int*))(void *)((&(tclStubsPtr->tcl_PkgProvideEx))[645]))((interp), (obj), (max), (ptr)): \ tclIntStubsPtr->tclGetIntForIndex((interp), (obj), (max), (ptr))) -#elif TCL_MINOR_VERSION < 7 +#elif defined(TCL_MINOR_VERSION) && (TCL_MINOR_VERSION < 7) extern int TclGetIntForIndex(Tcl_Interp*, Tcl_Obj *, int, int*); # define Tcl_GetIntForIndex(interp, obj, max, ptr) TclGetIntForIndex(interp, obj, max, ptr) #endif diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 01bf19a533..ab7f660d6a 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -51,6 +51,7 @@ MODULE_SCOPE const TkStubs tkStubs; #define TkMacOSXIsCharacterMissing (int (*)(Tk_Font, unsigned int))(void *)doNothing #undef TkMacOSXSetDrawingEnabled #define TkMacOSXSetDrawingEnabled (void (*)(TkWindow *, int))(void *)doNothing +#define TkUnusedStubEntry 0 #if defined(_WIN32) && !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 @@ -1345,6 +1346,10 @@ const TkStubs tkStubs = { Tk_GetOtherWindow, /* 288 */ Tk_Get3DBorderColors, /* 289 */ Tk_MakeWindow, /* 290 */ + Tk_UnderlineCharsInContext, /* 291 */ + Tk_DrawCharsInContext, /* 292 */ + Tk_MeasureCharsInContext, /* 293 */ + TkUnusedStubEntry, /* 294 */ }; /* !END!: Do not edit above this line. */ diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index c09e2d295f..09dfba14a4 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -8036,13 +8036,13 @@ CharDisplayProc( return; } - TkpDrawCharsInContext(display, dst, stylePtr->fgGC, sValuePtr->tkfont, + Tk_DrawCharsInContext(display, dst, stylePtr->fgGC, sValuePtr->tkfont, string, numBytes, start, len, ciPtr->baseChunkPtr->x + xDisplacement, y + baseline - sValuePtr->offset); if (sValuePtr->underline) { - TkUnderlineCharsInContext(display, dst, stylePtr->ulGC, + Tk_UnderlineCharsInContext(display, dst, stylePtr->ulGC, sValuePtr->tkfont, string, numBytes, ciPtr->baseChunkPtr->x + xDisplacement, y + baseline - sValuePtr->offset, @@ -8052,7 +8052,7 @@ CharDisplayProc( Tk_FontMetrics fm; Tk_GetFontMetrics(sValuePtr->tkfont, &fm); - TkUnderlineCharsInContext(display, dst, stylePtr->ovGC, + Tk_UnderlineCharsInContext(display, dst, stylePtr->ovGC, sValuePtr->tkfont, string, numBytes, ciPtr->baseChunkPtr->x + xDisplacement, y + baseline - sValuePtr->offset @@ -8698,7 +8698,7 @@ MeasureChars( break; } #ifdef TK_DRAW_IN_CONTEXT - start += TkpMeasureCharsInContext(tkfont, source, maxBytes, + start += Tk_MeasureCharsInContext(tkfont, source, maxBytes, start - source, special - start, maxX >= 0 ? maxX - curX : -1, flags, &width); #else @@ -8982,7 +8982,7 @@ FreeBaseChunk( * elide, "offset" and foreground stipple. Do *not* consider: background * color, border, relief or background stipple. * - * If we use TkpDrawCharsInContext(), we also don't need to check + * If we use Tk_DrawCharsInContext(), we also don't need to check * foreground color, font decorations, elide, offset and foreground * stipple, so all that is left is font (including font size and font * style) and "offset". diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index 1432fa1b27..239e06bb13 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -1482,7 +1482,7 @@ TkMacOSXRestoreDrawingContext( * Mark the view as needing to be redisplayed, since we have drawn on its * backing layer. */ - + [dcPtr->view setNeedsDisplay:YES]; #ifdef TK_MAC_DEBUG diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c index c0d3331646..1f1101429c 100644 --- a/macosx/tkMacOSXFont.c +++ b/macosx/tkMacOSXFont.c @@ -938,7 +938,7 @@ TkpGetFontAttrsForChar( * characters. * * With ATSUI we need the line context to do this right, so we have the - * actual implementation in TkpMeasureCharsInContext(). + * actual implementation in Tk_MeasureCharsInContext(). * * Results: * The return value is the number of bytes from source that fit into the @@ -976,18 +976,18 @@ Tk_MeasureChars( int *lengthPtr) /* Filled with x-location just after the * terminating character. */ { - return TkpMeasureCharsInContext(tkfont, source, numBytes, 0, numBytes, + return Tk_MeasureCharsInContext(tkfont, source, numBytes, 0, numBytes, maxLength, flags, lengthPtr); } /* *--------------------------------------------------------------------------- * - * TkpMeasureCharsInContext -- + * Tk_MeasureCharsInContext -- * * Determine the number of bytes from the string that will fit in the * given horizontal span. The measurement is done under the assumption - * that TkpDrawCharsInContext() will be used to actually display the + * that Tk_DrawCharsInContext() will be used to actually display the * characters. * * This one is almost the same as Tk_MeasureChars(), but with access to @@ -1005,7 +1005,7 @@ Tk_MeasureChars( */ int -TkpMeasureCharsInContext( +Tk_MeasureCharsInContext( Tk_Font tkfont, /* Font in which characters will be drawn. */ const char * source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. */ @@ -1251,7 +1251,7 @@ TkDrawAngledChars( /* *--------------------------------------------------------------------------- * - * TkpDrawCharsInContext -- + * Tk_DrawCharsInContext -- * * Draw a string of characters on the screen like Tk_DrawChars(), with * access to all the characters on the line for context. @@ -1269,7 +1269,7 @@ TkDrawAngledChars( */ void -TkpDrawCharsInContext( +Tk_DrawCharsInContext( Display *display, /* Display on which to draw. */ Drawable drawable, /* Window or pixmap in which to draw. */ GC gc, /* Graphics context for drawing characters. */ diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index baa1bbe297..7d7a690a99 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -651,7 +651,7 @@ TkpInit( * checking whether it was immediately withdrawn, and * therefore does not need to be placed on the screen. */ - + Tcl_DoWhenIdle(showRootWindow, window); break; } diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c index a573e1ba9f..da185c28e5 100644 --- a/macosx/tkMacOSXNotify.c +++ b/macosx/tkMacOSXNotify.c @@ -37,7 +37,7 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr; #endif #define Tcl_MacOSXNotifierAddRunLoopMode \ (tclIntPlatStubsPtr->tclMacOSXNotifierAddRunLoopMode) /* 19 */ -#elif TCL_MINOR_VERSION < 7 +#elif defined(TCL_MINOR_VERSION) && (TCL_MINOR_VERSION < 7) extern void TclMacOSXNotifierAddRunLoopMode(const void *runLoopMode); # define Tcl_MacOSXNotifierAddRunLoopMode TclMacOSXNotifierAddRunLoopMode #else diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index 13dc916584..090577d3ed 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -438,7 +438,7 @@ static void RefocusGrabWindow(void *data) { @end #pragma mark - - + /* *---------------------------------------------------------------------- * @@ -470,7 +470,7 @@ TkpWillDrawWidget(Tk_Window tkwin) { (void) tkwin; return false; } - + /* *---------------------------------------------------------------------- * diff --git a/tests/wm.test b/tests/wm.test index ea366a5d45..85aaa90445 100644 --- a/tests/wm.test +++ b/tests/wm.test @@ -1511,10 +1511,10 @@ test wm-stackorder-2.3 {stacking order} -body { toplevel .t2 tkwait visibility .t2 raiseDelay - lappend res [wm stackorder .] + lappend res [wm stackorder .] raise . raiseDelay - lappend res [wm stackorder .] + lappend res [wm stackorder .] raise .t2 raiseDelay lappend res [wm stackorder .] diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index c33d04f4c3..0dca9221ce 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.c @@ -1220,11 +1220,11 @@ Tk_MeasureChars( /* *--------------------------------------------------------------------------- * - * TkpMeasureCharsInContext -- + * Tk_MeasureCharsInContext -- * * Determine the number of bytes from the string that will fit in the * given horizontal span. The measurement is done under the assumption - * that TkpDrawCharsInContext() will be used to actually display the + * that Tk_MeasureCharsInContext() will be used to actually display the * characters. * * This one is almost the same as Tk_MeasureChars(), but with access to @@ -1243,7 +1243,7 @@ Tk_MeasureChars( */ int -TkpMeasureCharsInContext( +Tk_MeasureCharsInContext( Tk_Font tkfont, /* Font in which characters will be drawn. */ const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. */ @@ -1411,14 +1411,14 @@ Tk_DrawChars( /* *--------------------------------------------------------------------------- * - * TkpDrawCharsInContext -- + * Tk_DrawCharsInContext -- * * Draw a string of characters on the screen like Tk_DrawChars(), but * with access to all the characters on the line for context. On X11 this * context isn't consulted, so we just call Tk_DrawChars(). * * Note: TK_DRAW_IN_CONTEXT being currently defined only on macOS, this - * function is unused (and possibly unfinished). See [7655f65ae7]. + * function is unused. * * Results: * None. @@ -1430,7 +1430,7 @@ Tk_DrawChars( */ void -TkpDrawCharsInContext( +Tk_DrawCharsInContext( Display *display, /* Display on which to draw. */ Drawable drawable, /* Window or pixmap in which to draw. */ GC gc, /* Graphics context for drawing characters. */ diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index 9b7b0dcc5f..ea6c363588 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -830,7 +830,7 @@ Tk_MeasureChars( } int -TkpMeasureCharsInContext( +Tk_MeasureCharsInContext( Tk_Font tkfont, const char *source, TCL_UNUSED(Tcl_Size), @@ -1348,14 +1348,14 @@ TkDrawAngledChars( /* *--------------------------------------------------------------------------- * - * TkpDrawCharsInContext -- + * Tk_DrawCharsInContext -- * * Draw a string of characters on the screen like Tk_DrawChars(), but * with access to all the characters on the line for context. On X11 this * context isn't consulted, so we just call Tk_DrawChars(). * * Note: TK_DRAW_IN_CONTEXT being currently defined only on macOS, this - * function is unused (and possibly unfinished). See [7655f65ae7]. + * function is unused. * * Results: * None. @@ -1367,7 +1367,7 @@ TkDrawAngledChars( */ void -TkpDrawCharsInContext( +Tk_DrawCharsInContext( Display *display, /* Display on which to draw. */ Drawable drawable, /* Window or pixmap in which to draw. */ GC gc, /* Graphics context for drawing characters. */ diff --git a/win/Makefile.in b/win/Makefile.in index 59ee12d728..e7951c7f79 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -142,7 +142,7 @@ TK_DLL_FILE_TCL9 = @TK_DLL_FILE_TCL9@ TEST_DLL_FILE = tktest$(VER)${DLLSUFFIX} TEST_LIB_FILE = @LIBPREFIX@tktest$(VER)${DLLSUFFIX}${LIBSUFFIX} -SHARED_LIBRARIES = $(TK_DLL_FILE) $(TK_STUB_LIB_FILE) +SHARED_LIBRARIES = $(TK_DLL_FILE) $(TK_STUB_LIB_FILE) STATIC_LIBRARIES = $(TK_LIB_FILE) WISH = wish$(VER)${EXESUFFIX} @@ -216,7 +216,7 @@ NO_DEPRECATED_FLAGS = # required just to do a normal build although it can be required to run # make dist. TCL_EXE = @TCLSH_PROG@ -WINE = @WINE@ +WINE = @WINE@ ### # Tip 430 - ZipFS Modifications diff --git a/win/makefile.vc b/win/makefile.vc index d25d0b0c9b..e23f0e20e3 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -134,7 +134,7 @@ TK_NO_DEPRECATED = 1 !endif !endif -WISHC = "$(OUT_DIR)\$(WISHNAMEPREFIX)c$(VERSION)$(SUFX).exe" +WISHC = "$(OUT_DIR)\$(WISHNAMEPREFIX)c$(VERSION)$(SUFX).exe" TKTEST = "$(OUT_DIR)\$(PROJECT)test$(VERSION)$(SUFX).exe" CAT32 = "$(OUT_DIR)\cat32.exe" @@ -642,7 +642,7 @@ $(TMP_DIR)\tkMain2.obj: $(GENERICDIR)\tkMain.c $(cc32) $(pkgcflags) /DUNICODE /D_UNICODE -Fo$@ $? $(TMP_DIR)\tkPkgConfig.obj: $(GENERICDIR)\tkPkgConfig.c - $(cc32) $(pkgcflags) \ + $(cc32) $(pkgcflags) \ -DCFG_RUNTIME_DLLFILE="\"$(TKLIBNAME)\"" \ -Fo$@ $? diff --git a/win/tkWinFont.c b/win/tkWinFont.c index 76668c8ea3..18ed51d97c 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -988,11 +988,11 @@ Tk_MeasureChars( /* *--------------------------------------------------------------------------- * - * TkpMeasureCharsInContext -- + * Tk_MeasureCharsInContext -- * * Determine the number of bytes from the string that will fit in the * given horizontal span. The measurement is done under the assumption - * that TkpDrawCharsInContext() will be used to actually display the + * that Tk_MeasureCharsInContext() will be used to actually display the * characters. * * This one is almost the same as Tk_MeasureChars(), but with access to @@ -1011,7 +1011,7 @@ Tk_MeasureChars( */ int -TkpMeasureCharsInContext( +Tk_MeasureCharsInContext( Tk_Font tkfont, /* Font in which characters will be drawn. */ const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. */ @@ -1355,14 +1355,14 @@ TkDrawAngledChars( /* *--------------------------------------------------------------------------- * - * TkpDrawCharsInContext -- + * Tk_DrawCharsInContext -- * * Draw a string of characters on the screen like Tk_DrawChars(), but * with access to all the characters on the line for context. On Windows * this context isn't consulted, so we just call Tk_DrawChars(). * * Note: TK_DRAW_IN_CONTEXT being currently defined only on macOS, this - * function is unused (and possibly unfinished). See [7655f65ae7]. + * function is unused. * * Results: * None. @@ -1374,7 +1374,7 @@ TkDrawAngledChars( */ void -TkpDrawCharsInContext( +Tk_DrawCharsInContext( Display *display, /* Display on which to draw. */ Drawable drawable, /* Window or pixmap in which to draw. */ GC gc, /* Graphics context for drawing characters. */