summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-02-26 10:13:04 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-02-26 10:13:04 (GMT)
commit4d4bf9a051a30dad87a2b518e2641851b702dd3c (patch)
tree1566ff74caf52d519b52c4e823f7ab28ca15b54e
parent632866365dc6bc82d38d23624c3ca69966bd8aaa (diff)
parent22438af8abfb0b3cc6f608bd906d804bae7cc4de (diff)
downloadtk-4d4bf9a051a30dad87a2b518e2641851b702dd3c.zip
tk-4d4bf9a051a30dad87a2b518e2641851b702dd3c.tar.gz
tk-4d4bf9a051a30dad87a2b518e2641851b702dd3c.tar.bz2
Merge trunk
-rwxr-xr-xgeneric/nanosvg.h2
-rw-r--r--generic/nanosvgrast.h2
-rw-r--r--generic/tkArray.h4
-rw-r--r--generic/tkBind.c2
-rw-r--r--generic/tkButton.h2
-rw-r--r--generic/tkCanvUtil.c5
-rw-r--r--generic/tkCanvas.c10
-rw-r--r--generic/tkConsole.c19
-rw-r--r--generic/tkImgListFormat.c4
-rw-r--r--generic/tkImgPhoto.c4
-rw-r--r--generic/tkInt.h2
-rw-r--r--generic/tkListbox.c8
-rw-r--r--generic/tkMenu.c72
-rw-r--r--generic/tkMenu.h2
-rw-r--r--generic/tkObj.c76
-rw-r--r--generic/tkUtil.c1
-rw-r--r--generic/tkWindow.c4
-rw-r--r--generic/ttk/ttkEntry.c4
-rw-r--r--generic/ttk/ttkFrame.c4
-rw-r--r--generic/ttk/ttkManager.c20
-rw-r--r--generic/ttk/ttkManager.h22
-rw-r--r--generic/ttk/ttkNotebook.c51
-rw-r--r--generic/ttk/ttkPanedwindow.c28
-rw-r--r--generic/ttk/ttkTheme.c2
-rw-r--r--library/scrlbar.tcl31
-rw-r--r--library/ttk/fonts.tcl12
-rw-r--r--library/ttk/scrollbar.tcl7
-rw-r--r--macosx/tkMacOSXPort.h13
-rw-r--r--macosx/tkMacOSXWindowEvent.c7
-rw-r--r--tests/canvas.test10
-rw-r--r--tests/listbox.test4
-rw-r--r--tests/scrollbar.test32
-rw-r--r--tests/textTag.test33
-rw-r--r--tests/ttk/scrollbar.test86
-rw-r--r--unix/tkUnixPort.h15
-rwxr-xr-xwin/configure2
-rw-r--r--win/tcl.m42
-rw-r--r--win/tkWinDialog.c2
-rw-r--r--win/ttkWinXPTheme.c6
-rw-r--r--xlib/X11/Xlib.h8
40 files changed, 406 insertions, 214 deletions
diff --git a/generic/nanosvg.h b/generic/nanosvg.h
index 5377ae0..7bb13d2 100755
--- a/generic/nanosvg.h
+++ b/generic/nanosvg.h
@@ -662,7 +662,7 @@ static void nsvg__curveBounds(float* bounds, float* curve)
}
}
-static NSVGparser* nsvg__createParser()
+static NSVGparser* nsvg__createParser(void)
{
NSVGparser* p;
p = (NSVGparser*)NANOSVG_malloc(sizeof(NSVGparser));
diff --git a/generic/nanosvgrast.h b/generic/nanosvgrast.h
index 37636fe..993c29c 100644
--- a/generic/nanosvgrast.h
+++ b/generic/nanosvgrast.h
@@ -60,7 +60,7 @@ typedef struct NSVGrasterizer NSVGrasterizer;
*/
// Allocated rasterizer context.
-NANOSVG_SCOPE NSVGrasterizer* nsvgCreateRasterizer();
+NANOSVG_SCOPE NSVGrasterizer* nsvgCreateRasterizer(void);
// Rasterizes SVG image, returns RGBA image (non-premultiplied alpha)
// r - pointer to rasterizer context
diff --git a/generic/tkArray.h b/generic/tkArray.h
index 2bfdd5f..81f3198 100644
--- a/generic/tkArray.h
+++ b/generic/tkArray.h
@@ -188,7 +188,7 @@ AT##_Init(AT *arr) \
\
__TK_ARRAY_UNUSED \
static size_t \
-AT##_ElemSize() \
+AT##_ElemSize(void) \
{ \
return sizeof(ElemType); \
} \
@@ -399,7 +399,7 @@ typedef struct AT { \
\
__TK_ARRAY_UNUSED \
static size_t \
-AT##_ElemSize() \
+AT##_ElemSize(void) \
{ \
return sizeof(ElemType); \
} \
diff --git a/generic/tkBind.c b/generic/tkBind.c
index dc3abb0..4970dc8 100644
--- a/generic/tkBind.c
+++ b/generic/tkBind.c
@@ -792,7 +792,7 @@ GetButtonNumber(
}
static Time
-CurrentTimeInMilliSecs()
+CurrentTimeInMilliSecs(void)
{
Tcl_Time now;
Tcl_GetTime(&now);
diff --git a/generic/tkButton.h b/generic/tkButton.h
index 7e04fb9..edf7efe 100644
--- a/generic/tkButton.h
+++ b/generic/tkButton.h
@@ -306,7 +306,7 @@ MODULE_SCOPE char tkDefLabelPady[TCL_INTEGER_SPACE];
*/
#ifndef TkpButtonSetDefaults
-MODULE_SCOPE void TkpButtonSetDefaults();
+MODULE_SCOPE void TkpButtonSetDefaults(void);
#endif
MODULE_SCOPE void TkButtonWorldChanged(ClientData instanceData);
MODULE_SCOPE void TkpComputeButtonGeometry(TkButton *butPtr);
diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c
index cbc52dd..e42d9da 100644
--- a/generic/tkCanvUtil.c
+++ b/generic/tkCanvUtil.c
@@ -28,15 +28,16 @@ const Tk_SmoothMethod tkBezierSmoothMethod = {
"true",
TkMakeBezierCurve,
(void (*) (Tcl_Interp *interp, Tk_Canvas canvas, double *coordPtr,
- int numPoints, int numSteps)) TkMakeBezierPostscript,
+ int numPoints, int numSteps))(void *)TkMakeBezierPostscript,
};
static const Tk_SmoothMethod tkRawSmoothMethod = {
"raw",
TkMakeRawCurve,
(void (*) (Tcl_Interp *interp, Tk_Canvas canvas, double *coordPtr,
- int numPoints, int numSteps)) TkMakeRawCurvePostscript,
+ int numPoints, int numSteps))(void *)TkMakeRawCurvePostscript,
};
+
/*
* Function forward-declarations.
*/
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c
index 2c6c49a..53ea6d5 100644
--- a/generic/tkCanvas.c
+++ b/generic/tkCanvas.c
@@ -1681,11 +1681,6 @@ CanvasWidgetCmd(
} else {
FIRST_CANVAS_ITEM_MATCHING(objv[3], &searchPtr, goto done);
if (itemPtr == NULL) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "tagOrId \"%s\" doesn't match any items",
- Tcl_GetString(objv[3])));
- Tcl_SetErrorCode(interp, "TK", "CANVAS", "ITEM", NULL);
- result = TCL_ERROR;
goto done;
}
itemPtr = itemPtr->prevPtr;
@@ -1808,11 +1803,6 @@ CanvasWidgetCmd(
prevPtr = itemPtr;
}
if (prevPtr == NULL) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "tagOrId \"%s\" doesn't match any items",
- Tcl_GetString(objv[3])));
- Tcl_SetErrorCode(interp, "TK", "CANVAS", "ITEM", NULL);
- result = TCL_ERROR;
goto done;
}
}
diff --git a/generic/tkConsole.c b/generic/tkConsole.c
index c1d4c42..aa9b85b 100644
--- a/generic/tkConsole.c
+++ b/generic/tkConsole.c
@@ -44,6 +44,7 @@ typedef struct ChannelData {
*/
static int ConsoleClose(ClientData instanceData, Tcl_Interp *interp);
+static int Console2Close(ClientData instanceData, Tcl_Interp *interp, int flags);
static void ConsoleDeleteProc(ClientData clientData);
static void ConsoleEventProc(ClientData clientData, XEvent *eventPtr);
static int ConsoleHandle(ClientData instanceData, int direction,
@@ -66,7 +67,7 @@ static int InterpreterObjCmd(ClientData clientData, Tcl_Interp *interp,
static const Tcl_ChannelType consoleChannelType = {
"console", /* Type name. */
- TCL_CHANNEL_VERSION_4, /* v4 channel */
+ TCL_CHANNEL_VERSION_5, /* v4 channel */
ConsoleClose, /* Close proc. */
ConsoleInput, /* Input proc. */
ConsoleOutput, /* Output proc. */
@@ -75,7 +76,7 @@ static const Tcl_ChannelType consoleChannelType = {
NULL, /* Get option proc. */
ConsoleWatch, /* Watch for events on console. */
ConsoleHandle, /* Get a handle from the device. */
- NULL, /* close2proc. */
+ Console2Close, /* close2proc. */
NULL, /* Always non-blocking.*/
NULL, /* flush proc. */
NULL, /* handler proc. */
@@ -578,7 +579,7 @@ ConsoleInput(
/*
*----------------------------------------------------------------------
*
- * ConsoleClose --
+ * ConsoleClose/Console2Close --
*
* Closes the IO channel.
*
@@ -613,6 +614,18 @@ ConsoleClose(
ckfree(data);
return 0;
}
+
+static int
+Console2Close(
+ ClientData instanceData, /* Unused. */
+ Tcl_Interp *interp, /* Unused. */
+ int flags)
+{
+ if ((flags&(TCL_CLOSE_READ|TCL_CLOSE_WRITE))==0) {
+ return ConsoleClose(instanceData, interp);
+ }
+ return EINVAL;
+}
/*
*----------------------------------------------------------------------
diff --git a/generic/tkImgListFormat.c b/generic/tkImgListFormat.c
index 95daf53..70efc96 100644
--- a/generic/tkImgListFormat.c
+++ b/generic/tkImgListFormat.c
@@ -867,7 +867,7 @@ ParseColorAsList(
* To avoid that, avance the pointer to the next non-blank char.
*/
- while(isspace(*curPos)) {
+ while(isspace(UCHAR(*curPos))) {
++curPos;
}
while (i < 4 && *curPos != '\0') {
@@ -875,7 +875,7 @@ ParseColorAsList(
if (values[i] < 0 || values[i] > 255) {
return TCL_ERROR;
}
- while(isspace(*curPos)) {
+ while(isspace(UCHAR(*curPos))) {
++curPos;
}
++i;
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index 3028c0e..c821b81 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -770,7 +770,7 @@ ImgPhotoCmd(
Tk_PhotoImageBlock *blockPtr);
Tcl_DStringInit(&buffer);
- result = ((OldStringWriteProc) stringWriteProc)(interp, &buffer,
+ result = ((OldStringWriteProc)(void *)stringWriteProc)(interp, &buffer,
Tcl_GetString(options.format), &block);
if (result == TCL_OK) {
Tcl_DStringResult(interp, &buffer);
@@ -782,7 +782,7 @@ ImgPhotoCmd(
Tcl_Obj *formatString, Tk_PhotoImageBlock *blockPtr,
void *dummy);
- result = ((NewStringWriteProc) stringWriteProc)(interp,
+ result = ((NewStringWriteProc)(void *)stringWriteProc)(interp,
options.format, &block, NULL);
}
if (options.background) {
diff --git a/generic/tkInt.h b/generic/tkInt.h
index 5b51054..7cbe434 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -1333,6 +1333,8 @@ MODULE_SCOPE int TkListCreateFrame(ClientData clientData,
MODULE_SCOPE void TkRotatePoint(double originX, double originY,
double sine, double cosine, double *xPtr,
double *yPtr);
+MODULE_SCOPE int TkGetIntForIndex(Tcl_Obj *, TkSizeT, TkSizeT*);
+
#ifdef _WIN32
#define TkParseColor XParseColor
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index 6031571..22e49bf 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.c
@@ -2756,11 +2756,7 @@ GetListboxIndex(
break;
case INDEX_END:
/* "end" index */
- if (endIsSize) {
- *indexPtr = listPtr->nElements;
- } else {
- *indexPtr = listPtr->nElements - 1;
- }
+ *indexPtr = listPtr->nElements - (endIsSize ? 0 : 1);
break;
}
return TCL_OK;
@@ -2802,6 +2798,8 @@ GetListboxIndex(
if (Tcl_GetIntFromObj(NULL, indexObj, indexPtr) == TCL_OK) {
if (*indexPtr < -1) {
*indexPtr = -1;
+ } else if (*indexPtr > listPtr->nElements) {
+ *indexPtr = listPtr->nElements + (endIsSize ? 1 : 0);
}
return TCL_OK;
}
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index 79ed64e..25c4632 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -368,7 +368,9 @@ static void MenuWorldChanged(ClientData instanceData);
static int PostProcessEntry(TkMenuEntry *mePtr);
static void RecursivelyDeleteMenu(TkMenu *menuPtr);
static void UnhookCascadeEntry(TkMenuEntry *mePtr);
-static void TkMenuCleanup(ClientData unused);
+static void MenuCleanup(ClientData unused);
+static int GetMenuIndex(Tcl_Interp *interp, TkMenu *menuPtr,
+ Tcl_Obj *objPtr, int lastOK, TkSizeT *indexPtr);
/*
* The structure below is a list of procs that respond to certain window
@@ -645,7 +647,7 @@ MenuWidgetObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, "index");
goto error;
}
- if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
+ if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
goto error;
}
if (menuPtr->active == index) {
@@ -742,12 +744,12 @@ MenuWidgetObjCmd(
if (first >= menuPtr->numEntries) {
goto done;
}
- } else if (TkGetMenuIndex(interp,menuPtr,objv[2],0,&first) != TCL_OK){
+ } else if (GetMenuIndex(interp,menuPtr,objv[2],0,&first) != TCL_OK){
goto error;
}
if (objc == 3) {
last = first;
- } else if (TkGetMenuIndex(interp,menuPtr,objv[3],0,&last) != TCL_OK) {
+ } else if (GetMenuIndex(interp,menuPtr,objv[3],0,&last) != TCL_OK) {
goto error;
}
@@ -773,7 +775,7 @@ MenuWidgetObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, "index option");
goto error;
}
- if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
+ if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
goto error;
}
if (index == TCL_INDEX_NONE) {
@@ -798,7 +800,7 @@ MenuWidgetObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, "index ?-option value ...?");
goto error;
}
- if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
+ if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
goto error;
}
if (index == TCL_INDEX_NONE) {
@@ -838,7 +840,7 @@ MenuWidgetObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, "string");
goto error;
}
- if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
+ if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
goto error;
}
if (index == TCL_INDEX_NONE) {
@@ -865,7 +867,7 @@ MenuWidgetObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, "index");
goto error;
}
- if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
+ if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
goto error;
}
if (index == TCL_INDEX_NONE) {
@@ -887,7 +889,7 @@ MenuWidgetObjCmd(
goto error;
}
if (objc == 5) {
- if (TkGetMenuIndex(interp, menuPtr, objv[4], 0, &index) != TCL_OK) {
+ if (GetMenuIndex(interp, menuPtr, objv[4], 0, &index) != TCL_OK) {
goto error;
}
}
@@ -918,7 +920,7 @@ MenuWidgetObjCmd(
goto error;
}
- if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
+ if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
goto error;
}
if ((index == TCL_INDEX_NONE) || (menuPtr->entries[index]->type != CASCADE_ENTRY)) {
@@ -936,7 +938,7 @@ MenuWidgetObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, "index");
goto error;
}
- if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
+ if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
goto error;
}
if (index == TCL_INDEX_NONE) {
@@ -2095,7 +2097,7 @@ ConfigureMenuCloneEntries(
/*
*--------------------------------------------------------------
*
- * TkGetMenuIndex --
+ * GetMenuIndex --
*
* Parse a textual index into a menu and return the numerical index of
* the indicated entry.
@@ -2113,7 +2115,7 @@ ConfigureMenuCloneEntries(
*/
int
-TkGetMenuIndex(
+GetMenuIndex(
Tcl_Interp *interp, /* For error messages. */
TkMenu *menuPtr, /* Menu for which the index is being
* specified. */
@@ -2124,15 +2126,25 @@ TkGetMenuIndex(
TkSizeT *indexPtr) /* Where to store converted index. */
{
int i;
- const char *string = Tcl_GetString(objPtr);
+ const char *string;
+
+ if (TkGetIntForIndex(objPtr, menuPtr->numEntries - ((lastOK) ? 0 : 1), indexPtr) == TCL_OK) {
+ if (*indexPtr != TCL_INDEX_NONE) {
+ if (*indexPtr >= menuPtr->numEntries) {
+ *indexPtr = menuPtr->numEntries - ((lastOK) ? 0 : 1);
+ }
+ return TCL_OK;
+ }
+ }
+
+ string = Tcl_GetString(objPtr);
if ((string[0] == 'a') && (strcmp(string, "active") == 0)) {
*indexPtr = menuPtr->active;
goto success;
}
- if (((string[0] == 'l') && (strcmp(string, "last") == 0))
- || ((string[0] == 'e') && (strcmp(string, "end") == 0))) {
+ if ((string[0] == 'l') && (strcmp(string, "last") == 0)) {
*indexPtr = menuPtr->numEntries - ((lastOK) ? 0 : 1);
goto success;
}
@@ -2149,22 +2161,6 @@ TkGetMenuIndex(
}
}
- if (isdigit(UCHAR(string[0]))) {
- if (Tcl_GetIntFromObj(NULL, objPtr, &i) == TCL_OK) {
- if (i >= (int)menuPtr->numEntries) {
- if (lastOK) {
- i = menuPtr->numEntries;
- } else {
- i = menuPtr->numEntries-1;
- }
- } else if (i < 0) {
- i = -1;
- }
- *indexPtr = i;
- goto success;
- }
- }
-
for (i = 0; i < (int)menuPtr->numEntries; i++) {
Tcl_Obj *labelPtr = menuPtr->entries[i]->labelPtr;
const char *label = (labelPtr == NULL) ? NULL : Tcl_GetString(labelPtr);
@@ -2357,7 +2353,7 @@ MenuAddOrInsert(
TkMenu *menuListPtr;
if (indexPtr != NULL) {
- if (TkGetMenuIndex(interp, menuPtr, indexPtr, 1, &index) != TCL_OK) {
+ if (GetMenuIndex(interp, menuPtr, indexPtr, 1, &index) != TCL_OK) {
return TCL_ERROR;
}
} else {
@@ -2877,7 +2873,7 @@ MenuDoXPosition(
TkSizeT index;
TkRecomputeMenu(menuPtr);
- if (TkGetMenuIndex(interp, menuPtr, objPtr, 0, &index) != TCL_OK) {
+ if (GetMenuIndex(interp, menuPtr, objPtr, 0, &index) != TCL_OK) {
return TCL_ERROR;
}
Tcl_ResetResult(interp);
@@ -2914,7 +2910,7 @@ MenuDoYPosition(
TkSizeT index;
TkRecomputeMenu(menuPtr);
- if (TkGetMenuIndex(interp, menuPtr, objPtr, 0, &index) != TCL_OK) {
+ if (GetMenuIndex(interp, menuPtr, objPtr, 0, &index) != TCL_OK) {
goto error;
}
Tcl_ResetResult(interp);
@@ -3561,7 +3557,7 @@ DeleteMenuCloneEntries(
/*
*----------------------------------------------------------------------
*
- * TkMenuCleanup --
+ * MenuCleanup --
*
* Resets menusInitialized to allow Tk to be finalized and reused without
* the DLL being unloaded.
@@ -3576,7 +3572,7 @@ DeleteMenuCloneEntries(
*/
static void
-TkMenuCleanup(
+MenuCleanup(
ClientData dummy)
{
(void)dummy;
@@ -3618,7 +3614,7 @@ TkMenuInit(void)
* Make sure we cleanup on finalize.
*/
- TkCreateExitHandler((Tcl_ExitProc *) TkMenuCleanup, NULL);
+ TkCreateExitHandler((Tcl_ExitProc *) MenuCleanup, NULL);
Tcl_MutexUnlock(&menuMutex);
}
if (!tsdPtr->menusInitialized) {
diff --git a/generic/tkMenu.h b/generic/tkMenu.h
index 0b261e5..ecb6fac 100644
--- a/generic/tkMenu.h
+++ b/generic/tkMenu.h
@@ -491,8 +491,6 @@ MODULE_SCOPE TkMenuReferences*TkFindMenuReferencesObj(Tcl_Interp *interp,
Tcl_Obj *namePtr);
MODULE_SCOPE int TkFreeMenuReferences(TkMenuReferences *menuRefPtr);
MODULE_SCOPE Tcl_HashTable *TkGetMenuHashTable(Tcl_Interp *interp);
-MODULE_SCOPE int TkGetMenuIndex(Tcl_Interp *interp, TkMenu *menuPtr,
- Tcl_Obj *objPtr, int lastOK, TkSizeT *indexPtr);
MODULE_SCOPE void TkMenuInitializeDrawingFields(TkMenu *menuPtr);
MODULE_SCOPE void TkMenuInitializeEntryDrawingFields(TkMenuEntry *mePtr);
MODULE_SCOPE int TkInvokeMenu(Tcl_Interp *interp, TkMenu *menuPtr,
diff --git a/generic/tkObj.c b/generic/tkObj.c
index 44efe8f..dabc7ac 100644
--- a/generic/tkObj.c
+++ b/generic/tkObj.c
@@ -50,6 +50,7 @@ typedef struct PixelRep {
typedef struct {
const Tcl_ObjType *doubleTypePtr;
const Tcl_ObjType *intTypePtr;
+ const Tcl_ObjType *endTypePtr;
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
@@ -97,6 +98,29 @@ static int SetMMFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
static int SetPixelFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
static int SetWindowFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
+#if TCL_MAJOR_VERSION < 9
+#if defined(USE_TCL_STUBS)
+/* Little hack to eliminate the need for "tclInt.h" here:
+ Just copy a small portion of TclIntStubs, just
+ enough to make it work */
+typedef struct TclIntStubs {
+ int magic;
+ void *hooks;
+ void (*dummy[34]) (void); /* dummy entries 0-33, not used */
+ int (*tclGetIntForIndex) (Tcl_Interp *interp, Tcl_Obj *objPtr, int endValue, int *indexPtr); /* 34 */
+} TclIntStubs;
+extern const struct TclIntStubs *tclIntStubsPtr;
+
+# undef Tcl_GetIntForIndex
+# define Tcl_GetIntForIndex(interp, obj, max, ptr) ((tclIntStubsPtr->tclGetIntForIndex == NULL)? \
+ ((int (*)(Tcl_Interp*, Tcl_Obj *, int, int*))(void *)((&(tclStubsPtr->tcl_PkgProvideEx))[645]))((interp), (obj), (max), (ptr)): \
+ tclIntStubsPtr->tclGetIntForIndex((interp), (obj), (max), (ptr)))
+#elif TCL_MINOR_VERSION < 7
+extern int TclGetIntForIndex(Tcl_Interp*, Tcl_Obj *, int, int*);
+# define Tcl_GetIntForIndex TclGetIntForIndex
+#endif
+#endif
+
/*
* The following structure defines the implementation of the "pixel" Tcl
* object, used for measuring distances. The pixel object remembers its
@@ -160,12 +184,17 @@ GetTypeCache(void)
/* Smart initialization of doubleTypePtr/intTypePtr without
* hash-table lookup or creating complete Tcl_Obj's */
Tcl_Obj obj;
+ obj.bytes = (char *)"end";
obj.length = 3;
+ obj.typePtr = NULL;
+ Tcl_GetIntForIndex(NULL, &obj, TCL_INDEX_NONE, (TkSizeT *)&obj.internalRep.doubleValue);
+ tsdPtr->endTypePtr = obj.typePtr;
obj.bytes = (char *)"0.0";
+ obj.length = 3;
obj.typePtr = NULL;
Tcl_GetDoubleFromObj(NULL, &obj, &obj.internalRep.doubleValue);
tsdPtr->doubleTypePtr = obj.typePtr;
- obj.bytes += 2;
+ obj.bytes = (char *)"0";
obj.length = 1;
obj.typePtr = NULL;
Tcl_GetLongFromObj(NULL, &obj, &obj.internalRep.longValue);
@@ -177,6 +206,51 @@ GetTypeCache(void)
/*
*----------------------------------------------------------------------
*
+ * TkGetIntForIndex --
+ *
+ * Almost the same as Tcl_GetIntForIndex, but it return an int, and it is
+ * more restricted. For example it only accepts "end", not "end-1", and
+ * only "2", not "1+1"
+ *
+ * Results:
+ * The return value is a standard Tcl object result.
+ *
+ * Side effects:
+ * None
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkGetIntForIndex(Tcl_Obj *indexObj, TkSizeT end, TkSizeT *indexPtr) {
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
+ if (Tcl_GetIntForIndex(NULL, indexObj, end, indexPtr) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (indexObj->typePtr == tsdPtr->endTypePtr) {
+ /* check for "end", but not "end-??" or "end+??" */
+ return (*indexPtr == end) ? TCL_OK : TCL_ERROR;
+ }
+ if (indexObj->typePtr != tsdPtr->intTypePtr) {
+ /* Neither do we accept "??-??" or "??+??" */
+ return TCL_ERROR;
+ }
+#if TCL_MAJOR_VERSION < 9
+ if (*indexPtr < -1) {
+ *indexPtr = TCL_INDEX_NONE;
+ }
+#endif
+ if ((*indexPtr != TCL_INDEX_NONE) && (*indexPtr > end)) {
+ *indexPtr = end + 1;
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* GetPixelsFromObjEx --
*
* Attempt to return a pixel value from the Tcl object "objPtr". If the
diff --git a/generic/tkUtil.c b/generic/tkUtil.c
index e2ba8b2..77adc6c 100644
--- a/generic/tkUtil.c
+++ b/generic/tkUtil.c
@@ -306,6 +306,7 @@ TkOffsetParseProc(
tsoffset.flags = INT_MAX;
goto goodTSOffset;
}
+ break;
case 'w':
if (value[1] != '\0') {goto badTSOffset;}
tsoffset.flags = TK_OFFSET_LEFT|TK_OFFSET_MIDDLE;
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 95d16de..306b818 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -124,7 +124,7 @@ static const TkCmd commands[] = {
{"place", Tk_PlaceObjCmd, PASSMAINWINDOW|ISSAFE},
{"raise", Tk_RaiseObjCmd, PASSMAINWINDOW|ISSAFE},
{"selection", Tk_SelectionObjCmd, PASSMAINWINDOW},
- {"tk", (Tcl_ObjCmdProc *) TkInitTkCmd, USEINITPROC|PASSMAINWINDOW|ISSAFE},
+ {"tk", (Tcl_ObjCmdProc *)(void *)TkInitTkCmd, USEINITPROC|PASSMAINWINDOW|ISSAFE},
{"tkwait", Tk_TkwaitObjCmd, PASSMAINWINDOW|ISSAFE},
{"update", Tk_UpdateObjCmd, PASSMAINWINDOW|ISSAFE},
{"winfo", Tk_WinfoObjCmd, PASSMAINWINDOW|ISSAFE},
@@ -937,7 +937,7 @@ TkCreateMainWindow(
clientData = NULL;
}
if (cmdPtr->flags & USEINITPROC) {
- ((TkInitProc *) cmdPtr->objProc)(interp, clientData);
+ ((TkInitProc *)(void *)cmdPtr->objProc)(interp, clientData);
} else {
Tcl_CreateObjCommand(interp, cmdPtr->name, cmdPtr->objProc,
clientData, NULL);
diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c
index 92b980a..cb5435a 100644
--- a/generic/ttk/ttkEntry.c
+++ b/generic/ttk/ttkEntry.c
@@ -1556,7 +1556,7 @@ EntryIndexCommand(
if (EntryIndex(interp, entryPtr, objv[2], &index) != TCL_OK) {
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index));
return TCL_OK;
}
@@ -1856,7 +1856,7 @@ static int ComboboxCurrentCommand(
}
}
cbPtr->combobox.currentIndex = currentIndex;
- Tcl_SetObjResult(interp, Tcl_NewIntObj(currentIndex));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(currentIndex));
return TCL_OK;
} else if (objc == 3) {
int result, index;
diff --git a/generic/ttk/ttkFrame.c b/generic/ttk/ttkFrame.c
index 6ce6a6c..85ef9fa 100644
--- a/generic/ttk/ttkFrame.c
+++ b/generic/ttk/ttkFrame.c
@@ -492,7 +492,7 @@ static void LabelframePlaceSlaves(void *recordPtr)
}
}
-static int LabelRequest(void *managerData, int index, int width, int height)
+static int LabelRequest(void *managerData, TkSizeT index, int width, int height)
{
(void)managerData;
(void)index;
@@ -509,7 +509,7 @@ static int LabelRequest(void *managerData, int index, int width, int height)
* This routine is also called when the widget voluntarily forgets
* the slave in LabelframeConfigure.
*/
-static void LabelRemoved(void *managerData, int slaveIndex)
+static void LabelRemoved(void *managerData, TkSizeT slaveIndex)
{
Labelframe *lframe = (Labelframe *)managerData;
(void)slaveIndex;
diff --git a/generic/ttk/ttkManager.c b/generic/ttk/ttkManager.c
index 3390805..5de14bd 100644
--- a/generic/ttk/ttkManager.c
+++ b/generic/ttk/ttkManager.c
@@ -342,7 +342,7 @@ void Ttk_LostSlaveProc(ClientData clientData, Tk_Window slaveWindow)
* Add a new slave window at the specified index.
*/
void Ttk_InsertSlave(
- Ttk_Manager *mgr, int index, Tk_Window tkwin, void *slaveData)
+ Ttk_Manager *mgr, TkSizeT index, Tk_Window tkwin, void *slaveData)
{
Ttk_Slave *slave = NewSlave(mgr, tkwin, slaveData);
InsertSlave(mgr, slave, index);
@@ -351,7 +351,7 @@ void Ttk_InsertSlave(
/* ++ Ttk_ForgetSlave --
* Unmanage the specified slave.
*/
-void Ttk_ForgetSlave(Ttk_Manager *mgr, int slaveIndex)
+void Ttk_ForgetSlave(Ttk_Manager *mgr, TkSizeT slaveIndex)
{
Tk_Window slaveWindow = mgr->slaves[slaveIndex]->slaveWindow;
RemoveSlave(mgr, slaveIndex);
@@ -366,7 +366,7 @@ void Ttk_ForgetSlave(Ttk_Manager *mgr, int slaveIndex)
* map the slave.
*/
void Ttk_PlaceSlave(
- Ttk_Manager *mgr, int slaveIndex, int x, int y, int width, int height)
+ Ttk_Manager *mgr, TkSizeT slaveIndex, int x, int y, int width, int height)
{
Ttk_Slave *slave = mgr->slaves[slaveIndex];
Tk_MaintainGeometry(slave->slaveWindow,mgr->masterWindow,x,y,width,height);
@@ -379,7 +379,7 @@ void Ttk_PlaceSlave(
/* ++ Ttk_UnmapSlave --
* Unmap the specified slave, but leave it managed.
*/
-void Ttk_UnmapSlave(Ttk_Manager *mgr, int slaveIndex)
+void Ttk_UnmapSlave(Ttk_Manager *mgr, TkSizeT slaveIndex)
{
Ttk_Slave *slave = mgr->slaves[slaveIndex];
Tk_UnmaintainGeometry(slave->slaveWindow, mgr->masterWindow);
@@ -405,15 +405,15 @@ void Ttk_ManagerSizeChanged(Ttk_Manager *mgr)
/* +++ Accessors.
*/
-int Ttk_NumberSlaves(Ttk_Manager *mgr)
+TkSizeT Ttk_NumberSlaves(Ttk_Manager *mgr)
{
return mgr->nSlaves;
}
-void *Ttk_SlaveData(Ttk_Manager *mgr, int slaveIndex)
+void *Ttk_SlaveData(Ttk_Manager *mgr, TkSizeT slaveIndex)
{
return mgr->slaves[slaveIndex]->slaveData;
}
-Tk_Window Ttk_SlaveWindow(Ttk_Manager *mgr, int slaveIndex)
+Tk_Window Ttk_SlaveWindow(Ttk_Manager *mgr, TkSizeT slaveIndex)
{
return mgr->slaves[slaveIndex]->slaveWindow;
}
@@ -425,13 +425,13 @@ Tk_Window Ttk_SlaveWindow(Ttk_Manager *mgr, int slaveIndex)
/* ++ Ttk_SlaveIndex --
* Returns the index of specified slave window, -1 if not found.
*/
-int Ttk_SlaveIndex(Ttk_Manager *mgr, Tk_Window slaveWindow)
+TkSizeT Ttk_SlaveIndex(Ttk_Manager *mgr, Tk_Window slaveWindow)
{
int index;
for (index = 0; index < mgr->nSlaves; ++index)
if (mgr->slaves[index]->slaveWindow == slaveWindow)
return index;
- return -1;
+ return TCL_INDEX_NONE;
}
/* ++ Ttk_GetSlaveIndexFromObj(interp, mgr, objPtr, indexPtr) --
@@ -488,7 +488,7 @@ int Ttk_GetSlaveIndexFromObj(
/* ++ Ttk_ReorderSlave(mgr, fromIndex, toIndex) --
* Change slave order.
*/
-void Ttk_ReorderSlave(Ttk_Manager *mgr, int fromIndex, int toIndex)
+void Ttk_ReorderSlave(Ttk_Manager *mgr, TkSizeT fromIndex, TkSizeT toIndex)
{
Ttk_Slave *moved = mgr->slaves[fromIndex];
diff --git a/generic/ttk/ttkManager.h b/generic/ttk/ttkManager.h
index 07fcea1..365a080 100644
--- a/generic/ttk/ttkManager.h
+++ b/generic/ttk/ttkManager.h
@@ -31,8 +31,8 @@ typedef struct { /* Manager hooks */
int (*RequestedSize)(void *managerData, int *widthPtr, int *heightPtr);
void (*PlaceSlaves)(void *managerData);
- int (*SlaveRequest)(void *managerData, int slaveIndex, int w, int h);
- void (*SlaveRemoved)(void *managerData, int slaveIndex);
+ int (*SlaveRequest)(void *managerData, TkSizeT slaveIndex, int w, int h);
+ void (*SlaveRemoved)(void *managerData, TkSizeT slaveIndex);
} Ttk_ManagerSpec;
/*
@@ -49,18 +49,18 @@ MODULE_SCOPE Ttk_Manager *Ttk_CreateManager(
MODULE_SCOPE void Ttk_DeleteManager(Ttk_Manager *);
MODULE_SCOPE void Ttk_InsertSlave(
- Ttk_Manager *, int position, Tk_Window, void *slaveData);
+ Ttk_Manager *, TkSizeT position, Tk_Window, void *slaveData);
-MODULE_SCOPE void Ttk_ForgetSlave(Ttk_Manager *, int slaveIndex);
+MODULE_SCOPE void Ttk_ForgetSlave(Ttk_Manager *, TkSizeT slaveIndex);
-MODULE_SCOPE void Ttk_ReorderSlave(Ttk_Manager *, int fromIndex, int toIndex);
+MODULE_SCOPE void Ttk_ReorderSlave(Ttk_Manager *, TkSizeT fromIndex, TkSizeT toIndex);
/* Rearrange slave positions */
MODULE_SCOPE void Ttk_PlaceSlave(
- Ttk_Manager *, int slaveIndex, int x, int y, int width, int height);
+ Ttk_Manager *, TkSizeT slaveIndex, int x, int y, int width, int height);
/* Position and map the slave */
-MODULE_SCOPE void Ttk_UnmapSlave(Ttk_Manager *, int slaveIndex);
+MODULE_SCOPE void Ttk_UnmapSlave(Ttk_Manager *, TkSizeT slaveIndex);
/* Unmap the slave */
MODULE_SCOPE void Ttk_ManagerSizeChanged(Ttk_Manager *);
@@ -69,7 +69,7 @@ MODULE_SCOPE void Ttk_ManagerLayoutChanged(Ttk_Manager *);
/* Utilities:
*/
-MODULE_SCOPE int Ttk_SlaveIndex(Ttk_Manager *, Tk_Window);
+MODULE_SCOPE TkSizeT Ttk_SlaveIndex(Ttk_Manager *, Tk_Window);
/* Returns: index in slave array of specified window, -1 if not found */
MODULE_SCOPE int Ttk_GetSlaveIndexFromObj(
@@ -77,13 +77,13 @@ MODULE_SCOPE int Ttk_GetSlaveIndexFromObj(
/* Accessor functions:
*/
-MODULE_SCOPE int Ttk_NumberSlaves(Ttk_Manager *);
+MODULE_SCOPE TkSizeT Ttk_NumberSlaves(Ttk_Manager *);
/* Returns: number of managed slaves */
-MODULE_SCOPE void *Ttk_SlaveData(Ttk_Manager *, int slaveIndex);
+MODULE_SCOPE void *Ttk_SlaveData(Ttk_Manager *, TkSizeT slaveIndex);
/* Returns: client data associated with slave */
-MODULE_SCOPE Tk_Window Ttk_SlaveWindow(Ttk_Manager *, int slaveIndex);
+MODULE_SCOPE Tk_Window Ttk_SlaveWindow(Ttk_Manager *, TkSizeT slaveIndex);
/* Returns: slave window */
MODULE_SCOPE int Ttk_Maintainable(Tcl_Interp *, Tk_Window slave, Tk_Window master);
diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c
index 7b3e8cb..93178f4 100644
--- a/generic/ttk/ttkNotebook.c
+++ b/generic/ttk/ttkNotebook.c
@@ -254,9 +254,9 @@ error:
* Return the index of the tab at point x,y,
* or -1 if no tab at that point.
*/
-static int IdentifyTab(Notebook *nb, int x, int y)
+static TkSizeT IdentifyTab(Notebook *nb, int x, int y)
{
- int index;
+ TkSizeT index;
for (index = 0; index < Ttk_NumberSlaves(nb->notebook.mgr); ++index) {
Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr,index);
if ( tab->state != TAB_STATE_HIDDEN
@@ -265,7 +265,7 @@ static int IdentifyTab(Notebook *nb, int x, int y)
return index;
}
}
- return -1;
+ return TCL_INDEX_NONE;
}
/*
@@ -287,19 +287,19 @@ static void ActivateTab(Notebook *nb, int index)
* The USER1 bit is set for the leftmost visible tab, and USER2
* is set for the rightmost visible tab.
*/
-static Ttk_State TabState(Notebook *nb, int index)
+static Ttk_State TabState(Notebook *nb, TkSizeT index)
{
Ttk_State state = nb->core.state;
Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index);
- int i = 0;
+ TkSizeT i = 0;
- if (index == nb->notebook.currentIndex) {
+ if ((int)index == nb->notebook.currentIndex) {
state |= TTK_STATE_SELECTED;
} else {
state &= ~TTK_STATE_FOCUS;
}
- if (index == nb->notebook.activeIndex) {
+ if ((int)index == nb->notebook.activeIndex) {
state |= TTK_STATE_ACTIVE;
}
for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) {
@@ -312,7 +312,7 @@ static Ttk_State TabState(Notebook *nb, int index)
}
break;
}
- for (i = Ttk_NumberSlaves(nb->notebook.mgr) - 1; i >= 0; --i) {
+ for (i = Ttk_NumberSlaves(nb->notebook.mgr) - 1; i != TCL_INDEX_NONE; --i) {
Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i);
if (tab->state == TAB_STATE_HIDDEN) {
continue;
@@ -351,7 +351,7 @@ static void TabrowSize(
{
Ttk_Layout tabLayout = nb->notebook.tabLayout;
int tabrowWidth = 0, tabrowHeight = 0;
- int i;
+ TkSizeT i;
for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) {
Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i);
@@ -391,7 +391,7 @@ static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr)
int clientWidth = 0, clientHeight = 0,
reqWidth = 0, reqHeight = 0,
tabrowWidth = 0, tabrowHeight = 0;
- int i;
+ TkSizeT i;
NotebookStyleOptions(nb, &nbstyle);
@@ -695,16 +695,16 @@ static void SelectNearestTab(Notebook *nb)
* Select the next tab if the current one is being removed.
* Adjust currentIndex to account for removed slave.
*/
-static void TabRemoved(void *managerData, int index)
+static void TabRemoved(void *managerData, TkSizeT index)
{
Notebook *nb = (Notebook *)managerData;
Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index);
- if (index == nb->notebook.currentIndex) {
+ if ((int)index == nb->notebook.currentIndex) {
SelectNearestTab(nb);
}
- if (index < nb->notebook.currentIndex) {
+ if ((int)index < nb->notebook.currentIndex) {
--nb->notebook.currentIndex;
}
@@ -713,7 +713,7 @@ static void TabRemoved(void *managerData, int index)
TtkRedisplayWidget(&nb->core);
}
-static int TabRequest(void *managerData, int index, int width, int height)
+static int TabRequest(void *managerData, TkSizeT index, int width, int height)
{
(void)managerData;
(void)index;
@@ -736,7 +736,7 @@ static int AddTab(
return TCL_ERROR;
}
#if 0 /* can't happen */
- if (Ttk_SlaveIndex(nb->notebook.mgr, slaveWindow) >= 0) {
+ if (Ttk_SlaveIndex(nb->notebook.mgr, slaveWindow) != TCL_INDEX_NONE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf("%s already added",
Tk_PathName(slaveWindow)));
Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "PRESENT", NULL);
@@ -796,7 +796,7 @@ static void NotebookEventHandler(ClientData clientData, XEvent *eventPtr)
Tk_DeleteEventHandler(nb->core.tkwin,
NotebookEventMask, NotebookEventHandler, clientData);
} else if (eventPtr->type == MotionNotify) {
- int index = IdentifyTab(nb, eventPtr->xmotion.x, eventPtr->xmotion.y);
+ TkSizeT index = IdentifyTab(nb, eventPtr->xmotion.x, eventPtr->xmotion.y);
ActivateTab(nb, index);
} else if (eventPtr->type == LeaveNotify) {
ActivateTab(nb, -1);
@@ -1059,7 +1059,8 @@ static int NotebookIdentifyCommand(
int what = IDENTIFY_ELEMENT;
Notebook *nb = (Notebook *)recordPtr;
Ttk_Element element = NULL;
- int x, y, tabIndex;
+ int x, y;
+ TkSizeT tabIndex;
if (objc < 4 || objc > 5) {
Tcl_WrongNumArgs(interp, 2,objv, "?what? x y");
@@ -1075,7 +1076,7 @@ static int NotebookIdentifyCommand(
}
tabIndex = IdentifyTab(nb, x, y);
- if (tabIndex >= 0) {
+ if (tabIndex != TCL_INDEX_NONE) {
Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, tabIndex);
Ttk_State state = TabState(nb, tabIndex);
Ttk_Layout tabLayout = nb->notebook.tabLayout;
@@ -1095,8 +1096,8 @@ static int NotebookIdentifyCommand(
}
break;
case IDENTIFY_TAB:
- if (tabIndex >= 0) {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(tabIndex));
+ if (tabIndex != TCL_INDEX_NONE) {
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(tabIndex));
}
break;
}
@@ -1123,14 +1124,14 @@ static int NotebookIndexCommand(
* Special-case for "end":
*/
if (!strcmp("end", Tcl_GetString(objv[2]))) {
- int nSlaves = Ttk_NumberSlaves(nb->notebook.mgr);
- Tcl_SetObjResult(interp, Tcl_NewIntObj(nSlaves));
+ TkSizeT nSlaves = Ttk_NumberSlaves(nb->notebook.mgr);
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(nSlaves));
return TCL_OK;
}
status = FindTabIndex(interp, nb, objv[2], &index);
- if (status == TCL_OK && index >= 0) {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
+ if (status == TCL_OK && index != -1) {
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index));
}
return status;
@@ -1172,7 +1173,7 @@ static int NotebookTabsCommand(
Notebook *nb = (Notebook *)recordPtr;
Ttk_Manager *mgr = nb->notebook.mgr;
Tcl_Obj *result;
- int i;
+ TkSizeT i;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 2, objv, "");
diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c
index 77e5b4e..105f823 100644
--- a/generic/ttk/ttkPanedwindow.c
+++ b/generic/ttk/ttkPanedwindow.c
@@ -206,7 +206,7 @@ static int ShoveUp(Paned *pw, int i, int pos)
* Same as ShoveUp, but going in the opposite direction
* and stopping at the sentinel sash.
*/
-static int ShoveDown(Paned *pw, int i, int pos)
+static int ShoveDown(Paned *pw, TkSizeT i, int pos)
{
Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr,i);
int sashThickness = pw->paned.sashThickness;
@@ -275,7 +275,7 @@ static void AdjustPanes(Paned *pw)
{
int sashThickness = pw->paned.sashThickness;
int pos = 0;
- int index;
+ TkSizeT index;
for (index = 0; index < Ttk_NumberSlaves(pw->paned.mgr); ++index) {
Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index);
@@ -372,7 +372,7 @@ static void PlacePanes(Paned *pw)
int width = Tk_Width(pw->core.tkwin), height = Tk_Height(pw->core.tkwin);
int sashThickness = pw->paned.sashThickness;
int pos = 0;
- int index;
+ TkSizeT index;
for (index = 0; index < Ttk_NumberSlaves(pw->paned.mgr); ++index) {
Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index);
@@ -403,7 +403,7 @@ static void PanedPlaceSlaves(void *managerData)
PlacePanes(pw);
}
-static void PaneRemoved(void *managerData, int index)
+static void PaneRemoved(void *managerData, TkSizeT index)
{
Paned *pw = (Paned *)managerData;
Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index);
@@ -419,7 +419,7 @@ static int AddPane(
if (!Ttk_Maintainable(interp, slaveWindow, pw->core.tkwin)) {
return TCL_ERROR;
}
- if (Ttk_SlaveIndex(pw->paned.mgr, slaveWindow) >= 0) {
+ if (Ttk_SlaveIndex(pw->paned.mgr, slaveWindow) != TCL_INDEX_NONE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%s already added", Tk_PathName(slaveWindow)));
Tcl_SetErrorCode(interp, "TTK", "PANE", "PRESENT", NULL);
@@ -445,7 +445,7 @@ static int AddPane(
* in order to avoid unexpected pane resizes (esp. while the
* user is dragging a sash [#1325286]).
*/
-static int PaneRequest(void *managerData, int index, int width, int height)
+static int PaneRequest(void *managerData, TkSizeT index, int width, int height)
{
Paned *pw = (Paned *)managerData;
Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index);
@@ -604,11 +604,11 @@ static void DrawSash(Paned *pw, int index, Drawable d)
static void PanedDisplay(void *recordPtr, Drawable d)
{
Paned *pw = (Paned *)recordPtr;
- int i, nSashes = Ttk_NumberSlaves(pw->paned.mgr) - 1;
+ TkSizeT i, nSlaves = Ttk_NumberSlaves(pw->paned.mgr);
TtkWidgetDisplay(recordPtr, d);
- for (i = 0; i < nSashes; ++i) {
- DrawSash(pw, i, d);
+ for (i = 1; i < nSlaves; ++i) {
+ DrawSash(pw, i - 1, d);
}
}
@@ -744,7 +744,7 @@ static int PanedIdentifyCommand(
/* Found it. */
switch (what) {
case IDENTIFY_SASH:
- Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index));
return TCL_OK;
case IDENTIFY_ELEMENT:
{
@@ -809,7 +809,7 @@ static int PanedPanesCommand(
Paned *pw = (Paned *)recordPtr;
Ttk_Manager *mgr = pw->paned.mgr;
Tcl_Obj *panes;
- int i;
+ TkSizeT i;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 2, objv, "");
@@ -844,7 +844,7 @@ static int PanedSashposCommand(
if (Tcl_GetIntFromObj(interp, objv[2], &sashIndex) != TCL_OK) {
return TCL_ERROR;
}
- if (sashIndex < 0 || sashIndex >= Ttk_NumberSlaves(pw->paned.mgr) - 1) {
+ if (sashIndex < 0 || (TkSizeT)(sashIndex + 1) >= Ttk_NumberSlaves(pw->paned.mgr)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"sash index %d out of range", sashIndex));
Tcl_SetErrorCode(interp, "TTK", "PANE", "SASH_INDEX", NULL);
@@ -854,7 +854,7 @@ static int PanedSashposCommand(
pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, sashIndex);
if (objc == 3) {
- Tcl_SetObjResult(interp, Tcl_NewIntObj(pane->sashPos));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(pane->sashPos));
return TCL_OK;
}
/* else -- set new sash position */
@@ -872,7 +872,7 @@ static int PanedSashposCommand(
AdjustPanes(pw);
Ttk_ManagerLayoutChanged(pw->paned.mgr);
- Tcl_SetObjResult(interp, Tcl_NewIntObj(pane->sashPos));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(pane->sashPos));
return TCL_OK;
}
diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c
index 9ec34d3..e5e756d 100644
--- a/generic/ttk/ttkTheme.c
+++ b/generic/ttk/ttkTheme.c
@@ -35,7 +35,7 @@ typedef struct Ttk_Style_
Ttk_ResourceCache cache; /* Back-pointer to resource cache */
} Style;
-static Style *NewStyle()
+static Style *NewStyle(void)
{
Style *stylePtr = (Style *)ckalloc(sizeof(Style));
diff --git a/library/scrlbar.tcl b/library/scrlbar.tcl
index bce8391..8106b3d 100644
--- a/library/scrlbar.tcl
+++ b/library/scrlbar.tcl
@@ -131,16 +131,10 @@ bind Scrollbar <<LineEnd>> {
if {[tk windowingsystem] eq "aqua"} {
bind Scrollbar <MouseWheel> {
- tk::ScrollByUnits %W v [expr {-(%D)}]
+ tk::ScrollByUnits %W hv [expr {-(%D)}]
}
bind Scrollbar <Option-MouseWheel> {
- tk::ScrollByUnits %W v [expr {-10 * (%D)}]
- }
- bind Scrollbar <Shift-MouseWheel> {
- tk::ScrollByUnits %W h [expr {-(%D)}]
- }
- bind Scrollbar <Shift-Option-MouseWheel> {
- tk::ScrollByUnits %W h [expr {-10 * (%D)}]
+ tk::ScrollByUnits %W hv [expr {-10 * (%D)}]
}
} else {
# We must make sure that positive and negative movements are rounded
@@ -151,27 +145,18 @@ if {[tk windowingsystem] eq "aqua"} {
# The following code ensure equal +/- behaviour.
bind Scrollbar <MouseWheel> {
if {%D >= 0} {
- tk::ScrollByUnits %W v [expr {-%D/30}]
- } else {
- tk::ScrollByUnits %W v [expr {(29-%D)/30}]
- }
- }
- bind Scrollbar <Shift-MouseWheel> {
- if {%D >= 0} {
- tk::ScrollByUnits %W h [expr {-%D/30}]
+ tk::ScrollByUnits %W hv [expr {-%D/30}]
} else {
- tk::ScrollByUnits %W h [expr {(29-%D)/30}]
+ tk::ScrollByUnits %W hv [expr {(29-%D)/30}]
}
}
}
if {[tk windowingsystem] eq "x11"} {
- bind Scrollbar <Button-4> {tk::ScrollByUnits %W v -5}
- bind Scrollbar <Button-5> {tk::ScrollByUnits %W v 5}
- bind Scrollbar <Shift-Button-4> {tk::ScrollByUnits %W h -5}
- bind Scrollbar <Shift-Button-5> {tk::ScrollByUnits %W h 5}
- bind Scrollbar <Button-6> {tk::ScrollByUnits %W h -5}
- bind Scrollbar <Button-7> {tk::ScrollByUnits %W h 5}
+ bind Scrollbar <Button-4> {tk::ScrollByUnits %W hv -5}
+ bind Scrollbar <Button-5> {tk::ScrollByUnits %W hv 5}
+ bind Scrollbar <Button-6> {tk::ScrollByUnits %W hv -5}
+ bind Scrollbar <Button-7> {tk::ScrollByUnits %W hv 5}
}
# tk::ScrollButtonDown --
diff --git a/library/ttk/fonts.tcl b/library/ttk/fonts.tcl
index a2781c6..d819973 100644
--- a/library/ttk/fonts.tcl
+++ b/library/ttk/fonts.tcl
@@ -53,10 +53,6 @@
# Most other toolkits use medium weight for all UI elements,
# which is what we do now.
#
-# Font size specified in pixels on X11, not points.
-# This is Theoretically Wrong, but in practice works better; using
-# points leads to huge inconsistencies across different servers.
-#
namespace eval ttk {
@@ -131,10 +127,10 @@ switch -- [tk windowingsystem] {
set F(family) "Helvetica"
set F(fixed) "courier"
}
- set F(size) -12
- set F(ttsize) -10
- set F(capsize) -14
- set F(fixedsize) -12
+ set F(size) 10
+ set F(ttsize) 9
+ set F(capsize) 12
+ set F(fixedsize) 10
font configure TkDefaultFont -family $F(family) -size $F(size)
font configure TkTextFont -family $F(family) -size $F(size)
diff --git a/library/ttk/scrollbar.tcl b/library/ttk/scrollbar.tcl
index 15f9cde..7537491 100644
--- a/library/ttk/scrollbar.tcl
+++ b/library/ttk/scrollbar.tcl
@@ -21,14 +21,13 @@ bind TScrollbar <ButtonRelease-2> { ttk::scrollbar::Release %W %x %y }
#
# The shift-bindings scroll left/right (not up/down)
# if a widget has both possibilities
-set eventList [list <MouseWheel> <Shift-MouseWheel>]
+set eventList [list <MouseWheel>]
switch [tk windowingsystem] {
aqua {
- lappend eventList <Option-MouseWheel> <Shift-Option-MouseWheel>
+ lappend eventList <Option-MouseWheel>
}
x11 {
- lappend eventList <Button-4> <Button-5> <Button-6> <Button-7>\
- <Shift-Button-4> <Shift-Button-5>
+ lappend eventList <Button-4> <Button-5> <Button-6> <Button-7>
}
}
foreach event $eventList {
diff --git a/macosx/tkMacOSXPort.h b/macosx/tkMacOSXPort.h
index 96b06da..6d23e55 100644
--- a/macosx/tkMacOSXPort.h
+++ b/macosx/tkMacOSXPort.h
@@ -1,7 +1,7 @@
/*
* tkMacOSXPort.h --
*
- * This file is included by all of the Tk C files. It contains
+ * This file is included by all of the Tk C files. It contains
* information that may be configuration-dependent, such as
* #includes for system include files and a few other things.
*
@@ -17,14 +17,15 @@
#define _TKMACPORT
#include <stdio.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <math.h>
#include <pwd.h>
-#include <stdlib.h>
#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <math.h>
#include <string.h>
+#include <limits.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <sys/file.h>
#ifdef HAVE_SYS_SELECT_H
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index fe6981d..d9ad52f 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -903,13 +903,14 @@ RedisplayView(
ClientData clientdata)
{
NSView *view = (NSView *) clientdata;
-
+
/*
* Make sure that we are not trying to displaying a view that no longer
- * exists.
+ * exists. Must call [NSApp windows] because [NSApp orderedWindows] excludes
+ * floating/utility windows and other window panels.
*/
- for (NSWindow *w in [NSApp orderedWindows]) {
+ for (NSWindow *w in [NSApp windows]) {
if ([w contentView] == view) {
[view setNeedsDisplay:YES];
break;
diff --git a/tests/canvas.test b/tests/canvas.test
index 1386208..5086389 100644
--- a/tests/canvas.test
+++ b/tests/canvas.test
@@ -227,6 +227,16 @@ test canvas-2.4 {CanvasWidgetCmd, xview option} -constraints nonPortable -body {
update
lappend x [.c xview]
} -result {{0.6 0.9} {0.66 0.96}}
+test canvas-2.5 {CanvasWidgetCmd, raise/lower option, no error on non-existing tags} -setup {
+ .c create line 0 0 10 10 -tags aline
+} -body {
+ .c raise aline noline
+ .c raise bline aline
+ .c lower aline noline
+ .c lower bline aline
+} -cleanup {
+ .c delete aline
+} -result {}
catch {destroy .c}
# Canvas used in 3.* test cases
diff --git a/tests/listbox.test b/tests/listbox.test
index e9a2f28..f994e45 100644
--- a/tests/listbox.test
+++ b/tests/listbox.test
@@ -724,7 +724,7 @@ test listbox-3.62 {ListboxWidgetCmd procedure, "index" option} -body {
} -result 18
test listbox-3.63 {ListboxWidgetCmd procedure, "index" option} -body {
.l index 34
-} -result 34
+} -result 19
test listbox-3.64 {ListboxWidgetCmd procedure, "insert" option} -body {
.l insert
} -returnCodes error -result {wrong # args: should be ".l insert index ?element ...?"}
@@ -2112,7 +2112,7 @@ test listbox-10.17 {GetListboxIndex procedure} -setup {
.l index 20
} -cleanup {
destroy .l
-} -result {20}
+} -result {13}
test listbox-10.18 {GetListboxIndex procedure} -setup {
destroy .l
} -body {
diff --git a/tests/scrollbar.test b/tests/scrollbar.test
index 8a9d2c4..e02e3a8 100644
--- a/tests/scrollbar.test
+++ b/tests/scrollbar.test
@@ -714,7 +714,7 @@ test scrollbar-10.1.2 {<MouseWheel> event on scrollbar} -constraints {aqua} -set
destroy .t .s
} -result {5.0}
-test scrollbar-10.2.1 {<MouseWheel> event on scrollbar} -constraints {notAqua} -setup {
+test scrollbar-10.2.1 {<Shift-MouseWheel> event on horizontal scrollbar} -constraints {notAqua} -setup {
destroy .t .s
} -body {
pack [text .t -xscrollcommand {.s set} -wrap none] -side top
@@ -728,7 +728,7 @@ test scrollbar-10.2.1 {<MouseWheel> event on scrollbar} -constraints {notAqua} -
} -cleanup {
destroy .t .s
} -result {1.4}
-test scrollbar-10.2.2 {<MouseWheel> event on scrollbar} -constraints {aqua} -setup {
+test scrollbar-10.2.2 {<Shift-MouseWheel> event on horizontal scrollbar} -constraints {aqua} -setup {
destroy .t .s
} -body {
pack [text .t -xscrollcommand {.s set} -wrap none] -side top
@@ -742,6 +742,34 @@ test scrollbar-10.2.2 {<MouseWheel> event on scrollbar} -constraints {aqua} -set
} -cleanup {
destroy .t .s
} -result {1.4}
+test scrollbar-10.2.3 {<MouseWheel> event on horizontal scrollbar} -constraints {notAqua} -setup {
+ destroy .t .s
+} -body {
+ pack [text .t -xscrollcommand {.s set} -wrap none] -side top
+ for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "}
+ pack [scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top
+ update
+ focus -force .s
+ event generate .s <MouseWheel> -delta -120
+ after 200 {set eventprocessed 1} ; vwait eventprocessed
+ .t index @0,0
+} -cleanup {
+ destroy .t .s
+} -result {1.4}
+test scrollbar-10.2.4 {<MouseWheel> event on horizontal scrollbar} -constraints {aqua} -setup {
+ destroy .t .s
+} -body {
+ pack [text .t -xscrollcommand {.s set} -wrap none] -side top
+ for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "}
+ pack [scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top
+ update
+ focus -force .s
+ event generate .s <MouseWheel> -delta -4
+ after 200 {set eventprocessed 1} ; vwait eventprocessed
+ .t index @0,0
+} -cleanup {
+ destroy .t .s
+} -result {1.4}
test scrollbar-11.1 {bug fix: [011706ec42] Scrollbar unsafe wrt widget destruction} -body {
proc destroy_scrollbar {} {
diff --git a/tests/textTag.test b/tests/textTag.test
index 0d0d89b..04a4b30 100644
--- a/tests/textTag.test
+++ b/tests/textTag.test
@@ -1233,7 +1233,8 @@ set y5 [expr [lindex $c 1] + [lindex $c 3]/2]
test textTag-15.1 {TkTextBindProc} -setup {
.t tag delete x y
- event generate {} <Motion> -warp 1 -x -1 -y -1; update
+ wm geometry . +200+200 ; update
+ event generate {} <Motion> -warp 1 -x 5 -y 5 ; update idletasks ; after 50
} -body {
bind .t <ButtonRelease> {lappend x up}
.t tag bind x <ButtonRelease> {lappend x x-up}
@@ -1258,7 +1259,8 @@ test textTag-15.1 {TkTextBindProc} -setup {
test textTag-15.2 {TkTextBindProc} -setup {
.t tag delete x y
- event generate {} <Motion> -warp 1 -x -1 -y -1; update
+ wm geometry . +200+200 ; update
+ event generate {} <Motion> -warp 1 -x 5 -y 5 ; update idletasks ; after 50
} -body {
.t tag bind x <Enter> {lappend x x-enter}
.t tag bind x <Button> {lappend x x-down}
@@ -1286,7 +1288,8 @@ test textTag-15.2 {TkTextBindProc} -setup {
test textTag-15.3 {TkTextBindProc} -setup {
.t tag delete x y
- event generate {} <Motion> -warp 1 -x -1 -y -1; update
+ wm geometry . +200+200 ; update
+ event generate {} <Motion> -warp 1 -x 5 -y 5 ; update idletasks ; after 50
} -body {
.t tag bind x <Enter> {lappend x x-enter}
.t tag bind x <Button-1> {lappend x x-down}
@@ -1319,7 +1322,8 @@ test textTag-15.3 {TkTextBindProc} -setup {
test textTag-16.1 {TkTextPickCurrent procedure} -setup {
.t tag delete {*}[.t tag names]
- event generate {} <Motion> -warp 1 -x -1 -y -1; update
+ wm geometry . +200+200 ; update
+ event generate {} <Motion> -warp 1 -x 5 -y 5 ; update idletasks ; after 50
} -body {
event gen .t <ButtonRelease-1> -state 0x100 -x $x1 -y $y1
set x [.t index current]
@@ -1341,7 +1345,8 @@ test textTag-16.2 {TkTextPickCurrent procedure} -constraints {
haveFontSizes
} -setup {
.t tag delete {*}[.t tag names]
- event generate {} <Motion> -warp 1 -x -1 -y -1; update
+ wm geometry . +200+200 ; update
+ event generate {} <Motion> -warp 1 -x 5 -y 5 ; update idletasks ; after 50
.t configure -font $textWidgetFont -wrap none
} -body {
.t tag configure big -font $bigFont
@@ -1360,7 +1365,8 @@ test textTag-16.3 {TkTextPickCurrent procedure} -setup {
foreach i {a b c d} {
.t tag remove $i 1.0 end
}
- event generate {} <Motion> -warp 1 -x -1 -y -1; update
+ wm geometry . +200+200 ; update
+ event generate {} <Motion> -warp 1 -x 5 -y 5 ; update idletasks ; after 50
} -body {
foreach i {a b c d} {
.t tag bind $i <Enter> "lappend x enter-$i"
@@ -1387,7 +1393,8 @@ test textTag-16.4 {TkTextPickCurrent procedure} -setup {
foreach i {a b c d} {
.t tag remove $i 1.0 end
}
- event generate {} <Motion> -warp 1 -x -1 -y -1; update
+ wm geometry . +200+200 ; update
+ event generate {} <Motion> -warp 1 -x 5 -y 5 ; update idletasks ; after 50
} -body {
foreach i {a b c d} {
.t tag bind $i <Enter> "lappend x enter-$i"
@@ -1415,7 +1422,8 @@ test textTag-16.5 {TkTextPickCurrent procedure} -constraints {
foreach i {big a b c d} {
.t tag remove $i 1.0 end
}
- event generate {} <Motion> -warp 1 -x -1 -y -1; update
+ wm geometry . +200+200 ; update
+ event generate {} <Motion> -warp 1 -x 5 -y 5 ; update idletasks ; after 50
.t configure -font $textWidgetFont -wrap none
} -body {
.t tag configure big -font $bigFont
@@ -1435,7 +1443,8 @@ test textTag-16.6 {TkTextPickCurrent procedure} -constraints {
foreach i {big a b c d} {
.t tag remove $i 1.0 end
}
- event generate {} <Motion> -warp 1 -x -1 -y -1; update
+ wm geometry . +200+200 ; update
+ event generate {} <Motion> -warp 1 -x 5 -y 5 ; update idletasks ; after 50
.t configure -font $textWidgetFont -wrap none
} -body {
.t tag configure big -font $bigFont
@@ -1456,7 +1465,8 @@ test textTag-16.7 {TkTextPickCurrent procedure} -constraints {
foreach i {big a b c d} {
.t tag remove $i 1.0 end
}
- event generate {} <Motion> -warp 1 -x -1 -y -1; update
+ wm geometry . +200+200 ; update
+ event generate {} <Motion> -warp 1 -x 5 -y 5 ; update idletasks ; after 50
.t configure -font $textWidgetFont -wrap none
} -body {
.t tag configure big -font $bigFont
@@ -1488,7 +1498,8 @@ test textTag-17.1 {insert procedure inserts tags} -setup {
test textTag-18.1 {TkTextPickCurrent tag bindings} -setup {
destroy .t
- event generate {} <Motion> -warp 1 -x -1 -y -1; update
+ wm geometry . +200+200 ; update
+ event generate {} <Motion> -warp 1 -x 5 -y 5 ; update idletasks ; after 50
} -body {
text .t -width 30 -height 4 -relief sunken -borderwidth 10 \
-highlightthickness 10 -pady 2
diff --git a/tests/ttk/scrollbar.test b/tests/ttk/scrollbar.test
index 0743def..443687a 100644
--- a/tests/ttk/scrollbar.test
+++ b/tests/ttk/scrollbar.test
@@ -70,6 +70,92 @@ test scrollbar-1.3 "Change orientation" -body {
expr {$h < $w}
} -result 1
+test scrollbar-10.1.1 {<MouseWheel> event on scrollbar} -constraints {notAqua} -setup {
+ destroy .t .s
+} -body {
+ pack [text .t -yscrollcommand {.s set}] -side left
+ for {set i 1} {$i < 100} {incr i} {.t insert end "Line $i\n"}
+ pack [ttk::scrollbar .s -command {.t yview}] -fill y -expand 1 -side left
+ update
+ focus -force .s
+ event generate .s <MouseWheel> -delta -120
+ after 200 {set eventprocessed 1} ; vwait eventprocessed
+ .t index @0,0
+} -cleanup {
+ destroy .t .s
+} -result {5.0}
+test scrollbar-10.1.2 {<MouseWheel> event on scrollbar} -constraints {aqua} -setup {
+ destroy .t .s
+} -body {
+ pack [text .t -yscrollcommand {.s set}] -side left
+ for {set i 1} {$i < 100} {incr i} {.t insert end "Line $i\n"}
+ pack [ttk::scrollbar .s -command {.t yview}] -fill y -expand 1 -side left
+ update
+ focus -force .s
+ event generate .s <MouseWheel> -delta -4
+ after 200 {set eventprocessed 1} ; vwait eventprocessed
+ .t index @0,0
+} -cleanup {
+ destroy .t .s
+} -result {5.0}
+
+test scrollbar-10.2.1 {<Shift-MouseWheel> event on horizontal scrollbar} -constraints {notAqua} -setup {
+ destroy .t .s
+} -body {
+ pack [text .t -xscrollcommand {.s set} -wrap none] -side top
+ for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "}
+ pack [ttk::scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top
+ update
+ focus -force .s
+ event generate .s <Shift-MouseWheel> -delta -120
+ after 200 {set eventprocessed 1} ; vwait eventprocessed
+ .t index @0,0
+} -cleanup {
+ destroy .t .s
+} -result {1.4}
+test scrollbar-10.2.2 {<Shift-MouseWheel> event on horizontal scrollbar} -constraints {aqua} -setup {
+ destroy .t .s
+} -body {
+ pack [text .t -xscrollcommand {.s set} -wrap none] -side top
+ for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "}
+ pack [ttk::scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top
+ update
+ focus -force .s
+ event generate .s <Shift-MouseWheel> -delta -4
+ after 200 {set eventprocessed 1} ; vwait eventprocessed
+ .t index @0,0
+} -cleanup {
+ destroy .t .s
+} -result {1.4}
+test scrollbar-10.2.3 {<MouseWheel> event on horizontal scrollbar} -constraints {notAqua} -setup {
+ destroy .t .s
+} -body {
+ pack [text .t -xscrollcommand {.s set} -wrap none] -side top
+ for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "}
+ pack [ttk::scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top
+ update
+ focus -force .s
+ event generate .s <MouseWheel> -delta -120
+ after 200 {set eventprocessed 1} ; vwait eventprocessed
+ .t index @0,0
+} -cleanup {
+ destroy .t .s
+} -result {1.4}
+test scrollbar-10.2.4 {<MouseWheel> event on horizontal scrollbar} -constraints {aqua} -setup {
+ destroy .t .s
+} -body {
+ pack [text .t -xscrollcommand {.s set} -wrap none] -side top
+ for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "}
+ pack [ttk::scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top
+ update
+ focus -force .s
+ event generate .s <MouseWheel> -delta -4
+ after 200 {set eventprocessed 1} ; vwait eventprocessed
+ .t index @0,0
+} -cleanup {
+ destroy .t .s
+} -result {1.4}
+
#
# Scale tests:
#
diff --git a/unix/tkUnixPort.h b/unix/tkUnixPort.h
index f51f1e7..eee7845 100644
--- a/unix/tkUnixPort.h
+++ b/unix/tkUnixPort.h
@@ -18,14 +18,15 @@
#define __UNIX__ 1
#include <stdio.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <math.h>
#include <pwd.h>
-#include <stdlib.h>
#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <math.h>
#include <string.h>
+#include <limits.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <sys/file.h>
#ifdef HAVE_SYS_SELECT_H
@@ -40,9 +41,9 @@
# include <time.h>
#else
# if HAVE_SYS_TIME_H
-# include <sys/time.h>
+# include <sys/time.h>
# else
-# include <time.h>
+# include <time.h>
# endif
#endif
#if HAVE_INTTYPES_H
diff --git a/win/configure b/win/configure
index 79138d3..f1eec1c 100755
--- a/win/configure
+++ b/win/configure
@@ -4276,7 +4276,7 @@ $as_echo "using shared flags" >&6; }
CFLAGS_WARNING="${CFLAGS_WARNING} -Wno-format"
;;
*)
- CFLAGS_WARNING="${CFLAGS_WARNING} -Wdeclaration-after-statement"
+ CFLAGS_WARNING="${CFLAGS_WARNING} -Wdeclaration-after-statement -Wstrict-prototypes"
;;
esac
diff --git a/win/tcl.m4 b/win/tcl.m4
index 9b07bd5..383c973 100644
--- a/win/tcl.m4
+++ b/win/tcl.m4
@@ -694,7 +694,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
CFLAGS_WARNING="${CFLAGS_WARNING} -Wno-format"
;;
*)
- CFLAGS_WARNING="${CFLAGS_WARNING} -Wdeclaration-after-statement"
+ CFLAGS_WARNING="${CFLAGS_WARNING} -Wdeclaration-after-statement -Wstrict-prototypes"
;;
esac
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c
index 8c80ca9..c9736d2 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.c
@@ -1202,7 +1202,7 @@ error_return: /* interp should already hold error */
* If new dialogs are available, COM is also initialized.
*----------------------------------------------------------------------
*/
-static int VistaFileDialogsAvailable()
+static int VistaFileDialogsAvailable(void)
{
HRESULT hr;
IFileDialog *fdlgPtr = NULL;
diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c
index c51b5be..7f20ed1 100644
--- a/win/ttkWinXPTheme.c
+++ b/win/ttkWinXPTheme.c
@@ -429,10 +429,10 @@ static void DestroyElementData(void *clientData)
{
ElementData *elementData = (ElementData *)clientData;
if (elementData->info->flags & HEAP_ELEMENT) {
- ckfree(elementData->info->statemap);
+ ckfree((char *)elementData->info->statemap);
ckfree((char *)elementData->info->className);
ckfree((char *)elementData->info->elementName);
- ckfree(elementData->info);
+ ckfree((char *)elementData->info);
}
ckfree(clientData);
}
@@ -1060,7 +1060,7 @@ static const ElementInfo ElementInfoTable[] = {
static int
GetSysFlagFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr)
{
- static const char *names[] = {
+ static const char *const names[] = {
"SM_CXBORDER", "SM_CYBORDER", "SM_CXVSCROLL", "SM_CYVSCROLL",
"SM_CXHSCROLL", "SM_CYHSCROLL", "SM_CXMENUCHECK", "SM_CYMENUCHECK",
"SM_CXMENUSIZE", "SM_CYMENUSIZE", "SM_CXSIZE", "SM_CYSIZE", "SM_CXSMSIZE",
diff --git a/xlib/X11/Xlib.h b/xlib/X11/Xlib.h
index 2db3f10..48cd28c 100644
--- a/xlib/X11/Xlib.h
+++ b/xlib/X11/Xlib.h
@@ -555,8 +555,8 @@ typedef struct _XDisplay {
* list to find the right procedure for each event might be
* expensive if many extensions are being used.
*/
- Bool (*event_vec[128])(); /* vector for wire to event */
- Status (*wire_vec[128])(); /* vector for event to wire */
+ Bool (*event_vec[128])(void); /* vector for wire to event */
+ Status (*wire_vec[128])(void); /* vector for event to wire */
KeySym lock_meaning; /* for XLookupString */
struct _XLockInfo *lock; /* multi-thread state, display lock */
struct _XInternalAsync *async_handlers; /* for internal async */
@@ -568,7 +568,7 @@ typedef struct _XDisplay {
struct _XDisplayAtoms *atoms; /* for XInternAtom */
unsigned int mode_switch; /* keyboard group modifiers */
struct _XContextDB *context_db; /* context database */
- Bool (**error_vec)(); /* vector for wire to error */
+ Bool (**error_vec)(void); /* vector for wire to error */
/*
* Xcms information
*/
@@ -581,7 +581,7 @@ typedef struct _XDisplay {
struct _XIMFilter *im_filters;
struct _XSQEvent *qfree; /* unallocated event queue elements */
unsigned long next_event_serial_num; /* inserted into next queue elt */
- int (*savedsynchandler)(); /* user synchandler when Xlib usurps */
+ int (*savedsynchandler)(void); /* user synchandler when Xlib usurps */
} Display;
#if NeedFunctionPrototypes /* prototypes require event type definitions */