summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-01-09 15:39:04 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-01-09 15:39:04 (GMT)
commit5acfe027a8779f827735f953b7453a126c71d2b5 (patch)
tree6985c030aec5d323290b61c70eba7b62bade3e53
parentdeefbc9ef76a6fb4574685f9625651e84360d266 (diff)
parenta6125082b3d0c0ffbc75c342295e1f534a90bbf7 (diff)
downloadtk-5acfe027a8779f827735f953b7453a126c71d2b5.zip
tk-5acfe027a8779f827735f953b7453a126c71d2b5.tar.gz
tk-5acfe027a8779f827735f953b7453a126c71d2b5.tar.bz2
Merge 8.7
-rw-r--r--generic/tkFocus.c8
-rw-r--r--generic/tkGeometry.c2
-rw-r--r--generic/tkInt.h6
-rw-r--r--generic/tkPkgConfig.c5
-rw-r--r--generic/tkTextWind.c20
-rw-r--r--generic/tkWindow.c6
-rw-r--r--generic/ttk/ttkManager.c17
-rw-r--r--generic/ttk/ttkNotebook.c4
-rw-r--r--generic/ttk/ttkTreeview.c75
-rw-r--r--macosx/tkMacOSXMouseEvent.c141
-rw-r--r--macosx/tkMacOSXWm.c5
-rw-r--r--tests/bind.test5
-rw-r--r--tests/constraints.tcl1
-rw-r--r--tests/pkgconfig.test14
-rw-r--r--tests/scrollbar.test17
-rw-r--r--tests/textTag.test4
-rw-r--r--tests/textWind.test241
-rw-r--r--tests/ttk/entry.test2
-rw-r--r--tests/ttk/treeview.test8
-rw-r--r--unix/tkUnixWm.c2
-rw-r--r--win/tkWinWm.c12
21 files changed, 333 insertions, 262 deletions
diff --git a/generic/tkFocus.c b/generic/tkFocus.c
index 5dc542a..0793db1 100644
--- a/generic/tkFocus.c
+++ b/generic/tkFocus.c
@@ -315,7 +315,7 @@ TkFocusFilterEvent(
* embedded child. We don't care about this, although we may end
* up getting a NotifyPointer later.
* NotifyInferior - focus is coming to us from an embedded child. When
- * focus is on an embeded focus, we still think we have the
+ * focus is on an embedded focus, we still think we have the
* focus, too, so this message doesn't change our state.
* NotifyPointerRoot - should never happen because this is sent to the
* root window.
@@ -369,7 +369,7 @@ TkFocusFilterEvent(
}
/*
- * If winPtr isn't a top-level window than just ignore the event.
+ * If winPtr isn't a top-level window then just ignore the event.
*/
winPtr = TkWmFocusToplevel(winPtr);
@@ -636,7 +636,7 @@ TkSetFocusWin(
* We are assigning focus to an embedded toplevel. The platform
* specific function TkpClaimFocus needs to handle the job of
* assigning focus to the container, since we have no way to find the
- * contaiuner.
+ * container.
*/
TkpClaimFocus(topLevelPtr, force);
@@ -1167,7 +1167,7 @@ TkFocusSplit(
*
* TkFocusJoin --
*
- * Remove the focus record for this window that is nolonger managed
+ * Remove the focus record for this window that is no longer managed
*
* Results:
* None.
diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c
index 35bf58e..10344f7 100644
--- a/generic/tkGeometry.c
+++ b/generic/tkGeometry.c
@@ -561,7 +561,7 @@ Tk_MaintainGeometry(
void
Tk_UnmaintainGeometry(
- Tk_Window window, /* WIndow for geometry management. */
+ Tk_Window window, /* Window for geometry management. */
Tk_Window container) /* Container for window; must be a descendant of
* window's parent. */
{
diff --git a/generic/tkInt.h b/generic/tkInt.h
index 4a358fe..98ed3b3 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -148,6 +148,12 @@
# define TCL_LL_MODIFIER "ll"
#endif
+#if TCL_MAJOR_VERSION > 8
+# define TKSIZET_MODIFIER TCL_Z_MODIFIER
+#else
+# define TKSIZET_MODIFIER ""
+#endif
+
/*
* Opaque type declarations:
*/
diff --git a/generic/tkPkgConfig.c b/generic/tkPkgConfig.c
index 2c0615d..5050f8a 100644
--- a/generic/tkPkgConfig.c
+++ b/generic/tkPkgConfig.c
@@ -95,15 +95,14 @@
#endif
static const Tcl_Config cfg[] = {
+#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
{"debug", CFG_DEBUG},
{"threaded", CFG_THREADED},
{"profiled", CFG_PROFILED},
{"64bit", CFG_64},
{"optimized", CFG_OPTIMIZED},
-#ifdef TK_NO_DEPRECATED
- {"nodeprecated", "1"},
-#endif
{"mem_debug", CFG_MEMDEBUG},
+#endif
{"fontsystem", CFG_FONTSYSTEM},
/* Runtime paths to various stuff */
diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c
index d63ad32..7d56084 100644
--- a/generic/tkTextWind.c
+++ b/generic/tkTextWind.c
@@ -1129,16 +1129,6 @@ TkTextEmbWinDisplayProc(
&lineX, &windowY, &width, &height);
windowX = lineX - chunkPtr->x + x;
- /*
- * Mark the window as displayed so that it won't get unmapped.
- * This needs to be done before the next instruction block because
- * Tk_MaintainGeometry/Tk_MapWindow will run event handlers, in
- * particular for the <Map> event, and if the bound script deletes
- * the embedded window its clients will get freed.
- */
-
- client->displayed = 1;
-
if (textPtr->tkwin == Tk_Parent(tkwin)) {
if ((windowX != Tk_X(tkwin)) || (windowY != Tk_Y(tkwin))
|| (Tk_ReqWidth(tkwin) != Tk_Width(tkwin))
@@ -1150,6 +1140,16 @@ TkTextEmbWinDisplayProc(
Tk_MaintainGeometry(tkwin, textPtr->tkwin, windowX, windowY,
width, height);
}
+
+ /*
+ * Mark the window as displayed so that it won't get unmapped.
+ * <TODO>: Tk_MaintainGeometry/Tk_MapWindow may run event handlers,
+ * in particular for the <Map> event. If the bound script
+ * deletes the embedded window or the text widget we will
+ * soon crash.
+ */
+
+ client->displayed = 1;
}
/*
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 525a6d9..9510254 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -1000,6 +1000,9 @@ TkCreateMainWindow(
#ifdef USE_NMAKE
".nmake"
#endif
+#ifdef TK_NO_DEPRECATED
+ ".no-deprecate"
+#endif
#ifndef TCL_CFG_OPTIMIZED
".no-optimize"
#endif
@@ -1026,6 +1029,9 @@ TkCreateMainWindow(
#endif
#if !defined(_WIN32) && !defined(MAC_OSX_TK)
".x11"
+#if !defined(HAVE_XFT)
+ ".no-xft"
+#endif
#endif
), NULL);
}
diff --git a/generic/ttk/ttkManager.c b/generic/ttk/ttkManager.c
index c3257c3..22c5ddb 100644
--- a/generic/ttk/ttkManager.c
+++ b/generic/ttk/ttkManager.c
@@ -314,13 +314,14 @@ void Ttk_GeometryRequestProc(ClientData clientData, Tk_Window window)
{
Ttk_Manager *mgr = (Ttk_Manager *)clientData;
TkSizeT index = Ttk_ContentIndex(mgr, window);
- int reqWidth = Tk_ReqWidth(window);
- int reqHeight= Tk_ReqHeight(window);
- if (mgr->managerSpec->ContentRequest(
- mgr->managerData, index, reqWidth, reqHeight))
- {
- ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED);
+ if (index != TCL_INDEX_NONE) {
+ int reqWidth = Tk_ReqWidth(window);
+ int reqHeight= Tk_ReqHeight(window);
+ if (mgr->managerSpec->ContentRequest(
+ mgr->managerData, index, reqWidth, reqHeight)) {
+ ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED);
+ }
}
}
@@ -329,7 +330,7 @@ void Ttk_LostContentProc(ClientData clientData, Tk_Window window)
Ttk_Manager *mgr = (Ttk_Manager *)clientData;
TkSizeT index = Ttk_ContentIndex(mgr, window);
- /* ASSERT: index >= 0 */
+ /* ASSERT: index != TCL_INDEX_NONE */
RemoveContent(mgr, index);
}
@@ -422,7 +423,7 @@ Tk_Window Ttk_ContentWindow(Ttk_Manager *mgr, TkSizeT index)
*/
/* ++ Ttk_ContentIndex --
- * Returns the index of specified content window, -1 if not found.
+ * Returns the index of specified content window, TCL_INDEX_NONE if not found.
*/
TkSizeT Ttk_ContentIndex(Ttk_Manager *mgr, Tk_Window window)
{
diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c
index f9d0308..15edc59 100644
--- a/generic/ttk/ttkNotebook.c
+++ b/generic/ttk/ttkNotebook.c
@@ -899,7 +899,7 @@ static int NotebookAddCommand(
{
Notebook *nb = (Notebook *)recordPtr;
Tk_Window window;
- int index;
+ TkSizeT index;
Tab *tab;
if (objc <= 2 || objc % 2 != 1) {
@@ -913,7 +913,7 @@ static int NotebookAddCommand(
}
index = Ttk_ContentIndex(nb->notebook.mgr, window);
- if (index < 0) { /* New tab */
+ if (index == TCL_INDEX_NONE) { /* New tab */
return AddTab(interp, nb, Ttk_NumberContent(nb->notebook.mgr), window, objc-3,objv+3);
}
diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c
index 18ce91f..b5b0a90 100644
--- a/generic/ttk/ttkTreeview.c
+++ b/generic/ttk/ttkTreeview.c
@@ -414,15 +414,13 @@ typedef struct {
/* Derived resources:
*/
Tcl_HashTable columnNames; /* Map: column name -> column table entry */
- int nColumns; /* #columns */
- unsigned showFlags; /* bitmask of subparts to display */
-
+ TkSizeT nColumns; /* #columns */
+ TkSizeT nDisplayColumns; /* #display columns */
TreeColumn **displayColumns; /* List of columns for display (incl tree) */
- int nDisplayColumns; /* #display columns */
Ttk_Box headingArea; /* Display area for column headings */
Ttk_Box treeArea; /* Display area for tree */
int slack; /* Slack space (see Resizing section) */
-
+ unsigned showFlags; /* bitmask of subparts to display */
} TreePart;
typedef struct {
@@ -521,7 +519,7 @@ static TreeColumn *GetColumn(
Tcl_Interp *interp, Treeview *tv, Tcl_Obj *columnIDObj)
{
Tcl_HashEntry *entryPtr;
- int columnIndex;
+ TkSizeT columnIndex;
/* Check for named column:
*/
@@ -531,12 +529,12 @@ static TreeColumn *GetColumn(
return (TreeColumn *)Tcl_GetHashValue(entryPtr);
}
- /* Check for number:
+ /* Check for index:
*/
- if (Tcl_GetIntFromObj(NULL, columnIDObj, &columnIndex) == TCL_OK) {
- if (columnIndex < 0 || columnIndex >= tv->tree.nColumns) {
+ if (TkGetIntForIndex(columnIDObj, tv->tree.nColumns - 1, 1, &columnIndex) == TCL_OK) {
+ if (columnIndex == TCL_INDEX_NONE || columnIndex >= tv->tree.nColumns) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "Column index %s out of bounds",
+ "Column index \"%s\" out of bounds",
Tcl_GetString(columnIDObj)));
Tcl_SetErrorCode(interp, "TTK", "TREE", "COLBOUND", NULL);
return NULL;
@@ -556,11 +554,11 @@ static TreeColumn *GetColumn(
static TreeColumn *FindColumn(
Tcl_Interp *interp, Treeview *tv, Tcl_Obj *columnIDObj)
{
- int colno;
+ TkSizeT colno;
- if (sscanf(Tcl_GetString(columnIDObj), "#%d", &colno) == 1)
+ if (sscanf(Tcl_GetString(columnIDObj), "#%" TKSIZET_MODIFIER "d", &colno) == 1)
{ /* Display column specification, #n */
- if (colno >= 0 && colno < tv->tree.nDisplayColumns) {
+ if (colno != TCL_INDEX_NONE && (TkSizeT)colno < tv->tree.nDisplayColumns) {
return tv->tree.displayColumns[colno];
}
/* else */
@@ -648,7 +646,7 @@ static Tcl_Obj *ItemID(Treeview *tv, TreeItem *item)
*/
static void TreeviewFreeColumns(Treeview *tv)
{
- int i;
+ TkSizeT i;
Tcl_DeleteHashTable(&tv->tree.columnNames);
Tcl_InitHashTable(&tv->tree.columnNames, TCL_STRING_KEYS);
@@ -766,7 +764,7 @@ static int TreeviewInitDisplayColumns(Tcl_Interp *interp, Treeview *tv)
*/
static int TreeWidth(Treeview *tv)
{
- int i = FirstColumn(tv);
+ TkSizeT i = FirstColumn(tv);
int width = 0;
while (i < tv->tree.nDisplayColumns) {
@@ -846,7 +844,7 @@ static int ShoveLeft(Treeview *tv, int i, int n)
*/
static int ShoveRight(Treeview *tv, int i, int n)
{
- while (n != 0 && i < tv->tree.nDisplayColumns) {
+ while (n != 0 && (TkSizeT)i < tv->tree.nDisplayColumns) {
TreeColumn *c = tv->tree.displayColumns[i];
if (c->stretch) {
n -= Stretch(c, n);
@@ -867,7 +865,8 @@ static int DistributeWidth(Treeview *tv, int n)
{
int w = TreeWidth(tv);
int m = 0;
- int i, d, r;
+ TkSizeT i;
+ int d, r;
for (i = FirstColumn(tv); i < tv->tree.nDisplayColumns; ++i) {
if (tv->tree.displayColumns[i]->stretch) {
@@ -1348,9 +1347,9 @@ static TreeItem *IdentifyItem(Treeview *tv, int y)
* Returns the display column number at the specified x position,
* or -1 if x is outside any columns.
*/
-static int IdentifyDisplayColumn(Treeview *tv, int x, int *x1)
+static TkSizeT IdentifyDisplayColumn(Treeview *tv, int x, int *x1)
{
- int colno = FirstColumn(tv);
+ TkSizeT colno = FirstColumn(tv);
int xpos = tv->tree.treeArea.x - tv->tree.xscroll.first;
while (colno < tv->tree.nDisplayColumns) {
@@ -1364,7 +1363,7 @@ static int IdentifyDisplayColumn(Treeview *tv, int x, int *x1)
xpos = next_xpos;
}
- return -1;
+ return TCL_INDEX_NONE;
}
/* + RowNumber --
@@ -1465,7 +1464,8 @@ static int BoundingBox(
bbox.width = TreeWidth(tv);
if (column) {
- int xpos = 0, i = FirstColumn(tv);
+ int xpos = 0;
+ TkSizeT i = FirstColumn(tv);
while (i < tv->tree.nDisplayColumns) {
if (tv->tree.displayColumns[i] == column) {
break;
@@ -1508,11 +1508,11 @@ static const char *const regionStrings[] = {
static TreeRegion IdentifyRegion(Treeview *tv, int x, int y)
{
- int x1 = 0, colno;
+ int x1 = 0;
+ TkSizeT colno = IdentifyDisplayColumn(tv, x, &x1);
- colno = IdentifyDisplayColumn(tv, x, &x1);
if (Ttk_BoxContains(tv->tree.headingArea, x, y)) {
- if (colno < 0) {
+ if (colno == TCL_INDEX_NONE) {
return REGION_NOTHING;
} else if (-HALO <= x1 - x && x1 - x <= HALO) {
return REGION_SEPARATOR;
@@ -1683,7 +1683,7 @@ static void DrawHeadings(Treeview *tv, Drawable d)
const int x0 = tv->tree.headingArea.x - tv->tree.xscroll.first;
const int y0 = tv->tree.headingArea.y;
const int h0 = tv->tree.headingArea.height;
- int i = FirstColumn(tv);
+ TkSizeT i = FirstColumn(tv);
int x = 0;
while (i < tv->tree.nDisplayColumns) {
@@ -1722,7 +1722,7 @@ static void DrawCells(
int rowHeight = tv->tree.rowHeight;
int nValues = 0;
Tcl_Obj **values = 0;
- int i;
+ TkSizeT i;
if (!item->valuesObj) {
return;
@@ -1730,7 +1730,7 @@ static void DrawCells(
Tcl_ListObjGetElements(NULL, item->valuesObj, &nValues, &values);
for (i = 0; i < tv->tree.nColumns; ++i) {
- tv->tree.columns[i].data = (i < nValues) ? values[i] : 0;
+ tv->tree.columns[i].data = (i < (TkSizeT)nValues) ? values[i] : 0;
}
for (i = 1; i < tv->tree.nDisplayColumns; ++i) {
@@ -2192,7 +2192,7 @@ static int TreeviewHorribleIdentify(
const char *what = "nothing", *detail = NULL;
TreeItem *item = 0;
Tcl_Obj *result;
- int dColumnNumber;
+ TkSizeT dColumnNumber;
char dcolbuf[16];
int x, y, x1;
(void)objc;
@@ -2205,10 +2205,10 @@ static int TreeviewHorribleIdentify(
}
dColumnNumber = IdentifyDisplayColumn(tv, x, &x1);
- if (dColumnNumber < 0) {
+ if (dColumnNumber == TCL_INDEX_NONE) {
goto done;
}
- sprintf(dcolbuf, "#%d", dColumnNumber);
+ sprintf(dcolbuf, "#%" TKSIZET_MODIFIER "u", dColumnNumber);
if (Ttk_BoxContains(tv->tree.headingArea,x,y)) {
if (-HALO <= x1 - x && x1 - x <= HALO) {
@@ -2276,7 +2276,8 @@ static int TreeviewIdentifyCommand(
Ttk_Box bbox;
TreeItem *item;
TreeColumn *column = 0;
- int colno, x1;
+ TkSizeT colno;
+ int x1;
if (objc == 4) { /* Old form */
return TreeviewHorribleIdentify(interp, objc, objv, tv);
@@ -2296,7 +2297,7 @@ static int TreeviewIdentifyCommand(
region = IdentifyRegion(tv, x, y);
item = IdentifyItem(tv, y);
colno = IdentifyDisplayColumn(tv, x, &x1);
- column = (colno >= 0) ? tv->tree.displayColumns[colno] : NULL;
+ column = (colno != TCL_INDEX_NONE) ? tv->tree.displayColumns[colno] : NULL;
switch (submethod)
{
@@ -2312,8 +2313,8 @@ static int TreeviewIdentifyCommand(
break;
case I_COLUMN :
- if (colno >= 0) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf("#%d", colno));
+ if (colno != TCL_INDEX_NONE) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("#%" TKSIZET_MODIFIER "u", colno));
}
break;
@@ -2459,7 +2460,7 @@ static int TreeviewSetCommand(
Treeview *tv = (Treeview *)recordPtr;
TreeItem *item;
TreeColumn *column;
- int columnNumber;
+ TkSizeT columnNumber;
if (objc < 3 || objc > 5) {
Tcl_WrongNumArgs(interp, 2, objv, "item ?column ?value??");
@@ -2526,7 +2527,7 @@ static int TreeviewSetCommand(
/* Make sure -values is fully populated:
*/
Tcl_ListObjLength(interp, item->valuesObj, &length);
- while (length < tv->tree.nColumns) {
+ while ((TkSizeT)length < tv->tree.nColumns) {
Tcl_Obj *empty = Tcl_NewStringObj("",0);
Tcl_ListObjAppendElement(interp, item->valuesObj, empty);
++length;
@@ -2866,7 +2867,7 @@ static int TreeviewDragCommand(
{
Treeview *tv = (Treeview *)recordPtr;
int left = tv->tree.treeArea.x - tv->tree.xscroll.first;
- int i = FirstColumn(tv);
+ TkSizeT i = FirstColumn(tv);
TreeColumn *column;
int newx;
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c
index fcbce34..b309261 100644
--- a/macosx/tkMacOSXMouseEvent.c
+++ b/macosx/tkMacOSXMouseEvent.c
@@ -54,19 +54,19 @@ enum {
*/
/* The basic job of tkProcessMouseEvent is to generate a call to
- * TkUpdatePointer. That function receives a Tk_Window which (ignoring cases
+ * Tk_UpdatePointer. That function receives a Tk_Window which (ignoring cases
* when a grab is in effect) should be the highest window within the focused
* toplevel that contains the pointer, as well as the pointer location in
* screen coordinates and the current button state. Tk maintains a cache of
- * these three values. A change in any of these values causes TkUpdatePointer
+ * these three values. A change in any of these values causes Tk_UpdatePointer
* to generate, respectively, Enter/Leave events, or Motion events, or
* button Press/Release events. The Tk_Window value is allowed to be NULL,
* which indicates that the pointer is not in the focused toplevel.
*
* Enter or Leave events for toplevel windows are generated when the Tk_Window
* value changes to or from NULL. This is problematic on macOS due to the fact
- * that TkUpdatePointer does not generate Motion events when the Tk_Window
- * value is NULL. A consequence of this is that TkUpdatePointer will either
+ * that Tk_UpdatePointer does not generate Motion events when the Tk_Window
+ * value is NULL. A consequence of this is that Tk_UpdatePointer will either
* fail to generate correct Enter/Leave events for toplevels or else be unable
* to generate Motion events when the pointer is outside of the focus window.
* It is important to be able to generate such events because otherwise a
@@ -99,6 +99,7 @@ enum {
Bool isTestingEvent = NO;
Bool isMotionEvent = NO;
Bool isOutside = NO;
+ Bool firstDrag = NO;
static Bool ignoreDrags = NO;
static Bool ignoreUpDown = NO;
static NSTimeInterval timestamp = 0;
@@ -142,13 +143,19 @@ enum {
buttonState &= ~Tk_GetButtonMask(button);
break;
case NSLeftMouseDragged:
- if (isOutside && ![NSApp tkDragTarget]) {
- ignoreDrags = YES;
+ if (![NSApp tkDragTarget]) {
+ if (isOutside) {
+ ignoreDrags = YES;
+ } else {
+ firstDrag = YES;
+ }
}
if (ignoreDrags) {
return theEvent;
}
- [NSApp setTkDragTarget: [NSApp tkEventTarget]];
+ if (![NSApp tkDragTarget]) {
+ [NSApp setTkDragTarget: [NSApp tkEventTarget]];
+ }
break;
case NSRightMouseDragged:
case NSOtherMouseDragged:
@@ -182,10 +189,29 @@ enum {
ignoreDrags = NO;
return theEvent;
}
+ buttonState &= ~Tk_GetButtonMask(Button1);
break;
case NSLeftMouseDown:
/*
+ * There are situations where Apple does not send NSLeftMouseUp events
+ * even though the mouse button has been released. One of these is
+ * whenever a menu is posted on the screen. This causes Tk to have an
+ * inaccurate idea of the current button state and to behave strangely.
+ * (See ticket[a132b5507e].) As a work-around we watch for NSButtonDown
+ * events that arrive when Tk thinks the button is already down and
+ * we attempt to correct Tk's cached button state by insering a call to
+ * Tk_UpdatePointer showing the button as up.
+ */
+
+ if ([NSApp tkButtonState] & Tk_GetButtonMask(Button1)) {
+ int fakeState = [NSApp tkButtonState] & ~Tk_GetButtonMask(Button1);
+ int x = location.x;
+ int y = floor(TkMacOSXZeroScreenHeight() - location.y);
+ Tk_UpdatePointer((Tk_Window) [NSApp tkEventTarget], x, y, fakeState);
+ }
+
+ /*
* Ignore left mouse button events which are in an NSWindow but outside
* of its contentView (see tickets [d72abe6b54] and [39cbacb9e8]).
* Ignore the first left button press after a live resize ends. (Apple
@@ -285,36 +311,26 @@ enum {
}
/*
- * Find the toplevel window for the event. If a capture has been
- * set this may involve redirecting the event.
+ * Find the toplevel window for the event.
*/
- capture = TkpGetCapture();
- if (capture) {
- winPtr = (TkWindow *) capture;
- eventWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window);
- if (!eventWindow) {
+ if ([NSApp tkDragTarget]) {
+ TkWindow *dragPtr = (TkWindow *) [NSApp tkDragTarget];
+ TKWindow *dragWindow = nil;
+ if (dragPtr) {
+ dragWindow = (TKWindow *)TkMacOSXGetNSWindowForDrawable(
+ dragPtr->window);
+ }
+ if (!dragWindow) {
+ [NSApp setTkDragTarget: nil];
+ target = NULL;
return theEvent;
}
+ winPtr = TkMacOSXGetHostToplevel((TkWindow *) [NSApp tkDragTarget])->winPtr;
+ } else if (eventType == NSScrollWheel) {
+ winPtr = scrollTarget;
} else {
- if ([NSApp tkDragTarget]) {
- TkWindow *dragPtr = (TkWindow *) [NSApp tkDragTarget];
- TKWindow *dragWindow = nil;
- if (dragPtr) {
- dragWindow = (TKWindow *)TkMacOSXGetNSWindowForDrawable(
- dragPtr->window);
- }
- if (!dragWindow) {
- [NSApp setTkDragTarget: nil];
- target = NULL;
- return theEvent;
- }
- winPtr = TkMacOSXGetHostToplevel((TkWindow *) [NSApp tkDragTarget])->winPtr;
- } else if (eventType == NSScrollWheel) {
- winPtr = scrollTarget;
- } else {
- winPtr = [NSApp tkEventTarget];
- }
+ winPtr = [NSApp tkEventTarget];
}
if (!winPtr) {
@@ -373,21 +389,16 @@ enum {
*/
if ([NSApp tkDragTarget]) {
- TkWindow *w = (TkWindow *) [NSApp tkDragTarget];
- win_x = global.x;
- win_y = global.y;
- for (; w != NULL; w = w->parentPtr) {
- win_x -= Tk_X(w);
- win_y -= Tk_Y(w);
- if (Tk_IsTopLevel(w)) {
-
- /*
- * Adjust for the titlebar.
- */
-
- win_y -= (eventWindow.frame.size.height -
- contentView.bounds.size.height);
- break;
+ Tk_Window dragTarget = (Tk_Window) [NSApp tkDragTarget];
+ Tk_Window dragWidget = NULL;
+ int x, y;
+ Tk_GetRootCoords(dragTarget, &x, &y);
+ win_x = global.x - x;
+ win_y = global.y - y;
+ if (firstDrag) {
+ dragWidget = Tk_TopCoordsToWindow(tkwin, local.x, local.y, &x, &y);
+ if (dragWidget) {
+ [NSApp setTkDragTarget: (TkWindow *) dragWidget];
}
}
target = (Tk_Window) [NSApp tkDragTarget];
@@ -404,18 +415,16 @@ enum {
if (grabWinPtr && /* There is a grab in effect ... */
!winPtr->dispPtr->grabFlags && /* and it is a local grab ... */
grabWinPtr->mainPtr == winPtr->mainPtr){ /* in the same application. */
- Tk_Window tkwin2;
+ Tk_Window w;
if (!target) {
return theEvent;
}
- for (tkwin2 = target;
- !Tk_IsTopLevel(tkwin2);
- tkwin2 = Tk_Parent(tkwin2)) {
- if (tkwin2 == (Tk_Window)grabWinPtr) {
+ for (w = target; !Tk_IsTopLevel(w); w = Tk_Parent(w)) {
+ if (w == (Tk_Window)grabWinPtr) {
break;
}
}
- if (tkwin2 != (Tk_Window)grabWinPtr) {
+ if (w != (Tk_Window)grabWinPtr) {
return theEvent;
}
}
@@ -472,8 +481,8 @@ enum {
global.x, global.y, state);
} else if (eventType == NSMouseExited) {
if ([NSApp tkDragTarget]) {
- Tk_UpdatePointer((Tk_Window) [NSApp tkPointerWindow],
- global.x, global.y, state);
+ Tk_UpdatePointer((Tk_Window) [NSApp tkDragTarget],
+ global.x, global.y, state);
} else {
Tk_UpdatePointer(NULL, global.x, global.y, state);
}
@@ -497,7 +506,7 @@ enum {
Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL);
/*
- * TkUpdatePointer must not be called in this case. Doing so
+ * Tk_UpdatePointer must not be called in this case. Doing so
* will break scrollbars; dragging will stop when the mouse
* leaves the window.
*/
@@ -560,6 +569,26 @@ enum {
}
}
}
+
+ /*
+ * If button events are being captured, and the target is not in the
+ * subtree below the capturing window, then the NSEvent should not be sent
+ * up the responder chain. This avoids, for example, beeps when clicking
+ * the mouse button outside of a posted combobox. See ticket [eb26d4ec8e].
+ */
+
+ capture = TkpGetCapture();
+ if (capture && eventType == NSLeftMouseDown) {
+ Tk_Window w;
+ for (w = target; w != NULL; w = Tk_Parent(w)) {
+ if (w == capture) {
+ break;
+ }
+ }
+ if (w != capture) {
+ return nil;
+ }
+ }
return theEvent;
}
@end
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 2931763..97f814d 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -981,6 +981,7 @@ TkWmDeadWindow(
{
WmInfo *wmPtr = winPtr->wmInfoPtr, *wmPtr2;
TKWindow *deadNSWindow;
+ TkWindow *dragTarget = [NSApp tkDragTarget];
if (wmPtr == NULL) {
return;
@@ -1060,7 +1061,7 @@ TkWmDeadWindow(
* state which is recorded in the NSApplication object.
*/
- if (winPtr == [NSApp tkDragTarget]) {
+ if (dragTarget && winPtr == TkMacOSXGetHostToplevel(dragTarget)->winPtr) {
[NSApp setTkDragTarget:nil];
}
if (winPtr == [NSApp tkPointerWindow]) {
@@ -3873,7 +3874,7 @@ WmTransientCmd(
}
for (w = containerPtr; w != NULL && w->wmInfoPtr != NULL;
- w = (TkWindow *)w->wmInfoPtr->container) {
+ w = (TkWindow *)w->wmInfoPtr->container) {
if (w == winPtr) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't set \"%s\" as container: would cause management loop",
diff --git a/tests/bind.test b/tests/bind.test
index 9b2f5e1..741915a 100644
--- a/tests/bind.test
+++ b/tests/bind.test
@@ -13,7 +13,6 @@ eval tcltest::configure $argv
tcltest::loadTestedCommands
tk useinputmethods 0
-testConstraint nodeprecated [expr {"nodeprecated" ni [tk::pkgconfig list]}]
testConstraint needsTcl87 [package vsatisfies [package provide Tcl] 8.7-]
testConstraint failsOnWindows [expr {![info exists ::env(CI)] || [tk windowingsystem] ne "win32"}]
@@ -6012,7 +6011,7 @@ test bind-28.9 {keysym names, Ð} -body {
} -cleanup {
destroy .t.f
} -result <Key-Ð>
-test bind-28.10 {keysym names, Ø} -constraints nodeprecated -body {
+test bind-28.10 {keysym names, Ø} -constraints deprecated -body {
frame .t.f -class Test -width 150 -height 100
bind .t.f <Ø> foo
bind .t.f
@@ -6026,7 +6025,7 @@ test bind-28.11 {keysym names, gcedilla} -body {
} -cleanup {
destroy .t.f
} -result <Key-gcedilla>
-test bind-28.12 {keysym names, Greek_IOTAdiaeresis -> Greek_IOTAdieresis} -body {
+test bind-28.12 {keysym names, Greek_IOTAdiaeresis -> Greek_IOTAdieresis} -constraints deprecated -body {
frame .t.f -class Test -width 150 -height 100
bind .t.f <Greek_IOTAdiaeresis> foo
bind .t.f
diff --git a/tests/constraints.tcl b/tests/constraints.tcl
index 66ac1eb..e7ff2bc 100644
--- a/tests/constraints.tcl
+++ b/tests/constraints.tcl
@@ -256,6 +256,7 @@ testConstraint altDisplay [info exists env(TK_ALT_DISPLAY)]
testConstraint noExceed [expr {
![testConstraint unix] || [catch {font actual "\{xyz"}]
}]
+testConstraint deprecated [expr {![package vsatisfies [package provide Tcl] 8.7-] || ![::tk::build-info no-deprecate]}]
# constraints for testing facilities defined in the tktest executable...
testConstraint testImageType [expr {"test" in [image types]}]
diff --git a/tests/pkgconfig.test b/tests/pkgconfig.test
index 7d17916..4b73a9a 100644
--- a/tests/pkgconfig.test
+++ b/tests/pkgconfig.test
@@ -18,24 +18,22 @@ namespace import ::tcltest::*
eval tcltest::configure $argv
tcltest::loadTestedCommands
-testConstraint nodeprecated [expr {"nodeprecated" ni [tk::pkgconfig list]}]
-
-test pkgconfig-1.1 {query keys} -constraints {nonwin nodeprecated} -body {
+test pkgconfig-1.1 {query keys} -constraints {nonwin} -body {
lsort [::tk::pkgconfig list]
} -match glob -result [list \
- 64bit bindir,install bindir,runtime debug demodir,install \
+ *bindir,install bindir,runtime *demodir,install \
demodir,runtime*docdir,install docdir,runtime fontsystem \
includedir,install includedir,runtime \
- libdir,install libdir,runtime mem_debug optimized profiled \
- scriptdir,install scriptdir,runtime threaded \
+ libdir,install libdir,runtime*\
+ scriptdir,install scriptdir,runtime*\
]
test pkgconfig-1.2 {query keys multiple times} {
string compare [::tk::pkgconfig list] [::tk::pkgconfig list]
} 0
test pkgconfig-1.3 {query value multiple times} {
string compare \
- [::tk::pkgconfig get 64bit] \
- [::tk::pkgconfig get 64bit]
+ [::tk::pkgconfig get fontsystem] \
+ [::tk::pkgconfig get fontsystem]
} 0
diff --git a/tests/scrollbar.test b/tests/scrollbar.test
index f471b15..b35321d 100644
--- a/tests/scrollbar.test
+++ b/tests/scrollbar.test
@@ -13,7 +13,6 @@ tcltest::loadTestedCommands
testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}]
testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
-testConstraint nodeprecated [expr {"nodeprecated" ni [tk::pkgconfig list]}]
proc scroll args {
global scrollInfo
@@ -318,7 +317,7 @@ destroy .t
test scrollbar-3.43 {ScrollbarWidgetCmd procedure, "get" option} {
list [catch {.s get a} msg] $msg
} {1 {wrong # args: should be ".s get"}}
-test scrollbar-3.44 {ScrollbarWidgetCmd procedure, "get" option} nodeprecated {
+test scrollbar-3.44 {ScrollbarWidgetCmd procedure, "get" option} deprecated {
.s set 100 10 13 14
.s get
} {100 10 13 14}
@@ -403,27 +402,27 @@ test scrollbar-3.63 {ScrollbarWidgetCmd procedure, "set" option} {
}
set result
} {0.4 0.4}
-test scrollbar-3.64 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
+test scrollbar-3.64 {ScrollbarWidgetCmd procedure, "set" option} deprecated {
list [catch {.s set abc def ghi jkl} msg] $msg
} {1 {expected integer but got "abc"}}
-test scrollbar-3.65 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
+test scrollbar-3.65 {ScrollbarWidgetCmd procedure, "set" option} deprecated {
list [catch {.s set 1 def ghi jkl} msg] $msg
} {1 {expected integer but got "def"}}
-test scrollbar-3.66 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
+test scrollbar-3.66 {ScrollbarWidgetCmd procedure, "set" option} deprecated {
list [catch {.s set 1 2 ghi jkl} msg] $msg
} {1 {expected integer but got "ghi"}}
-test scrollbar-3.67 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
+test scrollbar-3.67 {ScrollbarWidgetCmd procedure, "set" option} deprecated {
list [catch {.s set 1 2 3 jkl} msg] $msg
} {1 {expected integer but got "jkl"}}
-test scrollbar-3.68 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
+test scrollbar-3.68 {ScrollbarWidgetCmd procedure, "set" option} deprecated {
.s set -10 50 20 30
.s get
} {0 50 0 0}
-test scrollbar-3.69 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
+test scrollbar-3.69 {ScrollbarWidgetCmd procedure, "set" option} deprecated {
.s set 100 -10 20 30
.s get
} {100 0 20 30}
-test scrollbar-3.70 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
+test scrollbar-3.70 {ScrollbarWidgetCmd procedure, "set" option} deprecated {
.s set 100 50 30 20
.s get
} {100 50 30 30}
diff --git a/tests/textTag.test b/tests/textTag.test
index 74bd0d4..e88e47d 100644
--- a/tests/textTag.test
+++ b/tests/textTag.test
@@ -1331,13 +1331,13 @@ test textTag-15.4 {TkTextBindProc, key event with mouse outside the widget} -set
} -body {
set res {}
.t tag add tag1 1.0 end
- .t tag bind tag1 <KeyPress> {lappend res %K}
+ .t tag bind tag1 <Key> {lappend res %K}
.t mark set insert 1.2
update
event generate .t <Motion> -warp 1 -x -50 -y -50
controlPointerWarpTiming
focus -force .t
- event generate .t <KeyPress> -keysym a
+ event generate .t <Key> -keysym a
set res
} -cleanup {
.t tag delete tag1
diff --git a/tests/textWind.test b/tests/textWind.test
index d7dab90..881d847 100644
--- a/tests/textWind.test
+++ b/tests/textWind.test
@@ -11,7 +11,17 @@ namespace import ::tcltest::*
tcltest::configure {*}$argv
tcltest::loadTestedCommands
-testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}]
+# Platform specific procedure for updating the text widget.
+
+if {[tk windowingsystem] == "aqua"} {
+ proc updateText {} {
+ update idletasks
+ }
+} else {
+ proc updateText {} {
+ update
+ }
+}
deleteWindows
@@ -26,7 +36,7 @@ set tHeight 6
text .t -width $tWidth -height $tHeight -bd 2 -highlightthickness 2 \
-font $fixedFont
pack .t -expand 1 -fill both
-update
+updateText
.t debug on
set color [expr {[winfo depth .t] > 1 ? "green" : "black"}]
@@ -62,7 +72,7 @@ test textWind-1.1 {basic tests of options} -setup {
.t insert end "\nAnd this is a second line, which wraps around"
frame .f -width 3 -height 3 -bg $color
.t window create 2.2 -window .f
- update
+ updateText
list [winfo ismapped .f] [winfo geom .f] [.t bbox .f] \
[.t window configure .f -window]
} -result [list \
@@ -78,7 +88,7 @@ test textWind-1.2 {basic tests of options} -setup {
.t insert end "\nAnd this is a second line, which wraps around"
frame .f -width 3 -height 3 -bg $color
.t window create 2.2 -window .f -align top
- update
+ updateText
list [winfo ismapped .f] [winfo geom .f] [.t bbox .f] \
[.t window configure .f -align]
} -result [list \
@@ -104,7 +114,7 @@ test textWind-1.4 {basic tests of options} -setup {
# the window .f should be wider than the fixed width
frame .f -width 10 -height 20 -bg $color
.t window create 2.2 -window .f -padx 5
- update
+ updateText
list [winfo geom .f] [.t window configure .f -padx] [.t bbox 2.3]
} -result [list \
10x20+[expr {$padx+2*$fixedWidth+5}]+[expr {$pady+$fixedHeight}] \
@@ -118,7 +128,7 @@ test textWind-1.5 {basic tests of options} -setup {
.t insert end "\nAnd this is a second line, which wraps around"
frame .f -width 10 -height 20 -bg $color
.t window create 2.2 -window .f -pady 4
- update
+ updateText
list [winfo geom .f] [.t window configure .f -pady] [.t bbox 2.31]
} -result [list \
10x20+[expr {$padx+2*$fixedWidth}]+[expr {$pady+$fixedHeight+4}] \
@@ -132,7 +142,7 @@ test textWind-1.6 {basic tests of options} -setup {
.t insert end "\nAnd this is a second line, which wraps around"
frame .f -width 5 -height 5 -bg $color
.t window create 2.2 -window .f -stretch 1
- update
+ updateText
list [winfo geom .f] [.t window configure .f -stretch]
} -result [list \
5x$fixedHeight+[expr {$padx+2*$fixedWidth}]+[expr {$pady+$fixedHeight}] \
@@ -195,7 +205,7 @@ test textWind-2.11 {TkTextWindowCmd procedure} -setup {
.t insert end "\nAnd this is a second line, which wraps around"
frame .f -width 10 -height 6 -bg $color
.t window create 2.2 -window .f -align baseline -padx 1 -pady 2 -create foo
- update
+ updateText
.t window configure .f
} -cleanup {
destroy .f
@@ -211,7 +221,7 @@ test textWind-2.12 {TkTextWindowCmd procedure} -setup {
.t insert end "\nAnd this is a second line, which wraps around"
frame .f -width 10 -height 6 -bg $color
.t window create 2.2 -window .f -align baseline -padx 1 -pady 2 -create foo
- update
+ updateText
list [.t window configure .f -padx 33] [.t window configure .f -padx]
} -cleanup {
destroy .f
@@ -227,7 +237,7 @@ test textWind-2.13 {TkTextWindowCmd procedure} -setup {
.t insert end "\nAnd this is a second line, which wraps around"
frame .f -width 10 -height 6 -bg $color
.t window create 2.2 -window .f -align baseline -padx 1 -pady 2
- update
+ updateText
list [.t window configure .f -padx 14 -pady 15] \
[.t window configure .f -padx] [.t window configure .f -pady]
} -cleanup {
@@ -459,7 +469,7 @@ test textWind-3.11 {EmbWinConfigure procedure} -setup {
button .t.b -text "Hello!"
.t window create 1.4 -window .t.b
.t window create 1.6 -window .t.b
- update
+ updateText
.t index .t.b
} -result {1.6}
@@ -500,7 +510,7 @@ test textWind-5.1 {EmbWinStructureProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 10 -height 20 -bg $color
.t window create 1.2 -window .f
- update
+ updateText
destroy .f
.t index .f
} -returnCodes error -result {bad text index ".f"}
@@ -512,7 +522,7 @@ test textWind-5.2 {EmbWinStructureProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 10 -height 20 -bg $color
.t window create 1.2 -window .f
- update
+ updateText
destroy .f
catch {.t index .f}
list [.t bbox 1.2] [.t bbox 1.3]
@@ -528,7 +538,7 @@ test textWind-5.3 {EmbWinStructureProc procedure} -setup {
frame .f -width 10 -height 20 -bg $color
.t window create 1.2 -align bottom
.t window configure 1.2 -window .f
- update
+ updateText
destroy .f
.t index .f
} -returnCodes error -result {bad text index ".f"}
@@ -540,7 +550,7 @@ test textWind-5.4 {EmbWinStructureProc procedure} -setup {
frame .f -width 10 -height 20 -bg $color
.t window create 1.2 -align bottom
.t window configure 1.2 -window .f
- update
+ updateText
destroy .f
catch {.t index .f}
list [.t bbox 1.2] [.t bbox 1.3]
@@ -554,10 +564,10 @@ test textWind-5.5 {EmbWinStructureProc procedure} -setup {
} -body {
.t insert 1.0 "Some sample text"
.t window create 1.2 -create {frame .f -width 10 -height 20 -bg $color}
- update
+ updateText
.t window configure 1.2 -create {frame .f -width 20 -height 10 -bg $color}
destroy .f
- update
+ updateText
list [catch {.t index .f} msg] $msg [.t bbox 1.2] [.t bbox 1.3]
} -result [list 0 1.2 \
[list [expr {$padx+2*$fixedWidth}] [expr {$pady+(($fixedHeight-10)/2)}] 20 10] \
@@ -591,9 +601,9 @@ test textWind-7.1 {EmbWinLostContentProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 10 -height 20 -bg $color
.t window create 1.2 -window .f
- update
+ updateText
place .f -in .t -x 100 -y 50
- update
+ updateText
list [winfo geom .f] [.t bbox 1.2]
} -cleanup {
destroy .f
@@ -608,9 +618,9 @@ test textWind-7.2 {EmbWinLostContentProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .t.f -width 10 -height 20 -bg $color
.t window create 1.2 -window .t.f
- update
+ updateText
place .t.f -x 100 -y 50
- update
+ updateText
list [winfo geom .t.f] [.t bbox 1.2]
} -cleanup {
destroy .t.f
@@ -670,7 +680,7 @@ test textWind-10.1 {EmbWinLayoutProc procedure} -setup {
.t window create 1.5 -create {
frame .f -width 10 -height 20 -bg $color
}
- update
+ updateText
list [winfo exists .f] [winfo width .f] [winfo height .f] [.t index .f]
} -cleanup {
destroy .f
@@ -688,7 +698,7 @@ test textWind-10.2 {EmbWinLayoutProc procedure, error in creating window} -setup
error "couldn't create window"
}
set msg xyzzy
- update
+ updateText
list $msg [.t bbox 1.5]
} -cleanup {
rename bgerror {}
@@ -708,7 +718,7 @@ test textWind-10.3 {EmbWinLayoutProc procedure, error in creating window} -setup
concat gorp
}
set msg xyzzy
- update
+ updateText
list $msg [.t bbox 1.5]
} -cleanup {
rename bgerror {}
@@ -734,7 +744,7 @@ test textWind-10.4 {EmbWinLayoutProc procedure, error in creating window} -setup
}
set count 0
while {([llength $msg] < 2) && ($count < 100)} {
- update
+ updateText
incr count
.t bbox 1.5
after 10
@@ -764,7 +774,7 @@ test textWind-10.5 {EmbWinLayoutProc procedure, error in creating window} -setup
frame .t.f
frame .t.f.f -width 10 -height 20 -bg $color
}
- update idletasks
+ updateText
lappend msg [winfo exists .t.f.f]
} -cleanup {
destroy .t.f
@@ -781,12 +791,12 @@ test textWind-10.6 {EmbWinLayoutProc procedure, error in creating window} -setup
}
} -body {
.t insert 1.0 "Some sample text"
- update
+ updateText
.t window create 1.5 -create {
concat .t
}
set msg {}
- update
+ updateText
lappend msg [.t bbox 1.5]
} -cleanup {
rename bgerror {}
@@ -794,7 +804,7 @@ test textWind-10.6 {EmbWinLayoutProc procedure, error in creating window} -setup
{{can't embed .t relative to .t}} \
[list [expr {$padx+5*$fixedWidth}] [expr {$pady+($fixedHeight/2)}] 0 0]]
-test textWind-10.7 {EmbWinLayoutProc procedure, error in creating window} -constraints failsOnUbuntu -setup {
+test textWind-10.7 {EmbWinLayoutProc procedure, error in creating window} -setup {
.t delete 1.0 end
destroy .t2
proc bgerror args {
@@ -809,7 +819,7 @@ test textWind-10.7 {EmbWinLayoutProc procedure, error in creating window} -const
concat .t2
}
set msg {}
- update
+ update idletasks ; after 100 ; update
lappend msg [.t bbox 1.5]
} -cleanup {
rename bgerror {}
@@ -832,9 +842,9 @@ test textWind-10.8 {EmbWinLayoutProc procedure, error in creating window} -setup
concat .t2
}
set msg {}
- update
+ updateText
set i 0
- while {[llength $msg] == 1 && [incr i] < 200} { update }
+ while {[llength $msg] == 1 && [incr i] < 200} { updateText }
return $msg
} -cleanup {
destroy .t2
@@ -848,9 +858,9 @@ test textWind-10.9 {EmbWinLayoutProc procedure, steal window from self} -setup {
.t insert 1.0 ABCDEFGHIJKLMNOP
button .t.b -text "Hello!"
.t window create 1.5 -window .t.b
- update
+ updateText
.t window create 1.3 -create {concat .t.b}
- update
+ updateText
.t index .t.b
} -cleanup {
destroy .t.b
@@ -879,7 +889,7 @@ test textWind-10.11 {EmbWinLayoutProc procedure, doesn't fit on line} -setup {
.t insert 1.0 "Some sample text"
frame .f -width [expr {($tWidth-12)*$fixedWidth}] -height 20 -bg $color -bd 2 -relief raised
.t window create 1.12 -window .f
- update
+ updateText
list [.t bbox .f] [.t bbox 1.13]
} -cleanup {
destroy .f
@@ -895,7 +905,7 @@ test textWind-10.12 {EmbWinLayoutProc procedure, doesn't fit on line} -setup {
.t insert 1.0 "Some sample text"
frame .f -width [expr {($tWidth-12)*$fixedWidth+1}] -height 20 -bg $color -bd 2 -relief raised
.t window create 1.12 -window .f
- update
+ updateText
list [.t bbox .f] [.t bbox 1.13]
} -cleanup {
destroy .f
@@ -911,7 +921,7 @@ test textWind-10.13 {EmbWinLayoutProc procedure, doesn't fit on line} -setup {
.t insert 1.0 "Some sample text"
frame .f -width [expr {($tWidth-12)*$fixedWidth+5}] -height 20 -bg $color -bd 2 -relief raised
.t window create 1.12 -window .f
- update
+ updateText
list [.t bbox .f] [.t bbox 1.13]
} -cleanup {
destroy .f
@@ -927,7 +937,7 @@ test textWind-10.14 {EmbWinLayoutProc procedure, doesn't fit on line} -setup {
.t insert 1.0 "Some sample text"
frame .f -width [expr {($tWidth-12)*$fixedWidth+5}] -height 220 -bg $color -bd 2 -relief raised
.t window create 1.12 -window .f
- update
+ updateText
list [.t bbox .f] [.t bbox 1.13]
} -cleanup {
destroy .f
@@ -943,7 +953,7 @@ test textWind-10.15 {EmbWinLayoutProc procedure, doesn't fit on line} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 250 -height 220 -bg $color -bd 2 -relief raised
.t window create 1.12 -window .f
- update
+ updateText
list [.t bbox .f] [.t bbox 1.13]
} -cleanup {
destroy .f
@@ -964,7 +974,7 @@ test textWind-11.1 {EmbWinDisplayProc procedure, geometry transforms} -setup {
place .t -x 30 -y 50
frame .f -width 30 -height 20 -bg $color
.t window create 1.12 -window .f
- update ; after 100 ; update
+ update
winfo geom .f
} -cleanup {
destroy .f
@@ -984,7 +994,7 @@ test textWind-11.2 {EmbWinDisplayProc procedure, geometry transforms} -setup {
place .t -x 30 -y 50
frame .t.f -width 30 -height 20 -bg $color
.t window create 1.12 -window .t.f
- update ; after 100 ; update
+ update
winfo geom .t.f
} -cleanup {
destroy .t.f
@@ -1030,7 +1040,7 @@ test textWind-11.4 {EmbWinDisplayProc procedure, horizontal scrolling} -setup {
.t insert end " with junk after it."
.t xview moveto 0
.t xview scroll 5 units
- update
+ updateText
list [winfo ismapped .f] [winfo geom .f] [.t bbox .f] [winfo ismapped .f2]
} -cleanup {
destroy .f .f2
@@ -1051,10 +1061,10 @@ test textWind-11.5 {EmbWinDisplayProc procedure, horizontal scrolling} -setup {
frame .f2 -width 40 -height 10 -bg $color
.t window create end -window .f2
.t insert end " with junk after it."
- update
+ updateText
.t xview moveto 0
.t xview scroll 25 units
- update
+ updateText
list [winfo ismapped .f] [winfo ismapped .f2] [winfo geom .f2] [.t bbox .f2]
} -cleanup {
destroy .f .f2
@@ -1073,19 +1083,19 @@ test textWind-12.1 {EmbWinUndisplayProc procedure, mapping/unmapping} -setup {
bind .f <Map> {lappend x mapped}
bind .f <Unmap> {lappend x unmapped}
set x created
- update
+ updateText
lappend x modified
.t delete 1.0
- update
+ updateText
lappend x replaced
.t window configure .f -window {}
.t delete 1.1
.t window create 1.4 -window .f
- update
+ updateText
lappend x off-screen
.t configure -wrap none
.t insert 1.0 "Enough text to make the line run off-screen"
- update
+ updateText
return $x
} -cleanup {
destroy .f
@@ -1099,7 +1109,7 @@ test textWind-13.1 {EmbWinBboxProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 5 -height 5 -bg $color
.t window create 1.2 -window .f -align top -padx 2 -pady 1
- update
+ updateText
list [winfo geom .f] [.t bbox .f]
} -cleanup {
destroy .f
@@ -1114,7 +1124,7 @@ test textWind-13.2 {EmbWinBboxProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 5 -height 5 -bg $color
.t window create 1.2 -window .f -align center -padx 2 -pady 1
- update
+ updateText
list [winfo geom .f] [.t bbox .f]
} -cleanup {
destroy .f
@@ -1129,7 +1139,7 @@ test textWind-13.3 {EmbWinBboxProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 5 -height 5 -bg $color
.t window create 1.2 -window .f -align baseline -padx 2 -pady 1
- update
+ updateText
list [winfo geom .f] [.t bbox .f]
} -cleanup {
destroy .f
@@ -1144,7 +1154,7 @@ test textWind-13.4 {EmbWinBboxProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 5 -height 5 -bg $color
.t window create 1.2 -window .f -align bottom -padx 2 -pady 1
- update
+ updateText
list [winfo geom .f] [.t bbox .f]
} -cleanup {
destroy .f
@@ -1159,7 +1169,7 @@ test textWind-13.5 {EmbWinBboxProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 5 -height 5 -bg $color
.t window create 1.2 -window .f -align top -padx 2 -pady 1 -stretch 1
- update
+ updateText
list [winfo geom .f] [.t bbox .f]
} -cleanup {
destroy .f
@@ -1174,7 +1184,7 @@ test textWind-13.6 {EmbWinBboxProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 5 -height 5 -bg $color
.t window create 1.2 -window .f -align center -padx 2 -pady 1 -stretch 1
- update
+ updateText
list [winfo geom .f] [.t bbox .f]
} -cleanup {
destroy .f
@@ -1189,7 +1199,7 @@ test textWind-13.7 {EmbWinBboxProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 5 -height 5 -bg $color
.t window create 1.2 -window .f -align baseline -padx 2 -pady 1 -stretch 1
- update
+ updateText
list [winfo geom .f] [.t bbox .f]
} -cleanup {
destroy .f
@@ -1204,7 +1214,7 @@ test textWind-13.8 {EmbWinBboxProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 5 -height 5 -bg $color
.t window create 1.2 -window .f -align bottom -padx 2 -pady 1 -stretch 1
- update
+ updateText
list [winfo geom .f] [.t bbox .f]
} -cleanup {
destroy .f
@@ -1221,7 +1231,7 @@ test textWind-13.9 {EmbWinBboxProc procedure, spacing options} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 5 -height 5 -bg $color
.t window create 1.2 -window .f -align center -padx 2 -pady 1
- update
+ updateText
list [winfo geom .f] [.t bbox .f]
} -cleanup {
.t configure -spacing1 0 -spacing3 0
@@ -1238,14 +1248,14 @@ test textWind-14.1 {EmbWinDelayedUnmap procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 30 -height 20 -bg $color
.t window create 1.2 -window .f
- update
+ updateText
bind .f <Unmap> {lappend x unmapped}
set x modified
.t insert 1.0 x
lappend x removed
.t window configure .f -window {}
lappend x updated
- update
+ updateText
return $x
} -cleanup {
destroy .f
@@ -1258,14 +1268,14 @@ test textWind-14.2 {EmbWinDelayedUnmap procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 30 -height 20 -bg $color
.t window create 1.2 -window .f
- update
+ updateText
bind .f <Unmap> {lappend x unmapped}
set x modified
.t insert 1.0 x
lappend x deleted
.t delete .f
lappend x updated
- update
+ updateText
return $x
} -cleanup {
destroy .f
@@ -1278,10 +1288,10 @@ test textWind-14.3 {EmbWinDelayedUnmap procedure} -setup {
.t insert 1.0 "Some sample text\nAnother line\n3\n4\n5\n6\n7\n8\n9"
frame .f -width 30 -height 20 -bg $color
.t window create 1.2 -window .f
- update
+ updateText
.t yview 2.0
set result [winfo ismapped .f]
- update ; after 10
+ updateText ; after 10
list $result [winfo ismapped .f]
} -cleanup {
destroy .f
@@ -1294,10 +1304,10 @@ test textWind-14.4 {EmbWinDelayedUnmap procedure} -setup {
.t insert 1.0 "Some sample text\nAnother line\n3\n4\n5\n6\n7\n8\n9"
frame .t.f -width 30 -height 20 -bg $color
.t window create 1.2 -window .t.f
- update
+ updateText
.t yview 2.0
set result [winfo ismapped .t.f]
- update
+ updateText
list $result [winfo ismapped .t.f]
} -cleanup {
destroy .t.f
@@ -1335,9 +1345,9 @@ test textWind-16.1 {EmbWinTextStructureProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 30 -height 20 -bg $color
.t window create 1.6 -window .f
- update
+ updateText
pack forget .t
- update
+ updateText
winfo ismapped .f
} -cleanup {
pack .t
@@ -1352,12 +1362,12 @@ test textWind-16.2 {EmbWinTextStructureProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 30 -height 20 -bg $color
.t window create 1.6 -window .f
- update
+ updateText
set result {}
lappend result [winfo geom .f] [.t bbox .f]
frame .f2 -width 150 -height 30 -bd 2 -relief raised
pack .f2 -before .t
- update
+ updateText
lappend result [winfo geom .f] [.t bbox .f]
} -cleanup {
destroy .f .f2
@@ -1373,9 +1383,9 @@ test textWind-16.3 {EmbWinTextStructureProc procedure} -setup {
.t configure -wrap none
.t insert 1.0 "Some sample text"
.t window create 1.6
- update
+ updateText
pack forget .t
- update
+ updateText
} -cleanup {
pack .t
} -result {}
@@ -1388,9 +1398,9 @@ test textWind-16.4 {EmbWinTextStructureProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .t.f -width 30 -height 20 -bg $color
.t window create 1.6 -window .t.f
- update
+ updateText
pack forget .t
- update
+ updateText
list [winfo ismapped .t.f] [.t bbox .t.f]
} -cleanup {
pack .t
@@ -1406,7 +1416,7 @@ test textWind-17.1 {peer widgets and embedded windows} -setup {
.t window create 1.3 -window .f
toplevel .tt
pack [.t peer create .tt.t]
- update
+ updateText
destroy .t .tt
winfo exists .f
} -result 0
@@ -1420,10 +1430,10 @@ test textWind-17.2 {peer widgets and embedded windows} -setup {
.t window create 1.4 -window .f
toplevel .tt
pack [.t peer create .tt.t]
- update
+ updateText
destroy .t
.tt.t insert 1.0 "foo"
- update
+ updateText
destroy .tt
} -result {}
@@ -1435,9 +1445,9 @@ test textWind-17.3 {peer widget and -create} -setup {
.t insert 1.0 "Some sample text"
toplevel .tt
pack [.t peer create .tt.t]
- update
+ updateText
.t window create 1.2 -create {frame %W.f -width 10 -height 20 -bg blue}
- update
+ updateText
destroy .t .tt
} -result {}
@@ -1451,10 +1461,10 @@ test textWind-17.4 {peer widget deleted one window shouldn't delete others} -set
toplevel .tt
pack [.t peer create .tt.t]
.t window create 1.2 -create {frame %W.f -width 10 -height 20 -bg blue}
- update
+ updateText
destroy .tt
lappend res [.t get 1.2]
- update
+ updateText
lappend res [.t get 1.2]
} -cleanup {
destroy .t
@@ -1469,7 +1479,7 @@ test textWind-17.5 {peer widget window configuration} -setup {
toplevel .tt
pack [.t peer create .tt.t]
.t window create 1.2 -create {frame %W.f -width 10 -height 20 -bg blue}
- update
+ updateText
list [.t window cget 1.2 -window] [.tt.t window cget 1.2 -window]
} -cleanup {
destroy .tt .t
@@ -1484,7 +1494,7 @@ test textWind-17.6 {peer widget window configuration} -setup {
toplevel .tt
pack [.t peer create .tt.t]
.t window create 1.2 -create {frame %W.f -width 10 -height 20 -bg blue}
- update
+ updateText
list [.t window configure 1.2 -window] \
[.tt.t window configure 1.2 -window]
} -cleanup {
@@ -1500,7 +1510,7 @@ test textWind-17.7 {peer widget window configuration} -setup {
toplevel .tt
pack [.t peer create .tt.t]
.t window create 1.2 -window [frame .t.f -width 10 -height 20 -bg blue]
- update
+ updateText
list [.t window cget 1.2 -window] [.tt.t window cget 1.2 -window]
} -cleanup {
destroy .tt .t
@@ -1515,7 +1525,7 @@ test textWind-17.8 {peer widget window configuration} -setup {
toplevel .tt
pack [.t peer create .tt.t]
.t window create 1.2 -window [frame .t.f -width 10 -height 20 -bg blue]
- update
+ updateText
list [.t window configure 1.2 -window] \
[.tt.t window configure 1.2 -window]
} -cleanup {
@@ -1531,7 +1541,7 @@ test textWind-17.9 {peer widget window configuration} -setup {
toplevel .tt
pack [.t peer create .tt.t]
.t window create 1.2 -window [frame .t.f -width 10 -height 20 -bg blue]
- update
+ updateText
.tt.t window configure 1.2 -window [frame .tt.t.f -width 10 -height 20 -bg red]
list [.t window configure 1.2 -window] [.tt.t window configure 1.2 -window]
} -cleanup {
@@ -1547,30 +1557,51 @@ test textWind-17.10 {peer widget window configuration} -setup {
.t insert 1.0 "Some sample text"
toplevel .tt
pack [.t peer create .tt.t]
- update idletasks
+ updateText
.t window create 1.2 -window [frame .t.f -width 10 -height 20 -bg blue]
- update idletasks
- # There should be a window in the main widget but not in the peer.
- lappend res [.t window configure 1.2 -window]
- lappend res [.tt.t window configure 1.2 -window]
- .tt.t window create 1.2 -window [frame .tt.t.f -width 25 -height 20 -bg blue]
- update idletasks
- .t window configure 1.2 -create {destroy %W.f ; frame %W.f -width 50 -height 7 -bg red}
- update idletasks
- # The main widget should not have changed.
- lappend res [.t window configure 1.2 -window]
+ updateText
+ # There is a blue window in the main widget .t but not in the peer .tt.t
+ lappend res [.t window cget 1.2 -window]
+ lappend res [.tt.t window cget 1.2 -window]
+ # Insert a green window in the peer. Warning: the blue window previously
+ # inserted in .t at index 1.2 will now be found in .t at index 1.3
+ # The underlying linked segments are common in a text widget and its peers.
+ .tt.t window create 1.2 -window [frame .tt.t.f -width 25 -height 20 -bg green]
+ updateText
+ lappend res [.t window cget 1.2 -window]
+ lappend res [.t window cget 1.3 -window]
+ # In the peer, the green window still is at 1.2, and there is no window at 1.3
+ lappend res [.tt.t window cget 1.2 -window]
+ lappend res [.tt.t window cget 1.3 -window]
+ # Insert a red window in .t at index 1.2. This replaces the blue window originally at 1.2
+ # in .t, because the green window inserted in the peer is not visible from .t, therefore
+ # the embedded window found at index 1.2 in .t is the one originally at 1.2 in .t, i.e.
+ # the blue one
+ .t window configure 1.2 -create {destroy %W.f ; update ; frame %W.f -width 50 -height 7 -bg red}
+ updateText
+ # The main widget .t still has a window named .t.f at 1.2. This is NOT the blue
+ # frame but the red frame from the -create script, which bears the same name.
+ lappend res [.t window cget 1.2 -window]
+ # The peer still has its green .tt.t.f at 1.2
+ lappend res [.tt.t window cget 1.2 -window]
+ # When removing the -window option the create script plays, therefore .t still has
+ # the red frame .t.f at 1.2
.t window configure 1.2 -window {}
+ updateText
+ lappend res [.t window cget 1.2 -window]
+ # The -create script associated to index 1.2 applies to all peers (that's the reason
+ # why the manual states that "If multiple peer widgets are in use, it is usually simpler
+ # to use the -create option if embedded windows are desired in each peer."). Therefore
+ # when removing the -window option in the peer, the -create script is run, which replaces
+ # the green frame by the red one named as per the -create script, i.e. .tt.t.f
.tt.t window configure 1.2 -window {}
- update
- # Nothing should have changed.
- lappend res [.t window configure 1.2 -window]
- lappend res [.tt.t window configure 1.2 -window]
+ updateText
+ lappend res [.tt.t window cget 1.2 -window]
} -cleanup {
destroy .tt .t
-} -result {{-window {} {} {} .t.f} {-window {} {} {} {}} {-window {} {} {} .t.f}\
-{-window {} {} {} .t.f} {-window {} {} {} .tt.t.f}}
+} -result {.t.f {} {} .t.f .tt.t.f {} .t.f .tt.t.f .t.f .tt.t.f}
-test textWind-18.1 {embedded window deletion triggered by a script bound to <Map>} -setup {
+test textWind-18.1 {embedded window deletion triggered by a script bound to <Map>} -constraints knownBug -setup {
catch {destroy .t .f .f2}
} -body {
pack [text .t]
@@ -1578,11 +1609,11 @@ test textWind-18.1 {embedded window deletion triggered by a script bound to <Map
.t window create end -window [frame .f -background red -width 80 -height 80]
.t window create end -window [frame .f2 -background blue -width 80 -height 80]
bind .f <Map> {.t delete .f}
- update
+ updateText
# this shall not crash (bug 1501749)
after 100 {.t yview end}
tkwait visibility .f2
- update
+ updateText
} -cleanup {
destroy .t .f .f2
} -result {}
diff --git a/tests/ttk/entry.test b/tests/ttk/entry.test
index 1832cba..61d28cf 100644
--- a/tests/ttk/entry.test
+++ b/tests/ttk/entry.test
@@ -67,7 +67,7 @@ test entry-1.7 "Deletion - insert cursor in the middle " -body {
.e index insert
} -result 0
-test entry-1.8 "Index is between 0 and end" -body {
+test entry-1.8 "Index is between 0 and end" -constraints deprecated -body {
.e delete 0 end
.e insert end abcde
set res [list [.e index -1] [.e index -4] [.e index 999]]
diff --git a/tests/ttk/treeview.test b/tests/ttk/treeview.test
index 3c14295..04a0f26 100644
--- a/tests/ttk/treeview.test
+++ b/tests/ttk/treeview.test
@@ -54,11 +54,11 @@ test treeview-1.3 "bad displaycolumns" -body {
test treeview-1.4 "more bad displaycolumns" -body {
.tv configure -displaycolumns {1 2 3}
-} -returnCodes error -result "Column index 3 out of bounds"
+} -returnCodes error -result {Column index "3" out of bounds}
test treeview-1.5 "Don't forget to check negative numbers" -body {
- .tv configure -displaycolumns {1 -2 3}
-} -returnCodes error -result "Column index -2 out of bounds"
+ .tv configure -displaycolumns {1 {} 3}
+} -returnCodes error -result {Column index "" out of bounds}
# Item creation.
#
@@ -302,7 +302,7 @@ test treeview-5.6 "set illegal cell" -body {
test treeview-5.7 "set illegal cell" -body {
.tv set newnode 3 YY ;# 3 == current #columns
-} -returnCodes error -result "Column index 3 out of bounds"
+} -returnCodes error -result {Column index "3" out of bounds}
test treeview-5.8 "set display columns" -body {
.tv configure -displaycolumns [list 2 1 0]
diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c
index a67684c..ef47c51 100644
--- a/unix/tkUnixWm.c
+++ b/unix/tkUnixWm.c
@@ -3643,7 +3643,7 @@ WmTransientCmd(
}
for (w = containerPtr; w != NULL && w->wmInfoPtr != NULL;
- w = (TkWindow *)w->wmInfoPtr->containerPtr) {
+ w = (TkWindow *)w->wmInfoPtr->containerPtr) {
if (w == winPtr) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't set \"%s\" as container: would cause management loop",
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 770b0a2..87c236e 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -5502,7 +5502,7 @@ WmTransientCmd(
return TCL_ERROR;
}
for (w = containerPtr; w != NULL && w->wmInfoPtr != NULL;
- w = (TkWindow *)w->wmInfoPtr->containerPtr) {
+ w = (TkWindow *)w->wmInfoPtr->containerPtr) {
if (w == winPtr) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't set \"%s\" as container: would cause management loop",
@@ -8219,7 +8219,7 @@ ActivateWindow(
/*
* If the toplevel is in the middle of a move or size operation then
* we must delay handling of this event to avoid stealing the focus
- * while the window manage is in control.
+ * while the window manager is in control.
*/
if (eventPtr->flagPtr && *eventPtr->flagPtr) {
@@ -8287,7 +8287,7 @@ TkWinSetForegroundWindow(
*
* TkpWinToplevelWithdraw --
*
- * This function is to be used by a window manage to withdraw a toplevel
+ * This function is to be used by a window manager to withdraw a toplevel
* window.
*
* Results:
@@ -8314,7 +8314,7 @@ TkpWinToplevelWithDraw(
*
* TkpWinToplevelIconify --
*
- * This function is to be used by a window manage to iconify a toplevel
+ * This function is to be used by a window manager to iconify a toplevel
* window.
*
* Results:
@@ -8338,7 +8338,7 @@ TkpWinToplevelIconify(
*
* TkpWinToplevelDeiconify --
*
- * This function is to be used by a window manage to deiconify a toplevel
+ * This function is to be used by a window manager to deiconify a toplevel
* window.
*
* Results:
@@ -8405,7 +8405,7 @@ TkpWinToplevelDeiconify(
*
* TkpWinGeometryIsControlledByWm --
*
- * This function is to be used by a window manage to see if wm has
+ * This function is to be used by a window manager to see if wm has
* canceled geometry control.
*
* Results: