Re: [AD] X window creation

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


George Foot <george.foot@xxxxxxxxxx> writes:
> I think it would be great if we could open windows when the graphics 
> mode is set and close them afterwards -- this would make life a lot 
> easier for AllegroGL, and intuitively makes more sense to me. The 
> difference between this and your system is a sort of symmetry -- the 
> created window doesn't last from one graphics driver to the next; each 
> gets the chance to set up whichever window suits it best.

The problem with that is that if someone is using a window manager set to 
manual window placement mode, they have to redo the placement every time 
the program changes video mode, which could get annoying.

The current logic can do what you need for GL, though. All it does is 
that whenever setting an X or DGA mode, it checks whether the window 
exists, and if not, creates it. Then in allegro_exit(), it checks whether 
the window exists, and if so, destroys it. So all you need to do is, when 
setting a GL mode, first destroy any window that already exists, create 
your own, and then destroy your window when shutting down the GL driver. 
That would allow your GL code to create/destroy its own window only when 
that driver is active, while still letting other Allegro modes share a 
single window across multiple resolutions: the window would only be 
destroyed and recreated when switching from Allegro to a GL driver. In 
practice of course I suspect that most programs will only ever use either 
Allegro or GL graphics, so delaying the window creation until the first 
set_gfx_mode() allows the appropriate driver to be in charge of creating 
it for the first time.

> The only problem I can see with this is what Michael said about not 
> being able to get input, and what I found above about input getting 
> disabled when we close and reopen the window.

I think it's ok not to be able to get input while not in a graphics mode 
(really the program doesn't exist until it sets a graphics mode, and this 
is the same behaviour as in Windows).


-- 
Shawn Hargreaves - shawn@xxxxxxxxxx - http://www.talula.demon.co.uk/
"A binary is barely software: it's more like hardware on a floppy disk."



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/