[comp.windows.x] Athena Viewport Widget behaviour

rick@cstr.ed.ac.uk (Rick Innis) (07/20/90)

I've found what I consider to be a bug in the Athena Viewport widget.
Consider the following situation:

A Viewport is created with, say, a Form as its child. The Form contains
children of its own, which are free to ask their parent to resize them.
When they do this, the Form reconfigures its layout, in the course of which
it may make a resize request of its parent, the Viewport.

Now, when the Viewport gets a geometry request from its child, it checks to
see if the request is allowable. If so, it checks to see whether the new
value is greater than the previous one. If it is, it shrinks the child by the
space needed to display a scrollbar. It does this *without checking to see if
the scrollbar is already displayed*.

This seems broken to me. Firstly, it should check to see if the scrollbar is
displayed (not difficult). Secondly, I think the child has a better idea what
size it wants to be than the Viewport does - the Viewport should adjust its
own size to allow for the scrollbar rather than shrinking its child.

If this is felt to constitute a bug I'll be happy to provide a fix. Otherwise
I'll just keep working around it in my own code.

	--Rick.

converse@EXPO.LCS.MIT.EDU (07/21/90)

> Now, when the Viewport gets a geometry request from its child, it checks to
> see if the request is allowable. If so, it checks to see whether the new
> value is greater than the previous one. If it is, it shrinks the child by the
> space needed to display a scrollbar. It does this *without checking to see if
> the scrollbar is already displayed*.
> 
> This seems broken to me. Firstly, it should check to see if the scrollbar is
> displayed (not difficult). 

Please fill out a bug report template in doc/bugs/bug-report, preferably 
with a sample fix, and send it in.  With a quick check of adding various
folders to my xmh, and watching the area where buttons are displayed, I 
don't see the behavior that you describe.  I can add lots of rows of new
folder buttons, and the Box which contains the buttons, which is a child of
the Viewport, never appears to shrink after the vertical scrollbar is created.


> the Viewport should adjust its
> own size to allow for the scrollbar rather than shrinking its child.

Are you suggesting that when a Viewport decides it needs a new scrollbar,
it should make a geometry request of it's parent?  That seems okay, but
if the parent denies the request, what else is there to do but shrink
the child of the Viewport?  

Using resources, you can force the scrollbars to always (or never) appear.
If you force the scrollbars never to appear, the child's geometry requests
will propagate to the Viewport's parent.  Isn't that what you want?


Donna Converse
converse@expo.lcs.mit.edu