Index: generic/tkGrid.c ================================================================== --- generic/tkGrid.c +++ generic/tkGrid.c @@ -2778,10 +2778,11 @@ * If we have emptied this master from slaves it means we are no longer * handling it and should mark it as free. */ if ((masterPtr->slavePtr == NULL) && (masterPtr->flags & ALLOCED_MASTER)) { + Tk_GeometryRequest(masterPtr->tkwin, 0, 0); TkFreeGeometryMaster(masterPtr->tkwin, "grid"); masterPtr->flags &= ~ALLOCED_MASTER; } } @@ -3505,10 +3506,11 @@ * If we have emptied this master from slaves it means we are no longer * handling it and should mark it as free. */ if (masterPtr->slavePtr == NULL && masterPtr->flags & ALLOCED_MASTER) { + Tk_GeometryRequest(masterPtr->tkwin, 0, 0); TkFreeGeometryMaster(masterPtr->tkwin, "grid"); masterPtr->flags &= ~ALLOCED_MASTER; } return TCL_OK; Index: generic/tkPack.c ================================================================== --- generic/tkPack.c +++ generic/tkPack.c @@ -1361,10 +1361,11 @@ * If we have emptied this master from slaves it means we are no longer * handling it and should mark it as free. */ if (masterPtr->slavePtr == NULL && masterPtr->flags & ALLOCED_MASTER) { + Tk_GeometryRequest(masterPtr->tkwin, 0, 0); TkFreeGeometryMaster(masterPtr->tkwin, "pack"); masterPtr->flags &= ~ALLOCED_MASTER; } } Index: tests/grid.test ================================================================== --- tests/grid.test +++ tests/grid.test @@ -1996,11 +1996,58 @@ destroy .a grid .c -row 0 -column 0 grid info .c } {-in . -column 0 -row 0 -columnspan 2 -rowspan 2 -ipadx 0 -ipady 0 -padx {3 5} -pady {4 7} -sticky ns} grid_reset 22.5 - +test grid-23.1 {frame returns to 1x1 when children destroyed (tip 454)} { + grid [frame .f] + grid [frame .f.f] + grid [entry .f.f.e] + update + set res [list [expr {[winfo reqwidth .f.f] > 1}]\ + [expr {[winfo reqheight .f.f] > 1}]] + destroy .f.f.e + lappend res [winfo reqwidth .f.f] [winfo reqheight .f.f] +} {1 1 1 1} +grid_reset 23.1 +test grid-23.2 {frame keeps size when children destroyed with propagate off (tip 454)} { + grid [frame .f] + grid [frame .f.f] + grid [entry .f.f.e] + update + set w [winfo reqwidth .f.f] + set h [winfo reqheight .f.f] + grid propagate .f.f 0 + destroy .f.f.e + list [expr { $w - [winfo reqwidth .f.f]}]\ + [expr {$h - [winfo reqheight .f.f]}] +} {0 0} +grid_reset 23.2 +test grid-23.3 {frame returns to 1x1 when children ungridded (tip 454)} { + grid [frame .f] + grid [frame .f.f] + grid [entry .f.f.e] + update + set res [list [expr {[winfo reqwidth .f.f] > 1}]\ + [expr {[winfo reqheight .f.f] > 1}]] + grid forget .f.f.e + lappend res [winfo reqwidth .f.f] [winfo reqheight .f.f] +} {1 1 1 1} +grid_reset 23.3 +test grid-23.4 {frame returns to 1x1 when children moved (tip 454)} { + grid [frame .f] + grid [frame .f.f] + grid [entry .e] -in .f.f + grid [frame .f2] + update + set res [list [expr {[winfo reqwidth .f.f] > 1}]\ + [expr {[winfo reqheight .f.f] > 1}]] + grid configure .e -in .f2 + lappend res [winfo reqwidth .f.f] [winfo reqheight .f.f] +} {1 1 1 1} +grid_reset 23.4 + # cleanup cleanupTests return # Local Variables: Index: tests/pack.test ================================================================== --- tests/pack.test +++ tests/pack.test @@ -789,11 +789,10 @@ pack .pack.d -side top update list [winfo reqwidth .pack] [winfo reqheight .pack] } -result {100 110} - # For the tests below, create a couple of "pad" windows to shrink # the available space for the remaining windows. The tests have to # be done this way rather than shrinking the whole window, because # some window managers like mwm won't let a top-level window get # very small. @@ -1624,12 +1623,69 @@ lappend res [winfo geometry .pack.lf] } -cleanup { destroy .pack.l .pack.lf } -result {162x127+0+0 172x112+0+0} +test pack-20.1 {frame returns to 1x1 when children destroyed (tip 454)} -setup { + catch {eval pack forget [pack slaves .pack]} + destroy .pack.f +} -body { + pack [frame .pack.f] + pack [entry .pack.f.e] + update + set res [list [expr {[winfo reqwidth .pack.f] > 1}]\ + [expr {[winfo reqheight .pack.f] > 1}]] + destroy .pack.f.e + lappend res [winfo reqwidth .pack.f] [winfo reqheight .pack.f] +} -result {1 1 1 1} + +test pack-20.2 {frame keeps size when children destroyed and no propagation (tip 454)} -setup { + catch {eval pack forget [pack slaves .pack]} + destroy .pack.f +} -body { + pack [frame .pack.f] + pack [entry .pack.f.e] + update + set w [winfo reqwidth .pack.f] + set h [winfo reqheight .pack.f] + pack propagate .pack.f 0 + destroy .pack.f.e + list [expr {$w - [winfo reqwidth .pack.f]}]\ + [expr {$h - [winfo reqheight .pack.f]}] +} -result {0 0} + +test pack-20.3 {ttk::frame returns to 1x1 when children unpacked (tip 454)} -setup { + catch {eval pack forget [pack slaves .pack]} + destroy .pack.f +} -body { + pack [ttk::frame .pack.f] + pack [entry .pack.f.e] + update + set res [list [expr {[winfo reqwidth .pack.f] > 1}]\ + [expr {[winfo reqheight .pack.f] > 1}]] + pack forget .pack.f.e + lappend res [winfo reqwidth .pack.f] [winfo reqheight .pack.f] +} -result {1 1 1 1} + +test pack-20.4 {ttk::frame returns to 1x1 when children moved (tip 454)} -setup { + catch {eval pack forget [pack slaves .pack]} + destroy .pack.f + destroy .pack.f2 + destroy .pack.e +} -body { + pack [ttk::frame .pack.f] + pack [ttk::frame .pack.f2] + entry .pack.e + pack .pack.e -in .pack.f + update + set res [list [expr {[winfo reqwidth .pack.f] > 1}]\ + [expr {[winfo reqheight .pack.f] > 1}]] + pack configure .pack.e -in .pack.f2 + lappend res [winfo reqwidth .pack.f] [winfo reqheight .pack.f] +} -result {1 1 1 1} # cleanup cleanupTests return