Newsgroups: comp.windows.x.motif
Path: utzoo!utgpu!watserv1!watdragon!watsol.waterloo.edu!tbray
From: tbray@watsol.waterloo.edu (Tim Bray)
Subject: Re: Scrolled Window: Area Size; bug?
Message-ID: <1991Feb23.000225.26939@watdragon.waterloo.edu>
Sender: daemon@watdragon.waterloo.edu (Owner of Many System Processes)
Organization: University of Waterloo
References: <1991Feb19.213852.3289@csrd.uiuc.edu> <110630035@hpcvlx.cv.hp.com>
Date: Sat, 23 Feb 1991 00:02:25 GMT
Lines: 37

bobm@hpcvlx.cv.hp.com (Bob May) writes:
|someone writes:
||   I have a Scrolled WIndow with a scrollingPolicy of AUTOMATIC and a
|| scrollBarDisplayPolicy of AS_NEEDED. The work area of this Widget is a
|| Drawing Area. What I need to do is to determine, at arbitrary times, the
|| exact rectangular regtion of the Drawing Area that is visible thru the
|| viewing area of the Scrolled Window.
|   Try getting the widget ID contained in the Scrolled Window's XmNclipWindow
|   resource, then do a GetValues on the width and height of that widget.
|   Should be just what you need.

Odd that this should come up.  I just spent the best part of a day trying
to figure out why this doesn't work.  If I do the following:

XtSetArg(arg[0], XmNclipWindow, &clip); 
XtGetValues(scrolledwindow, arg, 1);
XtSetArg(arg[0], XmNwidth, &width);
XtSetArg(arg[1], XmNheight, &height);
XtGetValues(clip, arg, 2);

Then I am regularly but somewhat unpredictably getting garbage values
back in width & height.  I'm about 90% ready to call this a bug, since 

(1) the rest of this (large) application is working fine, and 
(2) these failures occur, but in different places, in the same app on
    a dec3100 and Sparc (more on the Sparc - it basically never works) - both
    the same MIT X11R4 & Motif 1.1
(3) if I break down and call XGetGeometry on XtWindow(clip), I get the right 
    answers.  

So there *may well* be a real bug here.  On a related note, I tried to resize
the clip window, via a somewhat equivalent XtSetArg/XtSetValues sequence, and
it flatly ignored me, but this may be a function of the Form it's living in; or maybe you just can't resize the clipWindow of a ScrolledWindow.

Motif is just great, except when it isn't.

Cheers, Tim Bray
