Re: is thaere a way to exit(1)?



On 01/17/2012 03:35 PM, Gary Kline wrote:
      well, it =is= busy.  it's looping endlessly; but then i
      limited it to 5 loops with a for-loop.  same.  (i thought my
      programming skills were better that having to use the
      debugger, but may have to.)  before, i am going to scp
      everything over to my eee-900a that runs debian.  see if it
      runs there.  i hope i don't see smoke rising from the
      netbook :-)

I think the problem is you are approaching your problem from a
traditional, procedural point of view.  That isn't going to work in
event-driven apps, which is what GTK apps are.  If in your code you are
looping endlessly, you are preventing GTK from handling events.  This
means that no X11 events (mouse, keyboard, etc) are processed.  Your
window manager detects this and makes your app turn gray which signifies
to the user that the app is hung (not responding to input).

If you need to do a long-running task in GTK, either spawn a thread to
do the work, allowing control of the main thread to return to GTK's main
loop, or during your loop you have to iterate the GTK main event loop by
doing something like this in your code:

while (gtk_events_pending ()) {
        gtk_main_iteration ();
}

In general, in a callback you must return control to GTK asap for the
GUI to keep running.

Hope this helps.



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