<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>[Allegro 5.1] Possible bug on al_set_new_window_position</title>
		<link>http://www.allegro.cc/forums/view/608603</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Mon, 17 Oct 2011 04:47:42 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I guess I mentioned this before, but it&#39;s still present on r15031.</p><p>Using <span class="source-code"><a href="http://www.allegro.cc/manual/al_set_new_window_position"><span class="a">al_set_new_window_position</span></a><span class="k2">(</span><span class="k2">)</span></span> seems to place the window slightly off on my machine. It&#39;s easier to see when you use <span class="source-code"><a href="http://www.allegro.cc/manual/al_set_new_window_position"><span class="a">al_set_new_window_position</span></a><span class="k2">(</span><span class="n">0</span>, <span class="n">0</span><span class="k2">)</span></span>. It happens with both Direct3D and OpenGL in windowed mode. Something similar happens with OpenGL when using <span class="source-code">ALLEGRO_FULLSCREEN_WINDOW</span> even if <span class="source-code"><a href="http://www.allegro.cc/manual/al_set_new_window_position"><span class="a">al_set_new_window_position</span></a><span class="k2">(</span><span class="k2">)</span></span> is not present.</p><p>Can someone confirm this? or perhaps it only happens on my machine?. I&#39;m using Windows XP and I have an old integrated Intel graphics card.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kenmasters1976)</author>
		<pubDate>Sun, 16 Oct 2011 02:47:20 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m looking at it now and there&#39;s definitely a bug. I&#39;ve found the source I think, unless there are multiple issues. I&#39;ll look into a fix.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Sun, 16 Oct 2011 04:02:25 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yep, I have the same problem... </p><p>Off-topic: Have you notice that Allegro 5.2 will have a video addon? <b>sweeeeeet!</b>.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (AMCerasoli)</author>
		<pubDate>Sun, 16 Oct 2011 04:05:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Can someone test this patch before I commit it?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Sun, 16 Oct 2011 04:51:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Well, I tried with WinMerge but it doesn&#39;t work, only compares files with files or folders with folder, which software are you using to generate/treat that .diff file?, I have never seen something like that before. </p><p>I guess isn&#39;t to big, I could do it manually.</p><p><b>Edit:</b><br />... I changed my mind, it&#39;s more complicated than I thought. <img src="http://www.allegro.cc/forums/smileys/shocked.gif" alt=":o" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (AMCerasoli)</author>
		<pubDate>Sun, 16 Oct 2011 05:25:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You need GNU patch to apply that diff. From your Allegro directory, simply</p><pre>
patch -p0 &lt; winpos.diff
</pre><p>

But Windows can have issues with programs named patch.exe (no clue why) so I rename it p.exe or something.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Sun, 16 Oct 2011 05:52:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I put it on the main folder and I got this:
</p><pre>
C:\Users\Armando&gt;cd c:/a5.1

c:\a5.1&gt;pa -p0 &lt; winpos.diff
patching file src/win/wwindow.c
Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application&#39;s support team for more information.
</pre><p>
Then I put the files (pa.exe and winpos.diff) inside win and I got this:
</p><pre>
C:\Users\Armando&gt;cd c:/a5.1/src/win

c:\a5.1\src\win&gt;pa -p0 &lt; winpos.diff
can&#39;t find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Index: src/win/wwindow.c
|===================================================================
|--- src/win/wwindow.c  (revision 15027)
|+++ src/win/wwindow.c  (working copy)
--------------------------
File to patch: wwindow.c <b>&lt;-- Here I typed the file to see what happens but nothing.</b>
patching file wwindow.c
missing header for unified diff at line 18 of patch
can&#39;t find file to patch at input line 18
Perhaps you used the wrong -p or --strip option?
File to patch:

</pre><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (AMCerasoli)</author>
		<pubDate>Sun, 16 Oct 2011 06:47:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Dangit, I probably didn&#39;t svn up before making the patch. I&#39;ll upload a new one. Make sure to svn revert any changes the failed attempts made.</p><p>[edit] Attached.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Sun, 16 Oct 2011 06:55:27 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Tested on Windows XP. It fixes the <span class="source-code">ALLEGRO_FULLSCREEN_WINDOW</span> issue but for normal windowed mode it seems to position the display at the right position but it doesn&#39;t take into account the title bar, so for <span class="source-code"><a href="http://www.allegro.cc/manual/al_set_new_window_position"><span class="a">al_set_new_window_position</span></a><span class="k2">(</span><span class="n">0</span>, <span class="n">0</span><span class="k2">)</span></span> the whole title bar is left out of the screen.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kenmasters1976)</author>
		<pubDate>Sun, 16 Oct 2011 08:04:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ok good, because that&#39;s the documented behavior <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />. There needs to be a way to get border sizes though I think.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Sun, 16 Oct 2011 08:19:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Oh, in that case it&#39;s OK; although, by the name of the function, one could expect it to set the whole window position, but as long as it&#39;s clearly stated in the documentation I guess it&#39;s not so bad.</p><p>One more thing though, I just checked and it seems like <span class="source-code">ALLEGRO_NOFRAME</span> also presents this issue (with and without the patch). Actually, there&#39;s a difference with the patch and without it, but both result in a misplaced window.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kenmasters1976)</author>
		<pubDate>Sun, 16 Oct 2011 08:50:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Here&#39;s a patch which should fix that issue too (it incorporates all of the previous changes too). Would appreciate a quick test! Thanks.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Sun, 16 Oct 2011 22:17:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The new patch fixes the <span class="source-code">ALLEGRO_NOFRAME</span> issue on Direct3D but not on OpenGL.</p><p>In fact, it&#39;s weird; the window size is the same with both OpenGL and Direct3D but while the OpenGL window position is correct, the position for drawing bitmaps is wrong. With Direct3D, on the other hand, looks like bitmaps are automatically scaled.</p><p>In both of the following screenshots, the bitmap is drawn at (0, 0). The actual bitmap size is 248x324, so apparently OpenGL is the one drawing it with the right size.</p><p>Using OpenGL:<br /><span class="remote-thumbnail"><span class="json">{"name":"winposbogl.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/8\/a8e06f8a29b4276d9155d19452433f04.png","w":486,"h":672,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/8\/a8e06f8a29b4276d9155d19452433f04"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/a/8/a8e06f8a29b4276d9155d19452433f04-240.jpg" alt="winposbogl.png" width="240" height="331" /></span></p><p>Using D3D:<br /><span class="remote-thumbnail"><span class="json">{"name":"winposbd3d.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/2\/9202ad1883ef9116de80cb04d1d22498.png","w":486,"h":672,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/2\/9202ad1883ef9116de80cb04d1d22498"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/9/2/9202ad1883ef9116de80cb04d1d22498-240.jpg" alt="winposbd3d.png" width="240" height="331" /></span></p><p>If someone could confirm this on recent hardware, it would be great as it may only affect ancient hardware like mine.</p><p>[OFF-TOPIC:] AMCerasoli, you should try the patch.exe included in MSYS, if you have it installed, that is.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kenmasters1976)</author>
		<pubDate>Sun, 16 Oct 2011 23:19:06 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Can you post your example above so I can fix it? Thanks.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Sun, 16 Oct 2011 23:29:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>This is the code I used. I added some primitives and changed the window size. Basically, all operations when using Direct3D are correct except for the automatic scaling (haven&#39;t checked what it does if I explicitly <span class="source-code">call <a href="http://www.allegro.cc/manual/al_draw_scaled_bitmap"><span class="a">al_draw_scaled_bitmap</span></a><span class="k2">(</span><span class="k2">)</span></span>).</p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number">  1</span><span class="p">#include &lt;allegro5/allegro.h&gt;</span>
<span class="number">  2</span><span class="p">#include &lt;allegro5/allegro_opengl.h&gt;</span>
<span class="number">  3</span><span class="p">#include &lt;allegro5/allegro_primitives.h&gt;</span>
<span class="number">  4</span>
<span class="number">  5</span><a href="http://www.allegro.cc/manual/ALLEGRO_DISPLAY"><span class="a">ALLEGRO_DISPLAY</span></a> <span class="k3">*</span>display <span class="k3">=</span> NULL<span class="k2">;</span>
<span class="number">  6</span><a href="http://www.allegro.cc/manual/ALLEGRO_EVENT_QUEUE"><span class="a">ALLEGRO_EVENT_QUEUE</span></a> <span class="k3">*</span>events <span class="k3">=</span> NULL<span class="k2">;</span>
<span class="number">  7</span><a href="http://www.allegro.cc/manual/ALLEGRO_BITMAP"><span class="a">ALLEGRO_BITMAP</span></a> <span class="k3">*</span>bmp <span class="k3">=</span> NULL<span class="k2">;</span>
<span class="number">  8</span>
<span class="number">  9</span><span class="k1">int</span> main<span class="k2">(</span><span class="k2">)</span> <span class="k2">{</span>
<span class="number"> 10</span>    <span class="k1">uint32_t</span> v<span class="k2">;</span>
<span class="number"> 11</span>
<span class="number"> 12</span>    <a href="http://www.allegro.cc/manual/al_init"><span class="a">al_init</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 13</span>    <a href="http://www.allegro.cc/manual/al_install_keyboard"><span class="a">al_install_keyboard</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 14</span>    <a href="http://www.allegro.cc/manual/al_set_new_display_flags"><span class="a">al_set_new_display_flags</span></a><span class="k2">(</span>ALLEGRO_NOFRAME <span class="k3">|</span> ALLEGRO_OPENGL<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 15</span>    <a href="http://www.allegro.cc/manual/al_set_new_window_position"><span class="a">al_set_new_window_position</span></a><span class="k2">(</span><span class="n">0</span>, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 16</span>    display <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_create_display"><span class="a">al_create_display</span></a><span class="k2">(</span><span class="n">640</span>, <span class="n">480</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 17</span>    <a href="http://www.allegro.cc/manual/al_init_primitives_addon"><span class="a">al_init_primitives_addon</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 18</span>    <a href="http://www.allegro.cc/manual/al_init_image_addon"><span class="a">al_init_image_addon</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 19</span>
<span class="number"> 20</span>    v <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_get_allegro_version"><span class="a">al_get_allegro_version</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 21</span>    <a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"Allegro version: %d.%d.%d[%d]\n"</span>, v <span class="k3">&gt;</span><span class="k3">&gt;</span> <span class="n">24</span>, <span class="k2">(</span>v <span class="k3">&gt;</span><span class="k3">&gt;</span> <span class="n">16</span><span class="k2">)</span> <span class="k3">&amp;</span> <span class="n">255</span>, <span class="k2">(</span>v <span class="k3">&gt;</span><span class="k3">&gt;</span> <span class="n">8</span><span class="k2">)</span> <span class="k3">&amp;</span> <span class="n">255</span>, v <span class="k3">&amp;</span> <span class="n">255</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 22</span>
<span class="number"> 23</span>    events <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_create_event_queue"><span class="a">al_create_event_queue</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 24</span>    <a href="http://www.delorie.com/djgpp/doc/libc/libc_48.html" target="_blank">assert</a><span class="k2">(</span>events<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 25</span>    <a href="http://www.allegro.cc/manual/al_register_event_source"><span class="a">al_register_event_source</span></a><span class="k2">(</span>events, <a href="http://www.allegro.cc/manual/al_get_keyboard_event_source"><span class="a">al_get_keyboard_event_source</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 26</span>
<span class="number"> 27</span>    bmp <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_load_bitmap"><span class="a">al_load_bitmap</span></a><span class="k2">(</span><span class="s">"ken.jpg"</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 28</span>    <a href="http://www.delorie.com/djgpp/doc/libc/libc_48.html" target="_blank">assert</a><span class="k2">(</span>bmp<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 29</span>
<span class="number"> 30</span>    <span class="k1">while</span> <span class="k2">(</span><a href="http://www.allegro.cc/manual/al_is_event_queue_empty"><span class="a">al_is_event_queue_empty</span></a><span class="k2">(</span>events<span class="k2">)</span><span class="k2">)</span> <span class="k2">{</span>
<span class="number"> 31</span>        <a href="http://www.allegro.cc/manual/al_clear_to_color"><span class="a">al_clear_to_color</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/al_map_rgb"><span class="a">al_map_rgb</span></a><span class="k2">(</span><span class="n">0</span>, <span class="n">128</span>, <span class="n">128</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 32</span>        <a href="http://www.allegro.cc/manual/al_draw_bitmap"><span class="a">al_draw_bitmap</span></a><span class="k2">(</span>bmp, <span class="n">0</span>, <span class="n">0</span>, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 33</span>        <a href="http://www.allegro.cc/manual/al_draw_rectangle"><span class="a">al_draw_rectangle</span></a><span class="k2">(</span><span class="n">0</span>.<span class="n">5</span>, <span class="n">0</span>.<span class="n">5</span>, <span class="n">640</span>, <span class="n">480</span>, <a href="http://www.allegro.cc/manual/al_map_rgb"><span class="a">al_map_rgb</span></a><span class="k2">(</span><span class="n">255</span>, <span class="n">255</span>, <span class="n">255</span><span class="k2">)</span>, <span class="n">1</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 34</span>        <a href="http://www.allegro.cc/manual/al_draw_rectangle"><span class="a">al_draw_rectangle</span></a><span class="k2">(</span><span class="n">0</span>.<span class="n">5</span>, <span class="n">0</span>.<span class="n">5</span>, <span class="n">248</span>, <span class="n">324</span>, <a href="http://www.allegro.cc/manual/al_map_rgb"><span class="a">al_map_rgb</span></a><span class="k2">(</span><span class="n">0</span>, <span class="n">0</span>, <span class="n">255</span><span class="k2">)</span>, <span class="n">1</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 35</span>        <a href="http://www.allegro.cc/manual/al_flip_display"><span class="a">al_flip_display</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 36</span>        <a href="http://www.allegro.cc/manual/al_rest"><span class="a">al_rest</span></a><span class="k2">(</span><span class="n">0</span>.<span class="n">015</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 37</span>    <span class="k2">}</span>
<span class="number"> 38</span><span class="k2">}</span>
</div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kenmasters1976)</author>
		<pubDate>Sun, 16 Oct 2011 23:42:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Here&#39;s another patch. Hope everything&#39;s right now.</p><p>Edit: Just so you know, if you want to draw the rectangle on the last pixel of the display, you should use &quot;-0.5&quot;. So it&#39;s your example that has the bug of not displaying the right and bottom pixels of the rectangle. Allegro is doing it right from my tests (adding -0.5 to those numbers).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Sun, 16 Oct 2011 23:57:57 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Everything seems to be fine now.</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/608603/934373#target">Trent Gamblin</a> said:</div><div class="quote"><p> Just so you know, if you want to draw the rectangle on the last pixel of the display, you should use &quot;-0.5&quot;.
</p></div></div><p>Oh, yeah. I&#39;m aware of that.</p><p>Thanks.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kenmasters1976)</author>
		<pubDate>Mon, 17 Oct 2011 00:25:30 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks for your help.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Mon, 17 Oct 2011 00:37:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yhea I have also downloaded the two files and checked and it works fine.</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/608603/934369#target">kenmasters1976</a> said:</div><div class="quote"><p> [OFF-TOPIC:] AMCerasoli, you should try the patch.exe included in MSYS, if you have it installed, that is.</p></div></div><p>Thanks man!, I didn&#39;t know that was there... I used the files uploaded by Trent because it was simpler.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (AMCerasoli)</author>
		<pubDate>Mon, 17 Oct 2011 04:47:42 +0000</pubDate>
	</item>
</rss>
