gdk application and events



	I've written a small application based on the imlib example available at rhad 
to view images.  I was doing this both because I wanted a very small 
application and because I wanted to learn how to use imlib and gdk...  My 
question is this:

	I use the following code snippet to check for events:

  gdk_events_pending();
  ev = gdk_event_get();

	This is how the example did this, but after researching a little bit I'm not 
so sure this is the correct way, or if there is even a good "correct" method 
for doing this...  What is happening is that gdk_events_pending() is not 
blocking to wait for an event, but instead when it does a select() it just 
times out and so all the rest of my code is called, including the 
gdk_event_get() function.  So basically my software ends up working just fine, 
but it eats up large amounts of CPU time spinning.  So why would the author of 
the example even use gdk_events_pending() at all in this case?  It seems to 
make no difference at all in the performance of my application of I just 
comment out that line.  What I'm hoping is that there is some way to call a 
function which will block waiting for events.  It seems that gdk should offer 
this functionality, though perhaps gtk is the correct place to look for that, 
but I was trying to stay away from that for now since it over complicates my 
application a bit...  Any advice on what I should be doing instead of what I'm 
already doing?  I suppose I'm looking for something like gdk_mail_loop() or 
something.  Perhaps gdk_events_pending_blocking() should be implemented?

	TIA,
	-dath



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]