Strange al_toggle_display_flag behavior
APrince

Hi, i am using Allegro 5.0.11 on Win7 x64 bit. Also I use DirectX as a renderer.

In my application I sometimes need to switch between windowed and fullscreen mode.

I noticed a strange behavior. If I call this:

al_toggle_display_flag(display,  ALLEGRO_FULLSCREEN_WINDOW, fullscreen);
al_toggle_display_flag(display,  ALLEGRO_NOFRAME, fullscreen);
//fullscreen is a variable that tells me wheter to switch from fullscreen to windowed or vice verse
//I call al_resize_display later on in the code if the target size is different than the current one, but this is not that important...

It stretches my window in both directions a bit (few pixels). The thing is that it does not actually change the coordinate system, it only stretches the window and the content within so it looks ugly.

This happens even if the al_toggle_display_flag does not really change anything - i.e. I set the flag to the value it already has.

There are 2 workarounds I have been able to come up with:

1) check the flag before setting it, if is the same avoid calling the function at all
2) call al_resize_display() after the code above to resize the window back to the size it should have...

Some examples:
My window has 1030x743 size. I call the code above suddenly it streches the window 1048x783, I call it again and it is 1063x820 and so on...

It might seem I use the flag settings a wrong way but I'm not I just tried to simplify the situation. The thing that setting flag to some value (even the value it already has) should not change the windows size in any case. It might be that big a problem as I can use the workarounds described above, but it rather points to the fact, that there is something seriously wrong going on underneath...

Thread #615704. Printed from Allegro.cc