[comp.windows.x.motif] Various problems

Paul.Quane@samba.acs.unc.edu (BBS Account) (08/07/90)

I am a novice user of motif ( 'swell as USENET) about to take an advantage
of this excellent forum in the hope of getting some help with my problems.
I use motif 1.0 (R3) on HP9000/300

1/ I Read the discussion on The FileSelectionBox bugs with interest. The fixes
   suggested are good if you have the source or 1.1 but what about me ?!! 
   A further problem I had with FSB was when I tried to add my own search
   procedure in order to have simple file names with no paths ( don't tell me,
   there's an easy way?! ). Anyhow after calling DoSearch and managing the 
   dialog the list had a missing last entry and a corrupted looking 2nd last.
   The Last entry should have been a recently added file to the directory
   to which the dirmask pointed. The corruption sorts itself out when the
   selection bar  is moved over the list item. Any Ideas ?

2/ I have tried using XtAppAddInput with the XtInputReadMask. The callback 
   procedure was called every time round XtMainLoop, not just when
   Input was pending on the file. Why doesn't it work as described. What
   am I doing wrong? ( I opened the file with open )

3/ I have a row/column child of a bulletin board with about 20 VERTICAL
   oriented children, some of which appear off the end of the screen.
   I have an aversion to hardcoding(even in resource defaults   files) 
   dimensions for widgets. Isn't that the job of the window manager - to
   optimize the display resource for best display of client windows ?
   Is this the only way to prevent the children at the end from being off the
   screen? The guide suggests that wrapping occurs to the next column
   when "there is no more room left" for another item. When exactly is "no
   more room" ?

any input will be appreciated. thanks for your help in advance
e-mail please to Paul.Quane@samba.acs.unc.edu
Paul Quane (919) 549 5154

argv@turnpike.Eng.Sun.COM (Dan Heller) (08/10/90)

In article <726@beguine.UUCP> Paul.Quane@samba.acs.unc.edu (BBS Account) writes:
> 2/ I have tried using XtAppAddInput with the XtInputReadMask. The callback 
>    procedure was called every time round XtMainLoop, not just when
>    Input was pending on the file. Why doesn't it work as described. What
>    am I doing wrong? ( I opened the file with open )
This should be added to the list of "frequently asked questions".
XtAppAddInput() when used on *files* will almost always cause the
associated function to be called.  The problem that most people
have is that they misinterpret the meaning of the function -- it
does *not* mean that the function is called whenever the file has
"new data" to read, it means that the function will be called whenever
the file is *ready* to be read.  Which, in most cases, is all the time.
Just because there is no new data to read does not imply that you
can't rewind the file and read it again ... thus, the file is still
"ready to be read."  To get the type of interaction you're expecting,
you should add the following two lines to the beginning of your function:
    if (ioctl(fd, FIONREAD, &n) == -1 || n == 0)
	return;
This tests to see if there is any data on the file descriptor that
is ready to be read (that you haven't read yet).  If there is nothing
new to read, n will equal zero.

--
dan
----------------------------------------------------
O'Reilly && Associates   argv@sun.com / argv@ora.com
Opinions expressed reflect those of the author only.