On Mon, 17 Dec 2001, Paul Davis wrote:

> >  I'm writing an app using xlib, but I need some buttons and menus.
>
> you should use a proper toolkit. nobody uses xlib on its own these days
> unless they are themselves writing a toolkit.

I'm interested in this topic too. It would be nice to write some modules
which aren't specified as gtk widgets or other gtk objects. Assume you
write an application with a proprietary internet protocol. You surely want
to open this protocol to any toolkit. So we need a mixed event handling,
one for our module and one for lets say a gtk application.

X isn't far away from such a network event handler since you can even
select on the filedescriptor to the X-Server in Xlib.

>
> > Can I mix my own event loop (while(true) { XNextEvent(Display *,
> >  XEvent*); switch(event.type) ...})
> > with Gtk+'s main loop?
>
> No.

Aren't there functions in gtk which, like XNextEvent select exactly one event
from the gtk event loop and dispatch it ? Of course we have to care about gtk
not catching our events. Shouldn't that be easy to distinguish by opening the
DISPLAY two times ? That may not be very, optimized but shouldn't it work ?
I will surely track this problem down the next months.

>
> >        Can I mix bare Xlib Window  with Gtk+ widgets?
>
> Sometimes, but its not easy and there are many pitfalls.
>
> --p

So lets try it:

        init gtk ... create some widgets ...
        init Xlib Display ... create some windows ...
        while ( !exit_application )
        {
                Try first event source ... handle and dispatch events
                Try second event source ... and so on ...
        }

Why shouldn't this work ? The two parts don't hurt each other ?

CU INGO

_______________________________________________
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to