Re: [AD] native menus

[ Thread Index | Date Index | More Archives ]

On Thu, 2011-07-07 at 17:36 -0500, Matthew Leverton wrote:
> On Wed, Jul 6, 2011 at 2:29 AM, Matthew Leverton <meffer@xxxxxxxxxx> wrote:
> > I poked around the GTK code and it looked like too much hassle for me
> > to bother with at the moment
> >
> Attached is a limited test implementation for GTK. It works with
> ex_menu.c to show/hide the main menu bar.
> But I don't know enough about how the window/display code works under
> Linux... Is there even an easy way to attach a GTK menu to the window?
> My test code just pops up a new detached window that contains the
> menu.

There's probably no easy way. From what I remember you can get a
GdkWindow for an external window from its X11 id and then maybe get a
GtkWindow from the GdkWindow but it means a lot of messing around. I
never tried though.

> Would we need something like: ALLEGRO_DISPLAY
> *al_create_native_display(w,h) that under Linux would return something
> that is a GTK window?

Hm. The clean way to do it likely would be to have a GTK system driver
instead of the X11 one. So instead of the X11 event thread we run the
GTK main loop and handle GTK events. Also would solve the problems you
mentioned in your previous post. And al_create_display would then open a
GTK window with an OpenGL view (and possibly a menu bar) inside.

But yeah, instead of just writing some menu code, you'd write a complete
GTK system driver now...

I guess only allowing popup menus in GTK will work best for now.

Somewhat related, if someone wants a full GTK or Qt GUI, it probably
wouldn't be too hard to use Allegro with it. For graphics functions,
there only has to be an active OpenGL context in the thread - just
instead of al_flip_display a GTK/Qt function would have to be called.

Maybe we should provide some kind of minimal OpenGL system driver which
does no setup at all and expects the user to do it. For events that
driver simply would create empty keyboard/mouse/display/... event
queues. Then the user could create ALLEGRO_EVENT events for GTK/Qt
events and add to the queue. And the actual game code would work
normally, just reading out those events again (which means the user's
GTK/Qt code could be completely separate and the same code could still
compile on e.g. Windows).

Elias Pschernig <elias.pschernig@xxxxxxxxxx>

Mail converted by MHonArc 2.6.19+