summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tk.h7
-rw-r--r--generic/tkArgv.c6
-rw-r--r--generic/tkAtom.c6
-rw-r--r--generic/tkBind.c12
-rw-r--r--generic/tkBitmap.c50
-rw-r--r--generic/tkBusy.c2
-rw-r--r--generic/tkButton.c12
-rw-r--r--generic/tkCanvUtil.c10
-rw-r--r--generic/tkClipboard.c12
-rw-r--r--generic/tkColor.c28
-rw-r--r--generic/tkConfig.c4
-rw-r--r--generic/tkCursor.c34
-rw-r--r--generic/tkEntry.c24
-rw-r--r--generic/tkError.c2
-rw-r--r--generic/tkFileFilter.c2
-rw-r--r--generic/tkFocus.c16
-rw-r--r--generic/tkFont.c22
-rw-r--r--generic/tkFrame.c20
-rw-r--r--generic/tkGC.c19
-rw-r--r--generic/tkGrab.c2
-rw-r--r--generic/tkImgGIF.c12
-rw-r--r--generic/tkImgPNG.c4
-rw-r--r--generic/tkImgPhInstance.c16
-rw-r--r--generic/tkInt.h12
-rw-r--r--generic/tkListbox.c44
-rw-r--r--generic/tkMacWinMenu.c2
-rw-r--r--generic/tkMenu.c16
-rw-r--r--generic/tkMenuDraw.c18
-rw-r--r--generic/tkMenubutton.c12
-rw-r--r--generic/tkMessage.c16
-rw-r--r--generic/tkObj.c12
-rw-r--r--generic/tkScale.c20
-rw-r--r--generic/tkSelect.c8
-rw-r--r--generic/tkSquare.c2
-rw-r--r--generic/tkStubLib.c2
-rw-r--r--generic/tkStyle.c8
-rw-r--r--generic/tkText.c16
-rw-r--r--generic/tkText.h2
-rw-r--r--generic/tkTextBTree.c20
-rw-r--r--generic/tkTextImage.c25
-rw-r--r--generic/tkTextIndex.c74
-rw-r--r--generic/tkTextMark.c23
-rw-r--r--generic/tkTextWind.c23
-rw-r--r--generic/tkTrig.c32
-rw-r--r--generic/tkUndo.c10
-rw-r--r--generic/tkUtil.c43
-rw-r--r--generic/tkVisual.c58
-rw-r--r--generic/tkWindow.c83
-rw-r--r--generic/ttk/ttkGenStubs.tcl2
-rw-r--r--generic/ttk/ttkWidget.c4
50 files changed, 507 insertions, 402 deletions
diff --git a/generic/tk.h b/generic/tk.h
index af8e5ca..d3c2466 100644
--- a/generic/tk.h
+++ b/generic/tk.h
@@ -75,10 +75,10 @@ extern "C" {
#define TK_MAJOR_VERSION 8
#define TK_MINOR_VERSION 6
#define TK_RELEASE_LEVEL TCL_FINAL_RELEASE
-#define TK_RELEASE_SERIAL 11
+#define TK_RELEASE_SERIAL 12
#define TK_VERSION "8.6"
-#define TK_PATCH_LEVEL "8.6.11"
+#define TK_PATCH_LEVEL "8.6.12"
/*
* A special definition used to allow this header file to be included from
@@ -93,6 +93,9 @@ extern "C" {
#ifndef RC_INVOKED
#if !defined(_XLIB_H) && !defined(_X11_XLIB_H_)
+#if defined(__GNUC__) && !defined(__cplusplus)
+# pragma GCC diagnostic ignored "-Wc++-compat"
+#endif
# include <X11/Xlib.h>
# ifdef MAC_OSX_TK
# include <X11/X.h>
diff --git a/generic/tkArgv.c b/generic/tkArgv.c
index 6c2c5c5..8fe8514 100644
--- a/generic/tkArgv.c
+++ b/generic/tkArgv.c
@@ -67,12 +67,12 @@ Tk_ParseArgv(
int flags) /* Or'ed combination of various flag bits,
* such as TK_ARGV_NO_DEFAULTS. */
{
- register const Tk_ArgvInfo *infoPtr;
+ const Tk_ArgvInfo *infoPtr;
/* Pointer to the current entry in the table
* of argument descriptions. */
const Tk_ArgvInfo *matchPtr;/* Descriptor that matches current argument. */
const char *curArg; /* Current argument */
- register char c; /* Second character of current arg (used for
+ char c; /* Second character of current arg (used for
* quick check for matching; use 2nd char.
* because first char. will almost always be
* '-'). */
@@ -338,7 +338,7 @@ PrintUsage(
* this word, then don't generate information
* for default options. */
{
- register const Tk_ArgvInfo *infoPtr;
+ const Tk_ArgvInfo *infoPtr;
size_t width, i, numSpaces;
Tcl_Obj *message;
diff --git a/generic/tkAtom.c b/generic/tkAtom.c
index 2491fb2..475f9d2 100644
--- a/generic/tkAtom.c
+++ b/generic/tkAtom.c
@@ -154,11 +154,11 @@ Tk_GetAtomName(
if (mustFree) {
XFree(mustFree);
}
- name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr);
+ name = (const char *)Tcl_GetHashKey(&dispPtr->nameTable, hPtr);
hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, INT2PTR(atom), &isNew);
Tcl_SetHashValue(hPtr, name);
}
- return Tcl_GetHashValue(hPtr);
+ return (const char *)Tcl_GetHashValue(hPtr);
}
/*
@@ -200,7 +200,7 @@ AtomInit(
name = atomNameArray[atom - 1];
hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, name, &isNew);
Tcl_SetHashValue(hPtr, INT2PTR(atom));
- name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr);
+ name = (const char *)Tcl_GetHashKey(&dispPtr->nameTable, hPtr);
hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, INT2PTR(atom), &isNew);
Tcl_SetHashValue(hPtr, name);
}
diff --git a/generic/tkBind.c b/generic/tkBind.c
index ad59299..7873d29 100644
--- a/generic/tkBind.c
+++ b/generic/tkBind.c
@@ -793,6 +793,7 @@ static Time
CurrentTimeInMilliSecs(void)
{
Tcl_Time now;
+
Tcl_GetTime(&now);
return ((Time) now.sec)*1000 + ((Time) now.usec)/1000;
}
@@ -946,6 +947,7 @@ FreePatSeqEntry(
PSEntry *entry)
{
PSEntry *next = PSList_Next(entry);
+
PSModMaskArr_Free(&entry->lastModMaskArr);
ckfree(entry);
return next;
@@ -1621,7 +1623,7 @@ Tk_CreateBinding(
ClientData object, /* Token for object with which binding is associated. */
const char *eventString, /* String describing event sequence that triggers binding. */
const char *script, /* Contains Tcl script to execute when binding triggers. */
- int append) /* 0 means replace any existing binding for eventString;
+ int append) /* 0 means replace any existing binding for eventString;
* 1 means append to that binding. If the existing binding is
* for a callback function and not a Tcl command string, the
* existing binding will always be replaced. */
@@ -4490,13 +4492,13 @@ NameToWindow(
*
* DoWarp --
*
- * Perform Warping of X pointer. Executed as an idle handler only.
+ * Perform warping of mouse pointer. Executed as an idle handler only.
*
* Results:
* None
*
* Side effects:
- * X Pointer will move to a new location.
+ * Mouse pointer moves to a new location.
*
*-------------------------------------------------------------------------
*/
@@ -4505,7 +4507,7 @@ static void
DoWarp(
ClientData clientData)
{
- TkDisplay *dispPtr = clientData;
+ TkDisplay *dispPtr = (TkDisplay *)clientData;
assert(clientData);
@@ -4610,7 +4612,7 @@ FindSequence(
* associated. For virtual event table, NULL. */
const char *eventString, /* String description of pattern to match on. See user
* documentation for details. */
- int create, /* 0 means don't create the entry if it doesn't already exist.
+ int create, /* 0 means don't create the entry if it doesn't already exist.
* 1 means create. */
int allowVirtual, /* 0 means that virtual events are not allowed in the sequence.
* 1 otherwise. */
diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c
index 54bab69..ccc97a4 100644
--- a/generic/tkBitmap.c
+++ b/generic/tkBitmap.c
@@ -167,7 +167,7 @@ Tk_AllocBitmapFromObj(
if (objPtr->typePtr != &tkBitmapObjType) {
InitBitmapObj(objPtr);
}
- bitmapPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ bitmapPtr = (TkBitmap *)objPtr->internalRep.twoPtrValue.ptr1;
/*
* If the object currently points to a TkBitmap, see if it's the one we
@@ -197,7 +197,7 @@ Tk_AllocBitmapFromObj(
*/
if (bitmapPtr != NULL) {
- TkBitmap *firstBitmapPtr = Tcl_GetHashValue(bitmapPtr->nameHashPtr);
+ TkBitmap *firstBitmapPtr = (TkBitmap *)Tcl_GetHashValue(bitmapPtr->nameHashPtr);
FreeBitmapObj(objPtr);
for (bitmapPtr = firstBitmapPtr; bitmapPtr != NULL;
@@ -307,7 +307,7 @@ GetBitmap(
Pixmap bitmap;
int isNew, width = 0, height = 0, dummy2;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!dispPtr->bitmapInit) {
@@ -317,7 +317,7 @@ GetBitmap(
nameHashPtr = Tcl_CreateHashEntry(&dispPtr->bitmapNameTable, string,
&isNew);
if (!isNew) {
- existingBitmapPtr = Tcl_GetHashValue(nameHashPtr);
+ existingBitmapPtr = (TkBitmap *)Tcl_GetHashValue(nameHashPtr);
for (bitmapPtr = existingBitmapPtr; bitmapPtr != NULL;
bitmapPtr = bitmapPtr->nextPtr) {
if ((Tk_Display(tkwin) == bitmapPtr->display) &&
@@ -395,7 +395,7 @@ GetBitmap(
goto error;
}
} else {
- predefPtr = Tcl_GetHashValue(predefHashPtr);
+ predefPtr = (TkPredefBitmap *)Tcl_GetHashValue(predefHashPtr);
width = predefPtr->width;
height = predefPtr->height;
if (predefPtr->native) {
@@ -407,7 +407,7 @@ GetBitmap(
} else {
bitmap = XCreateBitmapFromData(Tk_Display(tkwin),
RootWindowOfScreen(Tk_Screen(tkwin)),
- predefPtr->source, (unsigned)width, (unsigned)height);
+ (const char *)predefPtr->source, (unsigned)width, (unsigned)height);
}
}
}
@@ -416,7 +416,7 @@ GetBitmap(
* Add information about this bitmap to our database.
*/
- bitmapPtr = ckalloc(sizeof(TkBitmap));
+ bitmapPtr = (TkBitmap *)ckalloc(sizeof(TkBitmap));
bitmapPtr->bitmap = bitmap;
bitmapPtr->width = width;
bitmapPtr->height = height;
@@ -474,7 +474,7 @@ Tk_DefineBitmap(
int isNew;
Tcl_HashEntry *predefHashPtr;
TkPredefBitmap *predefPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -497,7 +497,7 @@ Tk_DefineBitmap(
Tcl_SetErrorCode(interp, "TK", "BITMAP", "EXISTS", NULL);
return TCL_ERROR;
}
- predefPtr = ckalloc(sizeof(TkPredefBitmap));
+ predefPtr = (TkPredefBitmap *)ckalloc(sizeof(TkPredefBitmap));
predefPtr->source = source;
predefPtr->width = width;
predefPtr->height = height;
@@ -540,7 +540,7 @@ Tk_NameOfBitmap(
if (idHashPtr == NULL) {
goto unknown;
}
- bitmapPtr = Tcl_GetHashValue(idHashPtr);
+ bitmapPtr = (TkBitmap *)Tcl_GetHashValue(idHashPtr);
return bitmapPtr->nameHashPtr->key.string;
}
@@ -582,7 +582,7 @@ Tk_SizeOfBitmap(
if (idHashPtr == NULL) {
goto unknownBitmap;
}
- bitmapPtr = Tcl_GetHashValue(idHashPtr);
+ bitmapPtr = (TkBitmap *)Tcl_GetHashValue(idHashPtr);
*widthPtr = bitmapPtr->width;
*heightPtr = bitmapPtr->height;
}
@@ -612,14 +612,13 @@ FreeBitmap(
{
TkBitmap *prevPtr;
- bitmapPtr->resourceRefCount--;
- if (bitmapPtr->resourceRefCount > 0) {
+ if (bitmapPtr->resourceRefCount-- > 1) {
return;
}
Tk_FreePixmap(bitmapPtr->display, bitmapPtr->bitmap);
Tcl_DeleteHashEntry(bitmapPtr->idHashPtr);
- prevPtr = Tcl_GetHashValue(bitmapPtr->nameHashPtr);
+ prevPtr = (TkBitmap *)Tcl_GetHashValue(bitmapPtr->nameHashPtr);
if (prevPtr == bitmapPtr) {
if (bitmapPtr->nextPtr == NULL) {
Tcl_DeleteHashEntry(bitmapPtr->nameHashPtr);
@@ -671,7 +670,7 @@ Tk_FreeBitmap(
if (idHashPtr == NULL) {
Tcl_Panic("Tk_FreeBitmap received unknown bitmap argument");
}
- FreeBitmap(Tcl_GetHashValue(idHashPtr));
+ FreeBitmap((TkBitmap *)Tcl_GetHashValue(idHashPtr));
}
/*
@@ -735,7 +734,7 @@ static void
FreeBitmapObj(
Tcl_Obj *objPtr) /* The object we are releasing. */
{
- TkBitmap *bitmapPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ TkBitmap *bitmapPtr = (TkBitmap *)objPtr->internalRep.twoPtrValue.ptr1;
if (bitmapPtr != NULL) {
bitmapPtr->objRefCount--;
@@ -770,7 +769,7 @@ DupBitmapObjProc(
Tcl_Obj *srcObjPtr, /* The object we are copying from. */
Tcl_Obj *dupObjPtr) /* The object we are copying to. */
{
- TkBitmap *bitmapPtr = srcObjPtr->internalRep.twoPtrValue.ptr1;
+ TkBitmap *bitmapPtr = (TkBitmap *)srcObjPtr->internalRep.twoPtrValue.ptr1;
dupObjPtr->typePtr = srcObjPtr->typePtr;
dupObjPtr->internalRep.twoPtrValue.ptr1 = bitmapPtr;
@@ -806,7 +805,6 @@ DupBitmapObjProc(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
Pixmap
Tk_GetBitmapFromData(
Tcl_Interp *interp, /* Interpreter to use for error reporting. */
@@ -820,20 +818,20 @@ Tk_GetBitmapFromData(
char string[16 + TCL_INTEGER_SPACE];
char *name;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!tsdPtr->initialized) {
BitmapInit(dispPtr);
}
- nameKey.source = source;
+ nameKey.source = (const char *)source;
nameKey.width = width;
nameKey.height = height;
dataHashPtr = Tcl_CreateHashEntry(&dispPtr->bitmapDataTable,
(char *) &nameKey, &isNew);
if (!isNew) {
- name = Tcl_GetHashValue(dataHashPtr);
+ name = (char *)Tcl_GetHashValue(dataHashPtr);
} else {
dispPtr->bitmapAutoNumber++;
sprintf(string, "_tk%d", dispPtr->bitmapAutoNumber);
@@ -911,7 +909,7 @@ GetBitmapFromObj(
InitBitmapObj(objPtr);
}
- bitmapPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ bitmapPtr = (TkBitmap *)objPtr->internalRep.twoPtrValue.ptr1;
if (bitmapPtr != NULL) {
if ((bitmapPtr->resourceRefCount > 0)
&& (Tk_Display(tkwin) == bitmapPtr->display)) {
@@ -932,7 +930,7 @@ GetBitmapFromObj(
* more TkBitmap structures. See if any of them will work.
*/
- for (bitmapPtr = Tcl_GetHashValue(hashPtr); bitmapPtr != NULL;
+ for (bitmapPtr = (TkBitmap *)Tcl_GetHashValue(hashPtr); bitmapPtr != NULL;
bitmapPtr = bitmapPtr->nextPtr) {
if (Tk_Display(tkwin) == bitmapPtr->display) {
objPtr->internalRep.twoPtrValue.ptr1 = bitmapPtr;
@@ -1012,7 +1010,7 @@ BitmapInit(
* or NULL if unavailable. */
{
Tcl_Interp *dummy;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -1150,7 +1148,7 @@ TkDebugBitmap(
resultPtr = Tcl_NewObj();
hashPtr = Tcl_FindHashEntry(&dispPtr->bitmapNameTable, name);
if (hashPtr != NULL) {
- bitmapPtr = Tcl_GetHashValue(hashPtr);
+ bitmapPtr = (TkBitmap *)Tcl_GetHashValue(hashPtr);
if (bitmapPtr == NULL) {
Tcl_Panic("TkDebugBitmap found empty hash table entry");
}
@@ -1190,7 +1188,7 @@ TkDebugBitmap(
Tcl_HashTable *
TkGetBitmapPredefTable(void)
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
return &tsdPtr->predefBitmapTable;
diff --git a/generic/tkBusy.c b/generic/tkBusy.c
index 1e4e91f..6f58c52 100644
--- a/generic/tkBusy.c
+++ b/generic/tkBusy.c
@@ -340,7 +340,7 @@ DestroyBusy(
RefWinEventProc, busyPtr);
if (busyPtr->tkBusy != NULL) {
- Tk_FreeConfigOptions(data, busyPtr->optionTable, busyPtr->tkBusy);
+ Tk_FreeConfigOptions((char *)data, busyPtr->optionTable, busyPtr->tkBusy);
Tk_DeleteEventHandler(busyPtr->tkBusy, StructureNotifyMask,
BusyEventProc, busyPtr);
Tk_ManageGeometry(busyPtr->tkBusy, NULL, busyPtr);
diff --git a/generic/tkButton.c b/generic/tkButton.c
index 3c15bf6..9e7c87d 100644
--- a/generic/tkButton.c
+++ b/generic/tkButton.c
@@ -105,7 +105,7 @@ static const Tk_OptionSpec labelOptionSpecs[] = {
{TK_OPTION_FONT, "-font", "font", "Font",
DEF_BUTTON_FONT, -1, Tk_Offset(TkButton, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
- DEF_BUTTON_FG, -1, Tk_Offset(TkButton, normalFg), 0, 0, 0},
+ DEF_LABEL_FG, -1, Tk_Offset(TkButton, normalFg), 0, 0, 0},
{TK_OPTION_STRING, "-height", "height", "Height",
DEF_BUTTON_HEIGHT, Tk_Offset(TkButton, heightPtr), -1, 0, 0, 0},
{TK_OPTION_BORDER, "-highlightbackground", "highlightBackground",
@@ -1036,7 +1036,7 @@ DestroyButton(
static int
ConfigureButton(
Tcl_Interp *interp, /* Used for error reporting. */
- register TkButton *butPtr, /* Information about widget; may or may
+ TkButton *butPtr, /* Information about widget; may or may
* not already have values for some fields. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument values. */
@@ -1612,7 +1612,7 @@ ButtonVarProc(
const char *name2, /* Second part of variable name. */
int flags) /* Information about what happened. */
{
- register TkButton *butPtr = clientData;
+ TkButton *butPtr = clientData;
const char *value;
Tcl_Obj *valuePtr;
@@ -1817,7 +1817,7 @@ ButtonImageProc(
* <= 0). */
int imgWidth, int imgHeight)/* New dimensions of image. */
{
- register TkButton *butPtr = clientData;
+ TkButton *butPtr = clientData;
if (butPtr->tkwin != NULL) {
TkpComputeButtonGeometry(butPtr);
@@ -1855,7 +1855,7 @@ ButtonSelectImageProc(
* <= 0). */
int imgWidth, int imgHeight)/* New dimensions of image. */
{
- register TkButton *butPtr = clientData;
+ TkButton *butPtr = clientData;
#ifdef MAC_OSX_TK
if (butPtr->tkwin != NULL) {
@@ -1902,7 +1902,7 @@ ButtonTristateImageProc(
* <= 0). */
int imgWidth, int imgHeight)/* New dimensions of image. */
{
- register TkButton *butPtr = clientData;
+ TkButton *butPtr = clientData;
#ifdef MAC_OSX_TK
if (butPtr->tkwin != NULL) {
diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c
index 1feef73..65af3da 100644
--- a/generic/tkCanvUtil.c
+++ b/generic/tkCanvUtil.c
@@ -332,7 +332,7 @@ Tk_CanvasSetOffset(
* redisplaying the canvas. */
Tk_TSOffset *offset) /* Offset (may be NULL pointer)*/
{
- register TkCanvas *canvasPtr = Canvas(canvas);
+ TkCanvas *canvasPtr = Canvas(canvas);
int flags = 0;
int x = - canvasPtr->drawableXOrigin;
int y = - canvasPtr->drawableYOrigin;
@@ -406,7 +406,7 @@ Tk_CanvasTagsParseProc(
char *widgRec, /* Pointer to record for item. */
int offset) /* Offset into item (ignored). */
{
- register Tk_Item *itemPtr = (Tk_Item *) widgRec;
+ Tk_Item *itemPtr = (Tk_Item *) widgRec;
int argc, i;
const char **argv;
Tk_Uid *newPtr;
@@ -474,7 +474,7 @@ Tk_CanvasTagsPrintProc(
* information about how to reclaim storage
* for return string. */
{
- register Tk_Item *itemPtr = (Tk_Item *) widgRec;
+ Tk_Item *itemPtr = (Tk_Item *) widgRec;
if (itemPtr->numTags == 0) {
*freeProcPtr = NULL;
@@ -733,7 +733,7 @@ TkSmoothParseProc(
char *widgRec, /* Pointer to record for item. */
int offset) /* Offset into item. */
{
- register const Tk_SmoothMethod **smoothPtr =
+ const Tk_SmoothMethod **smoothPtr =
(const Tk_SmoothMethod **) (widgRec + offset);
const Tk_SmoothMethod *smooth = NULL;
int b;
@@ -826,7 +826,7 @@ TkSmoothPrintProc(
* information about how to reclaim storage
* for return string. */
{
- register const Tk_SmoothMethod *smoothPtr =
+ const Tk_SmoothMethod *smoothPtr =
* (Tk_SmoothMethod **) (widgRec + offset);
return smoothPtr ? smoothPtr->name : "0";
diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c
index 8bc4237..e800da9 100644
--- a/generic/tkClipboard.c
+++ b/generic/tkClipboard.c
@@ -134,22 +134,22 @@ ClipboardAppHandler(
char *buffer, /* Place to store converted selection. */
int maxBytes) /* Maximum # of bytes to store at buffer. */
{
- TkDisplay *dispPtr = clientData;
- size_t length;
+ TkDisplay *dispPtr = (TkDisplay *)clientData;
+ int length;
const char *p;
p = dispPtr->clipboardAppPtr->winPtr->nameUid;
length = strlen(p);
- length -= offset;
- if (length <= 0) {
+ if (length <= offset) {
return 0;
}
- if (length > (size_t) maxBytes) {
+ length -= offset;
+ if (length > maxBytes) {
length = maxBytes;
}
memcpy(buffer, p, length);
buffer[length] = 0;
- return (int)length;
+ return length;
}
/*
diff --git a/generic/tkColor.c b/generic/tkColor.c
index f6650f9..6b6405a 100644
--- a/generic/tkColor.c
+++ b/generic/tkColor.c
@@ -128,7 +128,7 @@ Tk_AllocColorFromObj(
*/
if (tkColPtr != NULL) {
- TkColor *firstColorPtr = Tcl_GetHashValue(tkColPtr->hashPtr);
+ TkColor *firstColorPtr = (TkColor *)Tcl_GetHashValue(tkColPtr->hashPtr);
FreeColorObj(objPtr);
for (tkColPtr = firstColorPtr; tkColPtr != NULL;
@@ -203,7 +203,7 @@ Tk_GetColor(
nameHashPtr = Tcl_CreateHashEntry(&dispPtr->colorNameTable, name, &isNew);
if (!isNew) {
- existingColPtr = Tcl_GetHashValue(nameHashPtr);
+ existingColPtr = (TkColor *)Tcl_GetHashValue(nameHashPtr);
for (tkColPtr = existingColPtr; tkColPtr != NULL;
tkColPtr = tkColPtr->nextPtr) {
if ((tkColPtr->screen == Tk_Screen(tkwin))
@@ -314,7 +314,7 @@ Tk_GetColorByValue(
valueHashPtr = Tcl_CreateHashEntry(&dispPtr->colorValueTable,
(char *) &valueKey, &isNew);
if (!isNew) {
- tkColPtr = Tcl_GetHashValue(valueHashPtr);
+ tkColPtr = (TkColor *)Tcl_GetHashValue(valueHashPtr);
tkColPtr->resourceRefCount++;
return &tkColPtr->color;
}
@@ -363,12 +363,12 @@ const char *
Tk_NameOfColor(
XColor *colorPtr) /* Color whose name is desired. */
{
- register TkColor *tkColPtr = (TkColor *) colorPtr;
+ TkColor *tkColPtr = (TkColor *) colorPtr;
if (tkColPtr->magic==COLOR_MAGIC && tkColPtr->type==TK_COLOR_BY_NAME) {
return tkColPtr->hashPtr->key.string;
} else {
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
sprintf(tsdPtr->rgbString, "#%04x%04x%04x", colorPtr->red,
@@ -480,8 +480,7 @@ Tk_FreeColor(
Tcl_Panic("Tk_FreeColor called with bogus color");
}
- tkColPtr->resourceRefCount--;
- if (tkColPtr->resourceRefCount > 0) {
+ if (tkColPtr->resourceRefCount-- > 1) {
return;
}
@@ -497,7 +496,7 @@ Tk_FreeColor(
}
TkpFreeColor(tkColPtr);
- prevPtr = Tcl_GetHashValue(tkColPtr->hashPtr);
+ prevPtr = (TkColor *)Tcl_GetHashValue(tkColPtr->hashPtr);
if (prevPtr == tkColPtr) {
if (tkColPtr->nextPtr == NULL) {
Tcl_DeleteHashEntry(tkColPtr->hashPtr);
@@ -584,11 +583,10 @@ static void
FreeColorObj(
Tcl_Obj *objPtr) /* The object we are releasing. */
{
- TkColor *tkColPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ TkColor *tkColPtr = (TkColor *)objPtr->internalRep.twoPtrValue.ptr1;
if (tkColPtr != NULL) {
- tkColPtr->objRefCount--;
- if ((tkColPtr->objRefCount == 0)
+ if ((tkColPtr->objRefCount-- <= 1)
&& (tkColPtr->resourceRefCount == 0)) {
ckfree(tkColPtr);
}
@@ -619,7 +617,7 @@ DupColorObjProc(
Tcl_Obj *srcObjPtr, /* The object we are copying from. */
Tcl_Obj *dupObjPtr) /* The object we are copying to. */
{
- TkColor *tkColPtr = srcObjPtr->internalRep.twoPtrValue.ptr1;
+ TkColor *tkColPtr = (TkColor *)srcObjPtr->internalRep.twoPtrValue.ptr1;
dupObjPtr->typePtr = srcObjPtr->typePtr;
dupObjPtr->internalRep.twoPtrValue.ptr1 = tkColPtr;
@@ -669,7 +667,7 @@ Tk_GetColorFromObj(
* map. If it is, we are done.
*/
- tkColPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ tkColPtr = (TkColor *)objPtr->internalRep.twoPtrValue.ptr1;
if ((tkColPtr != NULL)
&& (tkColPtr->resourceRefCount > 0)
&& (Tk_Screen(tkwin) == tkColPtr->screen)
@@ -695,7 +693,7 @@ Tk_GetColorFromObj(
if (hashPtr == NULL) {
goto error;
}
- for (tkColPtr = Tcl_GetHashValue(hashPtr);
+ for (tkColPtr = (TkColor *)Tcl_GetHashValue(hashPtr);
(tkColPtr != NULL); tkColPtr = tkColPtr->nextPtr) {
if ((Tk_Screen(tkwin) == tkColPtr->screen)
&& (Tk_Colormap(tkwin) == tkColPtr->colormap)) {
@@ -811,7 +809,7 @@ TkDebugColor(
resultPtr = Tcl_NewObj();
hashPtr = Tcl_FindHashEntry(&dispPtr->colorNameTable, name);
if (hashPtr != NULL) {
- TkColor *tkColPtr = Tcl_GetHashValue(hashPtr);
+ TkColor *tkColPtr = (TkColor *)Tcl_GetHashValue(hashPtr);
if (tkColPtr == NULL) {
Tcl_Panic("TkDebugColor found empty hash table entry");
diff --git a/generic/tkConfig.c b/generic/tkConfig.c
index 65e28a6..6a0ffd8 100644
--- a/generic/tkConfig.c
+++ b/generic/tkConfig.c
@@ -664,7 +664,7 @@ DoObjConfig(
if (internalPtr != NULL) {
if (valuePtr != NULL) {
value = Tcl_GetStringFromObj(valuePtr, &length);
- newStr = ckalloc(length + 1);
+ newStr = (char *)ckalloc(length + 1);
strcpy(newStr, value);
} else {
newStr = NULL;
@@ -1400,7 +1400,7 @@ Tk_RestoreSavedOptions(
= savePtr->items[i].valuePtr;
}
if (specPtr->internalOffset >= 0) {
- register char *ptr = (char *) &savePtr->items[i].internalForm;
+ char *ptr = (char *) &savePtr->items[i].internalForm;
CLANG_ASSERT(internalPtr);
switch (specPtr->type) {
diff --git a/generic/tkCursor.c b/generic/tkCursor.c
index 21c713a..902472b 100644
--- a/generic/tkCursor.c
+++ b/generic/tkCursor.c
@@ -100,7 +100,7 @@ Tk_AllocCursorFromObj(
if (objPtr->typePtr != &tkCursorObjType) {
InitCursorObj(objPtr);
}
- cursorPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ cursorPtr = (TkCursor *)objPtr->internalRep.twoPtrValue.ptr1;
/*
* If the object currently points to a TkCursor, see if it's the one we
@@ -129,7 +129,7 @@ Tk_AllocCursorFromObj(
*/
if (cursorPtr != NULL) {
- TkCursor *firstCursorPtr = Tcl_GetHashValue(cursorPtr->hashPtr);
+ TkCursor *firstCursorPtr = (TkCursor *)Tcl_GetHashValue(cursorPtr->hashPtr);
FreeCursorObj(objPtr);
for (cursorPtr = firstCursorPtr; cursorPtr != NULL;
@@ -229,7 +229,7 @@ TkcGetCursor(
* details on legal syntax. */
{
Tcl_HashEntry *nameHashPtr;
- register TkCursor *cursorPtr;
+ TkCursor *cursorPtr;
TkCursor *existingCursorPtr = NULL;
int isNew;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -241,7 +241,7 @@ TkcGetCursor(
nameHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorNameTable,
string, &isNew);
if (!isNew) {
- existingCursorPtr = Tcl_GetHashValue(nameHashPtr);
+ existingCursorPtr = (TkCursor *)Tcl_GetHashValue(nameHashPtr);
for (cursorPtr = existingCursorPtr; cursorPtr != NULL;
cursorPtr = cursorPtr->nextPtr) {
if (Tk_Display(tkwin) == cursorPtr->display) {
@@ -320,7 +320,7 @@ Tk_GetCursorFromData(
{
DataKey dataKey;
Tcl_HashEntry *dataHashPtr;
- register TkCursor *cursorPtr;
+ TkCursor *cursorPtr;
int isNew;
XColor fgColor, bgColor;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -341,7 +341,7 @@ Tk_GetCursorFromData(
dataHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorDataTable,
(char *) &dataKey, &isNew);
if (!isNew) {
- cursorPtr = Tcl_GetHashValue(dataHashPtr);
+ cursorPtr = (TkCursor *)Tcl_GetHashValue(dataHashPtr);
cursorPtr->resourceRefCount++;
return cursorPtr->cursor;
}
@@ -432,7 +432,7 @@ Tk_NameOfCursor(
if (idHashPtr == NULL) {
goto printid;
}
- cursorPtr = Tcl_GetHashValue(idHashPtr);
+ cursorPtr = (TkCursor *)Tcl_GetHashValue(idHashPtr);
if (cursorPtr->otherTable != &dispPtr->cursorNameTable) {
goto printid;
}
@@ -463,13 +463,12 @@ FreeCursor(
{
TkCursor *prevPtr;
- cursorPtr->resourceRefCount--;
- if (cursorPtr->resourceRefCount > 0) {
+ if (cursorPtr->resourceRefCount-- > 1) {
return;
}
Tcl_DeleteHashEntry(cursorPtr->idHashPtr);
- prevPtr = Tcl_GetHashValue(cursorPtr->hashPtr);
+ prevPtr = (TkCursor *)Tcl_GetHashValue(cursorPtr->hashPtr);
if (prevPtr == cursorPtr) {
if (cursorPtr->nextPtr == NULL) {
Tcl_DeleteHashEntry(cursorPtr->hashPtr);
@@ -522,7 +521,7 @@ Tk_FreeCursor(
if (idHashPtr == NULL) {
Tcl_Panic("Tk_FreeCursor received unknown cursor argument");
}
- FreeCursor(Tcl_GetHashValue(idHashPtr));
+ FreeCursor((TkCursor *)Tcl_GetHashValue(idHashPtr));
}
/*
@@ -587,11 +586,10 @@ static void
FreeCursorObj(
Tcl_Obj *objPtr) /* The object we are releasing. */
{
- TkCursor *cursorPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ TkCursor *cursorPtr = (TkCursor *)objPtr->internalRep.twoPtrValue.ptr1;
if (cursorPtr != NULL) {
- cursorPtr->objRefCount--;
- if ((cursorPtr->objRefCount == 0)
+ if ((cursorPtr->objRefCount-- <= 1)
&& (cursorPtr->resourceRefCount == 0)) {
ckfree(cursorPtr);
}
@@ -622,7 +620,7 @@ DupCursorObjProc(
Tcl_Obj *srcObjPtr, /* The object we are copying from. */
Tcl_Obj *dupObjPtr) /* The object we are copying to. */
{
- TkCursor *cursorPtr = srcObjPtr->internalRep.twoPtrValue.ptr1;
+ TkCursor *cursorPtr = (TkCursor *)srcObjPtr->internalRep.twoPtrValue.ptr1;
dupObjPtr->typePtr = srcObjPtr->typePtr;
dupObjPtr->internalRep.twoPtrValue.ptr1 = cursorPtr;
@@ -707,7 +705,7 @@ GetCursorFromObj(
* cached is the one that is needed.
*/
- cursorPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ cursorPtr = (TkCursor *)objPtr->internalRep.twoPtrValue.ptr1;
if ((cursorPtr != NULL) && (Tk_Display(tkwin) == cursorPtr->display)) {
return cursorPtr;
}
@@ -722,7 +720,7 @@ GetCursorFromObj(
if (hashPtr == NULL) {
goto error;
}
- for (cursorPtr = Tcl_GetHashValue(hashPtr);
+ for (cursorPtr = (TkCursor *)Tcl_GetHashValue(hashPtr);
cursorPtr != NULL; cursorPtr = cursorPtr->nextPtr) {
if (Tk_Display(tkwin) == cursorPtr->display) {
FreeCursorObj(objPtr);
@@ -857,7 +855,7 @@ TkDebugCursor(
resultPtr = Tcl_NewObj();
hashPtr = Tcl_FindHashEntry(&dispPtr->cursorNameTable, name);
if (hashPtr != NULL) {
- cursorPtr = Tcl_GetHashValue(hashPtr);
+ cursorPtr = (TkCursor *)Tcl_GetHashValue(hashPtr);
if (cursorPtr == NULL) {
Tcl_Panic("TkDebugCursor found empty hash table entry");
}
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index 4ffb48b..a6684c7 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.c
@@ -477,7 +477,7 @@ Tk_EntryObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- register Entry *entryPtr;
+ Entry *entryPtr;
Tk_OptionTable optionTable;
Tk_Window tkwin;
char *tmp;
@@ -3234,11 +3234,11 @@ EntryTextVarProc(
static int
EntryValidate(
- register Entry *entryPtr, /* Entry that needs validation. */
- register char *cmd) /* Validation command (NULL-terminated
+ Entry *entryPtr, /* Entry that needs validation. */
+ char *cmd) /* Validation command (NULL-terminated
* string). */
{
- register Tcl_Interp *interp = entryPtr->interp;
+ Tcl_Interp *interp = entryPtr->interp;
int code, isOK;
code = Tcl_EvalEx(interp, cmd, -1, TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT);
@@ -3294,7 +3294,7 @@ EntryValidate(
static int
EntryValidateChange(
- register Entry *entryPtr, /* Entry that needs validation. */
+ Entry *entryPtr, /* Entry that needs validation. */
const char *change, /* Characters to be added/deleted
* (NUL-terminated string). */
const char *newValue, /* Potential new value of entry string */
@@ -3437,8 +3437,8 @@ EntryValidateChange(
static void
ExpandPercents(
- register Entry *entryPtr, /* Entry that needs validation. */
- register const char *before,
+ Entry *entryPtr, /* Entry that needs validation. */
+ const char *before,
/* Command containing percent expressions to
* be replaced. */
const char *change, /* Characters to added/deleted (NUL-terminated
@@ -3452,7 +3452,7 @@ ExpandPercents(
int spaceNeeded, cvtFlags; /* Used to substitute string as proper Tcl
* list element. */
int number, length;
- register const char *string;
+ const char *string;
int ch;
char numStorage[2*TCL_INTEGER_SPACE];
@@ -3607,8 +3607,8 @@ Tk_SpinboxObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- register Entry *entryPtr;
- register Spinbox *sbPtr;
+ Entry *entryPtr;
+ Spinbox *sbPtr;
Tk_OptionTable optionTable;
Tk_Window tkwin;
char *tmp;
@@ -4285,8 +4285,8 @@ GetSpinboxElement(
static int
SpinboxInvoke(
- register Tcl_Interp *interp,/* Current interpreter. */
- register Spinbox *sbPtr, /* Spinbox to invoke. */
+ Tcl_Interp *interp,/* Current interpreter. */
+ Spinbox *sbPtr, /* Spinbox to invoke. */
int element) /* Element to invoke, either the "up" or
* "down" button. */
{
diff --git a/generic/tkError.c b/generic/tkError.c
index 277d7f0..6ff5475 100644
--- a/generic/tkError.c
+++ b/generic/tkError.c
@@ -107,7 +107,7 @@ Tk_CreateErrorHandler(
* Create the handler record.
*/
- errorPtr = ckalloc(sizeof(TkErrorHandler));
+ errorPtr = (TkErrorHandler *)ckalloc(sizeof(TkErrorHandler));
errorPtr->dispPtr = dispPtr;
errorPtr->firstRequest = NextRequest(display);
errorPtr->lastRequest = (unsigned) -1;
diff --git a/generic/tkFileFilter.c b/generic/tkFileFilter.c
index 8588d70..c8dbc52 100644
--- a/generic/tkFileFilter.c
+++ b/generic/tkFileFilter.c
@@ -164,7 +164,7 @@ TkFreeFileFilters(
FileFilterClause *clausePtr;
GlobPattern *globPtr;
MacFileType *mfPtr;
- register void *toFree; /* A pointer that we are about to free. */
+ void *toFree; /* A pointer that we are about to free. */
for (filterPtr = flistPtr->filters; filterPtr != NULL; ) {
for (clausePtr = filterPtr->clauses; clausePtr != NULL; ) {
diff --git a/generic/tkFocus.c b/generic/tkFocus.c
index 4d46e4b..8066afd 100644
--- a/generic/tkFocus.c
+++ b/generic/tkFocus.c
@@ -113,8 +113,8 @@ Tk_FocusObjCmd(
static const char *const focusOptions[] = {
"-displayof", "-force", "-lastfor", NULL
};
- Tk_Window tkwin = clientData;
- TkWindow *winPtr = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
+ TkWindow *winPtr = (TkWindow *)clientData;
TkWindow *newPtr, *topLevelPtr;
ToplevelFocusInfo *tlFocusPtr;
const char *windowName;
@@ -415,7 +415,7 @@ TkFocusFilterEvent(
}
}
if (tlFocusPtr == NULL) {
- tlFocusPtr = ckalloc(sizeof(ToplevelFocusInfo));
+ tlFocusPtr = (ToplevelFocusInfo *)ckalloc(sizeof(ToplevelFocusInfo));
tlFocusPtr->topLevelPtr = tlFocusPtr->focusWinPtr = winPtr;
tlFocusPtr->nextPtr = winPtr->mainPtr->tlFocusPtr;
winPtr->mainPtr->tlFocusPtr = tlFocusPtr;
@@ -622,7 +622,7 @@ TkSetFocusWin(
}
}
if (tlFocusPtr == NULL) {
- tlFocusPtr = ckalloc(sizeof(ToplevelFocusInfo));
+ tlFocusPtr = (ToplevelFocusInfo *)ckalloc(sizeof(ToplevelFocusInfo));
tlFocusPtr->topLevelPtr = topLevelPtr;
tlFocusPtr->nextPtr = winPtr->mainPtr->tlFocusPtr;
winPtr->mainPtr->tlFocusPtr = tlFocusPtr;
@@ -807,7 +807,7 @@ TkFocusKeyEvent(
void
TkFocusDeadWindow(
- register TkWindow *winPtr) /* Information about the window that is being
+ TkWindow *winPtr) /* Information about the window that is being
* deleted. */
{
ToplevelFocusInfo *tlFocusPtr, *prevPtr;
@@ -961,7 +961,7 @@ FocusMapProc(
ClientData clientData, /* Toplevel window. */
XEvent *eventPtr) /* Information about event. */
{
- TkWindow *winPtr = clientData;
+ TkWindow *winPtr = (TkWindow *)clientData;
DisplayFocusInfo *displayFocusPtr;
if (eventPtr->type == VisibilityNotify) {
@@ -1015,7 +1015,7 @@ FindDisplayFocusInfo(
* The record doesn't exist yet. Make a new one.
*/
- displayFocusPtr = ckalloc(sizeof(DisplayFocusInfo));
+ displayFocusPtr = (DisplayFocusInfo *)ckalloc(sizeof(DisplayFocusInfo));
displayFocusPtr->dispPtr = dispPtr;
displayFocusPtr->focusWinPtr = NULL;
displayFocusPtr->focusOnMapPtr = NULL;
@@ -1143,7 +1143,7 @@ TkFocusSplit(
* Move focus to new toplevel.
*/
- ToplevelFocusInfo *newTlFocusPtr = ckalloc(sizeof(ToplevelFocusInfo));
+ ToplevelFocusInfo *newTlFocusPtr = (ToplevelFocusInfo *)ckalloc(sizeof(ToplevelFocusInfo));
newTlFocusPtr->topLevelPtr = winPtr;
newTlFocusPtr->focusWinPtr = tlFocusPtr->focusWinPtr;
diff --git a/generic/tkFont.c b/generic/tkFont.c
index 3e4044f..71008bc 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.c
@@ -897,6 +897,7 @@ RecomputeWidgets(
{
Tk_ClassWorldChangedProc *proc =
Tk_GetClassProc(winPtr->classProcsPtr, worldChangedProc);
+ TkWindow *tkwinPtr;
if (proc != NULL) {
proc(winPtr->instanceData);
@@ -912,18 +913,25 @@ RecomputeWidgets(
*
* However, the additional overhead of the recursive calls may become a
* performance problem if typical usage alters such that -font'ed widgets
- * appear high in the heirarchy, causing deep recursion. This could happen
- * with text widgets, or more likely with the (not yet existant) labeled
- * frame widget. With these widgets it is possible, even likely, that a
- * -font'ed widget (text or labeled frame) will not be a leaf node, but
+ * appear high in the hierarchy, causing deep recursion. This could happen
+ * with text widgets, or more likely with the labelframe
+ * widget. With these widgets it is possible, even likely, that a
+ * -font'ed widget (text or labelframe) will not be a leaf node, but
* will instead have many descendants. If this is ever found to cause a
* performance problem, it may be worth investigating an iterative version
* of the code below.
*/
- for (winPtr=winPtr->childList ; winPtr!=NULL ; winPtr=winPtr->nextPtr) {
- RecomputeWidgets(winPtr);
+ for (tkwinPtr=winPtr->childList ; tkwinPtr!=NULL ; tkwinPtr=tkwinPtr->nextPtr) {
+ RecomputeWidgets(tkwinPtr);
}
+
+ /*
+ * Broadcast font change virtually for mega-widget layout managers.
+ * Do this after the font change has been propagated to core widgets.
+ */
+ TkSendVirtualEvent((Tk_Window)winPtr, "TkWorldChanged",
+ Tcl_NewStringObj("FontChanged",-1));
}
/*
@@ -3780,7 +3788,7 @@ NewChunk(
if (layoutPtr->numChunks == maxChunks) {
maxChunks *= 2;
s = Tk_Offset(TextLayout, chunks) + (maxChunks * sizeof(LayoutChunk));
- layoutPtr = ckrealloc(layoutPtr, s);
+ layoutPtr = (TextLayout *)ckrealloc(layoutPtr, s);
*layoutPtrPtr = layoutPtr;
*maxPtr = maxChunks;
diff --git a/generic/tkFrame.c b/generic/tkFrame.c
index 54ba8e8..b5c20e8 100644
--- a/generic/tkFrame.c
+++ b/generic/tkFrame.c
@@ -741,7 +741,7 @@ FrameWidgetObjCmd(
enum options {
FRAME_CGET, FRAME_CONFIGURE
};
- register Frame *framePtr = clientData;
+ Frame *framePtr = clientData;
int result = TCL_OK, index;
int c, i, length;
Tcl_Obj *objPtr;
@@ -859,8 +859,8 @@ static void
DestroyFrame(
void *memPtr) /* Info about frame widget. */
{
- register Frame *framePtr = memPtr;
- register Labelframe *labelframePtr = memPtr;
+ Frame *framePtr = memPtr;
+ Labelframe *labelframePtr = memPtr;
if (framePtr->type == TYPE_LABELFRAME) {
Tk_FreeTextLayout(labelframePtr->textLayout);
@@ -896,7 +896,7 @@ static void
DestroyFramePartly(
Frame *framePtr) /* Info about frame widget. */
{
- register Labelframe *labelframePtr = (Labelframe *) framePtr;
+ Labelframe *labelframePtr = (Labelframe *) framePtr;
if (framePtr->type == TYPE_LABELFRAME && labelframePtr->labelWin != NULL) {
Tk_DeleteEventHandler(labelframePtr->labelWin, StructureNotifyMask,
@@ -936,7 +936,7 @@ DestroyFramePartly(
static int
ConfigureFrame(
Tcl_Interp *interp, /* Used for error reporting. */
- register Frame *framePtr, /* Information about widget; may or may not
+ Frame *framePtr, /* Information about widget; may or may not
* already have values for some fields. */
int objc, /* Number of valid entries in objv. */
Tcl_Obj *const objv[]) /* Arguments. */
@@ -1263,7 +1263,7 @@ FrameWorldChanged(
static void
ComputeFrameGeometry(
- register Frame *framePtr) /* Information about widget. */
+ Frame *framePtr) /* Information about widget. */
{
int otherWidth, otherHeight, otherWidthT, otherHeightT, padding;
int maxWidth, maxHeight;
@@ -1412,8 +1412,8 @@ static void
DisplayFrame(
ClientData clientData) /* Information about widget. */
{
- register Frame *framePtr = clientData;
- register Tk_Window tkwin = framePtr->tkwin;
+ Frame *framePtr = clientData;
+ Tk_Window tkwin = framePtr->tkwin;
int bdX1, bdY1, bdX2, bdY2, hlWidth;
Pixmap pixmap;
TkRegion clipRegion = NULL;
@@ -1635,9 +1635,9 @@ DisplayFrame(
static void
FrameEventProc(
ClientData clientData, /* Information about window. */
- register XEvent *eventPtr) /* Information about event. */
+ XEvent *eventPtr) /* Information about event. */
{
- register Frame *framePtr = clientData;
+ Frame *framePtr = clientData;
if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) {
goto redraw;
diff --git a/generic/tkGC.c b/generic/tkGC.c
index c424e30..8744ec4 100644
--- a/generic/tkGC.c
+++ b/generic/tkGC.c
@@ -66,17 +66,17 @@ static void GCInit(TkDisplay *dispPtr);
GC
Tk_GetGC(
Tk_Window tkwin, /* Window in which GC will be used. */
- register unsigned long valueMask,
+ unsigned long valueMask,
/* 1 bits correspond to values specified in
* *valuesPtr; other values are set from
* defaults. */
- register XGCValues *valuePtr)
+ XGCValues *valuePtr)
/* Values are specified here for bits set in
* valueMask. */
{
ValueKey valueKey;
Tcl_HashEntry *valueHashPtr, *idHashPtr;
- register TkGC *gcPtr;
+ TkGC *gcPtr;
int isNew;
Drawable d, freeDrawable;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -218,7 +218,7 @@ Tk_GetGC(
valueHashPtr = Tcl_CreateHashEntry(&dispPtr->gcValueTable,
(char *) &valueKey, &isNew);
if (!isNew) {
- gcPtr = Tcl_GetHashValue(valueHashPtr);
+ gcPtr = (TkGC *)Tcl_GetHashValue(valueHashPtr);
gcPtr->refCount++;
return gcPtr->gc;
}
@@ -228,7 +228,7 @@ Tk_GetGC(
* and add a new structure to the database.
*/
- gcPtr = ckalloc(sizeof(TkGC));
+ gcPtr = (TkGC *)ckalloc(sizeof(TkGC));
/*
* Find or make a drawable to use to specify the screen and depth of the
@@ -291,7 +291,7 @@ Tk_FreeGC(
GC gc) /* Graphics context to be released. */
{
Tcl_HashEntry *idHashPtr;
- register TkGC *gcPtr;
+ TkGC *gcPtr;
TkDisplay *dispPtr = TkGetDisplay(display);
if (!dispPtr->gcInit) {
@@ -311,9 +311,8 @@ Tk_FreeGC(
if (idHashPtr == NULL) {
Tcl_Panic("Tk_FreeGC received unknown gc argument");
}
- gcPtr = Tcl_GetHashValue(idHashPtr);
- gcPtr->refCount--;
- if (gcPtr->refCount == 0) {
+ gcPtr = (TkGC *)Tcl_GetHashValue(idHashPtr);
+ if (gcPtr->refCount-- <= 1) {
XFreeGC(gcPtr->display, gcPtr->gc);
Tcl_DeleteHashEntry(gcPtr->valueHashPtr);
Tcl_DeleteHashEntry(idHashPtr);
@@ -348,7 +347,7 @@ TkGCCleanup(
for (entryPtr = Tcl_FirstHashEntry(&dispPtr->gcIdTable, &search);
entryPtr != NULL; entryPtr = Tcl_NextHashEntry(&search)) {
- gcPtr = Tcl_GetHashValue(entryPtr);
+ gcPtr = (TkGC *)Tcl_GetHashValue(entryPtr);
XFreeGC(gcPtr->display, gcPtr->gc);
Tcl_DeleteHashEntry(gcPtr->valueHashPtr);
diff --git a/generic/tkGrab.c b/generic/tkGrab.c
index a1ff46c..787a2e2 100644
--- a/generic/tkGrab.c
+++ b/generic/tkGrab.c
@@ -16,6 +16,8 @@
#include "tkWinInt.h"
#elif !defined(MAC_OSX_TK)
#include "tkUnixInt.h"
+#else
+#include "tkMacOSXInt.h"
#endif
/*
diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c
index 76e48d4..ab4bc37 100644
--- a/generic/tkImgGIF.c
+++ b/generic/tkImgGIF.c
@@ -1035,13 +1035,13 @@ ReadImage(
{
unsigned char initialCodeSize;
int xpos = 0, ypos = 0, pass = 0, i, count;
- register unsigned char *pixelPtr;
+ unsigned char *pixelPtr;
static const int interlaceStep[] = { 8, 8, 4, 2 };
static const int interlaceStart[] = { 0, 4, 2, 1 };
unsigned short prefix[(1 << MAX_LWZ_BITS)];
unsigned char append[(1 << MAX_LWZ_BITS)];
unsigned char stack[(1 << MAX_LWZ_BITS)*2];
- register unsigned char *top;
+ unsigned char *top;
int codeSize, clearCode, inCode, endCode, oldCode, maxCode;
int code, firstCode, v;
@@ -1425,7 +1425,7 @@ Mread(
size_t numChunks, /* number of chunks */
MFile *handle) /* mmdecode "file" handle */
{
- register int i, c;
+ int i, c;
int count = chunkSize * numChunks;
for (i=0; i<count && (c=Mgetc(handle)) != GIF_DONE; i++) {
@@ -2157,9 +2157,9 @@ ClearHashTable( /* Reset code table. */
GIFState_t *statePtr,
int hSize)
{
- register int *hashTablePtr = statePtr->hashTable + hSize;
- register long i;
- register long m1 = -1;
+ int *hashTablePtr = statePtr->hashTable + hSize;
+ long i;
+ long m1 = -1;
i = hSize - 16;
do { /* might use Sys V memset(3) here */
diff --git a/generic/tkImgPNG.c b/generic/tkImgPNG.c
index 7e22f26..03bb4f8 100644
--- a/generic/tkImgPNG.c
+++ b/generic/tkImgPNG.c
@@ -2237,14 +2237,14 @@ ApplyAlpha(
PNGImage *pngPtr)
{
if (pngPtr->alpha != 1.0) {
- register unsigned char *p = pngPtr->block.pixelPtr;
+ unsigned char *p = pngPtr->block.pixelPtr;
unsigned char *endPtr = p + pngPtr->blockLen;
int offset = pngPtr->block.offset[3];
p += offset;
if (16 == pngPtr->bitDepth) {
- register unsigned int channel;
+ unsigned int channel;
while (p < endPtr) {
channel = (unsigned int)
diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c
index a40ee7f..37ee3d9 100644
--- a/generic/tkImgPhInstance.c
+++ b/generic/tkImgPhInstance.c
@@ -31,7 +31,7 @@ extern int _XInitImageFuncPtrs(XImage *image);
* Forward declarations
*/
-#ifndef TKPUTIMAGE_CAN_BLEND
+#ifndef TK_CAN_RENDER_RGBA
static void BlendComplexAlpha(XImage *bgImg, PhotoInstance *iPtr,
int xOffset, int yOffset, int width, int height);
#endif
@@ -409,7 +409,7 @@ TkImgPhotoGet(
*
*----------------------------------------------------------------------
*/
-#ifndef TKPUTIMAGE_CAN_BLEND
+#ifndef TK_CAN_RENDER_RGBA
#ifndef _WIN32
#define GetRValue(rgb) (UCHAR(((rgb) & red_mask) >> red_shift))
#define GetGValue(rgb) (UCHAR(((rgb) & green_mask) >> green_shift))
@@ -575,7 +575,7 @@ BlendComplexAlpha(
}
#undef ALPHA_BLEND
}
-#endif /* TKPUTIMAGE_CAN_BLEND */
+#endif /* TK_CAN_RENDER_RGBA */
/*
*----------------------------------------------------------------------
@@ -607,7 +607,7 @@ TkImgPhotoDisplay(
* to imageX and imageY. */
{
PhotoInstance *instancePtr = clientData;
-#ifndef TKPUTIMAGE_CAN_BLEND
+#ifndef TK_CAN_RENDER_RGBA
XVisualInfo visInfo = instancePtr->visualInfo;
#endif
@@ -620,9 +620,10 @@ TkImgPhotoDisplay(
return;
}
-#ifdef TKPUTIMAGE_CAN_BLEND
+#ifdef TK_CAN_RENDER_RGBA
+
/*
- * If TkPutImage can handle RGBA Ximages directly there is
+ * We can use TkpPutRGBAImage to render RGBA Ximages directly so there is
* no need to call XGetImage or to do the Porter-Duff compositing by hand.
*/
@@ -631,11 +632,12 @@ TkImgPhotoDisplay(
(unsigned int)instancePtr->width,
(unsigned int)instancePtr->height,
0, (unsigned int)(4 * instancePtr->width));
- TkPutImage(NULL, 0, display, drawable, instancePtr->gc,
+ TkpPutRGBAImage(display, drawable, instancePtr->gc,
photo, imageX, imageY, drawableX, drawableY,
(unsigned int) width, (unsigned int) height);
photo->data = NULL;
XDestroyImage(photo);
+
#else
if ((instancePtr->masterPtr->flags & COMPLEX_ALPHA)
diff --git a/generic/tkInt.h b/generic/tkInt.h
index a98b6d6..fe8f16e 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -679,6 +679,10 @@ typedef struct TkMainInfo {
struct TkMainInfo *nextPtr; /* Next in list of all main windows managed by
* this process. */
Tcl_HashTable busyTable; /* Information used by [tk busy] command. */
+ Tcl_ObjCmdProc *tclUpdateObjProc;
+ /* Saved Tcl [update] command, used to restore
+ * Tcl's version of [update] after Tk is shut
+ * down */
} TkMainInfo;
/*
@@ -1037,7 +1041,7 @@ MODULE_SCOPE const char *const tkWebColors[20];
#endif
/*
- * Support for Clang Static Analyzer <http://clang-analyzer.llvm.org>
+ * Support for Clang Static Analyzer <https://clang-analyzer.llvm.org/>
*/
#if defined(PURIFY) && defined(__clang__)
@@ -1198,9 +1202,6 @@ MODULE_SCOPE int Tk_SelectionObjCmd(ClientData clientData,
MODULE_SCOPE int Tk_SendObjCmd(ClientData clientData,
Tcl_Interp *interp,int objc,
Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tk_SendObjCmd(ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *const objv[]);
MODULE_SCOPE int Tk_SpinboxObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
@@ -1322,7 +1323,8 @@ MODULE_SCOPE void TkUnixSetXftClipRegion(TkRegion clipRegion);
# define c_class class
#endif
-#if TCL_UTF_MAX > 4
+/* Tcl 8.6 has a different definition of Tcl_UniChar than other Tcl versions for TCL_UTF_MAX > 3 */
+#if TCL_UTF_MAX > (3 + (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 6))
# define TkUtfToUniChar Tcl_UtfToUniChar
# define TkUniCharToUtf Tcl_UniCharToUtf
# define TkUtfPrev Tcl_UtfPrev
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index 514b349..cba8954 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.c
@@ -478,7 +478,7 @@ Tk_ListboxObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- register Listbox *listPtr;
+ Listbox *listPtr;
Tk_Window tkwin;
ListboxOptionTables *optionTables;
@@ -607,7 +607,7 @@ ListboxWidgetObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Arguments as Tcl_Obj's. */
{
- register Listbox *listPtr = clientData;
+ Listbox *listPtr = clientData;
int cmdIndex, index;
int result = TCL_OK;
Tcl_Obj *objPtr;
@@ -1082,7 +1082,7 @@ ListboxBboxSubCmd(
Listbox *listPtr, /* Information about the listbox */
int index) /* Index of the element to get bbox info on */
{
- register Tk_Window tkwin = listPtr->tkwin;
+ Tk_Window tkwin = listPtr->tkwin;
int lastVisibleIndex;
/*
@@ -1446,7 +1446,7 @@ static void
DestroyListbox(
void *memPtr) /* Info about listbox widget. */
{
- register Listbox *listPtr = memPtr;
+ Listbox *listPtr = memPtr;
Tcl_HashEntry *entry;
Tcl_HashSearch search;
@@ -1555,7 +1555,7 @@ DestroyListboxOptionTables(
static int
ConfigureListbox(
Tcl_Interp *interp, /* Used for error reporting. */
- register Listbox *listPtr, /* Information about widget; may or may not
+ Listbox *listPtr, /* Information about widget; may or may not
* already have values for some fields. */
int objc, /* Number of valid entries in argv. */
Tcl_Obj *const objv[]) /* Arguments. */
@@ -1715,7 +1715,7 @@ ConfigureListbox(
static int
ConfigureListboxItem(
Tcl_Interp *interp, /* Used for error reporting. */
- register Listbox *listPtr, /* Information about widget; may or may not
+ Listbox *listPtr, /* Information about widget; may or may not
* already have values for some fields. */
ItemAttr *attrs, /* Information about the item to configure */
int objc, /* Number of valid entries in argv. */
@@ -1837,8 +1837,8 @@ static void
DisplayListbox(
ClientData clientData) /* Information about window. */
{
- register Listbox *listPtr = clientData;
- register Tk_Window tkwin = listPtr->tkwin;
+ Listbox *listPtr = clientData;
+ Tk_Window tkwin = listPtr->tkwin;
GC gc;
int i, limit, x, y, prevSelected, freeGC, stringLen;
Tk_FontMetrics fm;
@@ -2317,7 +2317,7 @@ ListboxComputeGeometry(
static int
ListboxInsertSubCmd(
- register Listbox *listPtr, /* Listbox that is to get the new elements. */
+ Listbox *listPtr, /* Listbox that is to get the new elements. */
int index, /* Add the new elements before this
* element. */
int objc, /* Number of new elements to add. */
@@ -2433,7 +2433,7 @@ ListboxInsertSubCmd(
static int
ListboxDeleteSubCmd(
- register Listbox *listPtr, /* Listbox widget to modify. */
+ Listbox *listPtr, /* Listbox widget to modify. */
int first, /* Index of first element to delete. */
int last) /* Index of last element to delete. */
{
@@ -2828,7 +2828,7 @@ GetListboxIndex(
static void
ChangeListboxView(
- register Listbox *listPtr, /* Information about widget. */
+ Listbox *listPtr, /* Information about widget. */
int index) /* Index of element in listPtr that should now
* appear at the top of the listbox. */
{
@@ -2863,7 +2863,7 @@ ChangeListboxView(
static void
ChangeListboxOffset(
- register Listbox *listPtr, /* Information about widget. */
+ Listbox *listPtr, /* Information about widget. */
int offset) /* Desired new "xOffset" for listbox. */
{
int maxOffset;
@@ -2911,7 +2911,7 @@ ChangeListboxOffset(
static void
ListboxScanTo(
- register Listbox *listPtr, /* Information about widget. */
+ Listbox *listPtr, /* Information about widget. */
int x, /* X-coordinate to use for scan operation. */
int y) /* Y-coordinate to use for scan operation. */
{
@@ -2978,7 +2978,7 @@ ListboxScanTo(
static int
NearestListboxElement(
- register Listbox *listPtr, /* Information about widget. */
+ Listbox *listPtr, /* Information about widget. */
int y) /* Y-coordinate in listPtr's window. */
{
int index;
@@ -3019,7 +3019,7 @@ NearestListboxElement(
static int
ListboxSelect(
- register Listbox *listPtr, /* Information about widget. */
+ Listbox *listPtr, /* Information about widget. */
int first, /* Index of first element to select or
* deselect. */
int last, /* Index of last element to select or
@@ -3120,7 +3120,7 @@ ListboxFetchSelection(
* not including terminating NULL
* character. */
{
- register Listbox *listPtr = clientData;
+ Listbox *listPtr = clientData;
Tcl_DString selection;
int length, count, needNewline, stringLen, i;
Tcl_Obj *curElement;
@@ -3196,7 +3196,7 @@ static void
ListboxLostSelection(
ClientData clientData) /* Information about listbox widget. */
{
- register Listbox *listPtr = clientData;
+ Listbox *listPtr = clientData;
if ((listPtr->exportSelection) && (!Tcl_IsSafe(listPtr->interp))
&& (listPtr->nElements > 0)) {
@@ -3248,7 +3248,7 @@ GenerateListboxSelectEvent(
static void
EventuallyRedrawRange(
- register Listbox *listPtr, /* Information about widget. */
+ Listbox *listPtr, /* Information about widget. */
int first, /* Index of first element in list that needs
* to be redrawn. */
int last) /* Index of last element in list that needs to
@@ -3256,7 +3256,7 @@ EventuallyRedrawRange(
* just bracket a range. */
{
/*
- * We don't have to register a redraw callback if one is already pending,
+ * We don't have to a redraw callback if one is already pending,
* or if the window doesn't exist, or if the window isn't mapped.
*/
@@ -3291,7 +3291,7 @@ EventuallyRedrawRange(
static void
ListboxUpdateVScrollbar(
- register Listbox *listPtr) /* Information about widget. */
+ Listbox *listPtr) /* Information about widget. */
{
char firstStr[TCL_DOUBLE_SPACE], lastStr[TCL_DOUBLE_SPACE];
double first, last;
@@ -3361,7 +3361,7 @@ ListboxUpdateVScrollbar(
static void
ListboxUpdateHScrollbar(
- register Listbox *listPtr) /* Information about widget. */
+ Listbox *listPtr) /* Information about widget. */
{
char firstStr[TCL_DOUBLE_SPACE], lastStr[TCL_DOUBLE_SPACE];
int result, windowWidth;
@@ -3642,7 +3642,7 @@ MigrateHashEntries(
*----------------------------------------------------------------------
*/
static int GetMaxOffset(
- register Listbox *listPtr)
+ Listbox *listPtr)
{
int maxOffset;
diff --git a/generic/tkMacWinMenu.c b/generic/tkMacWinMenu.c
index ab92fec..7749c6d 100644
--- a/generic/tkMacWinMenu.c
+++ b/generic/tkMacWinMenu.c
@@ -67,7 +67,7 @@ PreprocessMenu(
do {
finished = 1;
for (index = 0; index < menuPtr->numEntries; index++) {
- register TkMenuEntry *entryPtr = menuPtr->entries[index];
+ TkMenuEntry *entryPtr = menuPtr->entries[index];
if ((entryPtr->type == CASCADE_ENTRY)
&& (entryPtr->namePtr != NULL)
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index 1cd7a16..18f59a8 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -406,7 +406,7 @@ Tk_MenuObjCmd(
{
Tk_Window tkwin = clientData;
Tk_Window newWin;
- register TkMenu *menuPtr;
+ TkMenu *menuPtr;
TkMenuReferences *menuRefPtr;
int i, index, toplevel;
const char *windowName;
@@ -617,8 +617,8 @@ MenuWidgetObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- register TkMenu *menuPtr = clientData;
- register TkMenuEntry *mePtr;
+ TkMenu *menuPtr = clientData;
+ TkMenuEntry *mePtr;
int result = TCL_OK;
int option;
ThreadSpecificData *tsdPtr =
@@ -1385,7 +1385,7 @@ static void
DestroyMenuEntry(
void *memPtr) /* Pointer to entry to be freed. */
{
- register TkMenuEntry *mePtr = memPtr;
+ TkMenuEntry *mePtr = memPtr;
TkMenu *menuPtr = mePtr->menuPtr;
if (menuPtr->postedCascade == mePtr) {
@@ -1519,7 +1519,7 @@ MenuWorldChanged(
static int
ConfigureMenu(
Tcl_Interp *interp, /* Used for error reporting. */
- register TkMenu *menuPtr, /* Information about widget; may or may not
+ TkMenu *menuPtr, /* Information about widget; may or may not
* already have values for some fields. */
int objc, /* Number of valid entries in argv. */
Tcl_Obj *const objv[]) /* Arguments. */
@@ -1901,7 +1901,7 @@ PostProcessEntry(
static int
ConfigureMenuEntry(
- register TkMenuEntry *mePtr,/* Information about menu entry; may or may
+ TkMenuEntry *mePtr,/* Information about menu entry; may or may
* not already have values for some fields. */
int objc, /* Number of valid entries in argv. */
Tcl_Obj *const objv[]) /* Arguments. */
@@ -2589,11 +2589,11 @@ MenuVarProc(
int
TkActivateMenuEntry(
- register TkMenu *menuPtr, /* Menu in which to activate. */
+ TkMenu *menuPtr, /* Menu in which to activate. */
int index) /* Index of entry to activate, or -1 to
* deactivate all entries. */
{
- register TkMenuEntry *mePtr;
+ TkMenuEntry *mePtr;
int result = TCL_OK;
if (menuPtr->active >= 0) {
diff --git a/generic/tkMenuDraw.c b/generic/tkMenuDraw.c
index 89f4a2b..3851a06 100644
--- a/generic/tkMenuDraw.c
+++ b/generic/tkMenuDraw.c
@@ -483,8 +483,8 @@ TkRecomputeMenu(
void
TkEventuallyRedrawMenu(
- register TkMenu *menuPtr, /* Information about menu to redraw. */
- register TkMenuEntry *mePtr)/* Entry to redraw. NULL means redraw all the
+ TkMenu *menuPtr, /* Information about menu to redraw. */
+ TkMenuEntry *mePtr)/* Entry to redraw. NULL means redraw all the
* entries in the menu. */
{
int i;
@@ -586,7 +586,7 @@ TkMenuSelectImageProc(
* <=0). */
int imgWidth, int imgHeight)/* New dimensions of image. */
{
- register TkMenuEntry *mePtr = clientData;
+ TkMenuEntry *mePtr = clientData;
if ((mePtr->entryFlags & ENTRY_SELECTED)
&& !(mePtr->menuPtr->menuFlags & REDRAW_PENDING)) {
@@ -615,9 +615,9 @@ static void
DisplayMenu(
ClientData clientData) /* Information about widget. */
{
- register TkMenu *menuPtr = clientData;
- register TkMenuEntry *mePtr;
- register Tk_Window tkwin = menuPtr->tkwin;
+ TkMenu *menuPtr = clientData;
+ TkMenuEntry *mePtr;
+ Tk_Window tkwin = menuPtr->tkwin;
int index, strictMotif;
Tk_Font tkfont;
Tk_FontMetrics menuMetrics;
@@ -824,7 +824,7 @@ TkMenuImageProc(
* <=0). */
int imgWidth, int imgHeight)/* New dimensions of image. */
{
- register TkMenu *menuPtr = ((TkMenuEntry *) clientData)->menuPtr;
+ TkMenu *menuPtr = ((TkMenuEntry *) clientData)->menuPtr;
if ((menuPtr->tkwin != NULL) && !(menuPtr->menuFlags & RESIZE_PENDING)) {
menuPtr->menuFlags |= RESIZE_PENDING;
@@ -882,8 +882,8 @@ int
TkPostSubmenu(
Tcl_Interp *interp, /* Used for invoking sub-commands and
* reporting errors. */
- register TkMenu *menuPtr, /* Information about menu as a whole. */
- register TkMenuEntry *mePtr)/* Info about submenu that is to be posted.
+ TkMenu *menuPtr, /* Information about menu as a whole. */
+ TkMenuEntry *mePtr)/* Info about submenu that is to be posted.
* NULL means make sure that no submenu is
* posted. */
{
diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c
index 2228a2e..5f4f40f 100644
--- a/generic/tkMenubutton.c
+++ b/generic/tkMenubutton.c
@@ -217,7 +217,7 @@ Tk_MenubuttonObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- register TkMenuButton *mbPtr;
+ TkMenuButton *mbPtr;
Tk_OptionTable optionTable;
Tk_Window tkwin;
@@ -347,7 +347,7 @@ MenuButtonWidgetObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- register TkMenuButton *mbPtr = clientData;
+ TkMenuButton *mbPtr = clientData;
int result, index;
Tcl_Obj *objPtr;
@@ -422,7 +422,7 @@ static void
DestroyMenuButton(
char *memPtr) /* Info about button widget. */
{
- register TkMenuButton *mbPtr = (TkMenuButton *) memPtr;
+ TkMenuButton *mbPtr = (TkMenuButton *) memPtr;
TkpDestroyMenuButton(mbPtr);
if (mbPtr->flags & REDRAW_PENDING) {
@@ -490,7 +490,7 @@ DestroyMenuButton(
static int
ConfigureMenuButton(
Tcl_Interp *interp, /* Used for error reporting. */
- register TkMenuButton *mbPtr,
+ TkMenuButton *mbPtr,
/* Information about widget; may or may not
* already have values for some fields. */
int objc, /* Number of valid entries in objv. */
@@ -877,7 +877,7 @@ MenuButtonTextVarProc(
const char *name2, /* Second part of variable name. */
int flags) /* Information about what happened. */
{
- register TkMenuButton *mbPtr = clientData;
+ TkMenuButton *mbPtr = clientData;
const char *value;
unsigned len;
@@ -964,7 +964,7 @@ MenuButtonImageProc(
* 0). */
int imgWidth, int imgHeight)/* New dimensions of image. */
{
- register TkMenuButton *mbPtr = clientData;
+ TkMenuButton *mbPtr = clientData;
if (mbPtr->tkwin != NULL) {
TkpComputeMenuButtonGeometry(mbPtr);
diff --git a/generic/tkMessage.c b/generic/tkMessage.c
index 1a3c6de..cc67b46 100644
--- a/generic/tkMessage.c
+++ b/generic/tkMessage.c
@@ -219,7 +219,7 @@ Tk_MessageObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- register Message *msgPtr;
+ Message *msgPtr;
Tk_OptionTable optionTable;
Tk_Window tkwin;
@@ -306,7 +306,7 @@ MessageWidgetObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- register Message *msgPtr = clientData;
+ Message *msgPtr = clientData;
static const char *const optionStrings[] = { "cget", "configure", NULL };
enum options { MESSAGE_CGET, MESSAGE_CONFIGURE };
int index;
@@ -384,7 +384,7 @@ static void
DestroyMessage(
char *memPtr) /* Info about message widget. */
{
- register Message *msgPtr = (Message *) memPtr;
+ Message *msgPtr = (Message *) memPtr;
msgPtr->flags |= MESSAGE_DELETED;
@@ -437,7 +437,7 @@ DestroyMessage(
static int
ConfigureMessage(
Tcl_Interp *interp, /* Used for error reporting. */
- register Message *msgPtr, /* Information about widget; may or may not
+ Message *msgPtr, /* Information about widget; may or may not
* already have values for some fields. */
int objc, /* Number of valid entries in argv. */
Tcl_Obj *const objv[], /* Arguments. */
@@ -582,7 +582,7 @@ MessageWorldChanged(
static void
ComputeMessageGeometry(
- register Message *msgPtr) /* Information about window. */
+ Message *msgPtr) /* Information about window. */
{
int width, inc, height;
int thisWidth, thisHeight, maxWidth;
@@ -666,8 +666,8 @@ static void
DisplayMessage(
ClientData clientData) /* Information about window. */
{
- register Message *msgPtr = clientData;
- register Tk_Window tkwin = msgPtr->tkwin;
+ Message *msgPtr = clientData;
+ Tk_Window tkwin = msgPtr->tkwin;
int x, y;
int borderWidth = msgPtr->highlightWidth;
@@ -835,7 +835,7 @@ MessageTextVarProc(
const char *name2, /* Second part of variable name. */
int flags) /* Information about what happened. */
{
- register Message *msgPtr = clientData;
+ Message *msgPtr = clientData;
const char *value;
/*
diff --git a/generic/tkObj.c b/generic/tkObj.c
index 716c7e1..1552d11 100644
--- a/generic/tkObj.c
+++ b/generic/tkObj.c
@@ -929,13 +929,13 @@ SetWindowFromAny(
static void
DupWindowInternalRep(
- register Tcl_Obj *srcPtr,
- register Tcl_Obj *copyPtr)
+ Tcl_Obj *srcPtr,
+ Tcl_Obj *copyPtr)
{
- register WindowRep *oldPtr, *newPtr;
+ WindowRep *oldPtr, *newPtr;
- oldPtr = srcPtr->internalRep.twoPtrValue.ptr1;
- newPtr = ckalloc(sizeof(WindowRep));
+ oldPtr = (WindowRep *)srcPtr->internalRep.twoPtrValue.ptr1;
+ newPtr = (WindowRep *)ckalloc(sizeof(WindowRep));
newPtr->tkwin = oldPtr->tkwin;
newPtr->mainPtr = oldPtr->mainPtr;
newPtr->epoch = oldPtr->epoch;
@@ -997,7 +997,7 @@ TkNewWindowObj(
SetWindowFromAny(NULL, objPtr);
- winPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ winPtr = (WindowRep *)objPtr->internalRep.twoPtrValue.ptr1;
winPtr->tkwin = tkwin;
winPtr->mainPtr = mainPtr;
winPtr->epoch = mainPtr->deletionEpoch;
diff --git a/generic/tkScale.c b/generic/tkScale.c
index 825f661..fa2a5d5 100644
--- a/generic/tkScale.c
+++ b/generic/tkScale.c
@@ -253,7 +253,7 @@ Tk_ScaleObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument values. */
{
- register TkScale *scalePtr;
+ TkScale *scalePtr;
Tk_OptionTable optionTable;
Tk_Window tkwin;
@@ -542,7 +542,7 @@ static void
DestroyScale(
char *memPtr) /* Info about scale widget. */
{
- register TkScale *scalePtr = (TkScale *) memPtr;
+ TkScale *scalePtr = (TkScale *) memPtr;
scalePtr->flags |= SCALE_DELETED;
@@ -599,7 +599,7 @@ DestroyScale(
static int
ConfigureScale(
Tcl_Interp *interp, /* Used for error reporting. */
- register TkScale *scalePtr, /* Information about widget; may or may not
+ TkScale *scalePtr, /* Information about widget; may or may not
* already have values for some fields. */
int objc, /* Number of valid entries in objv. */
Tcl_Obj *const objv[]) /* Argument values. */
@@ -1017,7 +1017,7 @@ ComputeFormat(
static void
ComputeScaleGeometry(
- register TkScale *scalePtr) /* Information about widget. */
+ TkScale *scalePtr) /* Information about widget. */
{
char valueString[TCL_DOUBLE_SPACE];
int tmp, valuePixels, tickPixels, x, y, extraSpace;
@@ -1246,7 +1246,7 @@ ScaleCmdDeletedProc(
void
TkEventuallyRedrawScale(
- register TkScale *scalePtr, /* Information about widget. */
+ TkScale *scalePtr, /* Information about widget. */
int what) /* What to redraw: REDRAW_SLIDER or
* REDRAW_ALL. */
{
@@ -1344,7 +1344,7 @@ ScaleVarProc(
const char *name2, /* Second part of variable name. */
int flags) /* Information about what happened. */
{
- register TkScale *scalePtr = clientData;
+ TkScale *scalePtr = clientData;
const char *resultStr;
double value;
Tcl_Obj *valuePtr;
@@ -1439,7 +1439,7 @@ ScaleVarProc(
void
TkScaleSetValue(
- register TkScale *scalePtr, /* Info about widget. */
+ TkScale *scalePtr, /* Info about widget. */
double value, /* New value for scale. Gets adjusted if it's
* off the scale. */
int setVar, /* Non-zero means reflect new value through to
@@ -1497,7 +1497,7 @@ TkScaleSetValue(
static void
ScaleSetVariable(
- register TkScale *scalePtr) /* Info about widget. */
+ TkScale *scalePtr) /* Info about widget. */
{
if (scalePtr->varNamePtr != NULL) {
char string[TCL_DOUBLE_SPACE];
@@ -1533,7 +1533,7 @@ ScaleSetVariable(
double
TkScalePixelToValue(
- register TkScale *scalePtr, /* Information about widget. */
+ TkScale *scalePtr, /* Information about widget. */
int x, int y) /* Coordinates of point within window. */
{
double value, pixelRange;
@@ -1591,7 +1591,7 @@ TkScalePixelToValue(
int
TkScaleValueToPixel(
- register TkScale *scalePtr, /* Information about widget. */
+ TkScale *scalePtr, /* Information about widget. */
double value) /* Reading of the widget. */
{
int y, pixelRange;
diff --git a/generic/tkSelect.c b/generic/tkSelect.c
index 9584be4..ef636da 100644
--- a/generic/tkSelect.c
+++ b/generic/tkSelect.c
@@ -1191,7 +1191,7 @@ TkSelInit(
* Using UTF8_STRING instead of the XA_UTF8_STRING macro allows us to
* support older X servers that didn't have UTF8_STRING yet. This is
* necessary on Unix systems. For more information, see:
- * http://www.cl.cam.ac.uk/~mgk25/unicode.html#x11
+ * https://www.cl.cam.ac.uk/~mgk25/unicode.html#x11
*/
#if !defined(_WIN32)
@@ -1325,7 +1325,7 @@ HandleTclCommand(
char *buffer, /* Place to store converted selection. */
int maxBytes) /* Maximum # of bytes to store at buffer. */
{
- CommandInfo *cmdInfoPtr = clientData;
+ CommandInfo *cmdInfoPtr = (CommandInfo *)clientData;
int length;
Tcl_Obj *command;
const char *string;
@@ -1399,12 +1399,12 @@ HandleTclCommand(
cmdInfoPtr->charOffset += Tcl_NumUtfChars(string, -1);
cmdInfoPtr->buffer[0] = '\0';
} else {
- int ch;
+ Tcl_UniChar ch = 0;
p = string;
string += count;
numChars = 0;
while (p < string) {
- p += TkUtfToUniChar(p, &ch);
+ p += Tcl_UtfToUniChar(p, &ch);
numChars++;
}
cmdInfoPtr->charOffset += numChars;
diff --git a/generic/tkSquare.c b/generic/tkSquare.c
index e92c03c..61f86c5 100644
--- a/generic/tkSquare.c
+++ b/generic/tkSquare.c
@@ -581,7 +581,7 @@ SquareDestroy(
static void
KeepInWindow(
- register Square *squarePtr) /* Pointer to widget record. */
+ Square *squarePtr) /* Pointer to widget record. */
{
int i, bd, relief;
int borderWidth, size;
diff --git a/generic/tkStubLib.c b/generic/tkStubLib.c
index ea48894..0400bfa 100644
--- a/generic/tkStubLib.c
+++ b/generic/tkStubLib.c
@@ -80,7 +80,7 @@ Tk_InitStubs(
ClientData clientData = NULL;
const char *actualVersion = tclStubsPtr->tcl_PkgRequireEx(interp,
packageName, version, 0, &clientData);
- const TkStubs *stubsPtr = clientData;
+ const TkStubs *stubsPtr = (const TkStubs *)clientData;
if (actualVersion == NULL) {
return NULL;
diff --git a/generic/tkStyle.c b/generic/tkStyle.c
index 1289f14..14bae66 100644
--- a/generic/tkStyle.c
+++ b/generic/tkStyle.c
@@ -1402,14 +1402,10 @@ Tk_AllocStyleFromObj(
Tcl_Obj *objPtr) /* Object containing name of the style to
* retrieve. */
{
- Style *stylePtr;
-
if (objPtr->typePtr != &styleObjType) {
SetStyleFromAny(interp, objPtr);
}
- stylePtr = objPtr->internalRep.twoPtrValue.ptr1;
-
- return (Tk_Style) stylePtr;
+ return (Tk_Style)objPtr->internalRep.twoPtrValue.ptr1;
}
/*
@@ -1439,7 +1435,7 @@ Tk_GetStyleFromObj(
SetStyleFromAny(NULL, objPtr);
}
- return objPtr->internalRep.twoPtrValue.ptr1;
+ return (Tk_Style)objPtr->internalRep.twoPtrValue.ptr1;
}
/*
diff --git a/generic/tkText.c b/generic/tkText.c
index c41fc67..90ec575 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -3297,7 +3297,7 @@ DeleteIndexRange(
TkTextSetYView(tPtr, &indexTmp, 0);
}
} else {
- TkTextMakeByteIndex(sharedTextPtr->tree, tPtr, line,
+ TkTextMakeByteIndex(sharedTextPtr->tree, NULL, line,
byteIndex, &indexTmp);
/*
* line may be before -startline of tPtr and must be
@@ -3306,20 +3306,12 @@ DeleteIndexRange(
* would be displayed.
* There is no need to worry about -endline however,
* because the view will only be reset if the deletion
- * involves the TOP line of the screen
+ * involves the TOP line of the screen. That said,
+ * the following call adjusts to both.
*/
- if (tPtr->start != NULL) {
- int start;
- TkTextIndex indexStart;
+ TkTextIndexAdjustToStartEnd(tPtr, &indexTmp, 0);
- start = TkBTreeLinesTo(NULL, tPtr->start);
- TkTextMakeByteIndex(sharedTextPtr->tree, NULL, start,
- 0, &indexStart);
- if (TkTextIndexCmp(&indexTmp, &indexStart) < 0) {
- indexTmp = indexStart;
- }
- }
TkTextSetYView(tPtr, &indexTmp, 0);
}
}
diff --git a/generic/tkText.h b/generic/tkText.h
index 9a9495a..9898462 100644
--- a/generic/tkText.h
+++ b/generic/tkText.h
@@ -1160,6 +1160,8 @@ MODULE_SCOPE int TkTextYviewCmd(TkText *textPtr, Tcl_Interp *interp,
MODULE_SCOPE void TkTextWinFreeClient(Tcl_HashEntry *hPtr,
TkTextEmbWindowClient *client);
MODULE_SCOPE void TkTextRunAfterSyncCmd(ClientData clientData);
+MODULE_SCOPE int TkTextIndexAdjustToStartEnd(TkText *textPtr,
+ TkTextIndex *indexPtr, int err);
#endif /* _TKTEXT */
/*
diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c
index 7832992..1b65cbc 100644
--- a/generic/tkTextBTree.c
+++ b/generic/tkTextBTree.c
@@ -1727,6 +1727,26 @@ TkBTreeFindPixelLine(
}
pixels -= linePtr->pixels[2 * pixelReference];
}
+
+ /*
+ * Check for any start/end offset for this text widget.
+ */
+
+ if (textPtr->start != NULL) {
+ int lineBoundary = TkBTreeLinesTo(NULL, textPtr->start);
+
+ if (TkBTreeLinesTo(NULL, linePtr) < lineBoundary) {
+ linePtr = TkBTreeFindLine(tree, NULL, lineBoundary);
+ }
+ }
+ if (textPtr->end != NULL) {
+ int lineBoundary = TkBTreeLinesTo(NULL, textPtr->end);
+
+ if (TkBTreeLinesTo(NULL, linePtr) > lineBoundary) {
+ linePtr = TkBTreeFindLine(tree, NULL, lineBoundary);
+ }
+ }
+
if (pixelOffset != NULL && linePtr != NULL) {
*pixelOffset = pixels;
}
diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c
index bc0da0a..776eb04 100644
--- a/generic/tkTextImage.c
+++ b/generic/tkTextImage.c
@@ -284,7 +284,7 @@ TkTextImageCmd(
for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->imageTable,
&search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
- Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), -1));
+ (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), -1));
}
Tcl_SetObjResult(interp, resultObj);
return TCL_OK;
@@ -764,9 +764,9 @@ EmbImageBboxProc(
* index corresponding to the image's position in the text.
*
* Results:
- * The return value is 1 if there is an embedded image by the given name
- * in the text widget, 0 otherwise. If the image exists, *indexPtr is
- * filled in with its index.
+ * The return value is TCL_OK if there is an embedded image by the given
+ * name in the text widget, TCL_ERROR otherwise. If the image exists,
+ * *indexPtr is filled in with its index.
*
* Side effects:
* None.
@@ -784,18 +784,29 @@ TkTextImageIndex(
TkTextSegment *eiPtr;
if (textPtr == NULL) {
- return 0;
+ return TCL_ERROR;
}
hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->imageTable, name);
if (hPtr == NULL) {
- return 0;
+ return TCL_ERROR;
}
eiPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
indexPtr->tree = textPtr->sharedTextPtr->tree;
indexPtr->linePtr = eiPtr->body.ei.linePtr;
indexPtr->byteIndex = TkTextSegToOffset(eiPtr, indexPtr->linePtr);
- return 1;
+
+ /*
+ * If indexPtr refers to somewhere outside the -startline/-endline
+ * range limits of the widget, error out since the image indeed is not
+ * reachable from this text widget (it may be reachable from a peer).
+ */
+
+ if (TkTextIndexAdjustToStartEnd(textPtr, indexPtr, 1) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+
+ return TCL_OK;
}
/*
diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c
index 1628389..e6632d0 100644
--- a/generic/tkTextIndex.c
+++ b/generic/tkTextIndex.c
@@ -480,7 +480,7 @@ TkTextMakeCharIndex(
TkTextSegment *segPtr;
char *p, *start, *end;
int index, offset;
- int ch;
+ Tcl_UniChar ch = 0;
indexPtr->tree = tree;
if (lineIndex < 0) {
@@ -527,7 +527,7 @@ TkTextMakeCharIndex(
return indexPtr;
}
charIndex--;
- offset = TkUtfToUniChar(p, &ch);
+ offset = Tcl_UtfToUniChar(p, &ch);
index += offset;
}
} else {
@@ -761,11 +761,11 @@ GetIndex(
goto done;
}
- if (TkTextWindowIndex(textPtr, string, indexPtr) != 0) {
+ if (TkTextWindowIndex(textPtr, string, indexPtr) == TCL_OK) {
goto done;
}
- if (TkTextImageIndex(textPtr, string, indexPtr) != 0) {
+ if (TkTextImageIndex(textPtr, string, indexPtr) == TCL_OK) {
goto done;
}
@@ -917,7 +917,7 @@ GetIndex(
*endOfBase = 0;
result = TkTextWindowIndex(textPtr, Tcl_DStringValue(&copy), indexPtr);
*endOfBase = c;
- if (result != 0) {
+ if (result == TCL_OK) {
goto gotBase;
}
}
@@ -954,7 +954,7 @@ GetIndex(
*endOfBase = 0;
result = TkTextImageIndex(textPtr, Tcl_DStringValue(&copy), indexPtr);
*endOfBase = c;
- if (result != 0) {
+ if (result == TCL_OK) {
goto gotBase;
}
}
@@ -997,6 +997,7 @@ GetIndex(
if (indexPtr->linePtr == NULL) {
Tcl_Panic("Bad index created");
}
+ TkTextIndexAdjustToStartEnd(textPtr, indexPtr, 0);
return TCL_OK;
error:
@@ -1009,6 +1010,67 @@ GetIndex(
/*
*---------------------------------------------------------------------------
*
+ * TkTextIndexAdjustToStartEnd --
+ *
+ * Adjust indexPtr to the -startline/-endline range, or just check
+ * if indexPtr is out of this range.
+ *
+ * Results:
+ * The return value is a standard Tcl return result. If check is true,
+ * return TCL_ERROR if indexPtr is outside the -startline/-endline
+ * range (indexPtr is not modified).
+ * If check is false, adjust indexPtr to -startline/-endline.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+int
+TkTextIndexAdjustToStartEnd(
+ TkText *textPtr,
+ TkTextIndex *indexPtr, /* Pointer to index. */
+ int check) /* 1 means only check indexPtr against
+ * the -startline/-endline range
+ * 0 means adjust to this range */
+{
+ int bound;
+ TkTextIndex indexBound;
+
+ if (!textPtr) {
+ return TCL_OK;
+ }
+ if (textPtr->start != NULL) {
+ bound = TkBTreeLinesTo(NULL, textPtr->start);
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, bound, 0,
+ &indexBound);
+ if (TkTextIndexCmp(indexPtr, &indexBound) < 0) {
+ if (check) {
+ return TCL_ERROR;
+ }
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, bound, 0,
+ indexPtr);
+ }
+ }
+ if (textPtr->end != NULL) {
+ bound = TkBTreeLinesTo(NULL, textPtr->end);
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, bound, 0,
+ &indexBound);
+ if (TkTextIndexCmp(indexPtr, &indexBound) > 0) {
+ if (check) {
+ return TCL_ERROR;
+ }
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, bound, 0,
+ indexPtr);
+ }
+ }
+ return TCL_OK;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
* TkTextPrintIndex --
*
* This function generates a string description of an index, suitable for
diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c
index dcd7008..f77e6b4 100644
--- a/generic/tkTextMark.c
+++ b/generic/tkTextMark.c
@@ -434,8 +434,6 @@ TkTextMarkNameToIndex(
TkTextIndex *indexPtr) /* Index information gets stored here. */
{
TkTextSegment *segPtr;
- TkTextIndex index;
- int start, end;
if (textPtr == NULL) {
return TCL_ERROR;
@@ -456,28 +454,17 @@ TkTextMarkNameToIndex(
}
TkTextMarkSegToIndex(textPtr, segPtr, indexPtr);
- /* If indexPtr refers to somewhere outside the -startline/-endline
+ /*
+ * If indexPtr refers to somewhere outside the -startline/-endline
* range limits of the widget, error out since the mark indeed is not
* reachable from this text widget (it may be reachable from a peer)
* (bug 1630271).
*/
- if (textPtr->start != NULL) {
- start = TkBTreeLinesTo(NULL, textPtr->start);
- TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, start, 0,
- &index);
- if (TkTextIndexCmp(indexPtr, &index) < 0) {
- return TCL_ERROR;
- }
- }
- if (textPtr->end != NULL) {
- end = TkBTreeLinesTo(NULL, textPtr->end);
- TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, end, 0,
- &index);
- if (TkTextIndexCmp(indexPtr, &index) > 0) {
- return TCL_ERROR;
- }
+ if (TkTextIndexAdjustToStartEnd(textPtr, indexPtr, 1) == TCL_ERROR) {
+ return TCL_ERROR;
}
+
return TCL_OK;
}
diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c
index c9f34e4..fdd5378 100644
--- a/generic/tkTextWind.c
+++ b/generic/tkTextWind.c
@@ -1320,9 +1320,9 @@ EmbWinDelayedUnmap(
* index corresponding to the window's position in the text.
*
* Results:
- * The return value is 1 if there is an embedded window by the given name
- * in the text widget, 0 otherwise. If the window exists, *indexPtr is
- * filled in with its index.
+ * The return value is TCL_OK if there is an embedded window by the given
+ * name in the text widget, TCL_ERROR otherwise. If the window exists,
+ * *indexPtr is filled in with its index.
*
* Side effects:
* None.
@@ -1340,19 +1340,30 @@ TkTextWindowIndex(
TkTextSegment *ewPtr;
if (textPtr == NULL) {
- return 0;
+ return TCL_ERROR;
}
hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->windowTable, name);
if (hPtr == NULL) {
- return 0;
+ return TCL_ERROR;
}
ewPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
indexPtr->tree = textPtr->sharedTextPtr->tree;
indexPtr->linePtr = ewPtr->body.ew.linePtr;
indexPtr->byteIndex = TkTextSegToOffset(ewPtr, indexPtr->linePtr);
- return 1;
+
+ /*
+ * If indexPtr refers to somewhere outside the -startline/-endline
+ * range limits of the widget, error out since the window indeed is not
+ * reachable from this text widget (it may be reachable from a peer).
+ */
+
+ if (TkTextIndexAdjustToStartEnd(textPtr, indexPtr, 1) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+
+ return TCL_OK;
}
/*
diff --git a/generic/tkTrig.c b/generic/tkTrig.c
index a2bf456..2e11db0 100644
--- a/generic/tkTrig.c
+++ b/generic/tkTrig.c
@@ -39,9 +39,9 @@
double
TkLineToPoint(
- double end1Ptr[2], /* Coordinates of first end-point of line. */
- double end2Ptr[2], /* Coordinates of second end-point of line. */
- double pointPtr[2]) /* Points to coords for point. */
+ double end1Ptr[], /* Coordinates of first end-point of line. */
+ double end2Ptr[], /* Coordinates of second end-point of line. */
+ double pointPtr[]) /* Points to coords for point. */
{
double x, y;
@@ -143,11 +143,11 @@ TkLineToPoint(
int
TkLineToArea(
- double end1Ptr[2], /* X and y coordinates for one endpoint of
+ double end1Ptr[], /* X and y coordinates for one endpoint of
* line. */
- double end2Ptr[2], /* X and y coordinates for other endpoint of
+ double end2Ptr[], /* X and y coordinates for other endpoint of
* line. */
- double rectPtr[4]) /* Points to coords for rectangle, in the
+ double rectPtr[]) /* Points to coords for rectangle, in the
* order x1, y1, x2, y2. X1 must be no larger
* than x2, and y1 no larger than y2. */
{
@@ -440,7 +440,7 @@ TkPolygonToPoint(
* intersect a ray extending vertically
* upwards from the point to infinity. */
int count;
- register double *pPtr;
+ double *pPtr;
/*
* Iterate through all of the edges in the polygon, updating bestDist and
@@ -588,7 +588,7 @@ TkPolygonToArea(
* polygon: x0, y0, x1, y1, ... The polygon
* may be self-intersecting. */
int numPoints, /* Total number of points at *polyPtr. */
- register double *rectPtr) /* Points to coords for rectangle, in the
+ double *rectPtr) /* Points to coords for rectangle, in the
* order x1, y1, x2, y2. X1 and y1 must be
* lower-left corner. */
{
@@ -596,7 +596,7 @@ TkPolygonToArea(
* outside, 1 means inside, won't ever be
* 0). */
int count;
- register double *pPtr;
+ double *pPtr;
/*
* Iterate over all of the edges of the polygon and test them against the
@@ -655,14 +655,14 @@ TkPolygonToArea(
/* ARGSUSED */
double
TkOvalToPoint(
- double ovalPtr[4], /* Pointer to array of four coordinates (x1,
+ double ovalPtr[], /* Pointer to array of four coordinates (x1,
* y1, x2, y2) defining oval's bounding
* box. */
double width, /* Width of outline for oval. */
int filled, /* Non-zero means oval should be treated as
* filled; zero means only consider
* outline. */
- double pointPtr[2]) /* Coordinates of point. */
+ double pointPtr[]) /* Coordinates of point. */
{
double xDelta, yDelta, scaledDistance, distToOutline, distToCenter;
double xDiam, yDiam;
@@ -751,11 +751,11 @@ TkOvalToPoint(
int
TkOvalToArea(
- register double *ovalPtr, /* Points to coordinates defining the
+ double *ovalPtr, /* Points to coordinates defining the
* bounding rectangle for the oval: x1, y1,
* x2, y2. X1 must be less than x2 and y1 less
* than y2. */
- register double *rectPtr) /* Points to coords for rectangle, in the
+ double *rectPtr) /* Points to coords for rectangle, in the
* order x1, y1, x2, y2. X1 and y1 must be
* lower-left corner. */
{
@@ -870,7 +870,7 @@ TkOvalToArea(
/* ARGSUSED */
void
TkIncludePoint(
- register Tk_Item *itemPtr, /* Item whose bounding box is being
+ Tk_Item *itemPtr, /* Item whose bounding box is being
* calculated. */
double *pointPtr) /* Address of two doubles giving x and y
* coordinates of point. */
@@ -919,7 +919,7 @@ TkBezierScreenPoints(
double control[], /* Array of coordinates for four control
* points: x0, y0, x1, y1, ... x3 y3. */
int numSteps, /* Number of curve points to generate. */
- register XPoint *xPointPtr) /* Where to put new points. */
+ XPoint *xPointPtr) /* Where to put new points. */
{
int i;
double u, u2, u3, t, t2, t3;
@@ -965,7 +965,7 @@ TkBezierPoints(
double control[], /* Array of coordinates for four control
* points: x0, y0, x1, y1, ... x3 y3. */
int numSteps, /* Number of curve points to generate. */
- register double *coordPtr) /* Where to put new points. */
+ double *coordPtr) /* Where to put new points. */
{
int i;
double u, u2, u3, t, t2, t3;
diff --git a/generic/tkUndo.c b/generic/tkUndo.c
index c66905d..7494332 100644
--- a/generic/tkUndo.c
+++ b/generic/tkUndo.c
@@ -94,7 +94,7 @@ TkUndoInsertSeparator(
TkUndoAtom *separator;
if (*stack!=NULL && (*stack)->type!=TK_UNDO_SEPARATOR) {
- separator = ckalloc(sizeof(TkUndoAtom));
+ separator = (TkUndoAtom *)ckalloc(sizeof(TkUndoAtom));
separator->type = TK_UNDO_SEPARATOR;
TkUndoPushStack(stack,separator);
return 1;
@@ -181,7 +181,7 @@ TkUndoPushAction(
{
TkUndoAtom *atom;
- atom = ckalloc(sizeof(TkUndoAtom));
+ atom = (TkUndoAtom *)ckalloc(sizeof(TkUndoAtom));
atom->type = TK_UNDO_ACTION;
atom->apply = apply;
atom->revert = revert;
@@ -237,7 +237,7 @@ TkUndoMakeCmdSubAtom(
Tcl_Panic("NULL command and actionScript in TkUndoMakeCmdSubAtom");
}
- atom = ckalloc(sizeof(TkUndoSubAtom));
+ atom = (TkUndoSubAtom *)ckalloc(sizeof(TkUndoSubAtom));
atom->command = command;
atom->funcPtr = NULL;
atom->clientData = NULL;
@@ -299,7 +299,7 @@ TkUndoMakeSubAtom(
Tcl_Panic("NULL funcPtr in TkUndoMakeSubAtom");
}
- atom = ckalloc(sizeof(TkUndoSubAtom));
+ atom = (TkUndoSubAtom *)ckalloc(sizeof(TkUndoSubAtom));
atom->command = NULL;
atom->funcPtr = funcPtr;
atom->clientData = clientData;
@@ -341,7 +341,7 @@ TkUndoInitStack(
{
TkUndoRedoStack *stack; /* An Undo/Redo stack */
- stack = ckalloc(sizeof(TkUndoRedoStack));
+ stack = (TkUndoRedoStack *)ckalloc(sizeof(TkUndoRedoStack));
stack->undoStack = NULL;
stack->redoStack = NULL;
stack->interp = interp;
diff --git a/generic/tkUtil.c b/generic/tkUtil.c
index 00ac7be..3cc8dbf 100644
--- a/generic/tkUtil.c
+++ b/generic/tkUtil.c
@@ -57,8 +57,7 @@ TkStateParseProc(
int flags = PTR2INT(clientData);
size_t length;
Tcl_Obj *msgObj;
-
- register Tk_State *statePtr = (Tk_State *) (widgRec + offset);
+ Tk_State *statePtr = (Tk_State *) (widgRec + offset);
if (value == NULL || *value == 0) {
*statePtr = TK_STATE_NULL;
@@ -134,7 +133,7 @@ TkStatePrintProc(
* information about how to reclaim storage
* for return string. */
{
- register Tk_State *statePtr = (Tk_State *) (widgRec + offset);
+ Tk_State *statePtr = (Tk_State *) (widgRec + offset);
switch (*statePtr) {
case TK_STATE_NORMAL:
@@ -179,8 +178,7 @@ TkOrientParseProc(
{
int c;
size_t length;
-
- register int *orientPtr = (int *) (widgRec + offset);
+ int *orientPtr = (int *) (widgRec + offset);
if (value == NULL || *value == 0) {
*orientPtr = 0;
@@ -237,7 +235,7 @@ TkOrientPrintProc(
* information about how to reclaim storage
* for return string. */
{
- register int *statePtr = (int *) (widgRec + offset);
+ int *statePtr = (int *) (widgRec + offset);
if (*statePtr) {
return "vertical";
@@ -424,7 +422,7 @@ TkOffsetPrintProc(
if (offsetPtr->flags >= INT_MAX) {
return "end";
}
- p = ckalloc(32);
+ p = (char *)ckalloc(32);
sprintf(p, "%d", offsetPtr->flags & ~TK_OFFSET_INDEX);
*freeProcPtr = TCL_DYNAMIC;
return p;
@@ -454,7 +452,7 @@ TkOffsetPrintProc(
return "se";
}
}
- q = p = ckalloc(32);
+ q = p = (char *)ckalloc(32);
if (offsetPtr->flags & TK_OFFSET_RELATIVE) {
*q++ = '#';
}
@@ -519,7 +517,7 @@ TkPixelPrintProc(
Tcl_FreeProc **freeProcPtr) /* not used */
{
double *doublePtr = (double *) (widgRec + offset);
- char *p = ckalloc(24);
+ char *p = (char *)ckalloc(24);
Tcl_PrintDouble(NULL, *doublePtr, p);
*freeProcPtr = TCL_DYNAMIC;
@@ -1088,7 +1086,7 @@ TkBackgroundEvalObjv(
Tcl_Command
TkMakeEnsemble(
Tcl_Interp *interp,
- const char *namespace,
+ const char *namesp,
const char *name,
ClientData clientData,
const TkEnsemble map[])
@@ -1105,11 +1103,11 @@ TkMakeEnsemble(
Tcl_DStringInit(&ds);
- namespacePtr = Tcl_FindNamespace(interp, namespace, NULL, 0);
+ namespacePtr = Tcl_FindNamespace(interp, namesp, NULL, 0);
if (namespacePtr == NULL) {
- namespacePtr = Tcl_CreateNamespace(interp, namespace, NULL, NULL);
+ namespacePtr = Tcl_CreateNamespace(interp, namesp, NULL, NULL);
if (namespacePtr == NULL) {
- Tcl_Panic("failed to create namespace \"%s\"", namespace);
+ Tcl_Panic("failed to create namespace \"%s\"", namesp);
}
}
@@ -1125,8 +1123,8 @@ TkMakeEnsemble(
}
Tcl_DStringSetLength(&ds, 0);
- Tcl_DStringAppend(&ds, namespace, -1);
- if (!(strlen(namespace) == 2 && namespace[1] == ':')) {
+ Tcl_DStringAppend(&ds, namesp, -1);
+ if (!(strlen(namesp) == 2 && namesp[1] == ':')) {
Tcl_DStringAppend(&ds, "::", -1);
}
Tcl_DStringAppend(&ds, name, -1);
@@ -1188,11 +1186,13 @@ TkSendVirtualEvent(
event.general.xany.display = Tk_Display(target);
event.virt.name = Tk_GetUid(eventName);
event.virt.user_data = detail;
+ if (detail) Tcl_IncrRefCount(detail); // Event code will DecrRefCount
Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL);
}
-#if TCL_UTF_MAX <= 4
+/* Tcl 8.6 has a different definition of Tcl_UniChar than other Tcl versions for TCL_UTF_MAX > 3 */
+#if TCL_UTF_MAX <= (3 + (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 6))
/*
*---------------------------------------------------------------------------
*
@@ -1221,11 +1221,11 @@ TkUtfToUniChar(
Tcl_UniChar uniChar = 0;
int len = Tcl_UtfToUniChar(src, &uniChar);
- if ((sizeof(Tcl_UniChar) == 2) && ((uniChar & 0xFC00) == 0xD800)) {
+ if ((uniChar & 0xFC00) == 0xD800) {
Tcl_UniChar low = uniChar;
- /* This can only happen if Tcl is compiled with TCL_UTF_MAX=4,
- * or when a high surrogate character is detected in UTF-8 form */
- int len2 = Tcl_UtfToUniChar(src+len, &low);
+ /* This can only happen if sizeof(Tcl_UniChar)== 2 and src points
+ * to a character > U+FFFF */
+ size_t len2 = Tcl_UtfToUniChar(src+len, &low);
if ((low & 0xFC00) == 0xDC00) {
*chPtr = (((uniChar & 0x3FF) << 10) | (low & 0x3FF)) + 0x10000;
return len + len2;
@@ -1256,7 +1256,7 @@ TkUtfToUniChar(
int TkUniCharToUtf(int ch, char *buf)
{
- if ((sizeof(Tcl_UniChar) == 2) && (((unsigned)(ch - 0x10000) <= 0xFFFFF))) {
+ if ((unsigned)(ch - 0x10000) <= 0xFFFFF) {
/* Spit out a 4-byte UTF-8 character or 2 x 3-byte UTF-8 characters, depending on Tcl
* version and/or TCL_UTF_MAX build value */
int len = Tcl_UniCharToUtf(0xD800 | ((ch - 0x10000) >> 10), buf);
@@ -1333,7 +1333,6 @@ TkUtfAtIndex(
return p;
}
#endif
-
/*
* Local Variables:
* mode: c
diff --git a/generic/tkVisual.c b/generic/tkVisual.c
index 567c552..9324499 100644
--- a/generic/tkVisual.c
+++ b/generic/tkVisual.c
@@ -96,10 +96,10 @@ Tk_GetVisual(
* Tk_FreeColormap. */
{
Tk_Window tkwin2;
- XVisualInfo template, *visInfoList, *bestPtr;
+ XVisualInfo templ, *visInfoList, *bestPtr;
long mask;
Visual *visual;
- ptrdiff_t length;
+ size_t length;
int c, numVisuals, prio, bestPrio, i;
const char *p;
const VisualDictionary *dictPtr;
@@ -137,20 +137,20 @@ Tk_GetVisual(
for (cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL;
cmapPtr = cmapPtr->nextPtr) {
if (cmapPtr->colormap == *colormapPtr) {
- cmapPtr->refCount += 1;
+ cmapPtr->refCount++;
break;
}
}
}
return visual;
}
- template.depth = Tk_Depth(tkwin2);
- template.c_class = visual->c_class;
- template.red_mask = visual->red_mask;
- template.green_mask = visual->green_mask;
- template.blue_mask = visual->blue_mask;
- template.colormap_size = visual->map_entries;
- template.bits_per_rgb = visual->bits_per_rgb;
+ templ.depth = Tk_Depth(tkwin2);
+ templ.c_class = visual->c_class;
+ templ.red_mask = visual->red_mask;
+ templ.green_mask = visual->green_mask;
+ templ.blue_mask = visual->blue_mask;
+ templ.colormap_size = visual->map_entries;
+ templ.bits_per_rgb = visual->bits_per_rgb;
mask = VisualDepthMask|VisualClassMask|VisualRedMaskMask
|VisualGreenMaskMask|VisualBlueMaskMask|VisualColormapSizeMask
|VisualBitsPerRGBMask;
@@ -178,7 +178,7 @@ Tk_GetVisual(
Tcl_SetErrorCode(interp, "TK", "VALUE", "VISUALID", NULL);
return NULL;
}
- template.visualid = visualId;
+ templ.visualid = visualId;
mask = VisualIDMask;
} else {
/*
@@ -192,16 +192,15 @@ Tk_GetVisual(
}
}
length = p - string;
- template.c_class = -1;
+ templ.c_class = -1;
for (dictPtr = visualNames; dictPtr->name != NULL; dictPtr++) {
- if ((dictPtr->name[0] == c) && (length >= dictPtr->minLength)
- && (strncmp(string, dictPtr->name,
- (size_t) length) == 0)) {
- template.c_class = dictPtr->c_class;
+ if ((dictPtr->name[0] == c) && (length >= (size_t)dictPtr->minLength)
+ && (strncmp(string, dictPtr->name, length) == 0)) {
+ templ.c_class = dictPtr->c_class;
break;
}
}
- if (template.c_class == -1) {
+ if (templ.c_class == -1) {
Tcl_Obj *msgObj = Tcl_ObjPrintf(
"unknown or ambiguous visual name \"%s\": class must be ",
string);
@@ -218,8 +217,8 @@ Tk_GetVisual(
p++;
}
if (*p == 0) {
- template.depth = 10000;
- } else if (Tcl_GetInt(interp, p, &template.depth) != TCL_OK) {
+ templ.depth = 10000;
+ } else if (Tcl_GetInt(interp, p, &templ.depth) != TCL_OK) {
return NULL;
}
if (c == 'b') {
@@ -234,9 +233,9 @@ Tk_GetVisual(
* an error if there are none that match.
*/
- template.screen = Tk_ScreenNumber(tkwin);
+ templ.screen = Tk_ScreenNumber(tkwin);
mask |= VisualScreenMask;
- visInfoList = XGetVisualInfo(Tk_Display(tkwin), mask, &template,
+ visInfoList = XGetVisualInfo(Tk_Display(tkwin), mask, &templ,
&numVisuals);
if (visInfoList == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -286,11 +285,11 @@ Tk_GetVisual(
goto newBest;
}
if (visInfoList[i].depth < bestPtr->depth) {
- if (visInfoList[i].depth >= template.depth) {
+ if (visInfoList[i].depth >= templ.depth) {
goto newBest;
}
} else if (visInfoList[i].depth > bestPtr->depth) {
- if (bestPtr->depth < template.depth) {
+ if (bestPtr->depth < templ.depth) {
goto newBest;
}
} else {
@@ -324,11 +323,11 @@ Tk_GetVisual(
cmapPtr = cmapPtr->nextPtr) {
if (cmapPtr->shareable && (cmapPtr->visual == visual)) {
*colormapPtr = cmapPtr->colormap;
- cmapPtr->refCount += 1;
+ cmapPtr->refCount++;
goto done;
}
}
- cmapPtr = ckalloc(sizeof(TkColormap));
+ cmapPtr = (TkColormap *)ckalloc(sizeof(TkColormap));
cmapPtr->colormap = XCreateColormap(Tk_Display(tkwin),
RootWindowOfScreen(Tk_Screen(tkwin)), visual,
AllocNone);
@@ -383,7 +382,7 @@ Tk_GetColormap(
*/
if (strcmp(string, "new") == 0) {
- cmapPtr = ckalloc(sizeof(TkColormap));
+ cmapPtr = (TkColormap *)ckalloc(sizeof(TkColormap));
cmapPtr->colormap = XCreateColormap(Tk_Display(tkwin),
RootWindowOfScreen(Tk_Screen(tkwin)), Tk_Visual(tkwin),
AllocNone);
@@ -427,7 +426,7 @@ Tk_GetColormap(
for (cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL;
cmapPtr = cmapPtr->nextPtr) {
if (cmapPtr->colormap == colormap) {
- cmapPtr->refCount += 1;
+ cmapPtr->refCount++;
}
}
return colormap;
@@ -476,8 +475,7 @@ Tk_FreeColormap(
for (prevPtr = NULL, cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL;
prevPtr = cmapPtr, cmapPtr = cmapPtr->nextPtr) {
if (cmapPtr->colormap == colormap) {
- cmapPtr->refCount -= 1;
- if (cmapPtr->refCount == 0) {
+ if (cmapPtr->refCount-- <= 1) {
XFreeColormap(display, colormap);
if (prevPtr == NULL) {
dispPtr->cmapPtr = cmapPtr->nextPtr;
@@ -534,7 +532,7 @@ Tk_PreserveColormap(
for (cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL;
cmapPtr = cmapPtr->nextPtr) {
if (cmapPtr->colormap == colormap) {
- cmapPtr->refCount += 1;
+ cmapPtr->refCount++;
return;
}
}
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 9750ed8..f48e469 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -93,6 +93,7 @@ static const XSetWindowAttributes defAtts= {
#define PASSMAINWINDOW 2
#define WINMACONLY 4
#define USEINITPROC 8
+#define SAVEUPDATECMD 16 /* better only be one of these! */
typedef int (TkInitProc)(Tcl_Interp *interp, ClientData clientData);
typedef struct {
@@ -126,7 +127,7 @@ static const TkCmd commands[] = {
{"selection", Tk_SelectionObjCmd, PASSMAINWINDOW},
{"tk", (Tcl_ObjCmdProc *)(void *)TkInitTkCmd, USEINITPROC|PASSMAINWINDOW|ISSAFE},
{"tkwait", Tk_TkwaitObjCmd, PASSMAINWINDOW|ISSAFE},
- {"update", Tk_UpdateObjCmd, PASSMAINWINDOW|ISSAFE},
+ {"update", Tk_UpdateObjCmd, PASSMAINWINDOW|ISSAFE|SAVEUPDATECMD},
{"winfo", Tk_WinfoObjCmd, PASSMAINWINDOW|ISSAFE},
{"wm", Tk_WmObjCmd, PASSMAINWINDOW},
@@ -316,8 +317,8 @@ CreateTopLevelWindow(
* parent. */
unsigned int flags) /* Additional flags to set on the window. */
{
- register TkWindow *winPtr;
- register TkDisplay *dispPtr;
+ TkWindow *winPtr;
+ TkDisplay *dispPtr;
int screenId;
ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
@@ -419,7 +420,7 @@ GetScreen(
* DISPLAY envariable. */
int *screenPtr) /* Where to store screen number. */
{
- register TkDisplay *dispPtr;
+ TkDisplay *dispPtr;
const char *p;
int screenId;
size_t length;
@@ -620,7 +621,7 @@ TkAllocWindow(
* inherit visual information. NULL means use
* screen defaults instead of inheriting. */
{
- register TkWindow *winPtr = ckalloc(sizeof(TkWindow));
+ TkWindow *winPtr = ckalloc(sizeof(TkWindow));
winPtr->display = dispPtr->display;
winPtr->dispPtr = dispPtr;
@@ -701,7 +702,7 @@ TkAllocWindow(
static int
NameWindow(
Tcl_Interp *interp, /* Interpreter to use for error reporting. */
- register TkWindow *winPtr, /* Window that is to be named and inserted. */
+ TkWindow *winPtr, /* Window that is to be named and inserted. */
TkWindow *parentPtr, /* Pointer to logical parent for winPtr (used
* for naming, options, etc.). */
const char *name) /* Name for winPtr; must be unique among
@@ -832,9 +833,9 @@ TkCreateMainWindow(
Tk_Window tkwin;
int dummy, isSafe;
Tcl_HashEntry *hPtr;
- register TkMainInfo *mainPtr;
- register TkWindow *winPtr;
- register const TkCmd *cmdPtr;
+ TkMainInfo *mainPtr;
+ TkWindow *winPtr;
+ const TkCmd *cmdPtr;
ClientData clientData;
ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
@@ -880,6 +881,7 @@ TkCreateMainWindow(
Tcl_InitHashTable(&mainPtr->imageTable, TCL_STRING_KEYS);
mainPtr->strictMotif = 0;
mainPtr->alwaysShowSelection = 0;
+ mainPtr->tclUpdateObjProc = NULL;
if (Tcl_LinkVar(interp, "tk_strictMotif", (char *) &mainPtr->strictMotif,
TCL_LINK_BOOLEAN) != TCL_OK) {
Tcl_ResetResult(interp);
@@ -919,6 +921,8 @@ TkCreateMainWindow(
isSafe = Tcl_IsSafe(interp);
for (cmdPtr = commands; cmdPtr->name != NULL; cmdPtr++) {
+ Tcl_CmdInfo cmdInfo;
+
if (cmdPtr->objProc == NULL) {
Tcl_Panic("TkCreateMainWindow: builtin command with NULL string and object procs");
}
@@ -938,6 +942,11 @@ TkCreateMainWindow(
} else {
clientData = NULL;
}
+ if ((cmdPtr->flags & SAVEUPDATECMD) &&
+ Tcl_GetCommandInfo(interp, cmdPtr->name, &cmdInfo) &&
+ cmdInfo.isNativeObjectProc && !cmdInfo.objClientData && !cmdInfo.deleteProc) {
+ mainPtr->tclUpdateObjProc = cmdInfo.objProc;
+ }
if (cmdPtr->flags & USEINITPROC) {
((TkInitProc *)(void *)cmdPtr->objProc)(interp, clientData);
} else {
@@ -1488,7 +1497,7 @@ Tk_DestroyWindow(
winPtr->mainPtr->deletionEpoch++;
}
if (winPtr->mainPtr->refCount-- <= 1) {
- register const TkCmd *cmdPtr;
+ const TkCmd *cmdPtr;
/*
* We just deleted the last window in the application. Delete the
@@ -1502,10 +1511,20 @@ Tk_DestroyWindow(
*/
if ((winPtr->mainPtr->interp != NULL) &&
- !Tcl_InterpDeleted(winPtr->mainPtr->interp)) {
+ !Tcl_InterpDeleted(winPtr->mainPtr->interp)) {
for (cmdPtr = commands; cmdPtr->name != NULL; cmdPtr++) {
- Tcl_CreateObjCommand(winPtr->mainPtr->interp, cmdPtr->name,
- TkDeadAppObjCmd, NULL, NULL);
+ if ((cmdPtr->flags & SAVEUPDATECMD) &&
+ winPtr->mainPtr->tclUpdateObjProc != NULL) {
+ /* Restore Tcl's version of [update] */
+ Tcl_CreateObjCommand(winPtr->mainPtr->interp,
+ cmdPtr->name,
+ winPtr->mainPtr->tclUpdateObjProc,
+ NULL, NULL);
+ } else {
+ Tcl_CreateObjCommand(winPtr->mainPtr->interp,
+ cmdPtr->name, TkDeadAppObjCmd,
+ NULL, NULL);
+ }
}
Tcl_CreateObjCommand(winPtr->mainPtr->interp, "send",
TkDeadAppObjCmd, NULL, NULL);
@@ -1675,7 +1694,7 @@ void
Tk_MakeWindowExist(
Tk_Window tkwin) /* Token for window. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
TkWindow *winPtr2;
Window parent;
Tcl_HashEntry *hPtr;
@@ -1784,7 +1803,7 @@ void
Tk_UnmapWindow(
Tk_Window tkwin) /* Token for window to unmap. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
if (!(winPtr->flags & TK_MAPPED) || (winPtr->flags & TK_ALREADY_DEAD)) {
return;
@@ -1821,7 +1840,7 @@ Tk_ConfigureWindow(
* are to be used. */
XWindowChanges *valuePtr) /* New values. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
if (valueMask & CWX) {
winPtr->changes.x = valuePtr->x;
@@ -1857,7 +1876,7 @@ Tk_MoveWindow(
Tk_Window tkwin, /* Window to move. */
int x, int y) /* New location for window (within parent). */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
winPtr->changes.x = x;
winPtr->changes.y = y;
@@ -1875,7 +1894,7 @@ Tk_ResizeWindow(
Tk_Window tkwin, /* Window to resize. */
int width, int height) /* New dimensions for window. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
winPtr->changes.width = (unsigned) width;
winPtr->changes.height = (unsigned) height;
@@ -1895,7 +1914,7 @@ Tk_MoveResizeWindow(
int x, int y, /* New location for window (within parent). */
int width, int height) /* New dimensions for window. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
winPtr->changes.x = x;
winPtr->changes.y = y;
@@ -1916,7 +1935,7 @@ Tk_SetWindowBorderWidth(
Tk_Window tkwin, /* Window to modify. */
int width) /* New border width for window. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
winPtr->changes.border_width = width;
if (winPtr->window != None) {
@@ -1934,10 +1953,10 @@ Tk_ChangeWindowAttributes(
Tk_Window tkwin, /* Window to manipulate. */
unsigned long valueMask, /* OR'ed combination of bits, indicating which
* fields of *attsPtr are to be used. */
- register XSetWindowAttributes *attsPtr)
+ XSetWindowAttributes *attsPtr)
/* New values for some attributes. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
if (valueMask & CWBackPixmap) {
winPtr->atts.background_pixmap = attsPtr->background_pixmap;
@@ -2000,7 +2019,7 @@ Tk_SetWindowBackground(
unsigned long pixel) /* Pixel value to use for window's
* background. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
winPtr->atts.background_pixel = pixel;
@@ -2017,7 +2036,7 @@ Tk_SetWindowBackgroundPixmap(
Tk_Window tkwin, /* Window to manipulate. */
Pixmap pixmap) /* Pixmap to use for window's background. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
winPtr->atts.background_pixmap = pixmap;
@@ -2035,7 +2054,7 @@ Tk_SetWindowBorder(
Tk_Window tkwin, /* Window to manipulate. */
unsigned long pixel) /* Pixel value to use for window's border. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
winPtr->atts.border_pixel = pixel;
@@ -2052,7 +2071,7 @@ Tk_SetWindowBorderPixmap(
Tk_Window tkwin, /* Window to manipulate. */
Pixmap pixmap) /* Pixmap to use for window's border. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
winPtr->atts.border_pixmap = pixmap;
@@ -2070,7 +2089,7 @@ Tk_DefineCursor(
Tk_Window tkwin, /* Window to manipulate. */
Tk_Cursor cursor) /* Cursor to use for window (may be None). */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
#if defined(MAC_OSX_TK)
winPtr->atts.cursor = (XCursor) cursor;
@@ -2097,7 +2116,7 @@ Tk_SetWindowColormap(
Tk_Window tkwin, /* Window to manipulate. */
Colormap colormap) /* Colormap to use for window. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
winPtr->atts.colormap = colormap;
@@ -2139,7 +2158,7 @@ Tk_SetWindowVisual(
int depth, /* New depth for window. */
Colormap colormap) /* An appropriate colormap for the visual. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
if (winPtr->window != None) {
/* Too late! */
@@ -2182,7 +2201,7 @@ Tk_SetWindowVisual(
void
TkDoConfigureNotify(
- register TkWindow *winPtr) /* Window whose configuration was just
+ TkWindow *winPtr) /* Window whose configuration was just
* changed. */
{
XEvent event;
@@ -2228,7 +2247,7 @@ Tk_SetClass(
Tk_Window tkwin, /* Token for window to assign class. */
const char *className) /* New class for tkwin. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
winPtr->classUid = Tk_GetUid(className);
if (winPtr->flags & TK_WIN_MANAGED) {
@@ -2261,7 +2280,7 @@ Tk_SetClassProcs(
const Tk_ClassProcs *procs, /* Class procs structure. */
ClientData instanceData) /* Data to be passed to class functions. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
winPtr->classProcsPtr = procs;
winPtr->instanceData = instanceData;
diff --git a/generic/ttk/ttkGenStubs.tcl b/generic/ttk/ttkGenStubs.tcl
index 82704b3..af8a2a5 100644
--- a/generic/ttk/ttkGenStubs.tcl
+++ b/generic/ttk/ttkGenStubs.tcl
@@ -689,7 +689,7 @@ proc genStubs::makeInit {name decl index} {
# have the interface name, the declaration, and
# the index appended.
# guardProc The proc to invoke to add guards. It will have
-# the slot status and text appended.
+# the slot status and text appended.
# textVar The variable to use for output.
# skipString The string to emit if a slot is skipped. This
# string will be subst'ed in the loop so "$i" can
diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c
index 0cfc119..f5bfb4d 100644
--- a/generic/ttk/ttkWidget.c
+++ b/generic/ttk/ttkWidget.c
@@ -8,10 +8,6 @@
#include "ttkTheme.h"
#include "ttkWidget.h"
-#ifdef MAC_OSX_TK
-#define TK_NO_DOUBLE_BUFFERING 1
-#endif
-
/*------------------------------------------------------------------------
* +++ Internal helper routines.
*/