diff options
author | fvogel <fvogelnew1@free.fr> | 2022-01-09 13:50:44 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2022-01-09 13:50:44 (GMT) |
commit | 4d7dd5c1d1a545bed4de7e4b6627e1302796b0f0 (patch) | |
tree | f06a633171a49d51d320b5c4813d41c014efad1b | |
parent | 5d20906695103bcff6e8b250372db81d240ac320 (diff) | |
parent | f86a6ca13380485515492bb0b31d6680f89bacc1 (diff) | |
download | tk-4d7dd5c1d1a545bed4de7e4b6627e1302796b0f0.zip tk-4d7dd5c1d1a545bed4de7e4b6627e1302796b0f0.tar.gz tk-4d7dd5c1d1a545bed4de7e4b6627e1302796b0f0.tar.bz2 |
merge 8.6
-rw-r--r-- | generic/tkTextWind.c | 20 | ||||
-rw-r--r-- | generic/tkWindow.c | 6 | ||||
-rw-r--r-- | macosx/tkMacOSXWm.c | 3 | ||||
-rw-r--r-- | tests/textWind.test | 241 |
4 files changed, 154 insertions, 116 deletions
diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index fdd5378..bd15cc9 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 50b29fa..7506d2f 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -1003,6 +1003,9 @@ TkCreateMainWindow( #ifdef USE_NMAKE ".nmake" #endif +#ifdef TK_NO_DEPRECATED + ".no-deprecate" +#endif #ifndef TCL_CFG_OPTIMIZED ".no-optimize" #endif @@ -1029,6 +1032,9 @@ TkCreateMainWindow( #endif #if !defined(_WIN32) && !defined(MAC_OSX_TK) ".x11" +#if !defined(HAVE_XFT) + ".no-xft" +#endif #endif ), NULL); } diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 9391906..7b06200 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -978,6 +978,7 @@ TkWmDeadWindow( { WmInfo *wmPtr = winPtr->wmInfoPtr, *wmPtr2; TKWindow *deadNSWindow; + TkWindow *dragTarget = [NSApp tkDragTarget]; if (wmPtr == NULL) { return; @@ -1057,7 +1058,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]) { diff --git a/tests/textWind.test b/tests/textWind.test index 5b99126..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,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 {} |