summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2022-01-23 09:07:53 (GMT)
committerfvogel <fvogelnew1@free.fr>2022-01-23 09:07:53 (GMT)
commit6ebd1be570486b1ac7469be9ad397dfa6cb769d6 (patch)
treeb5dd90a34fe8f09b94e6b0066f16b26a0eca1ad8
parent4157f4fa97dad25b7fbf237c74206ad5cc5fa29f (diff)
parent6ad3890840c7cc592572370e25e7010bbdceebf1 (diff)
downloadtk-6ebd1be570486b1ac7469be9ad397dfa6cb769d6.zip
tk-6ebd1be570486b1ac7469be9ad397dfa6cb769d6.tar.gz
tk-6ebd1be570486b1ac7469be9ad397dfa6cb769d6.tar.bz2
merge core-8-6-branch
-rw-r--r--.github/workflows/mac-build.yml2
-rw-r--r--generic/tkFocus.c12
-rw-r--r--generic/tkInt.h10
-rw-r--r--library/demos/images/earth.gifbin51712 -> 51559 bytes
-rw-r--r--tests/earth.gifbin51712 -> 51559 bytes
-rw-r--r--tests/event.test54
-rw-r--r--tests/filebox.test19
-rw-r--r--tests/textWind.test239
8 files changed, 210 insertions, 126 deletions
diff --git a/.github/workflows/mac-build.yml b/.github/workflows/mac-build.yml
index 2600858..629efdf 100644
--- a/.github/workflows/mac-build.yml
+++ b/.github/workflows/mac-build.yml
@@ -106,7 +106,7 @@ jobs:
- name: Configure (symbols=${{ matrix.symbols }} ${{matrix.options }})
# Note that macOS is always a 64 bit platform
run: |
- ./configure --enable-64bit ${CFGOPT} "--prefix=$HOME/install dir" || {
+ ./configure --enable-64bit ${CFGOPT} "--prefix=$HOME/install dir" --disable-xft || {
cat config.log
echo "::error::Failure during Configure"
exit 1
diff --git a/generic/tkFocus.c b/generic/tkFocus.c
index 9b3b2dc..9bf31d4 100644
--- a/generic/tkFocus.c
+++ b/generic/tkFocus.c
@@ -813,6 +813,7 @@ TkFocusDeadWindow(
ToplevelFocusInfo *tlFocusPtr, *prevPtr;
DisplayFocusInfo *displayFocusPtr;
TkDisplay *dispPtr = winPtr->dispPtr;
+ int noMatch = 1;
/*
* Certain special windows like those used for send and clipboard have no
@@ -856,6 +857,7 @@ TkFocusDeadWindow(
prevPtr->nextPtr = tlFocusPtr->nextPtr;
}
ckfree(tlFocusPtr);
+ noMatch = 0;
break;
} else if (winPtr == tlFocusPtr->focusWinPtr) {
/*
@@ -873,6 +875,7 @@ TkFocusDeadWindow(
displayFocusPtr->focusWinPtr = tlFocusPtr->topLevelPtr;
dispPtr->focusPtr = tlFocusPtr->topLevelPtr;
}
+ noMatch = 0;
break;
}
}
@@ -890,6 +893,15 @@ TkFocusDeadWindow(
if (displayFocusPtr->focusOnMapPtr == winPtr) {
displayFocusPtr->focusOnMapPtr = NULL;
}
+
+ /*
+ * It may happen that the search above for focus records that refer
+ * to this window did not find any match. In such a case, when the
+ * dead window had the focus, release it.
+ */
+ if (noMatch && (dispPtr->focusPtr == winPtr)) {
+ dispPtr->focusPtr = NULL;
+ }
}
/*
diff --git a/generic/tkInt.h b/generic/tkInt.h
index fe8f16e..21df17d 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -368,8 +368,14 @@ typedef struct TkDisplay {
* by that container. */
int geomInit;
-#define TkGetContainer(tkwin) (((TkWindow *)tkwin)->maintainerPtr != NULL ? \
- ((TkWindow *)tkwin)->maintainerPtr : ((TkWindow *)tkwin)->parentPtr)
+ /*
+ * Information used by tkGrid.c, tkPack.c, tkPlace.c, tkPointer.c,
+ * and ttkMacOSXTheme.c:
+ */
+
+#define TkGetContainer(tkwin) (Tk_TopWinHierarchy((TkWindow *)tkwin) ? NULL : \
+ (((TkWindow *)tkwin)->maintainerPtr != NULL ? \
+ ((TkWindow *)tkwin)->maintainerPtr : ((TkWindow *)tkwin)->parentPtr))
/*
* Information used by tkGet.c only:
diff --git a/library/demos/images/earth.gif b/library/demos/images/earth.gif
index 2c229eb..d667244 100644
--- a/library/demos/images/earth.gif
+++ b/library/demos/images/earth.gif
Binary files differ
diff --git a/tests/earth.gif b/tests/earth.gif
index 2c229eb..d667244 100644
--- a/tests/earth.gif
+++ b/tests/earth.gif
Binary files differ
diff --git a/tests/event.test b/tests/event.test
index f0e2311..c521b25 100644
--- a/tests/event.test
+++ b/tests/event.test
@@ -892,6 +892,60 @@ test event-9 {no <Enter> event is generated for the container window when its
}
} -result {.top .top.f}
+test event-9.1 {enter . window by destroying a toplevel - bug b1d115fa60} -setup {
+ set EnterBind [bind . <Enter>]
+} -body {
+ wm geometry . 200x200+300+300
+ wm deiconify .
+ _pause 200
+ toplevel .top2 -width 200 -height 200
+ wm geometry .top2 +[expr {[winfo rootx .]+50}]+[expr {[winfo rooty .]+50}]
+ wm deiconify .top2
+ raise .top2
+ _pause 400
+ event generate .top2 <Motion> -warp 1 -x 50 -y 50
+ _pause 100
+ bind . <Enter> {lappend res %W}
+ set res [list ]
+ destroy .top2
+ _pause 200
+ set res
+} -cleanup {
+ deleteWindows
+ bind . <Enter> $EnterBind
+} -result {.}
+test event-9.2 {enter toplevel window by destroying a toplevel - bug b1d115fa60} -setup {
+ set iconified false
+ if {[winfo ismapped .]} {
+ wm iconify .
+ update
+ set iconified true
+ }
+} -body {
+ toplevel .top1
+ wm geometry .top1 200x200+300+300
+ wm deiconify .top1
+ _pause 200
+ toplevel .top2 -width 200 -height 200
+ wm geometry .top2 +[expr {[winfo rootx .top1]+50}]+[expr {[winfo rooty .top1]+50}]
+ wm deiconify .top2
+ raise .top2
+ _pause 400
+ event generate .top2 <Motion> -warp 1 -x 50 -y 50
+ _pause 100
+ bind .top1 <Enter> {lappend res %W}
+ set res [list ]
+ destroy .top2
+ _pause 200
+ set res
+} -cleanup {
+ deleteWindows ; # destroy all children of ".", this already includes .top1
+ if {$iconified} {
+ wm deiconify .
+ update
+ }
+} -result {.top1}
+
# cleanup
update
unset -nocomplain keypress_lookup
diff --git a/tests/filebox.test b/tests/filebox.test
index fdb5614..3c48846 100644
--- a/tests/filebox.test
+++ b/tests/filebox.test
@@ -74,7 +74,6 @@ proc EnterFileByKey {parent fileName fileDir} {
}
proc SendButtonPress {parent btn type} {
- global tk_strictMotif
if {$parent == "."} {
set w .__tk_filedialog
} else {
@@ -210,7 +209,6 @@ foreach mode $modes {
# set verylongstring $verylongstring$verylongstring
# set verylongstring $verylongstring$verylongstring
- set color #404040
test filebox-2.1-$mode "tk_getOpenFile command" nonUnixUserInteraction {
ToPressButton $parent cancel
tk_getOpenFile -title "Press Cancel ($verylongstring)" -parent $parent
@@ -281,9 +279,6 @@ foreach mode $modes {
catch {unset tv}
catch {unset typeName}
ToPressButton $parent ok
- if {[info exists tv]} {
- } else {
- }
set choice [tk_getOpenFile -title "Press Ok" \
-filetypes $filters($x) -parent $parent \
-initialfile $fileName -initialdir $fileDir \
@@ -337,20 +332,6 @@ foreach mode $modes {
[info commands ::tk::dialog::file::] eq ""
}]
- set parent .
-
- set verylongstring longstring:
- set verylongstring $verylongstring$verylongstring
- set verylongstring $verylongstring$verylongstring
- set verylongstring $verylongstring$verylongstring
- set verylongstring $verylongstring$verylongstring
- # set verylongstring $verylongstring$verylongstring
- # set verylongstring $verylongstring$verylongstring
- # set verylongstring $verylongstring$verylongstring
- # set verylongstring $verylongstring$verylongstring
- # set verylongstring $verylongstring$verylongstring
-
- set color #404040
test filebox-5.1-$mode "tk_getSaveFile command" nonUnixUserInteraction {
ToPressButton $parent cancel
tk_getSaveFile -title "Press Cancel ($verylongstring)" -parent $parent
diff --git a/tests/textWind.test b/tests/textWind.test
index c707f3d..0b9bd51 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,28 +1557,49 @@ 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>} -constraints knownBug -setup {
catch {destroy .t .f .f2}
@@ -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 {}