<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>(5.2.3) Switching out of Fullscreen doesn&#39;t work on one of my computers.</title>
		<link>http://www.allegro.cc/forums/view/617765</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 14 Mar 2019 10:20:43 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>version: 5.2.3<br />OS: Windows 10</p><p>Toggling ALLEGRO_FULLSCREEN_WINDOW works fine on one of my machines but not the other.  </p><p>On the other one, the initial window works fine, but after entering fullscreen and then exiting, instead of a window I just get a picture-in-picture effect in the bottom left corner of the screen.</p><p>I can&#39;t update to the latest version (that is to say, I&#39;ve tried and failed) so I&#39;m trying to see if this was/is a known issue and what suggestions anyone has on a workaround or if I am doing something wrong.</p><p>Here&#39;s the Forth code:</p><pre>
variable winx  variable winy
: ?poswin ( - )   \ save/restore window position when toggling in and out of fullscreen
    display al_get_display_flags ALLEGRO_FULLSCREEN_WINDOW and if
        fs @ 0= if  r&gt; call  display winx @ winy @ al_set_window_position  then
    else
        fs @ if     display winx winy al_get_window_position  then
    then ;
    
0 value #lastscale
variable newfs
: 2s&gt;f ( ix iy - f: x y ) swap s&gt;f s&gt;f ;
: ?fs ( - )  \ toggle fullscreen based on FS flag
    ?poswin
    fs @ newfs @ = ?exit
    display fs @ if native 2@ else res 2@ #lastscale * swap #lastscale * swap then al_resize_display drop
    display ALLEGRO_FULLSCREEN_WINDOW fs @ $1 and al_toggle_display_flag drop
    fs @ newfs !
    fs @ if
        #globalscale to #lastscale
        native xy@ 2s&gt;f f/ 
        res xy@ 2s&gt;f f/ f&gt; if
            native y@ res y@ /
        else
            native x@ res x@ /
        then
            4 min to #globalscale
    else
        #lastscale to #globalscale
    then
    FULLSCREEN_EVENT al-emit-user-event
;
</pre><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (roger levy)</author>
		<pubDate>Tue, 05 Mar 2019 09:22:56 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Maybe a driver issue? This kind of thing also happens with AAA games, this is not easy...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (torhu)</author>
		<pubDate>Tue, 05 Mar 2019 09:46:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I can&#39;t imagine that being the case...  ALLEGRO_FULLSCREEN_WINDOW essentially just resizes the window and removes the frame.  For some reason it doesn&#39;t appear to be doing either!  Only changing the projection, I guess.</p><p>Update:</p><p>Extra weirdness!  When working in my engine&#39;s IDE I have this issue (on one computer), but in exported games it works fine!  </p><p>Which is very strange because they use the exact same code.  The only difference is the Ramen IDE has a &quot;parent&quot; window, the SwiftForth IDE.</p><p>Update:</p><p>OK, I lied.  There is a difference;  exported games don&#39;t set ALLEGRO_OPENGL.  Which is technically a bug; they should.  But that means that Allegro 5 isn&#39;t playing well with OpenGL on this machine.  Or the driver is buggy ... or both!  What should I do?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (roger levy)</author>
		<pubDate>Tue, 05 Mar 2019 09:49:34 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Well, what is an &quot;exported&quot; game?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (torhu)</author>
		<pubDate>Tue, 05 Mar 2019 10:30:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Classic Forth practice is to save an image of the running compiler-interpreter, along with the compiled program in memory.  This image is called a &quot;turnkey&quot; and that&#39;s what my exported games are.  They use the &quot;runtime&quot; startup code that&#39;s slightly different from the &quot;development&quot; startup code.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (roger levy)</author>
		<pubDate>Tue, 05 Mar 2019 10:48:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I guess the question is what happens to the code you write before it is executed. Forth is an old and largely unsupported language. There could be many reasons why your program fails. Do you have an active Forth community that you can ask?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (torhu)</author>
		<pubDate>Tue, 05 Mar 2019 11:44:46 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It may be helpful to post the <span class="source-code">allegro.log</span>.</p><p>You can enable it by... having an allegro5.cfg in the same directory as your program with the contents:</p><div class="source-code snippet"><div class="inner"><pre><span class="k2">[</span>trace<span class="k2">]</span>
level<span class="k3">=</span>debug
</pre></div></div><p>

An <span class="source-code">allegro.log</span> will appear after you run your program.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Tue, 05 Mar 2019 13:13:44 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I really haven&#39;t the faintest what you&#39;re doing in that Forth code, but it should be as simple as translating this C to Forth :</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">bool</span> fs <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_get_display_flags"><span class="a">al_get_display_flags</span></a><span class="k2">(</span>display<span class="k2">)</span> <span class="k3">&amp;</span> ALLEGRO_FULLSCREEN_WINDOW<span class="k2">;</span>
al_set_display_flag<span class="k2">(</span>display , ALLEGRO_FULLSCREEN_WINDOW , <span class="k3">!</span>fs<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Wed, 06 Mar 2019 01:27:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Destroying and recreating the display solved the issue.</p><p>A particular monitor caused a different issue when the first computer was connected to it.  Different but no better.  So it seems to be picky not only depending on what driver but what monitor is connected.  (I tested with and without OpenGL and it didn&#39;t matter with this combination.)</p><p><s>I&#39;d recommend to anyone to just never ALLEGRO_FULLSCREEN_WINDOW with al_toggle_display_flag.  Maybe that feature should be removed.</s></p><p>EDIT: After some more debugging I think I was doing something wrong, I&#39;ll update when I figure it all out.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (roger levy)</author>
		<pubDate>Fri, 08 Mar 2019 09:20:32 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="https://www.allegro.cc/forums/thread/617765/1041610#target">roger levy</a> said:</div><div class="quote"><p>
Destroying and recreating the display solved the issue.
</p></div></div><p>
That&#39;s one option, sure, but it&#39;s sub-optimal. It would mean moving all the textures to memory and back, which is fine if you haven&#39;t loaded any.</p><p><span class="source-code"><a href="http://www.allegro.cc/manual/al_toggle_display_flag"><span class="a">al_toggle_display_flag</span></a></span> was deprecated in favor of <a href="https://liballeg.org/a5docs/trunk/display.html#al_set_display_flag">al_set_display_flag</a>. They do the same thing. Whether or not the implementation changed I&#39;m not sure yet. My gitfu isn&#39;t good enough to figure out how to compare 5.2.3 with master.</p><p>Also, <span class="source-code">al_set_display_flag<span class="k2">(</span>d , ALLEGRO_FULLSCREEN_WINDOW , onoff<span class="k2">)</span></span> works fine for me on Windows 10 with 5.2.5.</p><p>If you need help upgrading that&#39;s a different topic.</p><p><b>EDIT</b><br />Is this the code to toggle the flag?
</p><div class="source-code snippet"><div class="inner"><pre>display ALLEGRO_FULLSCREEN_WINDOW fs @ $<span class="n">1</span> <span class="k1">and</span> <a href="http://www.allegro.cc/manual/al_toggle_display_flag"><span class="a">al_toggle_display_flag</span></a> drop
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sat, 09 Mar 2019 03:57:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Could anyone download this and run the examples under bin/ and post how toggling fullscreen with alt-enter works for them?  (Assuming they run.  Windows 7+ only)</p><p><a href="https://www.dropbox.com/s/zpzs2nhlufpyrwg/RamenEngine-2.0-Preview-1.zip?dl=0">https://www.dropbox.com/s/zpzs2nhlufpyrwg/RamenEngine-2.0-Preview-1.zip?dl=0</a></p><p>@Edgar, the documentation says that bitmaps are preserved in cases where the driver might drop them from VRAM, so doesn&#39;t that mean it shouldn&#39;t be an issue?</p><p>I added a check to see if the al_set_display_flag returns 0 and if so use the destruction/creation method.  On the computer where toggling out of fullscreen doesn&#39;t work right, it doesn&#39;t return 0 so the bug persists.</p><p>I spend way too much time dealing with these kinds of low-level issues that I feel Allegro should have already solved for me.  I&#39;m thinking of dropping windowed mode entirely, or prohibiting switching (i.e. applications are windowed OR fullscreen.)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (roger levy)</author>
		<pubDate>Sun, 10 Mar 2019 07:30:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="https://www.allegro.cc/forums/thread/617765/1041617#target">roger levy</a> said:</div><div class="quote"><p>
@Edgar, the documentation says that bitmaps are preserved in cases where the driver might drop them from VRAM, so doesn&#39;t that mean it shouldn&#39;t be an issue?
</p></div></div><p>
It&#39;s a performance issue, not a usability issue, just wanted you to be aware in case your apps are resource heavy.</p><div class="quote_container"><div class="title"><a href="https://www.allegro.cc/forums/thread/617765/1041617#target">roger levy</a> said:</div><div class="quote"><p>
I spend way too much time dealing with these kinds of low-level issues that I feel Allegro should have already solved for me. I&#39;m thinking of dropping windowed mode entirely, or prohibiting switching (i.e. applications are windowed OR fullscreen.) 
</p></div></div><p>
I&#39;ve been spending some time with the Windows window code and I&#39;m confident we could get it fixed (if it hasn&#39;t been already).</p><p>I&#39;m not seeing any changes in src\win\wwindow.c since 5.2.3. I checked out 5.2.3 and it&#39;s the same.</p><p>It works fine for me as long as I don&#39;t have my HDMI monitor attached, then it gets weird. Try updating your graphics drivers and see if that helps.</p><p>I downloaded your zip from DropBox and Windows Defender says it found a Trojan in your code. <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /></p><p><span class="remote-thumbnail"><span class="json">{"name":"611945","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/3\/7339cc9217cdbc8a8ef5dafced95d6e7.png","w":698,"h":786,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/3\/7339cc9217cdbc8a8ef5dafced95d6e7"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/7/3/7339cc9217cdbc8a8ef5dafced95d6e7-240.jpg" alt="611945" width="240" height="270" /></span>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sun, 10 Mar 2019 14:54:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I was afraid of that...  my install literally just started doing the same thing.  Can you whitelist it?  I forget the procedure but when it gets tripped if you click advanced options or something you get the choice to ignore it.</p><p>It&#39;s a bug with SwiftForth, don&#39;t know if they even fixed it.  Things are way overdue to jump ship from that product.  Because the evaluation doesn&#39;t let you write .exe&#39;s and the full copy costs $400 and I don&#39;t even use 90% of its features, which are oriented towards Windows GUI&#39;s.</p><p>Graphics drivers are up to date.  It&#39;s just plain old Intel HD.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (roger levy)</author>
		<pubDate>Sun, 10 Mar 2019 20:10:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Alt Enter works fine on your platformer app.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Tue, 12 Mar 2019 03:10:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Good to hear, but I got the same bug on my mom&#39;s computer (another Intel HD), so it doesn&#39;t appear to be a fluke.  What kind of graphics adapter do you have?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (roger levy)</author>
		<pubDate>Tue, 12 Mar 2019 05:41:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Intel HD by default. NVIDIA by choice.</p><p>Your platformer works fine, including on my HDMI monitor, just with the Intel.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Tue, 12 Mar 2019 06:07:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Are you switching to fullscreen and back, or just into fullscreen and quitting?  It happens when you go from window-&gt;fullscreen-&gt;window.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (roger levy)</author>
		<pubDate>Tue, 12 Mar 2019 06:09:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Both
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Tue, 12 Mar 2019 07:29:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>OK.  Are you able to access any other machines?  Otherwise I guess we just have to wait and see if anyone else can reproduce it.  </p><p>The toggling ability isn&#39;t a crucial feature, so for now I&#39;ve taken it out of the engine.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (roger levy)</author>
		<pubDate>Tue, 12 Mar 2019 08:36:43 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I don&#39;t have any other computers to test it on except for XP.</p><p>I tried using my HDTV and it works too.</p><p>Thing is, going from fs window to window is a mode switch for the monitor.</p><p>So maybe you just have bad monitors, I don&#39;t know.</p><p>Thing is, the windows code does the same thing on every windows edition there is. It&#39;s not necessarily a Windows problem, rather a hardware or software problem.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Thu, 14 Mar 2019 10:20:43 +0000</pubDate>
	</item>
</rss>
