summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2020-10-05 12:32:17 (GMT)
committerdgp <dgp@users.sourceforge.net>2020-10-05 12:32:17 (GMT)
commit7502bf6e5e8ea5e8f96b215a1c31af4d3835bd62 (patch)
treeb7ebd53581c2ce9bcd73246166cbaa56879998f1 /unix
parent4a1bb2bf6ed0b0c05e67c02714d12dc9e8ffd79f (diff)
parent121af720bc29f65b64fcdcf520cb2d00368eb258 (diff)
downloadtk-7502bf6e5e8ea5e8f96b215a1c31af4d3835bd62.zip
tk-7502bf6e5e8ea5e8f96b215a1c31af4d3835bd62.tar.gz
tk-7502bf6e5e8ea5e8f96b215a1c31af4d3835bd62.tar.bz2
merge 8.6
Diffstat (limited to 'unix')
-rw-r--r--unix/tkUnixButton.c14
-rw-r--r--unix/tkUnixMenu.c75
-rw-r--r--unix/tkUnixMenubu.c8
-rw-r--r--unix/tkUnixSelect.c58
4 files changed, 73 insertions, 82 deletions
diff --git a/unix/tkUnixButton.c b/unix/tkUnixButton.c
index 6a99124..8d293f6 100644
--- a/unix/tkUnixButton.c
+++ b/unix/tkUnixButton.c
@@ -173,7 +173,7 @@ TkpDrawCheckIndicator(
* Sanity check.
*/
- if (tkwin == NULL || display == None || d == None || bgBorder == NULL
+ if (tkwin == NULL || display == NULL || d == None || bgBorder == NULL
|| indicatorColor == NULL) {
return;
}
@@ -326,11 +326,9 @@ TkpDrawCheckIndicator(
TkButton *
TkpCreateButton(
- Tk_Window tkwin)
+ TCL_UNUSED(Tk_Window))
{
- UnixButton *butPtr = ckalloc(sizeof(UnixButton));
-
- return (TkButton *) butPtr;
+ return (TkButton *)ckalloc(sizeof(UnixButton));
}
/*
@@ -396,7 +394,7 @@ void
TkpDisplayButton(
ClientData clientData) /* Information about widget. */
{
- register TkButton *butPtr = (TkButton *) clientData;
+ TkButton *butPtr = (TkButton *)clientData;
GC gc;
Tk_3DBorder border;
Pixmap pixmap;
@@ -807,8 +805,6 @@ TkpDisplayButton(
butPtr->borderWidth, relief);
}
if (butPtr->highlightWidth > 0) {
- GC gc;
-
if (butPtr->flags & GOT_FOCUS) {
gc = Tk_GCForColor(butPtr->highlightColorPtr, pixmap);
} else {
@@ -860,7 +856,7 @@ TkpDisplayButton(
void
TkpComputeButtonGeometry(
- register TkButton *butPtr) /* Button whose geometry may have changed. */
+ TkButton *butPtr) /* Button whose geometry may have changed. */
{
int width, height, avgWidth, txtWidth, txtHeight;
int haveImage = 0, haveText = 0;
diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c
index fc8b4f2..4ef5af2 100644
--- a/unix/tkUnixMenu.c
+++ b/unix/tkUnixMenu.c
@@ -145,7 +145,7 @@ TkpNewMenu(
void
TkpDestroyMenu(
- TkMenu *menuPtr)
+ TCL_UNUSED(TkMenu *))
{
/*
* Nothing to do.
@@ -171,7 +171,7 @@ TkpDestroyMenu(
void
TkpDestroyMenuEntry(
- TkMenuEntry *mEntryPtr)
+ TCL_UNUSED(TkMenuEntry *))
{
/*
* Nothing to do.
@@ -199,7 +199,7 @@ TkpDestroyMenuEntry(
int
TkpConfigureMenuEntry(
- 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. */
{
/*
@@ -239,7 +239,7 @@ TkpConfigureMenuEntry(
int
TkpMenuNewEntry(
- TkMenuEntry *mePtr)
+ TCL_UNUSED(TkMenuEntry *))
{
return TCL_OK;
}
@@ -292,9 +292,9 @@ TkpSetWindowMenuBar(
void
TkpSetMainMenubar(
- Tcl_Interp *interp,
- Tk_Window tkwin,
- const char *menuName)
+ TCL_UNUSED(Tcl_Interp *),
+ TCL_UNUSED(Tk_Window),
+ TCL_UNUSED(const char *))
{
/*
* Nothing to do.
@@ -323,8 +323,8 @@ static void
GetMenuIndicatorGeometry(
TkMenu *menuPtr, /* The menu we are drawing. */
TkMenuEntry *mePtr, /* The entry we are interested in. */
- Tk_Font tkfont, /* The precalculated font */
- const Tk_FontMetrics *fmPtr,/* The precalculated metrics */
+ TCL_UNUSED(Tk_Font), /* The precalculated font */
+ TCL_UNUSED(const Tk_FontMetrics *),/* The precalculated metrics */
int *widthPtr, /* The resulting width */
int *heightPtr) /* The resulting height */
{
@@ -445,7 +445,6 @@ DrawMenuEntryBackground(
} else {
relief = TK_RELIEF_RAISED;
}
-
Tk_GetPixelsFromObj(NULL, menuPtr->tkwin,
menuPtr->activeBorderWidthPtr, &activeBorderWidth);
Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder, x, y, width, height,
@@ -524,7 +523,7 @@ DrawMenuEntryAccelerator(
if (menuPtr->menuType == MENUBAR) {
left += 5;
}
- Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel,
+ Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel,
mePtr->accelLength, left,
(y + (height + fmPtr->ascent - fmPtr->descent) / 2));
}
@@ -554,11 +553,11 @@ DrawMenuEntryIndicator(
Tk_3DBorder border, /* The background color */
XColor *indicatorColor, /* The color to draw indicators with */
XColor *disableColor, /* The color use use when disabled */
- Tk_Font tkfont, /* The font to draw with */
- const Tk_FontMetrics *fmPtr,/* The font metrics of the font */
+ TCL_UNUSED(Tk_Font), /* The font to draw with */
+ TCL_UNUSED(const Tk_FontMetrics *),/* The font metrics of the font */
int x, /* The left of the entry rect */
int y, /* The top of the entry rect */
- int width, /* Width of menu entry */
+ TCL_UNUSED(int), /* Width of menu entry */
int height) /* Height of menu entry */
{
/*
@@ -623,11 +622,11 @@ DrawMenuEntryIndicator(
static void
DrawMenuSeparator(
TkMenu *menuPtr, /* The menu we are drawing */
- TkMenuEntry *mePtr, /* The entry we are drawing */
+ TCL_UNUSED(TkMenuEntry *), /* The entry we are drawing */
Drawable d, /* The drawable we are using */
- GC gc, /* The gc to draw into */
- Tk_Font tkfont, /* The font to draw with */
- const Tk_FontMetrics *fmPtr,/* The font metrics from the font */
+ TCL_UNUSED(GC), /* The gc to draw into */
+ TCL_UNUSED(Tk_Font), /* The font to draw with */
+ TCL_UNUSED(const Tk_FontMetrics *),/* The font metrics from the font */
int x, int y,
int width, int height)
{
@@ -790,7 +789,7 @@ DrawMenuEntryLabel(
imageHeight, d, leftEdge + imageXOffset,
(int) (y + (mePtr->height-imageHeight)/2 + imageYOffset));
}
- } else if (mePtr->bitmapPtr != None) {
+ } else if (mePtr->bitmapPtr != NULL) {
Pixmap bitmap = Tk_GetBitmapFromObj(menuPtr->tkwin, mePtr->bitmapPtr);
XCopyPlane(menuPtr->display, bitmap, d, gc, 0, 0,
@@ -818,7 +817,7 @@ DrawMenuEntryLabel(
XFillRectangle(menuPtr->display, d, menuPtr->disabledGC, x, y,
(unsigned) width, (unsigned) height);
} else if ((mePtr->image != NULL)
- && (menuPtr->disabledImageGC != None)) {
+ && (menuPtr->disabledImageGC != NULL)) {
XFillRectangle(menuPtr->display, d, menuPtr->disabledImageGC,
leftEdge + imageXOffset,
(int) (y + (mePtr->height - imageHeight)/2 + imageYOffset),
@@ -852,7 +851,7 @@ DrawMenuUnderline(
Tk_Font tkfont, /* The precalculated font */
const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
int x, int y,
- int width, int height)
+ TCL_UNUSED(int), int height)
{
if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) {
int len;
@@ -931,7 +930,7 @@ TkpPostMenu(
int
TkpPostTearoffMenu(
- Tcl_Interp *interp, /* The interpreter of the menu */
+ TCL_UNUSED(Tcl_Interp *), /* The interpreter of the menu */
TkMenu *menuPtr, /* The menu we are posting */
int x, int y, int index) /* The root X,Y coordinates where the
* specified entry will be posted */
@@ -1021,9 +1020,9 @@ TkpPostTearoffMenu(
static void
GetMenuSeparatorGeometry(
- TkMenu *menuPtr, /* The menu we are measuring */
- TkMenuEntry *mePtr, /* The entry we are measuring */
- Tk_Font tkfont, /* The precalculated font */
+ TCL_UNUSED(TkMenu *), /* The menu we are measuring */
+ TCL_UNUSED(TkMenuEntry *), /* The entry we are measuring */
+ TCL_UNUSED(Tk_Font), /* The precalculated font */
const Tk_FontMetrics *fmPtr,/* The precalcualted font metrics */
int *widthPtr, /* The resulting width */
int *heightPtr) /* The resulting height */
@@ -1051,7 +1050,7 @@ GetMenuSeparatorGeometry(
static void
GetTearoffEntryGeometry(
TkMenu *menuPtr, /* The menu we are drawing */
- TkMenuEntry *mePtr, /* The entry we are measuring */
+ TCL_UNUSED(TkMenuEntry *), /* The entry we are measuring */
Tk_Font tkfont, /* The precalculated font */
const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
int *widthPtr, /* The resulting width */
@@ -1092,15 +1091,13 @@ TkpComputeMenubarGeometry(
Tk_FontMetrics menuMetrics, entryMetrics, *fmPtr;
int width, height, i, j, x, y, currentRowHeight, maxWidth;
int maxWindowWidth, lastRowBreak, lastEntry;
- int borderWidth, activeBorderWidth, helpMenuIndex = -1;
+ int activeBorderWidth, helpMenuIndex = -1;
TkMenuEntry *mePtr;
if (menuPtr->tkwin == NULL) {
return;
}
- Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr,
- &borderWidth);
Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr,
&activeBorderWidth);
maxWidth = 0;
@@ -1122,7 +1119,7 @@ TkpComputeMenubarGeometry(
/*
* On the Mac especially, getting font metrics can be quite slow, so
* we want to do it intelligently. We are going to precalculate them
- * and pass them down to all of the measureing and drawing routines.
+ * and pass them down to all of the measuring and drawing routines.
* We will measure the font metrics of the menu once, and if an entry
* has a font set, we will measure it as we come to it, and then we
* decide which set to give the geometry routines.
@@ -1269,11 +1266,11 @@ TkpComputeMenubarGeometry(
static void
DrawTearoffEntry(
TkMenu *menuPtr, /* The menu we are drawing */
- TkMenuEntry *mePtr, /* The entry we are drawing */
+ TCL_UNUSED(TkMenuEntry *), /* The entry we are drawing */
Drawable d, /* The drawable we are drawing into */
- GC gc, /* The gc we are drawing with */
- Tk_Font tkfont, /* The font we are drawing with */
- const Tk_FontMetrics *fmPtr,/* The metrics we are drawing with */
+ TCL_UNUSED(GC), /* The gc we are drawing with */
+ TCL_UNUSED(Tk_Font), /* The font we are drawing with */
+ TCL_UNUSED(const Tk_FontMetrics *),/* The metrics we are drawing with */
int x, int y,
int width, int height)
{
@@ -1324,8 +1321,8 @@ DrawTearoffEntry(
void
TkpInitializeMenuBindings(
- Tcl_Interp *interp, /* The interpreter to set. */
- Tk_BindingTable bindingTable)
+ TCL_UNUSED(Tcl_Interp *), /* The interpreter to set. */
+ TCL_UNUSED(Tk_BindingTable))
/* The table to add to. */
{
/*
@@ -1376,7 +1373,7 @@ SetHelpMenu(
&& (cascadeEntryPtr->menuPtr->masterMenuPtr->tkwin != NULL)
&& (menuPtr->masterMenuPtr->tkwin != NULL)) {
TkMenu *masterMenuPtr = cascadeEntryPtr->menuPtr->masterMenuPtr;
- char *helpMenuName = ckalloc(strlen(Tk_PathName(
+ char *helpMenuName = (char *)ckalloc(strlen(Tk_PathName(
masterMenuPtr->tkwin)) + strlen(".help") + 1);
strcpy(helpMenuName, Tk_PathName(masterMenuPtr->tkwin));
@@ -1852,8 +1849,8 @@ TkpComputeStandardMenuGeometry(
void
TkpMenuNotifyToplevelCreate(
- Tcl_Interp *interp, /* The interp the menu lives in. */
- const char *menuName) /* The name of the menu to reconfigure. */
+ TCL_UNUSED(Tcl_Interp *), /* The interp the menu lives in. */
+ TCL_UNUSED(const char *)) /* The name of the menu to reconfigure. */
{
/*
* Nothing to do.
diff --git a/unix/tkUnixMenubu.c b/unix/tkUnixMenubu.c
index 2c6b99b..6677e83 100644
--- a/unix/tkUnixMenubu.c
+++ b/unix/tkUnixMenubu.c
@@ -25,16 +25,16 @@
* Returns a newly allocated TkMenuButton structure.
*
* Side effects:
- * Registers an event handler for the widget.
+ * None
*
*----------------------------------------------------------------------
*/
TkMenuButton *
TkpCreateMenuButton(
- Tk_Window tkwin)
+ TCL_UNUSED(Tk_Window))
{
- return ckalloc(sizeof(TkMenuButton));
+ return (TkMenuButton *)ckalloc(sizeof(TkMenuButton));
}
/*
@@ -280,8 +280,6 @@ TkpDisplayMenuButton(
mbPtr->borderWidth, mbPtr->relief);
}
if (mbPtr->highlightWidth != 0) {
- GC gc;
-
if (mbPtr->flags & GOT_FOCUS) {
gc = Tk_GCForColor(mbPtr->highlightColorPtr, pixmap);
} else {
diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c
index 4819183..527bc4c 100644
--- a/unix/tkUnixSelect.c
+++ b/unix/tkUnixSelect.c
@@ -240,17 +240,17 @@ TkSelGetSelection(
void
TkSelPropProc(
- register XEvent *eventPtr) /* X PropertyChange event. */
+ XEvent *eventPtr) /* X PropertyChange event. */
{
- register IncrInfo *incrPtr;
- register TkSelHandler *selPtr;
+ IncrInfo *incrPtr;
+ TkSelHandler *selPtr;
int length, numItems;
unsigned long i;
Atom target, formatType;
long buffer[TK_SEL_WORDS_AT_ONCE];
TkDisplay *dispPtr = TkGetDisplay(eventPtr->xany.display);
Tk_ErrorHandler errorHandler;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -356,7 +356,7 @@ TkSelPropProc(
((char *) buffer)[numItems] = 0;
errorHandler = Tk_CreateErrorHandler(eventPtr->xproperty.display,
- -1, -1, -1, (int (*)()) NULL, NULL);
+ -1, -1, -1, NULL, NULL);
/*
* Encode the data using the proper format for each type.
@@ -449,7 +449,7 @@ TkSelPropProc(
if (srcLen > 3) {
Tcl_Panic("selection conversion left too many bytes unconverted");
}
- memcpy(incrPtr->converts[i].buffer, src, (size_t) srcLen+1);
+ memcpy(incrPtr->converts[i].buffer, src, srcLen + 1);
Tcl_DStringFree(&ds);
} else {
/*
@@ -519,10 +519,10 @@ TkSelPropProc(
void
TkSelEventProc(
Tk_Window tkwin, /* Window for which event was targeted. */
- register XEvent *eventPtr) /* X event: either SelectionClear,
+ XEvent *eventPtr) /* X event: either SelectionClear,
* SelectionRequest, or SelectionNotify. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
TkDisplay *dispPtr = winPtr->dispPtr;
Tcl_Interp *interp;
@@ -540,12 +540,11 @@ TkSelEventProc(
*/
if (eventPtr->type == SelectionNotify) {
- register TkSelRetrievalInfo *retrPtr;
+ TkSelRetrievalInfo *retrPtr;
char *propInfo, **propInfoPtr = &propInfo;
Atom type;
int format, result;
unsigned long numItems, bytesAfter;
- Tcl_DString ds;
for (retrPtr = pendingRetrievals; ; retrPtr = retrPtr->nextPtr) {
if (retrPtr == NULL) {
@@ -591,6 +590,7 @@ TkSelEventProc(
if ((type == XA_STRING) || (type == dispPtr->textAtom)
|| (type == dispPtr->compoundTextAtom)) {
Tcl_Encoding encoding;
+ Tcl_DString ds;
if (format != 8) {
Tcl_SetObjResult(retrPtr->interp, Tcl_ObjPrintf(
@@ -649,7 +649,7 @@ TkSelEventProc(
}
if (propInfo[numItems] != '\0') {
- propData = ckalloc(numItems + 1);
+ propData = (char *)ckalloc(numItems + 1);
strcpy(propData, propInfo);
propData[numItems] = '\0';
}
@@ -742,7 +742,7 @@ static void
SelTimeoutProc(
ClientData clientData) /* Information about retrieval in progress. */
{
- register TkSelRetrievalInfo *retrPtr = clientData;
+ TkSelRetrievalInfo *retrPtr = (TkSelRetrievalInfo *)clientData;
/*
* Make sure that the retrieval is still in progress. Then see how long
@@ -766,7 +766,7 @@ SelTimeoutProc(
retrPtr->result = TCL_ERROR;
} else {
retrPtr->timeout = Tcl_CreateTimerHandler(1000, SelTimeoutProc,
- (ClientData) retrPtr);
+ retrPtr);
}
}
@@ -796,7 +796,7 @@ ConvertSelection(
* request; may not be selection's current
* owner, be we set it to the current
* owner. */
- register XSelectionRequestEvent *eventPtr)
+ XSelectionRequestEvent *eventPtr)
/* Event describing request. */
{
union {
@@ -813,11 +813,11 @@ ConvertSelection(
Tk_ErrorHandler errorHandler;
TkSelectionInfo *infoPtr;
TkSelInProgress ip;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- errorHandler = Tk_CreateErrorHandler(eventPtr->display, -1, -1,-1,
- (int (*)()) NULL, NULL);
+ errorHandler = Tk_CreateErrorHandler(eventPtr->display, -1, -1,
+ -1, NULL, NULL);
/*
* Initialize the reply event.
@@ -893,12 +893,12 @@ ConvertSelection(
* below).
*/
- incr.converts = ckalloc(incr.numConversions * sizeof(ConvertInfo));
+ incr.converts = (ConvertInfo *)ckalloc(incr.numConversions * sizeof(ConvertInfo));
incr.numIncrs = 0;
for (i = 0; i < incr.numConversions; i++) {
Atom target, property, type;
long buffer[TK_SEL_WORDS_AT_ONCE];
- register TkSelHandler *selPtr;
+ TkSelHandler *selPtr;
int numItems, format;
char *propPtr;
@@ -919,7 +919,7 @@ ConvertSelection(
/*
* Nobody seems to know about this kind of request. If it's of a
* sort that we can handle without any help, do it. Otherwise mark
- * the request as an errror.
+ * the request as an error.
*/
numItems = TkSelDefaultSelection(infoPtr, target, (char *) buffer,
@@ -1064,7 +1064,7 @@ ConvertSelection(
}
Tcl_DeleteTimerHandler(incr.timeout);
errorHandler = Tk_CreateErrorHandler(winPtr->display,
- -1, -1, -1, (int (*)()) NULL, NULL);
+ -1, -1, -1, NULL, NULL);
XSelectInput(reply.xsel.display, reply.xsel.requestor, 0L);
Tk_DeleteErrorHandler(errorHandler);
if (tsdPtr->pendingIncrs == &incr) {
@@ -1124,9 +1124,9 @@ ConvertSelection(
static void
SelRcvIncrProc(
ClientData clientData, /* Information about retrieval. */
- register XEvent *eventPtr) /* X PropertyChange event. */
+ XEvent *eventPtr) /* X PropertyChange event. */
{
- register TkSelRetrievalInfo *retrPtr = clientData;
+ TkSelRetrievalInfo *retrPtr = (TkSelRetrievalInfo *)clientData;
char *propInfo, **propInfoPtr = &propInfo;
Atom type;
int format, result;
@@ -1374,7 +1374,7 @@ IncrTimeoutProc(
* retrieval for which we are selection
* owner. */
{
- register IncrInfo *incrPtr = clientData;
+ IncrInfo *incrPtr = (IncrInfo *)clientData;
incrPtr->idleTime++;
if (incrPtr->idleTime >= 5) {
@@ -1435,7 +1435,7 @@ SelCvtToX(
if (Tcl_SplitList(NULL, string, &numFields, &field) != TCL_OK) {
return NULL;
}
- propPtr = ckalloc(numFields * sizeof(long));
+ propPtr = (long *)ckalloc(numFields * sizeof(long));
/*
* Convert the fields one-by-one.
@@ -1487,7 +1487,7 @@ SelCvtToX(
static void
SelCvtFromX32(
- register long *propPtr, /* Property value from X. */
+ long *propPtr, /* Property value from X. */
int numValues, /* Number of 32-bit values in property. */
Atom type, /* Type of property Should not be XA_STRING
* (if so, don't bother calling this function
@@ -1520,12 +1520,12 @@ SelCvtFromX32(
static void
SelCvtFromX8(
- register char *propPtr, /* Property value from X. */
+ char *propPtr, /* Property value from X. */
int numValues, /* Number of 8-bit values in property. */
- Atom type, /* Type of property Should not be XA_STRING
+ TCL_UNUSED(Atom), /* Type of property Should not be XA_STRING
* (if so, don't bother calling this function
* at all). */
- Tk_Window tkwin, /* Window to use for atom conversion. */
+ TCL_UNUSED(Tk_Window), /* Window to use for atom conversion. */
Tcl_DString *dsPtr) /* Where to store the converted string. */
{
/*