Re: [AD] al_toggle_display_flag

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


On 5 Feb 2010, at 10:43 , Elias Pschernig wrote:
> I'd like to introduce a new function al_toggle_display_flag() which
> would replace the current al_toggle_window_frame().
> 
> The change would look like this. Instead of:
> 
> al_toggle_window_frame(display, true)
> 
> you would use:
> 
> al_toggle_display_flag(display, ALLEGRO_NOFRAME, true)
> 
> Except instead of just ALLEGRO_NOFRAME, each of the display flags could
> be used. It also would have a boolean return value telling if the change
> succeeded.

Ok.

> In addition to toggling the window frame, also the resize flag and
> expose events flag could be toggled then. Once we have support for it,
> also an ALLEGRO_MAXIMIZED flag. And of course fullscreen mode but I'll
> write another message about that.

Speaking purely from an OS X perspective, some of these things are possible on 10.6 (and up, presumably), but none of it is possible on earlier versions. That's not a problem, but it is something to keep in mind. Resizing the window so that it is maximised is no problem (just a matter of asking what the size of a window that would fill the entire screen would be), switching an established display to fullscreen mode is impossible or very nearly impossible, since fullscreen mode works very different from windowed mode. We'd essentially have to destroy the display and recreate it, which is doable but in my opinion not worth it.
Still, that's fine if the function can just return FALSE. All in all, sounds good.

> We could just as well have a separate function for each and I'm not
> really sure which is better, right now I feel re-using the flags is the
> nicer API.

I agree.

> Also except fullscreen none of these flags are very important
> to toggle - usually the only time you would care is the initial state.

Well, that may be true - personally I don't think I'd use this feature very often.
About the fullscreen flag being the most important though - is that the main reason you would want to have this function? As I said, that is a very non-trivial thing to do on OS X.
If we can support it on some platforms but not others, then we have to tell users to write code like

if (!al_toggle_display_flag(dpy, ALLEGRO_FULLSCREEN, true)) {
   al_destroy_display(dpy);
   al_set_new_display_flag(ALLEGRO_FULLSCREEN, true);
   dpy = al_create_display(...);
}

if they *really* want to make sure their code runs in fullscreen mode. In which case we might as well tell them to write only the code in the {...} block.

> Anyway, it should be a simple change - the "toggle_frame" display vtable
> entry would be renamed to "toggle_display_flag". A driver could then
> just provide an empty function returning false if it doesn't like
> changing window properties after it was created (e.g. the iphone port).

Sounds good.

Evert



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