[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

X Event capturing



Hi!
I am developing a software to monitor events in X Window (Linux). I am using C (and Xlib) only. How can I detect if an event has occurred for a particular window?
Finding the queue length and staying in the "check" loop as below, does not "capture" any event at all.

for (done = 0;done<5;done++)
	{
	        qlength = QLength(dpy);
                if (qlength == 0)
                {
                	sleep(1);
                	continue;
                }

		XNextEvent (dpy, &event);
		switch (event.type)
		          ...
         }

Should the delay be increased to stay waiting in the loop, or decreased to avoid missing some event? Please help. I am able to find out the applications
that are running, but not the events that occur.

Waiting for a reply,
- Karthika

_____________________________________________________
Chat with your friends as soon as they come online. Get Rediff Bol at
http://bol.rediff.com