Re: [AD] About the X-Window version. |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Peter Wang <tjaden@xxxxxxxxxx> writes:
> I guess what I'm asking is, is it possible for a program to connect to the
> X server without opening a window, then open it during set_gfx_mode?
> If not, would it be viable for X/Allegro to not connect until set_gfx_mode
> called for the first time?
(coming up: a wild guess from someone who has never done any X coding :-)
The trouble with opening a window during set_gfx_mode(), is that then you'd
probably want to destroy it again during set_gfx_mode(GFX_TEXT), and that
would lead to a new window being created for each new graphics mode, and
therefore manual positioning window managers would require you to repeat the
positioning every time the program changed video mode. Not good!
I suppose it would be possible to only create the window the first time
set_gfx_mode() is called, but that leads to an inconsistency in that the
program state before your first call to set_gfx_mode() is totally different
to after you call set_gfx_mode(GFX_TEXT), and I don't think that is such a
good thing.
Creating one a window at startup is consistent with how the Windows version
behaves (although with that, the window isn't actually visible until you set
a graphics mode, but it does show up in the task bar). Part of the rules for
being portable are that you are no longer allowed to do anything important
_without_ being in a graphics mode (because not all systems have any other
way to be, for example Windows apps don't exist at all unless they have a
window to be inside of).
The current behaviour is only a problem for apps that quit after printing an
error message to the console, but on Windows, that is handled by overriding
allegro_message() to bring up a dialog box. Unfortunately we don't have any
such easy way to do this in X (it would be silly to require a whole toolkit
just for displaying error messages!) but in the long run, I think that might
be the best way to fix this. Among other things, a graphical allegro_error()
would be useful for people who launch programs from a menu or graphical file
manager, since otherwise they don't have any way to see the error output.
And automatically opening windows isn't a problem for true commandline apps
like the dat archiver, because those use the SYSTEM_NONE driver instead
of SYSTEM_XWINDOWS, which bypasses the X code entirely.
--
Shawn Hargreaves - shawn@xxxxxxxxxx - http://www.talula.demon.co.uk/
"A binary is barely software: it's more like hardware on a floppy disk."