summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2024-07-12 16:24:02 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2024-07-12 16:24:02 (GMT)
commited381a36648ee0c9050e7bcd0a44e92f295d21ff (patch)
tree9cddd75f916e2f3bd37d2904e0d7b74f30f66b44
parent47a7d357fcba6b6d2898e876f9e9a5403ff4e22f (diff)
parent405cd1740e12c6b84187670afbaf7f835310c288 (diff)
downloadtk-ed381a36648ee0c9050e7bcd0a44e92f295d21ff.zip
tk-ed381a36648ee0c9050e7bcd0a44e92f295d21ff.tar.gz
tk-ed381a36648ee0c9050e7bcd0a44e92f295d21ff.tar.bz2
Merge 8.7. Fix indenting
-rw-r--r--doc/SetOptions.32
-rw-r--r--generic/tkBusy.c10
-rw-r--r--generic/tkCanvArc.c6
-rw-r--r--generic/tkCanvImg.c2
-rw-r--r--generic/tkCanvLine.c8
-rw-r--r--generic/tkCanvPs.c2
-rw-r--r--generic/tkCanvWind.c2
-rw-r--r--generic/tkConsole.c2
-rw-r--r--generic/tkText.h10
-rw-r--r--generic/tkTextBTree.c52
-rw-r--r--generic/tkTextDisp.c688
-rw-r--r--generic/tkTextIndex.c48
-rw-r--r--generic/tkTextMark.c38
-rw-r--r--tests/canvas.test7
-rw-r--r--unix/tkUnixEmbed.c40
-rw-r--r--unix/tkUnixInit.c2
-rw-r--r--unix/tkUnixKey.c4
-rw-r--r--unix/tkUnixRFont.c14
-rw-r--r--unix/tkUnixSend.c22
-rw-r--r--unix/tkUnixSysTray.c122
-rw-r--r--unix/tkUnixWm.c70
-rw-r--r--win/ttkWinMonitor.c12
-rw-r--r--win/ttkWinTheme.c2
-rw-r--r--win/ttkWinXPTheme.c10
24 files changed, 591 insertions, 584 deletions
diff --git a/doc/SetOptions.3 b/doc/SetOptions.3
index cbbe648..d84da6c 100644
--- a/doc/SetOptions.3
+++ b/doc/SetOptions.3
@@ -548,7 +548,7 @@ free, and restore saved copies of the type and creating a structure
pointing to those procedures:
.CS
typedef struct Tk_ObjCustomOption {
- char *name;
+ const char *\fname\fR;
Tk_CustomOptionSetProc *\fIsetProc\fR;
Tk_CustomOptionGetProc *\fIgetProc\fR;
Tk_CustomOptionRestoreProc *\fIrestoreProc\fR;
diff --git a/generic/tkBusy.c b/generic/tkBusy.c
index 65e1fc7..ffa1cb8 100644
--- a/generic/tkBusy.c
+++ b/generic/tkBusy.c
@@ -770,7 +770,7 @@ HoldBusy(
TkpHideBusyWindow(busyPtr);
}
if (result == TCL_OK) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(busyPtr->tkBusy), TCL_INDEX_NONE));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(busyPtr->tkBusy), TCL_INDEX_NONE));
}
return result;
}
@@ -806,7 +806,7 @@ Tk_BusyObjCmd(
int index, result = TCL_OK;
static const char *const optionStrings[] = {
"busywindow", "cget", "configure", "current", "forget", "hold",
- "status", NULL
+ "status", NULL
};
enum options {
BUSY_BUSYWINDOW, BUSY_CGET, BUSY_CONFIGURE, BUSY_CURRENT, BUSY_FORGET,
@@ -843,10 +843,10 @@ Tk_BusyObjCmd(
busyPtr = GetBusy(interp, busyTablePtr, objv[2]);
if (busyPtr == NULL) {
Tcl_ResetResult(interp);
- return TCL_OK;
+ return TCL_OK;
}
- Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(busyPtr->tkBusy), TCL_INDEX_NONE));
- return TCL_OK;
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(busyPtr->tkBusy), TCL_INDEX_NONE));
+ return TCL_OK;
case BUSY_CGET:
if (objc != 4) {
diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c
index c197ff8..da40b99 100644
--- a/generic/tkCanvArc.c
+++ b/generic/tkCanvArc.c
@@ -619,7 +619,7 @@ ComputeArcParametersFromHeight(
*/
if (arcPtr->height == 0)
- return;
+ return;
/*
* Calculate the chord length, return early if it is too small.
@@ -629,8 +629,8 @@ ComputeArcParametersFromHeight(
arcPtr->startPoint[0] - arcPtr->endPoint[0]);
if (chordLen < DBL_EPSILON) {
- arcPtr->start = arcPtr->extent = arcPtr->height = 0;
- return;
+ arcPtr->start = arcPtr->extent = arcPtr->height = 0;
+ return;
}
chordDir[0] = (arcPtr->endPoint[0] - arcPtr->startPoint[0]) / chordLen;
diff --git a/generic/tkCanvImg.c b/generic/tkCanvImg.c
index 46fc288..5f67ec6 100644
--- a/generic/tkCanvImg.c
+++ b/generic/tkCanvImg.c
@@ -722,7 +722,7 @@ ImageToPostscript(
* Image item without actual image specified.
*/
- return TCL_OK;
+ return TCL_OK;
}
Tk_SizeOfImage(image, &width, &height);
diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c
index 7897705..a0e6b54 100644
--- a/generic/tkCanvLine.c
+++ b/generic/tkCanvLine.c
@@ -485,7 +485,7 @@ ConfigureLine(
tkwin = Tk_CanvasTkwin(canvas);
if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc,
- (const char **) objv, (char *) linePtr, flags|TK_CONFIG_OBJS)) {
+ (const char **)objv, (char *)linePtr, flags|TK_CONFIG_OBJS)) {
return TCL_ERROR;
}
@@ -704,10 +704,10 @@ ComputeLineBbox(
width = 1.0;
}
if (linePtr->arrow != ARROWS_NONE) {
- if (linePtr->arrow != ARROWS_LAST) {
+ if (linePtr->arrow != ARROWS_LAST && linePtr->firstArrowPtr) {
TkIncludePoint((Tk_Item *) linePtr, linePtr->firstArrowPtr);
}
- if (linePtr->arrow != ARROWS_FIRST) {
+ if (linePtr->arrow != ARROWS_FIRST && linePtr->lastArrowPtr) {
TkIncludePoint((Tk_Item *) linePtr, linePtr->lastArrowPtr);
}
}
@@ -1018,7 +1018,7 @@ LineInsert(
newCoordPtr[i+objc] = linePtr->coordPtr[i];
}
if (linePtr->coordPtr) {
- ckfree(linePtr->coordPtr);
+ ckfree(linePtr->coordPtr);
}
linePtr->coordPtr = newCoordPtr;
length += objc ;
diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c
index af2718b..d0e5e13 100644
--- a/generic/tkCanvPs.c
+++ b/generic/tkCanvPs.c
@@ -907,7 +907,7 @@ PostscriptBitmap(
* syntactically correct.
*/
- Tcl_AppendToObj(psObj, "<>", TCL_INDEX_NONE);
+ Tcl_AppendToObj(psObj, "<>", TCL_INDEX_NONE);
return;
}
diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c
index 38754d8..358c697 100644
--- a/generic/tkCanvWind.c
+++ b/generic/tkCanvWind.c
@@ -803,7 +803,7 @@ WinItemToPostscript(
Tk_Window tkwin = winItemPtr->tkwin;
if (prepass || winItemPtr->tkwin == NULL) {
- return TCL_OK;
+ return TCL_OK;
}
width = Tk_Width(tkwin);
diff --git a/generic/tkConsole.c b/generic/tkConsole.c
index 106b79a..8302b38 100644
--- a/generic/tkConsole.c
+++ b/generic/tkConsole.c
@@ -223,7 +223,7 @@ Tk_InitConsoleChannels(
*/
if (Tcl_InitStubs(interp, "8.6-", 0) == NULL) {
- return;
+ return;
}
consoleInitPtr = (int *)Tcl_GetThreadData(&consoleInitKey, (int) sizeof(int));
diff --git a/generic/tkText.h b/generic/tkText.h
index a2d8240..ca7aa4c 100644
--- a/generic/tkText.h
+++ b/generic/tkText.h
@@ -371,7 +371,7 @@ typedef struct TkTextTag {
int lMargin2; /* Left margin for second and later display lines
* of each text line, in pixels. INT_MIN means option not specified. */
Tk_3DBorder lMarginColor; /* Used for drawing background in left margins.
- * This is used for both lmargin1 and lmargin2.
+ * This is used for both lmargin1 and lmargin2.
* NULL means no value specified here. */
char *offsetString; /* -offset option string (malloc-ed). NULL
* means option not specified. */
@@ -383,7 +383,7 @@ typedef struct TkTextTag {
int overstrike; /* > 0 means draw horizontal line through
* middle of text. -1 means not specified. */
XColor *overstrikeColor; /* Color for the overstrike. NULL means same
- * color as foreground. */
+ * color as foreground. */
char *rMarginString; /* -rmargin option string (malloc-ed). NULL
* means option not specified. */
int rMargin; /* Right margin for text, in pixels. INT_MIN means option not specified. */
@@ -417,7 +417,7 @@ typedef struct TkTextTag {
int underline; /* > 0 means draw underline underneath
* text. -1 means not specified. */
XColor *underlineColor; /* Color for the underline. NULL means same
- * color as foreground. */
+ * color as foreground. */
TkWrapMode wrapMode; /* How to handle wrap-around for this tag.
* Must be TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_WORD,
* TEXT_WRAPMODE_NONE, or TEXT_WRAPMODE_NULL to
@@ -601,7 +601,7 @@ typedef struct TkSharedText {
struct TkText *peers;
Tcl_Size undoMarkId; /* Counts undo marks temporarily used during
- undo and redo operations. */
+ undo and redo operations. */
} TkSharedText;
/*
@@ -808,7 +808,7 @@ typedef struct TkText {
int autoSeparators; /* Non-zero means the separators will be
* inserted automatically. */
Tcl_Obj *afterSyncCmd; /* Command to be executed when lines are up to
- * date */
+ * date */
} TkText;
/*
diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c
index 4810b30..7a65ee1 100644
--- a/generic/tkTextBTree.c
+++ b/generic/tkTextBTree.c
@@ -2019,32 +2019,32 @@ TkBTreeLinesTo(
}
}
if (textPtr != NULL) {
- /*
- * The index to return must be relative to textPtr, not to the entire
- * tree. Take care to never return a negative index when linePtr
- * denotes a line before -startline, or an index larger than the
- * number of lines in textPtr when linePtr is a line past -endline.
- */
-
- int indexStart, indexEnd;
-
- if (textPtr->start != NULL) {
- indexStart = TkBTreeLinesTo(NULL, textPtr->start);
- } else {
- indexStart = 0;
- }
- if (textPtr->end != NULL) {
- indexEnd = TkBTreeLinesTo(NULL, textPtr->end);
- } else {
- indexEnd = TkBTreeNumLines(textPtr->sharedTextPtr->tree, NULL);
- }
- if (index < indexStart) {
- index = 0;
- } else if (index > indexEnd) {
- index = TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr);
- } else {
- index -= indexStart;
- }
+ /*
+ * The index to return must be relative to textPtr, not to the entire
+ * tree. Take care to never return a negative index when linePtr
+ * denotes a line before -startline, or an index larger than the
+ * number of lines in textPtr when linePtr is a line past -endline.
+ */
+
+ int indexStart, indexEnd;
+
+ if (textPtr->start != NULL) {
+ indexStart = TkBTreeLinesTo(NULL, textPtr->start);
+ } else {
+ indexStart = 0;
+ }
+ if (textPtr->end != NULL) {
+ indexEnd = TkBTreeLinesTo(NULL, textPtr->end);
+ } else {
+ indexEnd = TkBTreeNumLines(textPtr->sharedTextPtr->tree, NULL);
+ }
+ if (index < indexStart) {
+ index = 0;
+ } else if (index > indexEnd) {
+ index = TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr);
+ } else {
+ index -= indexStart;
+ }
}
return index;
}
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index a01c329..a432a24 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -142,7 +142,7 @@ typedef struct StyleValues {
int overstrike; /* Non-zero means draw overstrike through
* text. */
XColor *overstrikeColor; /* Foreground color for overstrike through
- * text. */
+ * text. */
int rMargin; /* Right margin, in pixels. */
Tk_3DBorder rMarginColor; /* Color of right margin. */
int spacing1; /* Spacing above first dline in text line. */
@@ -155,7 +155,7 @@ typedef struct StyleValues {
int underline; /* Non-zero means draw underline underneath
* text. */
XColor *underlineColor; /* Foreground color for underline underneath
- * text. */
+ * text. */
int elide; /* Zero means draw text, otherwise not. */
TkWrapMode wrapMode; /* How to handle wrap-around for this tag.
* One of TEXT_WRAPMODE_CHAR,
@@ -214,7 +214,7 @@ typedef struct TextStyle {
#define LOG(toVar,what) \
if (OK_TO_LOG) \
- Tcl_SetVar2(textPtr->interp, toVar, NULL, (what), \
+ Tcl_SetVar2(textPtr->interp, toVar, NULL, (what), \
TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT)
#define CLEAR(var) \
if (OK_TO_LOG) \
@@ -255,11 +255,11 @@ typedef struct DLine {
Tk_3DBorder lMarginColor; /* Background color of the area corresponding
* to the left margin of the display line. */
int lMarginWidth; /* Pixel width of the area corresponding to
- * the left margin. */
+ * the left margin. */
Tk_3DBorder rMarginColor; /* Background color of the area corresponding
* to the right margin of the display line. */
int rMarginWidth; /* Pixel width of the area corresponding to
- * the right margin. */
+ * the right margin. */
int length; /* Total length of line, in pixels. */
TkTextDispChunk *chunkPtr; /* Pointer to first chunk in list of all of
* those that are displayed on this line of
@@ -573,7 +573,7 @@ static void DisplayLineBackground(TkText *textPtr, DLine *dlPtr,
DLine *prevPtr, Pixmap pixmap);
static void DisplayText(void *clientData);
static DLine * FindDLine(TkText *textPtr, DLine *dlPtr,
- const TkTextIndex *indexPtr);
+ const TkTextIndex *indexPtr);
static void FreeDLines(TkText *textPtr, DLine *firstPtr,
DLine *lastPtr, int action);
static void FreeStyle(TkText *textPtr, TextStyle *stylePtr);
@@ -622,7 +622,7 @@ static void AsyncUpdateLineMetrics(void *clientData);
static void GenerateWidgetViewSyncEvent(TkText *textPtr, Bool InSync);
static void AsyncUpdateYScrollbar(void *clientData);
static int IsStartOfNotMergedLine(const TkText *textPtr,
- const TkTextIndex *indexPtr);
+ const TkTextIndex *indexPtr);
/*
* Result values returned by TextGetScrollInfoObj:
@@ -823,19 +823,19 @@ GetStyle(
isSelected = 0;
for (i = 0 ; i < numTags; i++) {
- if (textPtr->selTagPtr == tagPtrs[i]) {
- isSelected = 1;
- break;
- }
+ if (textPtr->selTagPtr == tagPtrs[i]) {
+ isSelected = 1;
+ break;
+ }
}
for (i = 0 ; i < numTags; i++) {
Tk_3DBorder border;
- XColor *fgColor;
+ XColor *fgColor;
tagPtr = tagPtrs[i];
border = tagPtr->border;
- fgColor = tagPtr->fgColor;
+ fgColor = tagPtr->fgColor;
/*
* If this is the selection tag, and inactiveSelBorder is NULL (the
@@ -855,13 +855,13 @@ GetStyle(
border = textPtr->inactiveSelBorder;
}
- if ((tagPtr->selBorder != NULL) && (isSelected)) {
- border = tagPtr->selBorder;
- }
+ if ((tagPtr->selBorder != NULL) && (isSelected)) {
+ border = tagPtr->selBorder;
+ }
- if ((tagPtr->selFgColor != NULL) && isSelected) {
- fgColor = tagPtr->selFgColor;
- }
+ if ((tagPtr->selFgColor != NULL) && isSelected) {
+ fgColor = tagPtr->selFgColor;
+ }
if ((border != NULL) && (tagPtr->priority > borderPrio)) {
styleValues.border = border;
@@ -928,11 +928,11 @@ GetStyle(
&& (tagPtr->priority > overstrikePrio)) {
styleValues.overstrike = tagPtr->overstrike > 0;
overstrikePrio = tagPtr->priority;
- if (tagPtr->overstrikeColor != NULL) {
- styleValues.overstrikeColor = tagPtr->overstrikeColor;
- } else if (fgColor != NULL) {
- styleValues.overstrikeColor = fgColor;
- }
+ if (tagPtr->overstrikeColor != NULL) {
+ styleValues.overstrikeColor = tagPtr->overstrikeColor;
+ } else if (fgColor != NULL) {
+ styleValues.overstrikeColor = fgColor;
+ }
}
if ((tagPtr->rMargin != INT_MIN)
&& (tagPtr->priority > rMarginPrio)) {
@@ -974,11 +974,11 @@ GetStyle(
&& (tagPtr->priority > underlinePrio)) {
styleValues.underline = tagPtr->underline > 0;
underlinePrio = tagPtr->priority;
- if (tagPtr->underlineColor != NULL) {
- styleValues.underlineColor = tagPtr->underlineColor;
- } else if (fgColor != NULL) {
- styleValues.underlineColor = fgColor;
- }
+ if (tagPtr->underlineColor != NULL) {
+ styleValues.underlineColor = tagPtr->underlineColor;
+ } else if (fgColor != NULL) {
+ styleValues.underlineColor = fgColor;
+ }
}
if ((tagPtr->elide >= 0)
&& (tagPtr->priority > elidePrio)) {
@@ -1476,7 +1476,7 @@ LayoutDLine(
x = chunkPtr->stylePtr->sValuePtr->lMargin2;
}
- dlPtr->lMarginWidth = x;
+ dlPtr->lMarginWidth = x;
if (wrapMode == TEXT_WRAPMODE_NONE) {
maxX = -1;
} else {
@@ -1791,7 +1791,7 @@ LayoutDLine(
dlPtr->lMarginColor = sValuePtr->lMarginColor;
dlPtr->rMarginColor = sValuePtr->rMarginColor;
if (wrapMode != TEXT_WRAPMODE_NONE) {
- dlPtr->rMarginWidth = rMargin;
+ dlPtr->rMarginWidth = rMargin;
}
/*
@@ -2099,9 +2099,9 @@ UpdateDisplayInfo(
* widget.
*/
- lineNum = TkBTreeNumLines(textPtr->sharedTextPtr->tree,
- textPtr) - 1;
- bytesToCount = INT_MAX;
+ lineNum = TkBTreeNumLines(textPtr->sharedTextPtr->tree,
+ textPtr) - 1;
+ bytesToCount = INT_MAX;
} else {
lineNum = TkBTreeLinesTo(textPtr,
dInfoPtr->dLinePtr->index.linePtr);
@@ -2488,14 +2488,14 @@ DisplayDLine(
* Third, draw the background color of the left and right margins.
*/
if (dlPtr->lMarginColor != NULL) {
- Tk_Fill3DRectangle(textPtr->tkwin, pixmap, dlPtr->lMarginColor, 0, y,
- dlPtr->lMarginWidth + dInfoPtr->x - dInfoPtr->curXPixelOffset,
- dlPtr->height, 0, TK_RELIEF_FLAT);
+ Tk_Fill3DRectangle(textPtr->tkwin, pixmap, dlPtr->lMarginColor, 0, y,
+ dlPtr->lMarginWidth + dInfoPtr->x - dInfoPtr->curXPixelOffset,
+ dlPtr->height, 0, TK_RELIEF_FLAT);
}
if (dlPtr->rMarginColor != NULL) {
- Tk_Fill3DRectangle(textPtr->tkwin, pixmap, dlPtr->rMarginColor,
- dInfoPtr->maxX - dlPtr->rMarginWidth + dInfoPtr->curXPixelOffset,
- y, dlPtr->rMarginWidth, dlPtr->height, 0, TK_RELIEF_FLAT);
+ Tk_Fill3DRectangle(textPtr->tkwin, pixmap, dlPtr->rMarginColor,
+ dInfoPtr->maxX - dlPtr->rMarginWidth + dInfoPtr->curXPixelOffset,
+ y, dlPtr->rMarginWidth, dlPtr->height, 0, TK_RELIEF_FLAT);
}
/*
@@ -2720,15 +2720,15 @@ DisplayLineBackground(
rightX = leftX + 32767;
}
- /*
- * Prevent the borders from leaking on adjacent characters,
- * which would happen for too large border width.
- */
+ /*
+ * Prevent the borders from leaking on adjacent characters,
+ * which would happen for too large border width.
+ */
- bw = sValuePtr->borderWidth;
- if (leftX + sValuePtr->borderWidth > rightX) {
- bw = rightX - leftX;
- }
+ bw = sValuePtr->borderWidth;
+ if (leftX + sValuePtr->borderWidth > rightX) {
+ bw = rightX - leftX;
+ }
XFillRectangle(display, pixmap, chunkPtr->stylePtr->bgGC,
leftX + xOffset, y, (unsigned int) (rightX - leftX),
@@ -2835,23 +2835,23 @@ DisplayLineBackground(
matchRight = (nextPtr2 != NULL)
&& SAME_BACKGROUND(nextPtr2->stylePtr, chunkPtr->stylePtr);
if (matchLeft && !matchRight) {
- bw = sValuePtr->borderWidth;
- if (rightX2 - sValuePtr->borderWidth < leftX) {
- bw = rightX2 - leftX;
- }
+ bw = sValuePtr->borderWidth;
+ if (rightX2 - sValuePtr->borderWidth < leftX) {
+ bw = rightX2 - leftX;
+ }
if (sValuePtr->relief != TK_RELIEF_FLAT) {
Tk_3DVerticalBevel(textPtr->tkwin, pixmap, sValuePtr->border,
rightX2 - bw + xOffset, y, bw,
sValuePtr->borderWidth, 0, sValuePtr->relief);
}
- leftX = rightX2 - bw;
+ leftX = rightX2 - bw;
leftXIn = 0;
} else if (!matchLeft && matchRight
&& (sValuePtr->relief != TK_RELIEF_FLAT)) {
- bw = sValuePtr->borderWidth;
- if (rightX2 + sValuePtr->borderWidth > rightX) {
- bw = rightX - rightX2;
- }
+ bw = sValuePtr->borderWidth;
+ if (rightX2 + sValuePtr->borderWidth > rightX) {
+ bw = rightX - rightX2;
+ }
Tk_3DVerticalBevel(textPtr->tkwin, pixmap, sValuePtr->border,
rightX2 + xOffset, y, bw, sValuePtr->borderWidth,
1, sValuePtr->relief);
@@ -2945,10 +2945,10 @@ DisplayLineBackground(
matchRight = (nextPtr2 != NULL)
&& SAME_BACKGROUND(nextPtr2->stylePtr, chunkPtr->stylePtr);
if (matchLeft && !matchRight) {
- bw = sValuePtr->borderWidth;
- if (rightX2 - sValuePtr->borderWidth < leftX) {
- bw = rightX2 - leftX;
- }
+ bw = sValuePtr->borderWidth;
+ if (rightX2 - sValuePtr->borderWidth < leftX) {
+ bw = rightX2 - leftX;
+ }
if (sValuePtr->relief != TK_RELIEF_FLAT) {
Tk_3DVerticalBevel(textPtr->tkwin, pixmap, sValuePtr->border,
rightX2 - bw + xOffset,
@@ -2959,10 +2959,10 @@ DisplayLineBackground(
leftXIn = 1;
} else if (!matchLeft && matchRight
&& (sValuePtr->relief != TK_RELIEF_FLAT)) {
- bw = sValuePtr->borderWidth;
- if (rightX2 + sValuePtr->borderWidth > rightX) {
- bw = rightX - rightX2;
- }
+ bw = sValuePtr->borderWidth;
+ if (rightX2 + sValuePtr->borderWidth > rightX) {
+ bw = rightX - rightX2;
+ }
Tk_3DVerticalBevel(textPtr->tkwin, pixmap, sValuePtr->border,
rightX2 + xOffset,
y + dlPtr->height - sValuePtr->borderWidth, bw,
@@ -3022,7 +3022,7 @@ AsyncUpdateLineMetrics(
dInfoPtr->lineUpdateTimer = NULL;
if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)
- || !Tk_IsMapped(textPtr->tkwin)) {
+ || !Tk_IsMapped(textPtr->tkwin)) {
/*
* The widget has been deleted, or is not mapped. Don't do anything.
*/
@@ -3082,27 +3082,27 @@ AsyncUpdateLineMetrics(
* after the afterSyncCmd pointer had been set to NULL.
*/
- if (textPtr->afterSyncCmd) {
- int code;
+ if (textPtr->afterSyncCmd) {
+ int code;
Tcl_CancelIdleCall(TkTextRunAfterSyncCmd, textPtr);
- Tcl_Preserve(textPtr->interp);
- code = Tcl_EvalObjEx(textPtr->interp, textPtr->afterSyncCmd,
- TCL_EVAL_GLOBAL);
+ Tcl_Preserve(textPtr->interp);
+ code = Tcl_EvalObjEx(textPtr->interp, textPtr->afterSyncCmd,
+ TCL_EVAL_GLOBAL);
if (code == TCL_ERROR) {
- Tcl_AddErrorInfo(textPtr->interp, "\n (text sync)");
- Tcl_BackgroundException(textPtr->interp, TCL_ERROR);
+ Tcl_AddErrorInfo(textPtr->interp, "\n (text sync)");
+ Tcl_BackgroundException(textPtr->interp, TCL_ERROR);
}
- Tcl_Release(textPtr->interp);
- Tcl_DecrRefCount(textPtr->afterSyncCmd);
- textPtr->afterSyncCmd = NULL;
+ Tcl_Release(textPtr->interp);
+ Tcl_DecrRefCount(textPtr->afterSyncCmd);
+ textPtr->afterSyncCmd = NULL;
}
- /*
- * Fire the <<WidgetViewSync>> event since the widget view is in sync
- * with its internal data (actually it will be after the next trip
- * through the event loop, because the widget redraws at idle-time).
- */
- GenerateWidgetViewSyncEvent(textPtr, 1);
+ /*
+ * Fire the <<WidgetViewSync>> event since the widget view is in sync
+ * with its internal data (actually it will be after the next trip
+ * through the event loop, because the widget redraws at idle-time).
+ */
+ GenerateWidgetViewSyncEvent(textPtr, 1);
if (textPtr->refCount-- <= 1) {
ckfree(textPtr);
@@ -3218,8 +3218,8 @@ TkTextUpdateLineMetrics(
int count = 0;
int totalLines = TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr);
int fullUpdateRequested = (lineNum == 0 &&
- endLine == totalLines &&
- doThisMuch == -1);
+ endLine == totalLines &&
+ doThisMuch == -1);
if (totalLines == 0) {
/*
@@ -3398,7 +3398,7 @@ TkTextUpdateLineMetrics(
GetYView(textPtr->interp, textPtr, 1);
}
if (fullUpdateRequested) {
- GenerateWidgetViewSyncEvent(textPtr, 1);
+ GenerateWidgetViewSyncEvent(textPtr, 1);
}
return lineNum;
}
@@ -3774,24 +3774,24 @@ CalculateDisplayLineHeight(
int pixelHeight;
if (tkTextDebug) {
- int oldtkTextDebug = tkTextDebug;
- /*
- * Check that the indexPtr we are given really is at the start of a
- * display line. The gymnastics with tkTextDebug is to prevent
- * failure of a test suite test, that checks that lines are rendered
- * exactly once. TkTextFindDisplayLineEnd is used here for checking
- * indexPtr but it calls LayoutDLine/FreeDLine which makes the
- * counting wrong. The debug mode shall therefore be switched off
- * when calling TkTextFindDisplayLineEnd.
- */
-
- TkTextIndex indexPtr2 = *indexPtr;
- tkTextDebug = 0;
- TkTextFindDisplayLineEnd(textPtr, &indexPtr2, 0, NULL);
- tkTextDebug = oldtkTextDebug;
- if (TkTextIndexCmp(&indexPtr2,indexPtr) != 0) {
- Tcl_Panic("CalculateDisplayLineHeight called with bad indexPtr");
- }
+ int oldtkTextDebug = tkTextDebug;
+ /*
+ * Check that the indexPtr we are given really is at the start of a
+ * display line. The gymnastics with tkTextDebug is to prevent
+ * failure of a test suite test, that checks that lines are rendered
+ * exactly once. TkTextFindDisplayLineEnd is used here for checking
+ * indexPtr but it calls LayoutDLine/FreeDLine which makes the
+ * counting wrong. The debug mode shall therefore be switched off
+ * when calling TkTextFindDisplayLineEnd.
+ */
+
+ TkTextIndex indexPtr2 = *indexPtr;
+ tkTextDebug = 0;
+ TkTextFindDisplayLineEnd(textPtr, &indexPtr2, 0, NULL);
+ tkTextDebug = oldtkTextDebug;
+ if (TkTextIndexCmp(&indexPtr2,indexPtr) != 0) {
+ Tcl_Panic("CalculateDisplayLineHeight called with bad indexPtr");
+ }
}
/*
@@ -3870,12 +3870,12 @@ TkTextIndexYPixels(
index = *indexPtr;
while (1) {
- TkTextFindDisplayLineEnd(textPtr, &index, 0, NULL);
- if (index.byteIndex == 0) {
- break;
- }
- TkTextIndexBackBytes(textPtr, &index, 1, &index);
- alreadyStartOfLine = 0;
+ TkTextFindDisplayLineEnd(textPtr, &index, 0, NULL);
+ if (index.byteIndex == 0) {
+ break;
+ }
+ TkTextIndexBackBytes(textPtr, &index, 1, &index);
+ alreadyStartOfLine = 0;
}
pixelHeight = TkBTreePixelsTo(textPtr, index.linePtr);
@@ -3887,7 +3887,7 @@ TkTextIndexYPixels(
*/
if (alreadyStartOfLine) {
- return pixelHeight;
+ return pixelHeight;
}
/*
@@ -3909,10 +3909,10 @@ TkTextIndexYPixels(
height = CalculateDisplayLineHeight(textPtr, &index, &bytes, NULL);
- TkTextIndexForwBytes(textPtr, &index, bytes, &index);
+ TkTextIndexForwBytes(textPtr, &index, bytes, &index);
- compare = TkTextIndexCmp(&index,indexPtr);
- if (compare > 0) {
+ compare = TkTextIndexCmp(&index,indexPtr);
+ if (compare > 0) {
return pixelHeight;
}
@@ -3920,7 +3920,7 @@ TkTextIndexYPixels(
pixelHeight += height;
}
- if (compare == 0) {
+ if (compare == 0) {
return pixelHeight;
}
}
@@ -4020,7 +4020,7 @@ TkTextUpdateOneLine(
* test below this while loop.
*/
- height = CalculateDisplayLineHeight(textPtr, indexPtr, &bytes,
+ height = CalculateDisplayLineHeight(textPtr, indexPtr, &bytes,
&logicalLines);
if (height > 0) {
@@ -4034,31 +4034,31 @@ TkTextUpdateOneLine(
break;
}
- if (mergedLines == 0) {
- if (indexPtr->linePtr != linePtr) {
- /*
- * If we reached the end of the logical line, then either way
- * we don't have a partial calculation.
- */
-
- partialCalc = 0;
- break;
- }
- } else {
- if (IsStartOfNotMergedLine(textPtr, indexPtr)) {
- /*
- * We've ended a logical line.
- */
-
- partialCalc = 0;
- break;
- }
-
- /*
- * We must still be on the same wrapped line, on a new logical
- * line merged with the logical line 'linePtr'.
- */
- }
+ if (mergedLines == 0) {
+ if (indexPtr->linePtr != linePtr) {
+ /*
+ * If we reached the end of the logical line, then either way
+ * we don't have a partial calculation.
+ */
+
+ partialCalc = 0;
+ break;
+ }
+ } else {
+ if (IsStartOfNotMergedLine(textPtr, indexPtr)) {
+ /*
+ * We've ended a logical line.
+ */
+
+ partialCalc = 0;
+ break;
+ }
+
+ /*
+ * We must still be on the same wrapped line, on a new logical
+ * line merged with the logical line 'linePtr'.
+ */
+ }
if (partialCalc && displayLines > 50 && mergedLines == 0) {
/*
* Only calculate 50 display lines at a time, to avoid huge
@@ -4906,8 +4906,8 @@ TextChanged(
rounded.byteIndex = 0;
notBegin = 0;
while (!IsStartOfNotMergedLine(textPtr, &rounded) && notBegin) {
- notBegin = !TkTextIndexBackBytes(textPtr, &rounded, 1, &rounded);
- rounded.byteIndex = 0;
+ notBegin = !TkTextIndexBackBytes(textPtr, &rounded, 1, &rounded);
+ rounded.byteIndex = 0;
}
/*
@@ -4919,11 +4919,11 @@ TextChanged(
firstPtr = FindDLine(textPtr, dInfoPtr->dLinePtr, &rounded);
if (firstPtr == NULL) {
- /*
- * index1Ptr pertains to no display line, i.e this index is after
- * the last display line. Since index2Ptr is after index1Ptr, there
- * is no display line to free/redisplay and we can return early.
- */
+ /*
+ * index1Ptr pertains to no display line, i.e this index is after
+ * the last display line. Since index2Ptr is after index1Ptr, there
+ * is no display line to free/redisplay and we can return early.
+ */
return;
}
@@ -4931,38 +4931,38 @@ TextChanged(
rounded = *index2Ptr;
linePtr = index2Ptr->linePtr;
do {
- linePtr = TkBTreeNextLine(textPtr, linePtr);
- if (linePtr == NULL) {
- break;
- }
- rounded.linePtr = linePtr;
- rounded.byteIndex = 0;
+ linePtr = TkBTreeNextLine(textPtr, linePtr);
+ if (linePtr == NULL) {
+ break;
+ }
+ rounded.linePtr = linePtr;
+ rounded.byteIndex = 0;
} while (!IsStartOfNotMergedLine(textPtr, &rounded));
if (linePtr == NULL) {
- lastPtr = NULL;
+ lastPtr = NULL;
} else {
- /*
- * 'rounded' now points to the start of a display line as well as the
- * start of a logical line not merged with its previous line, and
- * this index is the closest after index2Ptr.
- */
+ /*
+ * 'rounded' now points to the start of a display line as well as the
+ * start of a logical line not merged with its previous line, and
+ * this index is the closest after index2Ptr.
+ */
- lastPtr = FindDLine(textPtr, dInfoPtr->dLinePtr, &rounded);
+ lastPtr = FindDLine(textPtr, dInfoPtr->dLinePtr, &rounded);
- /*
- * At least one display line is supposed to change. This makes the
- * redisplay OK in case the display line we expect to get here was
- * unlinked by a previous call to TkTextChanged and the text widget
- * did not update before reaching this point. This happens for
- * instance when moving the cursor up one line.
- * Note that lastPtr != NULL here, otherwise we would have returned
- * earlier when we tested for firstPtr being NULL.
- */
+ /*
+ * At least one display line is supposed to change. This makes the
+ * redisplay OK in case the display line we expect to get here was
+ * unlinked by a previous call to TkTextChanged and the text widget
+ * did not update before reaching this point. This happens for
+ * instance when moving the cursor up one line.
+ * Note that lastPtr != NULL here, otherwise we would have returned
+ * earlier when we tested for firstPtr being NULL.
+ */
- if (lastPtr == firstPtr) {
- lastPtr = lastPtr->nextPtr;
- }
+ if (lastPtr == firstPtr) {
+ lastPtr = lastPtr->nextPtr;
+ }
}
/*
@@ -5147,7 +5147,7 @@ TextRedrawTag(
} else {
TkTextIndex tmp = *curIndexPtr;
- TkTextIndexBackBytes(textPtr, &tmp, 1, &tmp);
+ TkTextIndexBackBytes(textPtr, &tmp, 1, &tmp);
dlPtr = FindDLine(textPtr, dlPtr, &tmp);
}
if (dlPtr == NULL) {
@@ -5166,7 +5166,7 @@ TextRedrawTag(
}
endPtr = FindDLine(textPtr, dlPtr, endIndexPtr);
if ((endPtr != NULL)
- && (TkTextIndexCmp(&endPtr->index,endIndexPtr) < 0)) {
+ && (TkTextIndexCmp(&endPtr->index,endIndexPtr) < 0)) {
endPtr = endPtr->nextPtr;
}
@@ -5327,7 +5327,7 @@ TkTextRelayoutWindow(
inSync = 0;
}
- GenerateWidgetViewSyncEvent(textPtr, inSync);
+ GenerateWidgetViewSyncEvent(textPtr, inSync);
}
}
@@ -5403,9 +5403,9 @@ TkTextSetYView(
*/
textPtr->topIndex = *indexPtr;
- if (!IsStartOfNotMergedLine(textPtr, indexPtr)) {
- TkTextFindDisplayLineEnd(textPtr, &textPtr->topIndex, 0, NULL);
- }
+ if (!IsStartOfNotMergedLine(textPtr, indexPtr)) {
+ TkTextFindDisplayLineEnd(textPtr, &textPtr->topIndex, 0, NULL);
+ }
dInfoPtr->newTopPixelOffset = pickPlace;
goto scheduleUpdate;
}
@@ -5428,23 +5428,23 @@ TkTextSetYView(
*/
dlPtr = NULL;
- } else {
- if (TkTextIndexCmp(&dlPtr->index, indexPtr) <= 0) {
- if (dInfoPtr->dLinePtr == dlPtr && dInfoPtr->topPixelOffset != 0) {
- /*
- * It is on the top line, but that line is hanging off the top
- * of the screen. Change the top overlap to zero and update.
- */
-
- dInfoPtr->newTopPixelOffset = 0;
- goto scheduleUpdate;
- }
- /*
- * The line is already on screen, with no need to scroll.
- */
- return;
- }
- }
+ } else {
+ if (TkTextIndexCmp(&dlPtr->index, indexPtr) <= 0) {
+ if (dInfoPtr->dLinePtr == dlPtr && dInfoPtr->topPixelOffset != 0) {
+ /*
+ * It is on the top line, but that line is hanging off the top
+ * of the screen. Change the top overlap to zero and update.
+ */
+
+ dInfoPtr->newTopPixelOffset = 0;
+ goto scheduleUpdate;
+ }
+ /*
+ * The line is already on screen, with no need to scroll.
+ */
+ return;
+ }
+ }
}
/*
@@ -5509,7 +5509,7 @@ TkTextSetYView(
*/
if (dInfoPtr->maxY - dInfoPtr->y < lineHeight) {
- bottomY = lineHeight;
+ bottomY = lineHeight;
}
/*
@@ -5645,8 +5645,8 @@ MeasureUp(
index.linePtr = TkBTreeFindLine(srcPtr->tree, textPtr, lineNum);
index.byteIndex = 0;
- TkTextFindDisplayLineEnd(textPtr, &index, 0, NULL);
- lineNum = TkBTreeLinesTo(textPtr, index.linePtr);
+ TkTextFindDisplayLineEnd(textPtr, &index, 0, NULL);
+ lineNum = TkBTreeLinesTo(textPtr, index.linePtr);
lowestPtr = NULL;
do {
dlPtr = LayoutDLine(textPtr, &index);
@@ -5667,21 +5667,21 @@ MeasureUp(
for (dlPtr = lowestPtr; dlPtr != NULL; dlPtr = dlPtr->nextPtr) {
distance -= dlPtr->height;
if (distance <= 0) {
- *dstPtr = dlPtr->index;
-
- /*
- * dstPtr is the start of a display line that is or is not
- * the start of a logical line. If it is the start of a
- * logical line, we must check whether this line is merged
- * with the previous logical line, and if so we must adjust
- * dstPtr to the start of the display line since a display
- * line start needs to be returned.
- */
- if (!IsStartOfNotMergedLine(textPtr, dstPtr)) {
- TkTextFindDisplayLineEnd(textPtr, dstPtr, 0, NULL);
- }
-
- if (overlap != NULL) {
+ *dstPtr = dlPtr->index;
+
+ /*
+ * dstPtr is the start of a display line that is or is not
+ * the start of a logical line. If it is the start of a
+ * logical line, we must check whether this line is merged
+ * with the previous logical line, and if so we must adjust
+ * dstPtr to the start of the display line since a display
+ * line start needs to be returned.
+ */
+ if (!IsStartOfNotMergedLine(textPtr, dstPtr)) {
+ TkTextFindDisplayLineEnd(textPtr, dstPtr, 0, NULL);
+ }
+
+ if (overlap != NULL) {
*overlap = -distance;
}
break;
@@ -5814,30 +5814,30 @@ TkTextSeeCmd(
*/
if (chunkPtr != NULL) {
- chunkPtr->bboxProc(textPtr, chunkPtr, byteCount,
- dlPtr->y + dlPtr->spaceAbove,
- dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow,
- dlPtr->baseline - dlPtr->spaceAbove, &x, &y, &width,
- &height);
- delta = x - dInfoPtr->curXPixelOffset;
- oneThird = lineWidth/3;
- if (delta < 0) {
- if (delta < -oneThird) {
- dInfoPtr->newXPixelOffset = x - lineWidth/2;
- } else {
- dInfoPtr->newXPixelOffset += delta;
- }
- } else {
- delta -= lineWidth - width;
- if (delta <= 0) {
- return TCL_OK;
- }
- if (delta > oneThird) {
- dInfoPtr->newXPixelOffset = x - lineWidth/2;
- } else {
- dInfoPtr->newXPixelOffset += delta;
- }
- }
+ chunkPtr->bboxProc(textPtr, chunkPtr, byteCount,
+ dlPtr->y + dlPtr->spaceAbove,
+ dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow,
+ dlPtr->baseline - dlPtr->spaceAbove, &x, &y, &width,
+ &height);
+ delta = x - dInfoPtr->curXPixelOffset;
+ oneThird = lineWidth/3;
+ if (delta < 0) {
+ if (delta < -oneThird) {
+ dInfoPtr->newXPixelOffset = x - lineWidth/2;
+ } else {
+ dInfoPtr->newXPixelOffset += delta;
+ }
+ } else {
+ delta -= lineWidth - width;
+ if (delta <= 0) {
+ return TCL_OK;
+ }
+ if (delta > oneThird) {
+ dInfoPtr->newXPixelOffset = x - lineWidth/2;
+ } else {
+ dInfoPtr->newXPixelOffset += delta;
+ }
+ }
}
dInfoPtr->flags |= DINFO_OUT_OF_DATE;
if (!(dInfoPtr->flags & REDRAW_PENDING)) {
@@ -6075,24 +6075,24 @@ YScrollByLines(
if (offset == 0) {
textPtr->topIndex = dlPtr->index;
- /*
- * topIndex is the start of a logical line. However, if
- * the eol of the previous logical line is elided, then
- * topIndex may be elsewhere than the first character of
- * a display line, which is unwanted. Adjust to the start
- * of the display line, if needed.
- * topIndex is the start of a display line that is or is
- * not the start of a logical line. If it is the start of
- * a logical line, we must check whether this line is
- * merged with the previous logical line, and if so we
- * must adjust topIndex to the start of the display line.
- */
- if (!IsStartOfNotMergedLine(textPtr, &textPtr->topIndex)) {
- TkTextFindDisplayLineEnd(textPtr, &textPtr->topIndex,
- 0, NULL);
- }
-
- break;
+ /*
+ * topIndex is the start of a logical line. However, if
+ * the eol of the previous logical line is elided, then
+ * topIndex may be elsewhere than the first character of
+ * a display line, which is unwanted. Adjust to the start
+ * of the display line, if needed.
+ * topIndex is the start of a display line that is or is
+ * not the start of a logical line. If it is the start of
+ * a logical line, we must check whether this line is
+ * merged with the previous logical line, and if so we
+ * must adjust topIndex to the start of the display line.
+ */
+ if (!IsStartOfNotMergedLine(textPtr, &textPtr->topIndex)) {
+ TkTextFindDisplayLineEnd(textPtr, &textPtr->topIndex,
+ 0, NULL);
+ }
+
+ break;
}
}
@@ -6922,63 +6922,63 @@ FindDLine(
*/
while (TkTextIndexCmp(&dlPtr->index,indexPtr) < 0) {
- dlPtrPrev = dlPtr;
- dlPtr = dlPtr->nextPtr;
- if (dlPtr == NULL) {
- /*
- * We're past the last display line, either because the desired
- * index lies past the visible text, or because the desired index
- * is on the last display line.
- */
- indexPtr2 = dlPtrPrev->index;
- TkTextIndexForwBytes(textPtr, &indexPtr2, dlPtrPrev->byteCount,
- &indexPtr2);
- if (TkTextIndexCmp(&indexPtr2,indexPtr) > 0) {
- /*
- * The desired index is on the last display line.
- * --> return this display line.
- */
- dlPtr = dlPtrPrev;
- } else {
- /*
- * The desired index is past the visible text. There is no
- * display line displaying something at the desired index.
- * --> return NULL.
- */
- }
- break;
- }
- if (TkTextIndexCmp(&dlPtr->index,indexPtr) > 0) {
- /*
- * If we're here then we would normally expect that:
- * dlPtrPrev->index <= indexPtr < dlPtr->index
- * i.e. we have found the searched display line being dlPtr.
- * However it is possible that some DLines were unlinked
- * previously, leading to a situation where going through
- * the list of display lines skips display lines that did
- * exist just a moment ago.
- */
- indexPtr2 = dlPtrPrev->index;
- TkTextIndexForwBytes(textPtr, &indexPtr2, dlPtrPrev->byteCount,
- &indexPtr2);
- if (TkTextIndexCmp(&indexPtr2,indexPtr) > 0) {
- /*
- * Confirmed:
- * dlPtrPrev->index <= indexPtr < dlPtr->index
- * --> return dlPtrPrev.
- */
- dlPtr = dlPtrPrev;
- } else {
- /*
- * The last (rightmost) index shown by dlPtrPrev is still
- * before the desired index. This may be because there was
- * previously a display line between dlPtrPrev and dlPtr
- * and this display line has been unlinked.
- * --> return dlPtr.
- */
- }
- break;
- }
+ dlPtrPrev = dlPtr;
+ dlPtr = dlPtr->nextPtr;
+ if (dlPtr == NULL) {
+ /*
+ * We're past the last display line, either because the desired
+ * index lies past the visible text, or because the desired index
+ * is on the last display line.
+ */
+ indexPtr2 = dlPtrPrev->index;
+ TkTextIndexForwBytes(textPtr, &indexPtr2, dlPtrPrev->byteCount,
+ &indexPtr2);
+ if (TkTextIndexCmp(&indexPtr2,indexPtr) > 0) {
+ /*
+ * The desired index is on the last display line.
+ * --> return this display line.
+ */
+ dlPtr = dlPtrPrev;
+ } else {
+ /*
+ * The desired index is past the visible text. There is no
+ * display line displaying something at the desired index.
+ * --> return NULL.
+ */
+ }
+ break;
+ }
+ if (TkTextIndexCmp(&dlPtr->index,indexPtr) > 0) {
+ /*
+ * If we're here then we would normally expect that:
+ * dlPtrPrev->index <= indexPtr < dlPtr->index
+ * i.e. we have found the searched display line being dlPtr.
+ * However it is possible that some DLines were unlinked
+ * previously, leading to a situation where going through
+ * the list of display lines skips display lines that did
+ * exist just a moment ago.
+ */
+ indexPtr2 = dlPtrPrev->index;
+ TkTextIndexForwBytes(textPtr, &indexPtr2, dlPtrPrev->byteCount,
+ &indexPtr2);
+ if (TkTextIndexCmp(&indexPtr2,indexPtr) > 0) {
+ /*
+ * Confirmed:
+ * dlPtrPrev->index <= indexPtr < dlPtr->index
+ * --> return dlPtrPrev.
+ */
+ dlPtr = dlPtrPrev;
+ } else {
+ /*
+ * The last (rightmost) index shown by dlPtrPrev is still
+ * before the desired index. This may be because there was
+ * previously a display line between dlPtrPrev and dlPtr
+ * and this display line has been unlinked.
+ * --> return dlPtr.
+ */
+ }
+ break;
+ }
}
return dlPtr;
@@ -7011,24 +7011,24 @@ IsStartOfNotMergedLine(
TkTextIndex indexPtr2;
if (indexPtr->byteIndex != 0) {
- /*
- * Not the start of a logical line.
- */
- return 0;
+ /*
+ * Not the start of a logical line.
+ */
+ return 0;
}
if (TkTextIndexBackBytes(textPtr, indexPtr, 1, &indexPtr2)) {
- /*
- * indexPtr is the first index of the text widget.
- */
- return 1;
+ /*
+ * indexPtr is the first index of the text widget.
+ */
+ return 1;
}
if (!TkTextIsElided(textPtr, &indexPtr2, NULL)) {
- /*
- * The eol of the line just before indexPtr is elided.
- */
- return 1;
+ /*
+ * The eol of the line just before indexPtr is elided.
+ */
+ return 1;
}
return 0;
@@ -7202,7 +7202,7 @@ DlineIndexOfX(
* We've reached the end of the text.
*/
- TkTextIndexBackChars(NULL, indexPtr, 1, indexPtr, COUNT_INDICES);
+ TkTextIndexBackChars(NULL, indexPtr, 1, indexPtr, COUNT_INDICES);
return;
}
if (chunkPtr->nextPtr == NULL) {
@@ -7210,7 +7210,7 @@ DlineIndexOfX(
* We've reached the end of the display line.
*/
- TkTextIndexBackChars(NULL, indexPtr, 1, indexPtr, COUNT_INDICES);
+ TkTextIndexBackChars(NULL, indexPtr, 1, indexPtr, COUNT_INDICES);
return;
}
chunkPtr = chunkPtr->nextPtr;
@@ -7434,9 +7434,9 @@ TkTextIndexBbox(
if (charWidthPtr != NULL) {
*charWidthPtr = dInfoPtr->maxX - *xPtr;
- if (*charWidthPtr > textPtr->charWidth) {
- *charWidthPtr = textPtr->charWidth;
- }
+ if (*charWidthPtr > textPtr->charWidth) {
+ *charWidthPtr = textPtr->charWidth;
+ }
}
if (*xPtr > dInfoPtr->maxX) {
*xPtr = dInfoPtr->maxX;
@@ -7725,21 +7725,21 @@ TkTextCharLayoutProc(
nextX = maxX;
bytesThatFit++;
}
- if (wrapMode == TEXT_WRAPMODE_WORD) {
- while (p[bytesThatFit] == ' ') {
- /*
- * Space characters that would go at the beginning of the
- * next line are allocated to the current line. This gives
- * the effect of trimming white spaces that would otherwise
- * be seen at the beginning of wrapped lines.
- * Note that testing for '\t' is useless here because the
- * chunk always includes at most one trailing \t, see
- * LayoutDLine.
- */
-
- bytesThatFit++;
- }
- }
+ if (wrapMode == TEXT_WRAPMODE_WORD) {
+ while (p[bytesThatFit] == ' ') {
+ /*
+ * Space characters that would go at the beginning of the
+ * next line are allocated to the current line. This gives
+ * the effect of trimming white spaces that would otherwise
+ * be seen at the beginning of wrapped lines.
+ * Note that testing for '\t' is useless here because the
+ * chunk always includes at most one trailing \t, see
+ * LayoutDLine.
+ */
+
+ bytesThatFit++;
+ }
+ }
if (p[bytesThatFit] == '\n') {
/*
* A newline character takes up no space, so if the previous
diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c
index d566d5c..5a4115c 100644
--- a/generic/tkTextIndex.c
+++ b/generic/tkTextIndex.c
@@ -45,8 +45,8 @@ static int GetIndex(Tcl_Interp *interp, TkSharedText *sharedPtr,
TkText *textPtr, const char *string,
TkTextIndex *indexPtr, int *canCachePtr);
static int IndexCountBytesOrdered(const TkText *textPtr,
- const TkTextIndex *indexPtr1,
- const TkTextIndex *indexPtr2);
+ const TkTextIndex *indexPtr1,
+ const TkTextIndex *indexPtr2);
#if defined(USE_TCL_STUBS) && (TCL_MAJOR_VERSION < 9)
# undef Tcl_UtfPrev
@@ -1387,7 +1387,7 @@ ForwBack(
} else {
TkTextFindDisplayLineEnd(textPtr, indexPtr, 0, &xOffset);
while (count-- > 0) {
- TkTextIndex indexPtr2;
+ TkTextIndex indexPtr2;
/*
* Go to the beginning of the line, then backward one
@@ -1398,20 +1398,20 @@ ForwBack(
TkTextIndexBackChars(textPtr, indexPtr, 1, &indexPtr2,
COUNT_DISPLAY_INDICES);
- /*
- * If we couldn't go to the previous line, then we wanted
- to go before the start of the text: arrange for returning
- the first index of the first display line.
- */
-
- if (!TkTextIndexCmp(indexPtr, &indexPtr2)) {
- xOffset = 0;
- break;
- }
- *indexPtr = indexPtr2;
+ /*
+ * If we couldn't go to the previous line, then we wanted
+ to go before the start of the text: arrange for returning
+ the first index of the first display line.
+ */
+
+ if (!TkTextIndexCmp(indexPtr, &indexPtr2)) {
+ xOffset = 0;
+ break;
+ }
+ *indexPtr = indexPtr2;
}
}
- TkTextFindDisplayLineEnd(textPtr, indexPtr, 0, NULL);
+ TkTextFindDisplayLineEnd(textPtr, indexPtr, 0, NULL);
/*
* This call assumes indexPtr is the beginning of a display line
@@ -1757,7 +1757,7 @@ IndexCountBytesOrdered(
TkTextLine *linePtr;
if (indexPtr1->linePtr == indexPtr2->linePtr) {
- return indexPtr2->byteIndex - indexPtr1->byteIndex;
+ return indexPtr2->byteIndex - indexPtr1->byteIndex;
}
/*
@@ -1771,19 +1771,19 @@ IndexCountBytesOrdered(
segPtr1 = TkTextIndexToSeg(indexPtr1, &offset);
byteCount = -offset;
for (segPtr = segPtr1; segPtr != NULL; segPtr = segPtr->nextPtr) {
- byteCount += segPtr->size;
+ byteCount += segPtr->size;
}
linePtr = TkBTreeNextLine(textPtr, indexPtr1->linePtr);
while (linePtr != indexPtr2->linePtr) {
for (segPtr = linePtr->segPtr; segPtr != NULL;
- segPtr = segPtr->nextPtr) {
- byteCount += segPtr->size;
- }
- linePtr = TkBTreeNextLine(textPtr, linePtr);
- if (linePtr == NULL) {
- Tcl_Panic("TextIndexCountBytesOrdered ran out of lines");
- }
+ segPtr = segPtr->nextPtr) {
+ byteCount += segPtr->size;
+ }
+ linePtr = TkBTreeNextLine(textPtr, linePtr);
+ if (linePtr == NULL) {
+ Tcl_Panic("TextIndexCountBytesOrdered ran out of lines");
+ }
}
byteCount += indexPtr2->byteIndex;
diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c
index db1dec1..2339ed0 100644
--- a/generic/tkTextMark.c
+++ b/generic/tkTextMark.c
@@ -301,7 +301,7 @@ TkTextSetMark(
if (markPtr == textPtr->insertMarkPtr) {
TkTextIndex index, index2;
- int nblines;
+ int nblines;
TkTextMarkSegToIndex(textPtr, textPtr->insertMarkPtr, &index);
TkTextIndexForwChars(NULL, &index, 1, &index2, COUNT_INDICES);
@@ -313,12 +313,12 @@ TkTextSetMark(
TkTextChanged(NULL, textPtr, &index, &index2);
- /*
- * The number of lines in the widget is zero if and only if it is
- * a partial peer with -startline == -endline, i.e. an empty
- * peer. In this case the mark shall be set exactly at the given
- * index, and not one character backwards (bug 3487407).
- */
+ /*
+ * The number of lines in the widget is zero if and only if it is
+ * a partial peer with -startline == -endline, i.e. an empty
+ * peer. In this case the mark shall be set exactly at the given
+ * index, and not one character backwards (bug 3487407).
+ */
nblines = TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr);
if ((TkBTreeLinesTo(textPtr, indexPtr->linePtr) == nblines)
@@ -436,7 +436,7 @@ TkTextMarkNameToIndex(
TkTextSegment *segPtr;
if (textPtr == NULL) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
if (!strcmp(name, "insert")) {
@@ -749,7 +749,7 @@ MarkCheckProc(
*/
if (markPtr->body.mark.textPtr->insertMarkPtr == markPtr) {
- return;
+ return;
}
if (markPtr->body.mark.textPtr->currentMarkPtr == markPtr) {
return;
@@ -933,16 +933,16 @@ MarkFindPrev(
seg2Ptr = seg2Ptr->nextPtr) {
if (seg2Ptr->typePtr == &tkTextRightMarkType ||
seg2Ptr->typePtr == &tkTextLeftMarkType) {
- if (seg2Ptr->body.mark.hPtr == NULL) {
- if (seg2Ptr != textPtr->currentMarkPtr &&
- seg2Ptr != textPtr->insertMarkPtr) {
- /*
- * This is an insert or current mark from a
- * peer of textPtr.
- */
- continue;
- }
- }
+ if (seg2Ptr->body.mark.hPtr == NULL) {
+ if (seg2Ptr != textPtr->currentMarkPtr &&
+ seg2Ptr != textPtr->insertMarkPtr) {
+ /*
+ * This is an insert or current mark from a
+ * peer of textPtr.
+ */
+ continue;
+ }
+ }
prevPtr = seg2Ptr;
}
}
diff --git a/tests/canvas.test b/tests/canvas.test
index c06e0d2..e75ab36 100644
--- a/tests/canvas.test
+++ b/tests/canvas.test
@@ -558,6 +558,13 @@ test canvas-11.3 {canvas poly dchars, bug 3291543} {
.c dchars 1 2 end
.c coords 1
} {}
+test canvas-11.4 {canvas line dchars crash with -arrows, bug 51ece3786f} {
+ # This would crash
+ destroy .c
+ canvas .c
+ .c create line 10 10 100 100 -arrow last
+ .c dchars 1 0 1
+} {}
test canvas-12.1 {canvas mm obj, patch SF-403327, 102471} -setup {
destroy .c
diff --git a/unix/tkUnixEmbed.c b/unix/tkUnixEmbed.c
index 6215671..a8765bd 100644
--- a/unix/tkUnixEmbed.c
+++ b/unix/tkUnixEmbed.c
@@ -107,7 +107,7 @@ Tk_UseWindow(
Container *containerPtr;
XWindowAttributes parentAtts;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->window != None) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -139,7 +139,7 @@ Tk_UseWindow(
handler = Tk_CreateErrorHandler(winPtr->display, -1, -1, -1,
EmbedErrorProc, &anyError);
if (!XGetWindowAttributes(winPtr->display, parent, &parentAtts)) {
- anyError = 1;
+ anyError = 1;
}
XSync(winPtr->display, False);
Tk_DeleteErrorHandler(handler);
@@ -218,7 +218,7 @@ Tk_MakeWindow(
Container *containerPtr;
TkWindow *winPtr = (TkWindow *) tkwin;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->flags & TK_EMBEDDED) {
/*
@@ -274,7 +274,7 @@ Tk_MakeContainer(
TkWindow *winPtr = (TkWindow *) tkwin;
Container *containerPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* Register the window as a container so that, for example, we can find
@@ -400,7 +400,7 @@ ContainerEventProc(
Container *containerPtr;
Tk_ErrorHandler errHandler;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* Ignore any X protocol errors that happen in this function (almost any
@@ -505,13 +505,13 @@ EmbedStructureProc(
Tk_ErrorHandler errHandler;
if (eventPtr->type == ConfigureNotify) {
- /*
- * Send a ConfigureNotify to the embedded application.
- */
+ /*
+ * Send a ConfigureNotify to the embedded application.
+ */
- if (containerPtr->embeddedPtr != NULL) {
- TkDoConfigureNotify(containerPtr->embeddedPtr);
- }
+ if (containerPtr->embeddedPtr != NULL) {
+ TkDoConfigureNotify(containerPtr->embeddedPtr);
+ }
if (containerPtr->wrapper != None) {
/*
@@ -715,10 +715,10 @@ Tk_GetOtherWindow(
{
Container *containerPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (containerPtr = tsdPtr->firstContainerPtr;
- containerPtr != NULL;
+ containerPtr != NULL;
containerPtr = containerPtr->nextPtr) {
if ((Tk_Window)containerPtr->embeddedPtr == tkwin) {
return (Tk_Window)containerPtr->parentPtr;
@@ -761,7 +761,7 @@ TkpRedirectKeyEvent(
Container *containerPtr;
Window saved;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* First, find the top-level window corresponding to winPtr.
@@ -833,7 +833,7 @@ TkpClaimFocus(
XEvent event;
Container *containerPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!(topLevelPtr->flags & TK_EMBEDDED)) {
return;
@@ -885,7 +885,7 @@ TkpTestembedCmd(
char buffer[50];
Tcl_Interp *embeddedInterp = NULL, *parentInterp = NULL;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
(void)dummy;
if ((objc > 1) && (strcmp(Tcl_GetString(objv[1]), "all") == 0)) {
@@ -923,7 +923,7 @@ TkpTestembedCmd(
Tcl_DStringAppendElement(&dString,
containerPtr->parentPtr->pathName);
}
- /* Wrapper */
+ /* Wrapper */
if (containerPtr->wrapper == None) {
Tcl_DStringAppendElement(&dString, "");
} else if (all) {
@@ -971,7 +971,7 @@ EmbedWindowDeleted(
{
Container *containerPtr, *prevPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* Find the Container structure for this window work. Delete the
@@ -1030,10 +1030,10 @@ TkUnixContainerId(
{
Container *containerPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (containerPtr = tsdPtr->firstContainerPtr;
- containerPtr != NULL; containerPtr = containerPtr->nextPtr) {
+ containerPtr != NULL; containerPtr = containerPtr->nextPtr) {
if (containerPtr->embeddedPtr == winPtr) {
return containerPtr->parent;
}
diff --git a/unix/tkUnixInit.c b/unix/tkUnixInit.c
index c8acf22..f11263f 100644
--- a/unix/tkUnixInit.c
+++ b/unix/tkUnixInit.c
@@ -148,7 +148,7 @@ GetLibraryPath(
"com.tcltk.tklibrary", TK_FRAMEWORK_VERSION, 0, PATH_MAX,
tkLibPath);
if (tkLibPath[0] != '\0') {
- Tcl_SetVar2(interp, "tk_library", NULL, tkLibPath, TCL_GLOBAL_ONLY);
+ Tcl_SetVar2(interp, "tk_library", NULL, tkLibPath, TCL_GLOBAL_ONLY);
}
return foundInFramework;
}
diff --git a/unix/tkUnixKey.c b/unix/tkUnixKey.c
index c595fbb..dbdcecd 100644
--- a/unix/tkUnixKey.c
+++ b/unix/tkUnixKey.c
@@ -160,7 +160,7 @@ TkpGetString(
Tcl_DStringSetLength(&buf, TCL_DSTRING_STATIC_SIZE-1);
len = XmbLookupString(winPtr->inputContext, &eventPtr->xkey,
Tcl_DStringValue(&buf), Tcl_DStringLength(&buf),
- &kePtr->keysym, &status);
+ &kePtr->keysym, &status);
/*
* If the buffer wasn't big enough, grow the buffer and try again.
@@ -309,7 +309,7 @@ TkpGetKeySym(
*/
if (eventPtr->xkey.keycode > 0xff) {
- return NoSymbol;
+ return NoSymbol;
}
/*
diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c
index 617edfe..0d9dd8e 100644
--- a/unix/tkUnixRFont.c
+++ b/unix/tkUnixRFont.c
@@ -955,7 +955,7 @@ Tk_DrawChars(
XftGlyphFontSpec specs[NUM_SPEC];
XGlyphInfo metrics;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (fontPtr->ftDraw == 0) {
DEBUG(("Switch to drawable 0x%lx\n", drawable));
@@ -1088,7 +1088,7 @@ TkDrawAngledChars(
XftColor *xftcolor;
int xStart = x, yStart = y;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
#ifdef XFT_HAS_FIXED_ROTATED_PLACEMENT
int clen, nglyph;
FT_UInt glyphs[NUM_SPEC];
@@ -1169,10 +1169,10 @@ TkDrawAngledChars(
* at once (or whole blocks with same font), this requires a
* dynamic 'glyphs' array. In case of overflow the array has to
* be divided until the maximal string will fit. (GC)
- * Given the resolution of current displays though, this should
- * not be a huge issue since NUM_SPEC is 1024 and thus able to
- * cover about 6000 pixels for a 6 pixel wide font (which is
- * a very small barely readable font)
+ * Given the resolution of current displays though, this should
+ * not be a huge issue since NUM_SPEC is 1024 and thus able to
+ * cover about 6000 pixels for a 6 pixel wide font (which is
+ * a very small barely readable font)
*/
LOCK;
@@ -1428,7 +1428,7 @@ TkUnixSetXftClipRegion(
Region clipRegion) /* The clipping region to install. */
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
tsdPtr->clipRegion = clipRegion;
}
diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c
index 32ba61c..eb73e14 100644
--- a/unix/tkUnixSend.c
+++ b/unix/tkUnixSend.c
@@ -309,7 +309,7 @@ RegOpen(
XDeleteProperty(dispPtr->display,
RootWindow(dispPtr->display, 0),
dispPtr->registryProperty);
- XSync(dispPtr->display, False);
+ XSync(dispPtr->display, False);
}
Tk_DeleteErrorHandler(handler);
@@ -523,7 +523,7 @@ RegClose(
Tk_ErrorHandler handler;
handler = Tk_CreateErrorHandler(regPtr->dispPtr->display, -1, -1, -1,
- NULL, NULL);
+ NULL, NULL);
if (regPtr->modified) {
if (!regPtr->locked && !localData.sendDebug) {
@@ -1990,14 +1990,14 @@ TkpTestsendCmd(
return TCL_ERROR;
}
if (index == TESTSEND_BOGUS) {
- handler = Tk_CreateErrorHandler(winPtr->dispPtr->display, -1, -1, -1,
- NULL, NULL);
+ handler = Tk_CreateErrorHandler(winPtr->dispPtr->display, -1, -1, -1,
+ NULL, NULL);
XChangeProperty(winPtr->dispPtr->display,
RootWindow(winPtr->dispPtr->display, 0),
winPtr->dispPtr->registryProperty, XA_INTEGER, 32,
PropModeReplace,
(unsigned char *) "This is bogus information", 6);
- Tk_DeleteErrorHandler(handler);
+ Tk_DeleteErrorHandler(handler);
} else if (index == TESTSEND_PROP) {
int result, actualFormat;
unsigned long length, bytesAfter;
@@ -2036,10 +2036,10 @@ TkpTestsendCmd(
XFree(property);
}
} else if (Tcl_GetString(objv[4])[0] == 0) {
- handler = Tk_CreateErrorHandler(winPtr->dispPtr->display,
- -1, -1, -1, NULL, NULL);
+ handler = Tk_CreateErrorHandler(winPtr->dispPtr->display,
+ -1, -1, -1, NULL, NULL);
XDeleteProperty(winPtr->dispPtr->display, w, propName);
- Tk_DeleteErrorHandler(handler);
+ Tk_DeleteErrorHandler(handler);
} else {
Tcl_DString tmp;
@@ -2050,12 +2050,12 @@ TkpTestsendCmd(
*p = 0;
}
}
- handler = Tk_CreateErrorHandler(winPtr->dispPtr->display,
- -1, -1, -1, NULL, NULL);
+ handler = Tk_CreateErrorHandler(winPtr->dispPtr->display,
+ -1, -1, -1, NULL, NULL);
XChangeProperty(winPtr->dispPtr->display, w, propName, XA_STRING,
8, PropModeReplace, (unsigned char*)Tcl_DStringValue(&tmp),
p-Tcl_DStringValue(&tmp));
- Tk_DeleteErrorHandler(handler);
+ Tk_DeleteErrorHandler(handler);
Tcl_DStringFree(&tmp);
}
} else if (index == TESTSEND_SERIAL) {
diff --git a/unix/tkUnixSysTray.c b/unix/tkUnixSysTray.c
index 4ee0ecd..958bae0 100644
--- a/unix/tkUnixSysTray.c
+++ b/unix/tkUnixSysTray.c
@@ -90,8 +90,8 @@ TKU_AddInput(
{
XWindowAttributes xswa;
TKU_NO_BAD_WINDOW_BEGIN(dpy)
- XGetWindowAttributes(dpy,win,&xswa);
- XSelectInput(dpy,win,xswa.your_event_mask|add_to_mask);
+ XGetWindowAttributes(dpy,win,&xswa);
+ XSelectInput(dpy,win,xswa.your_event_mask|add_to_mask);
TKU_NO_BAD_WINDOW_END
}
@@ -261,9 +261,9 @@ TrayIconObjectCmd(
int msgid;
enum {XWC_CONFIGURE = 0, XWC_CGET, XWC_BALLOON, XWC_CANCEL,
- XWC_BBOX, XWC_DOCKED, XWC_ORIENTATION};
+ XWC_BBOX, XWC_DOCKED, XWC_ORIENTATION};
const char *st_wcmd[] = {"configure", "cget", "balloon", "cancel",
- "bbox", "docked", "orientation", NULL};
+ "bbox", "docked", "orientation", NULL};
long timeout = 0;
Tcl_Obj* optionValue;
@@ -273,7 +273,7 @@ TrayIconObjectCmd(
return TCL_ERROR;
}
if (Tcl_GetIndexFromObj(interp, objv[1], st_wcmd,
- "subcommand", TCL_EXACT, &wcmd) != TCL_OK) {
+ "subcommand", TCL_EXACT, &wcmd) != TCL_OK) {
return TCL_ERROR;
}
@@ -287,7 +287,7 @@ TrayIconObjectCmd(
return TCL_ERROR;
}
optionValue = Tk_GetOptionValue(interp,(char*)icon,
- icon->options,objv[2],icon->tkwin);
+ icon->options,objv[2],icon->tkwin);
if (optionValue) {
Tcl_SetObjResult(interp,optionValue);
return TCL_OK;
@@ -323,11 +323,11 @@ TrayIconObjectCmd(
case XWC_BBOX:
if (icon->drawingWin) {
XGetWindowAttributes(Tk_Display(icon->drawingWin),
- TKU_XID(icon->drawingWin), &xwa);
+ TKU_XID(icon->drawingWin), &xwa);
XTranslateCoordinates(Tk_Display(icon->drawingWin),
- TKU_XID(icon->drawingWin), xwa.root, 0,0,
- &icon->x, &icon->y, &bogus);
+ TKU_XID(icon->drawingWin), xwa.root, 0,0,
+ &icon->x, &icon->y, &bogus);
bbox[0] = icon->x;
bbox[1] = icon->y;
bbox[2] = bbox[0] + icon->width - 1;
@@ -540,15 +540,15 @@ CheckArgbVisual(
Colormap cmap = None;
TKU_NO_BAD_WINDOW_BEGIN(Tk_Display(icon->tkwin))
- XGetWindowProperty(Tk_Display(icon->tkwin),
- icon->trayManager,
- icon->a_NET_SYSTEM_TRAY_VISUAL,
- /* offset */ 0,
- /* length */ 1,
- /* delete */ False,
- /* type */ XA_VISUALID,
- &retType, &retFormat, &retNitems,
- &retBytesAfter, &retProp);
+ XGetWindowProperty(Tk_Display(icon->tkwin),
+ icon->trayManager,
+ icon->a_NET_SYSTEM_TRAY_VISUAL,
+ /* offset */ 0,
+ /* length */ 1,
+ /* delete */ False,
+ /* type */ XA_VISUALID,
+ &retType, &retFormat, &retNitems,
+ &retBytesAfter, &retProp);
TKU_NO_BAD_WINDOW_END
if (retType == XA_VISUALID &&
retNitems == 1 &&
@@ -557,7 +557,7 @@ CheckArgbVisual(
snprintf(numeric,256,"%ld",*(long*)retProp);
XFree(retProp);
match = Tk_GetVisual(icon->interp, icon->tkwin,
- numeric, &depth, &cmap);
+ numeric, &depth, &cmap);
}
if (match&& depth == 32 &&
match->red_mask == 0xFF0000UL &&
@@ -602,16 +602,16 @@ CreateTrayIconWindow(
* the docs.
*/
tkwin = icon->drawingWin = Tk_CreateWindow(icon->interp, icon->tkwin,
- Tk_Name(icon->tkwin), "");
+ Tk_Name(icon->tkwin), "");
if (tkwin) {
Tk_SetClass(icon->drawingWin,icon->classString);
Tk_CreateEventHandler(icon->drawingWin,ExposureMask|StructureNotifyMask|
- ButtonPressMask|ButtonReleaseMask|
- EnterWindowMask|LeaveWindowMask|PointerMotionMask,
- TrayIconEvent, icon);
+ ButtonPressMask|ButtonReleaseMask|
+ EnterWindowMask|LeaveWindowMask|PointerMotionMask,
+ TrayIconEvent, icon);
if(icon->bestVisual) {
Tk_SetWindowVisual(icon->drawingWin,icon->bestVisual,
- 32,icon->bestColormap);
+ 32,icon->bestColormap);
icon->flags |= ICON_FLAG_ARGB32;
Tk_SetWindowBackground(tkwin, 0);
} else {
@@ -709,7 +709,7 @@ TrayIconRequestSize(
{
if (icon->drawingWin) {
if (icon->requestedWidth != w ||
- icon->requestedHeight != h) {
+ icon->requestedHeight != h) {
Tk_SetMinimumRequestSize(icon->drawingWin,w,h);
Tk_GeometryRequest(icon->drawingWin,w,h);
Tk_SetGrid(icon->drawingWin,1,1,w,h);
@@ -898,7 +898,7 @@ DisplayIcon(
*/
if (icon->offscreenPixmap == None) {
icon->offscreenPixmap = Tk_GetPixmap(Tk_Display(icon->drawingWin),
- Tk_WindowId(icon->drawingWin), w, h, 32);
+ Tk_WindowId(icon->drawingWin), w, h, 32);
}
if (!icon->photo) {
icon->photo = Tk_FindPhoto(icon->interp, icon->imageString);
@@ -907,12 +907,12 @@ DisplayIcon(
Tcl_InterpState saved
= Tcl_SaveInterpState(icon->interp, TCL_OK);
icon->imageVisualInstance = Tk_GetImage(icon->interp,icon->drawingWin,
- icon->imageString, IgnoreImageChange, NULL);
+ icon->imageString, IgnoreImageChange, NULL);
Tcl_RestoreInterpState(icon->interp,saved);
}
if (icon->photo && !icon->offscreenImage) {
icon->offscreenImage = XGetImage(Tk_Display(icon->drawingWin),
- icon->offscreenPixmap, 0, 0, w, h, AllPlanes, ZPixmap);
+ icon->offscreenPixmap, 0, 0, w, h, AllPlanes, ZPixmap);
}
if (icon->offscreenGC == None) {
XGCValues gcv;
@@ -921,7 +921,7 @@ DisplayIcon(
gcv.foreground = 0;
gcv.background = 0;
icon->offscreenGC = Tk_GetGC(icon->drawingWin,
- GCFunction|GCPlaneMask|GCForeground|GCBackground, &gcv);
+ GCFunction|GCPlaneMask|GCForeground|GCBackground, &gcv);
}
if (icon->flags & ICON_FLAG_DIRTY_EDGES) {
XClearWindow(Tk_Display(icon->drawingWin), TKU_XID(icon->drawingWin));
@@ -967,16 +967,16 @@ DisplayIcon(
0,0,w,h);
if (icon->imageVisualInstance) {
Tk_RedrawImage(icon->imageVisualInstance,
- 0,0,w,h,
- icon->offscreenPixmap,
- 0,0);
+ 0,0,w,h,
+ icon->offscreenPixmap,
+ 0,0);
}
}
XCopyArea(Tk_Display(icon->drawingWin),
- icon->offscreenPixmap,
- TKU_XID(icon->drawingWin),
- icon->offscreenGC,
- imgx,imgy,outw,outh,outx,outy);
+ icon->offscreenPixmap,
+ TKU_XID(icon->drawingWin),
+ icon->offscreenGC,
+ imgx,imgy,outw,outh,outx,outy);
} else {
/* Non-argb redraw: clear window and draw an image over it.
For photos it gives a correct alpha blending with a parent
@@ -984,10 +984,10 @@ DisplayIcon(
work with lxpanel fancy backgrounds).
*/
XClearWindow(Tk_Display(icon->drawingWin),
- TKU_XID(icon->drawingWin));
+ TKU_XID(icon->drawingWin));
if (icon->image && icon->visible) {
Tk_RedrawImage(icon->image,imgx,imgy,outw,outh,
- TKU_XID(icon->drawingWin), outx, outy);
+ TKU_XID(icon->drawingWin), outx, outy);
}
}
}
@@ -1086,7 +1086,7 @@ TrayIconWrapperEvent(
to check for reparent-to-root is to ask for this root
first */
XGetWindowAttributes(ev->xreparent.display,
- ev->xreparent.window, &attr);
+ ev->xreparent.window, &attr);
if (attr.root == ev->xreparent.parent) {
/* upon reparent to root, */
if (icon->drawingWin) {
@@ -1098,7 +1098,7 @@ TrayIconWrapperEvent(
}
} /* Reparenting into some other embedder is theoretically possible,
* and everything would just work in this case.
- */
+ */
break;
}
}
@@ -1156,7 +1156,7 @@ TrayIconEvent(
case ConfigureNotify:
Tk_SendVirtualEvent(icon->tkwin,Tk_GetUid("IconConfigure"), NULL);
if (icon->width != ev->xconfigure.width ||
- icon->height != ev->xconfigure.height) {
+ icon->height != ev->xconfigure.height) {
icon->width = ev->xconfigure.width;
icon->height = ev->xconfigure.height;
icon->flags |= ICON_FLAG_DIRTY_EDGES;
@@ -1280,10 +1280,10 @@ PostBalloon(
ev.xclient.data.l[4] = ++icon->msgid;
TKU_NO_BAD_WINDOW_BEGIN(Tk_Display(icon->tkwin))
XSendEvent(dpy, icon->myManager , True, StructureNotifyMask|SubstructureNotifyMask, &ev);
- XSync(dpy, False);
+ XSync(dpy, False);
- /* Sending message elements */
- while (length>0) {
+ /* Sending message elements */
+ while (length>0) {
ev.type = ClientMessage;
ev.xclient.window = icon->wrapper;
ev.xclient.message_type = icon->a_NET_SYSTEM_TRAY_MESSAGE_DATA;
@@ -1294,7 +1294,7 @@ PostBalloon(
XSync(dpy,False);
utf8msg += 20;
length -= 20;
- }
+ }
TKU_NO_BAD_WINDOW_END;
return icon->msgid;
}
@@ -1340,7 +1340,7 @@ CancelBalloon(
ev.xclient.data.l[2] =msgid;
TKU_NO_BAD_WINDOW_BEGIN(Tk_Display(icon->tkwin))
XSendEvent(dpy, icon->myManager , True,
- StructureNotifyMask|SubstructureNotifyMask, &ev);
+ StructureNotifyMask|SubstructureNotifyMask, &ev);
TKU_NO_BAD_WINDOW_END
}
@@ -1431,8 +1431,8 @@ TrayIconUpdate(
*/
if (mask & ICON_CONF_XEMBED) {
if (icon->myManager == None &&
- icon->trayManager != None &&
- icon->docked) {
+ icon->trayManager != None &&
+ icon->docked) {
CheckArgbVisual(icon);
if (icon->drawingWin &&
((icon->bestVisual && !(icon->flags & ICON_FLAG_ARGB32)) ||
@@ -1451,8 +1451,8 @@ TrayIconUpdate(
}
}
if (icon->myManager != None &&
- icon->drawingWin != NULL &&
- !icon->docked) {
+ icon->drawingWin != NULL &&
+ !icon->docked) {
Tk_DestroyWindow(icon->drawingWin);
icon->drawingWin = NULL;
icon->myManager = None;
@@ -1501,7 +1501,7 @@ TrayIconConfigureMethod(
if (objc <= 1 && !(addflags & ICON_CONF_FIRST_TIME)) {
Tcl_Obj* info = Tk_GetOptionInfo(interp, (char*)icon, icon->options,
- objc? objv[0] : NULL, icon->tkwin);
+ objc? objv[0] : NULL, icon->tkwin);
if (info) {
Tcl_SetObjResult(interp,info);
return TCL_OK;
@@ -1511,7 +1511,7 @@ TrayIconConfigureMethod(
}
if (Tk_SetOptions(interp, icon,icon->options,objc,objv,
- icon->tkwin,&saved,&mask) != TCL_OK) {
+ icon->tkwin,&saved,&mask) != TCL_OK) {
return TCL_ERROR; /* msg by Tk_SetOptions */
}
mask |= addflags;
@@ -1519,7 +1519,7 @@ TrayIconConfigureMethod(
if (mask & ICON_CONF_IMAGE) {
if (icon->imageString) {
newImage = Tk_GetImage(interp, icon->tkwin, icon->imageString,
- TrayIconImageChanged, icon);
+ TrayIconImageChanged, icon);
if (!newImage) {
Tk_RestoreSavedOptions(&saved);
return TCL_ERROR; /* msg by Tk_GetImage */
@@ -1608,23 +1608,23 @@ TrayIconCreateCmd(
* because it's not really shown.
*/
icon->tkwin = Tk_CreateWindowFromPath(interp, mainWindow,
- Tcl_GetString(objv[1]),"");
+ Tcl_GetString(objv[1]),"");
if (icon->tkwin == NULL) {
goto handleErrors;
}
/* Subscribe to StructureNotify */
TKU_AddInput(Tk_Display(icon->tkwin),
- RootWindowOfScreen(Tk_Screen(icon->tkwin)),StructureNotifyMask);
+ RootWindowOfScreen(Tk_Screen(icon->tkwin)),StructureNotifyMask);
TKU_AddInput(Tk_Display(icon->tkwin),
- RootWindow(Tk_Display(icon->tkwin),0),StructureNotifyMask);
+ RootWindow(Tk_Display(icon->tkwin),0),StructureNotifyMask);
/* Spec says "screen 0" not "default", but... */
TKU_AddInput(Tk_Display(icon->tkwin),
- DefaultRootWindow(Tk_Display(icon->tkwin)),StructureNotifyMask);
+ DefaultRootWindow(Tk_Display(icon->tkwin)),StructureNotifyMask);
/* Early tracking of DestroyNotify is essential */
Tk_CreateEventHandler(icon->tkwin,StructureNotifyMask,
- UserIconEvent, icon);
+ UserIconEvent, icon);
/* Now try setting options */
icon->options = Tk_CreateOptionTable(interp,IconOptionSpec);
@@ -1653,13 +1653,13 @@ TrayIconCreateCmd(
if (objc>3) {
if (TrayIconConfigureMethod(icon, interp, objc-2, objv+2,
- ICON_CONF_XEMBED|ICON_CONF_IMAGE|ICON_CONF_FIRST_TIME) != TCL_OK) {
+ ICON_CONF_XEMBED|ICON_CONF_IMAGE|ICON_CONF_FIRST_TIME) != TCL_OK) {
goto handleErrors;
}
}
icon->widgetCmd = Tcl_CreateObjCommand(interp, Tcl_GetString(objv[1]),
- TrayIconObjectCmd, icon, TrayIconDeleteProc);
+ TrayIconObjectCmd, icon, TrayIconDeleteProc);
/* Sometimes a command just can't be created... */
if (!icon->widgetCmd) {
@@ -1706,7 +1706,7 @@ Tktray_Init(
Tcl_Interp *interp)
{
Tcl_CreateObjCommand(interp, "::tk::systray::_systray",
- TrayIconCreateCmd, Tk_MainWindow(interp), NULL);
+ TrayIconCreateCmd, Tk_MainWindow(interp), NULL);
return TCL_OK;
}
diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c
index 51a308b..8f449da 100644
--- a/unix/tkUnixWm.c
+++ b/unix/tkUnixWm.c
@@ -1829,10 +1829,10 @@ WmForgetCmd(
~(TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED);
RemapWindows(winPtr, winPtr->parentPtr);
- /*
- * Make sure wm no longer manages this window
- */
- Tk_ManageGeometry(frameWin, NULL, NULL);
+ /*
+ * Make sure wm no longer manages this window
+ */
+ Tk_ManageGeometry(frameWin, NULL, NULL);
/*
* Flags (above) must be cleared before calling TkMapTopFrame (below).
@@ -2492,7 +2492,7 @@ WmIconphotoCmd(
if (photo == NULL) {
ckfree(iconPropertyData);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "failed to create an iconphoto with image \"%s\"",
+ "failed to create an iconphoto with image \"%s\"",
Tcl_GetString(objv[i])));
Tcl_SetErrorCode(interp, "TK", "WM", "ICONPHOTO", "IMAGE", NULL);
return TCL_ERROR;
@@ -5847,9 +5847,9 @@ static int PointInWindow(
{
XWindowChanges changes = wmPtr->winPtr->changes;
return (x >= changes.x &&
- x < changes.x + changes.width &&
- y >= changes.y - wmPtr->menuHeight &&
- y < changes.y + changes.height);
+ x < changes.x + changes.width &&
+ y >= changes.y - wmPtr->menuHeight &&
+ y < changes.y + changes.height);
}
Tk_Window
@@ -5922,38 +5922,38 @@ Tk_CoordsToWindow(
}
for (wmPtr = (WmInfo *) dispPtr->firstWmPtr; wmPtr != NULL;
wmPtr = wmPtr->nextPtr) {
- if (wmPtr->winPtr->mainPtr == NULL) {
- continue;
- }
+ if (wmPtr->winPtr->mainPtr == NULL) {
+ continue;
+ }
if (child == wmPtr->reparent) {
- if (PointInWindow(x, y, wmPtr)) {
- goto gotToplevel;
- } else {
+ if (PointInWindow(x, y, wmPtr)) {
+ goto gotToplevel;
+ } else {
- /*
- * Return NULL if the point is in the title bar or border.
- */
+ /*
+ * Return NULL if the point is in the title bar or border.
+ */
- return NULL;
- }
+ return NULL;
+ }
}
if (wmPtr->wrapperPtr != NULL) {
if (child == wmPtr->wrapperPtr->window) {
goto gotToplevel;
} else if (wmPtr->winPtr->flags & TK_EMBEDDED &&
- Tk_GetOtherWindow((Tk_Window)wmPtr->winPtr) == NULL) {
-
- /*
- * This toplevel is embedded in a window belonging to
- * a different application.
- */
-
- int rx, ry;
- Tk_GetRootCoords((Tk_Window) wmPtr->winPtr, &rx, &ry);
- childX -= rx;
- childY -= ry;
- goto gotToplevel;
- }
+ Tk_GetOtherWindow((Tk_Window)wmPtr->winPtr) == NULL) {
+
+ /*
+ * This toplevel is embedded in a window belonging to
+ * a different application.
+ */
+
+ int rx, ry;
+ Tk_GetRootCoords((Tk_Window) wmPtr->winPtr, &rx, &ry);
+ childX -= rx;
+ childY -= ry;
+ goto gotToplevel;
+ }
} else if (child == wmPtr->winPtr->window) {
goto gotToplevel;
}
@@ -6050,11 +6050,11 @@ Tk_CoordsToWindow(
childY = y;
goto gotToplevel;
} else {
- winPtr = nextPtr;
- }
+ winPtr = nextPtr;
+ }
}
if (winPtr->mainPtr != ((TkWindow *) tkwin)->mainPtr) {
- return NULL;
+ return NULL;
}
return (Tk_Window) winPtr;
}
diff --git a/win/ttkWinMonitor.c b/win/ttkWinMonitor.c
index 0fb362b..32d2a07 100644
--- a/win/ttkWinMonitor.c
+++ b/win/ttkWinMonitor.c
@@ -122,12 +122,12 @@ WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
case WM_THEMECHANGED:
/*
- * Reset the application theme.
- * On windows, it is possible to sign in as a second user, change
- * the theme to 'winnative' (by setting the ui to 'best performance'),
- * which is a machine-wide change, and then sign back on to the original user.
- * Ttk_UseTheme needs to be executed again in order to process the fallback
- * from vista/xpnative to winnative.
+ * Reset the application theme.
+ * On windows, it is possible to sign in as a second user, change
+ * the theme to 'winnative' (by setting the ui to 'best performance'),
+ * which is a machine-wide change, and then sign back on to the original user.
+ * Ttk_UseTheme needs to be executed again in order to process the fallback
+ * from vista/xpnative to winnative.
*/
theme = Ttk_GetCurrentTheme(interp);
diff --git a/win/ttkWinTheme.c b/win/ttkWinTheme.c
index 690c30b..8e67b4d 100644
--- a/win/ttkWinTheme.c
+++ b/win/ttkWinTheme.c
@@ -964,7 +964,7 @@ TtkWinTheme_Init(
parentPtr = Ttk_GetTheme(interp, "alt");
themePtr = Ttk_CreateTheme(interp, "winnative", parentPtr);
if (!themePtr) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
Ttk_RegisterElementSpec(themePtr, "border", &BorderElementSpec, NULL);
diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c
index 51b236a..4b868aa 100644
--- a/win/ttkWinXPTheme.c
+++ b/win/ttkWinXPTheme.c
@@ -25,8 +25,8 @@ typedef HTHEME (STDAPICALLTYPE OpenThemeDataProc)(HWND hwnd,
LPCWSTR pszClassList);
typedef HRESULT (STDAPICALLTYPE CloseThemeDataProc)(HTHEME hTheme);
typedef HRESULT (STDAPICALLTYPE DrawThemeBackgroundProc)(HTHEME hTheme,
- HDC hdc, int iPartId, int iStateId, const RECT *pRect,
- OPTIONAL const RECT *pClipRect);
+ HDC hdc, int iPartId, int iStateId, const RECT *pRect,
+ OPTIONAL const RECT *pClipRect);
typedef HRESULT (STDAPICALLTYPE DrawThemeEdgeProc)(HTHEME hTheme,
HDC hdc, int iPartId, int iStateId, const RECT *pDestRect,
unsigned int uEdge, unsigned int uFlags,
@@ -892,7 +892,7 @@ static void TreeIndicatorElementDraw(
Drawable d, Ttk_Box b, Ttk_State state)
{
if (!(state & TTK_STATE_LEAF)) {
- GenericElementDraw(clientData,elementRecord,tkwin,d,b,state);
+ GenericElementDraw(clientData,elementRecord,tkwin,d,b,state);
}
}
@@ -1031,7 +1031,7 @@ TTK_LAYOUT("TMenubutton",
TTK_NODE("Menubutton.dropdown", TTK_PACK_RIGHT|TTK_FILL_Y)
TTK_GROUP("Menubutton.button", TTK_FILL_BOTH,
TTK_GROUP("Menubutton.padding", TTK_FILL_X,
- TTK_NODE("Menubutton.label", 0))))
+ TTK_NODE("Menubutton.label", 0))))
TTK_LAYOUT("Horizontal.TScrollbar",
TTK_GROUP("Horizontal.Scrollbar.trough", TTK_FILL_X,
@@ -1409,7 +1409,7 @@ TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd)
themePtr = Ttk_CreateTheme(interp, "xpnative", parentPtr);
if (!themePtr)
- return TCL_ERROR;
+ return TCL_ERROR;
/*
* Set theme data and cleanup proc