Re: [gtk-list] gtk_main() and foreign event loops



Alexander Taranov wrote:
> I want to use GTK in CORBA based server (Orbix or ORBACUS)
> Both ORB's have a mechanism to incorporte
> Xt event loop. 
> 
> DOes anybody know how to do this with gtk_main() ??

The trick is to run the event loop of the first component as an idle
task in the event loop of the other component.

For example: suppose your Corba thingy has a way to process events like:

  while(corba_events_available())
    process_corba_event();

Make a function like:

  int do_corba_events(gpointer data)
  {
    while(corba_events_available())
      process_corba_event();

    return(TRUE);
  }

Add an idle function to GTK+:

  int corba_id;

  corba_id = gtk_idle_add(GtkFunction)do_corba_event, NULL);

Now run GTK+ in the normal way, and your Corba event loop will be called.
Another way to accomplish this is by using gtk_timeout functions, or by
creating your own event loop that calls both GTK and Corba.

BTW: I fail to see why a _server_ needs a GUI.


Erik

-- 
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
of Electrical Engineering, Faculty of Information Technology and Systems,
Delft University of Technology, PO BOX 5031,  2600 GA Delft, The Netherlands
Phone: +31-15-2785859  Fax: +31-15-2781843  Email J.A.K.Mouw@its.tudelft.nl
WWW: http://www-ict.its.tudelft.nl/~erik/



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