Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bionet!ames!vsi1!daver!athsys!jim From: jim@athsys.uucp (Jim Becker) Newsgroups: comp.windows.x Subject: Re: Xt and applications that do non-window-related processing Message-ID: <246@tityus.UUCP> Date: 17 Feb 89 23:23:58 GMT References: <2696@daisy.UUCP> Organization: Athena Systems, Inc., Sunnyvale, CA Lines: 29 From article <2696@daisy.UUCP>, by klee@daisy.UUCP (Ken Lee): > In article <626@arisia.Xerox.COM> jlevy.pa@xerox.com (Jacob Levy) writes: >>Suppose I wanted to write an application that sat in an infinite >>loop and only every so often checked for input from X. It is >>simple to do this with Xlib, but seems a lot hairier with Xt. > This is a somewhat related question and possible solution. I have a couple of programs that give visual update status on the screen. Most of the time they are snoozing away, waking up every five seconds or so. Currently I am doing a sleep() call, then a call to XPending() to check for recent events. This works, but sometimes there is a lag of up to five seconds when I just miss Expose or other events. After playing in the X server code, it appears to me that the application should be able to do a select() call with the desired timeout value set and the appropriate bit set for the display->fd socket connection. Then the select() call would sleep until either the timeout occurred or there was activity from the X server connection. This is speculation, as I haven't had a chance to try this myself. (It also only works on select() oriented systems..) Does this sound like it would work correctly? Seems like you could also use a SIGIO handler and a global flag to indicate the presence of XEvents to be processed. -Jim Becker ...!sun!athsys!jim