From f3065b5641a236c48af7dcdcf8e138b72356de98 Mon Sep 17 00:00:00 2001 From: hobbs Date: Thu, 17 Jul 2003 00:37:03 +0000 Subject: * generic/tkPanedWindow.c (ArrangePanes): Ensure that the last pane * tests/panedwindow.test: shrinks instead of being clipped when resized below the reqsize. [Bug 748277] (spjuth) --- ChangeLog | 4 ++++ generic/tkPanedWindow.c | 12 +++++++++--- tests/panedwindow.test | 25 +++++++++++++++++++++++-- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9844410..de64aff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,10 @@ 2003-07-16 Jeff Hobbs + * generic/tkPanedWindow.c (ArrangePanes): Ensure that the last pane + * tests/panedwindow.test: shrinks instead of being clipped when + resized below the reqsize. [Bug 748277] (spjuth) + * generic/tkWindow.c (Initialize): do not free uninit'ed dstring. [Bug 755906] (mistachkin) diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index a096c75..60b938a 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkPanedWindow.c,v 1.13 2003/02/21 11:48:54 dkf Exp $ + * RCS: @(#) $Id: tkPanedWindow.c,v 1.13.2.1 2003/07/17 00:37:03 hobbs Exp $ */ #include "tkPort.h" @@ -1636,9 +1636,12 @@ ArrangePanes(clientData) if (pwPtr->orient == ORIENT_HORIZONTAL) { paneWidth = slavePtr->paneWidth; if (i == pwPtr->numSlaves - 1 && Tk_IsMapped(pwPtr->tkwin)) { - if (Tk_Width(pwPtr->tkwin) > Tk_ReqWidth(pwPtr->tkwin)) { + if (Tk_Width(pwPtr->tkwin) != Tk_ReqWidth(pwPtr->tkwin)) { paneWidth += Tk_Width(pwPtr->tkwin) - Tk_ReqWidth(pwPtr->tkwin); + if (paneWidth < 0) { + paneWidth = 0; + } } } paneHeight = Tk_Height(pwPtr->tkwin) - (2 * slavePtr->pady) - @@ -1646,9 +1649,12 @@ ArrangePanes(clientData) } else { paneHeight = slavePtr->paneHeight; if (i == pwPtr->numSlaves - 1 && Tk_IsMapped(pwPtr->tkwin)) { - if (Tk_Height(pwPtr->tkwin) > Tk_ReqHeight(pwPtr->tkwin)) { + if (Tk_Height(pwPtr->tkwin) != Tk_ReqHeight(pwPtr->tkwin)) { paneHeight += Tk_Height(pwPtr->tkwin) - Tk_ReqHeight(pwPtr->tkwin); + if (paneHeight < 0) { + paneHeight = 0; + } } } paneWidth = Tk_Width(pwPtr->tkwin) - (2 * slavePtr->padx) - diff --git a/tests/panedwindow.test b/tests/panedwindow.test index e073d4a..67a695d 100644 --- a/tests/panedwindow.test +++ b/tests/panedwindow.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: panedwindow.test,v 1.8 2003/02/21 11:48:56 dkf Exp $ +# RCS: @(#) $Id: panedwindow.test,v 1.8.2.1 2003/07/17 00:37:03 hobbs Exp $ package require tcltest 2.1 namespace import -force tcltest::configure @@ -1874,7 +1874,28 @@ test panedwindow-22.11 {ArrangePanes, panes with width <= 0 are unmapped} { destroy .p .p.f1 .p.f2 set result } {1 0} - +test panedwindow-22.12 {ArrangePanes, last pane shrinks} { + panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 + .p add [frame .f1 -width 20 -height 20 -bg blue] \ + [frame .f2 -width 20 -height 20 -bg red] -sticky nsew + place .p -width 40 -x 0 -y 0 + update + set result [winfo width .f2] + destroy .p .f1 .f2 + set result +} 18 +test panedwindow-22.13 {ArrangePanes, last pane shrinks} { + panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ + -orient vertical + .p add [frame .f1 -width 20 -height 20 -bg blue] \ + [frame .f2 -width 20 -height 20 -bg red] -sticky nsew + place .p -height 40 -x 0 -y 0 + update + set result [winfo height .f2] + destroy .p .f1 .f2 + set result +} 18 + test panedwindow-23.1 {PanedWindowReqProc, react to slave geometry changes} { # Basically just want to make sure that the PanedWindowReqProc is called panedwindow .p -borderwidth 0 -sashpad 0 -sashwidth 2 -- cgit v0.12