[comp.windows.x] Really waiting for events.

markf@zurich.ai.mit.edu (Mark Friedman) (07/11/90)

What do I do when I want to wait for an event from ANY of the displays
that I have opened? On unix I suppose I could do a select using the
ConnectionNumber's from the various displays, but this is not
portable. I'm also not sure whether this would work on systems that
try to optimimize client-server connections through shared memory when
the client and server are on the same machine. Does anyone have any
better ideas?

-Mark
--

Mark Friedman
MIT Artificial Intelligence Lab
545 Technology Sq.
Cambridge, Ma. 02139

markf@zurich.ai.mit.edu

klee@wsl.dec.com (Ken Lee) (07/12/90)

In article <MARKF.90Jul11112029@montreux.ai.mit.edu>, markf@zurich.ai.mit.edu
(Mark Friedman) writes:
|> What do I do when I want to wait for an event from ANY of the displays
|> that I have opened? On unix I suppose I could do a select using the
|> ConnectionNumber's from the various displays, but this is not
|> portable.

There is no portable way to do this.  Perhaps X11R5 should provide more
convenience functions for managing multiple displays?  One idea would be
a set of X*Event functions that accepted a list of displays.

Ken Lee
DEC Western Software Laboratory, Palo Alto, Calif.
Internet: klee@wsl.dec.com
uucp: uunet!decwrl!klee

west@gsrc.dec.com (Jim West (Stealth Contractor)) (07/12/90)

In article <MARKF.90Jul11112029@montreux.ai.mit.edu>, 
markf@zurich.ai.mit.edu (Mark Friedman) writes...

-What do I do when I want to wait for an event from ANY of the displays
-that I have opened? On unix I suppose I could do a select using the
-ConnectionNumber's from the various displays, but this is not
-portable. I'm also not sure whether this would work on systems that
-try to optimimize client-server connections through shared memory when
-the client and server are on the same machine. Does anyone have any
-better ideas?
- 
--Mark
---
- 
-Mark Friedman
-MIT Artificial Intelligence Lab
-545 Technology Sq.
-Cambridge, Ma. 02139
- 
-markf@zurich.ai.mit.edu

  From Xlib just use XNextEvent.  The event structure will have the display
ID in it.  You could use this to determine which display (and window) the
event was generated for.

  From the Toolkit you could use the same method as above or use Application
Context variables.  One for each display connection and then use XtAppNextEvent
to poll for events from a given display connection.

----------------------------------------------------------------------
 Jim West                      |  The Schainker Converse
 west@gsrc.dec.com             |  to Hoare's Law :
                               |
 These are my opinions.        |   Inside every small problem
 Digital has no idea           |     is a larger problem struggling
 what I'm  saying.             |       to get out.
----------------------------------------------------------------------

west@gsrc.dec.com (Jim West (Stealth Contractor)) (07/13/90)

- 
-In article <MARKF.90Jul11112029@montreux.ai.mit.edu>, 
-markf@zurich.ai.mit.edu (Mark Friedman) writes...
- 
--What do I do when I want to wait for an event from ANY of the displays
--that I have opened? On unix I suppose I could do a select using the
--ConnectionNumber's from the various displays, but this is not
--portable. I'm also not sure whether this would work on systems that
--try to optimimize client-server connections through shared memory when
--the client and server are on the same machine. Does anyone have any
--better ideas?
-- 
---Mark
----
-- 
--Mark Friedman
--MIT Artificial Intelligence Lab
--545 Technology Sq.
--Cambridge, Ma. 02139
-- 
--markf@zurich.ai.mit.edu
- 

  ahhh...forget what I said...It just 'dawned' on me that what you want is
a single point of entry for events...right?  If so then I was off on a deep
end.  Not sure if there is any better way...currently...maybe R5 ??

-----------------------------------------------------------------------
- Jim West                      |  The Schainker Converse
- west@gsrc.dec.com             |  to Hoare's Law :
-                               |
- These are my opinions.        |   Inside every small problem
- Digital has no idea           |     is a larger problem struggling
- what I'm  saying.             |       to get out.
-----------------------------------------------------------------------


----------------------------------------------------------------------
 Jim West                      |  The Schainker Converse
 west@gsrc.dec.com             |  to Hoare's Law :
                               |
 These are my opinions.        |   Inside every small problem
 Digital has no idea           |     is a larger problem struggling
 what I'm  saying.             |       to get out.
----------------------------------------------------------------------

mouse@LARRY.MCRCIM.MCGILL.EDU (der Mouse) (07/14/90)

>> What do I do when I want to wait for an event from ANY of the
>> displays that I have opened?

All I can suggest is the select() solution you are clearly already
aware of.  I don't know of any more portable way.

> From Xlib just use XNextEvent.

Read the initial posting.  Using XNextEvent assumes prior knowledge of
which display connection the next event will arrive on, or at least
assumes that all other displays can be ignored until an event arrives
over one of them.

> The event structure will have the display ID in it.  You could use
> this to determine which display (and window) the event was generated
> for.

Which is perfectly true but irrelevant to the central problem: wait for
an event on any one of several display connections, without knowing
which one the next even will arrive over.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu