<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>[A5] Display always on top?</title>
		<link>http://www.allegro.cc/forums/view/612307</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sat, 30 Mar 2013 11:35:07 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Is it possible to create a (fullscreen window) display so that it is always in front?</p><p>In a multi-monitor configuration like this:</p><p><span class="remote-thumbnail"><span class="json">{"name":"607332","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/d\/5da3049d8c624dd915871ee08ae0bbb6.png","w":478,"h":269,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/d\/5da3049d8c624dd915871ee08ae0bbb6"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/5/d/5da3049d8c624dd915871ee08ae0bbb6-240.jpg" alt="607332" width="240" height="135" /></span></p><p>If I drag a window over, that window becomes the focused window and is brought to the front, on top of the allegro display:</p><p><span class="remote-thumbnail"><span class="json">{"name":"607333","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/2\/d28c445acf967ef59e5cf2caf197cd9d.png","w":478,"h":269,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/2\/d28c445acf967ef59e5cf2caf197cd9d"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/d/2/d28c445acf967ef59e5cf2caf197cd9d-240.jpg" alt="607333" width="240" height="135" /></span></p><p>But I want the display to always be on top, like a powerpoint presentation window:</p><p><span class="remote-thumbnail"><span class="json">{"name":"607331","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/8\/4894e3d65d89b11c104c3209d7dcabb1.png","w":478,"h":269,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/8\/4894e3d65d89b11c104c3209d7dcabb1"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/4/8/4894e3d65d89b11c104c3209d7dcabb1-240.jpg" alt="607331" width="240" height="135" /></span></p><p>Is there a setting for that somewhere?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mark Oates)</author>
		<pubDate>Fri, 29 Mar 2013 21:36:13 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I don&#39;t understand what you&#39;re trying to do...... hahahahahaha I&#39;m kidding. You almost made a movie there man!. </p><p>Anyway, and what if you create a &quot;real&quot; fullscreen display in the second monitor? is not possible? I think that way nothing would be able to get on top.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (AMCerasoli)</author>
		<pubDate>Fri, 29 Mar 2013 22:01:13 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/612307/979338#target">AMCerasoli</a> said:</div><div class="quote"><p>I don&#39;t understand what you&#39;re trying to do.</p></div></div><p>Ok, that was funny. <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /></p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>Anyway, and what if you create a &quot;real&quot; fullscreen display in the second monitor? is not possible? I think that way nothing would be able to get on top.
</p></div></div><p>The problem with that is when I just select a window in the primary display, the fullscreen is disappears (minimizes?)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mark Oates)</author>
		<pubDate>Fri, 29 Mar 2013 22:15:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/612307/979339#target">Mark Oates</a> said:</div><div class="quote"><p> The problem with that is when I just select a window in the primary display, the fullscreen is disappears (minimizes?)</p></div></div><p>Awww it&#39;s true. But I&#39;m almost 100% sure that there is a way of doing it with the Windows handler (you know the HWND stuff) but I haven&#39;t done it before. </p><p>You&#39;ll probably need to get the Handler (<span class="source-code"><a href="http://www.allegro.cc/manual/al_get_win_window_handle"><span class="a">al_get_win_window_handle</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/ALLEGRO_DISPLAY"><span class="a">ALLEGRO_DISPLAY</span></a> <span class="k3">*</span>display<span class="k2">)</span></span>) and then with some Windows specific code set it to be at the top all the time.</p><p>Maybe using something like <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms633545(v=vs.85).aspx">SetWindowPos</a>?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (AMCerasoli)</author>
		<pubDate>Fri, 29 Mar 2013 22:56:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/612307/979341#target">AMCerasoli</a> said:</div><div class="quote"><p>You&#39;ll probably need to get the Handler (al_get_win_window_handle(ALLEGRO_DISPLAY *display)) and then with some Windows specific code set it to be at the top all the time.Maybe using something like SetWindowPos [msdn.microsoft.com]?
</p></div></div><p>

That&#39;s it!!! <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" /> <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" /></p><p>AMCerasoli, you&#39;re a genjus!!!</p><p>I just added this code:</p><div class="source-code snippet"><div class="inner"><pre>  HWND window_handle <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_get_win_window_handle"><span class="a">al_get_win_window_handle</span></a><span class="k2">(</span>control_display-&gt;display<span class="k2">)</span><span class="k2">;</span>
  SetWindowPos<span class="k2">(</span>window_handle, HWND_TOPMOST, <span class="n">0</span>, <span class="n">0</span>, <span class="n">0</span>, <span class="n">0</span>, SWP_NOMOVE <span class="k3">+</span> SWP_NOSIZE<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

[edit] <b>That makes me so haappyyyy!!!</b> <img src="http://www.allegro.cc/forums/smileys/cheesy.gif" alt=":D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mark Oates)</author>
		<pubDate>Sat, 30 Mar 2013 00:03:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Now set that same flag on the other window and see what happens.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Sat, 30 Mar 2013 00:15:42 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Oh neat.  It&#39;s like a topmost group.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mark Oates)</author>
		<pubDate>Sat, 30 Mar 2013 00:20:30 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Needs more bunnies.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sat, 30 Mar 2013 00:22:12 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/612307/979346#target">Thomas Fjellstrom</a> said:</div><div class="quote"><p> Needs more bunnies.</p></div></div><p>Ditto.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (pkrcel)</author>
		<pubDate>Sat, 30 Mar 2013 01:43:04 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Well I want to announce to everybody that Mark asked me to get marry with him. He sent me a PM because he was afraid that I could reject him. </p><p>The wedding is around 15 of April of this year in Tokyo. You&#39;re of course all invited.</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/612307/979343#target">Mark Oates</a> said:</div><div class="quote"><p> That makes me so haappyyyy!!!</p></div></div><p>Me too!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (AMCerasoli)</author>
		<pubDate>Sat, 30 Mar 2013 02:05:02 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Congrats!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sat, 30 Mar 2013 02:34:09 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/612307/979354#target">AMCerasoli</a> said:</div><div class="quote"><p>Well I want to announce to everybody that Mark asked me to get marry with him.</p></div></div><p>
<span class="remote-thumbnail"><span class="json">{"name":"607335","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/3\/5\/35d34c734e7448f1e0307f7f2356b28e.gif","w":500,"h":281,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/3\/5\/35d34c734e7448f1e0307f7f2356b28e"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/3/5/35d34c734e7448f1e0307f7f2356b28e-240.jpg" alt="607335" width="240" height="134" /></span></p><p>Well..... OK <img src="http://www.allegro.cc/forums/smileys/kiss.gif" alt=":-*" />.</p><p>But we have to get a prenup.  You ain&#39;t gettin&#39; my Bitcoinzz! <img src="http://www.allegro.cc/forums/smileys/angry.gif" alt="&gt;:(" /></p><p>[edit]</p><p>On topic, I should note that when using <span class="source-code">ALLEGRO_FULLSCREEN_WINDOW</span>, it does not have the expected behavior and a dragged window will appear above it.  However, if the display is created with <span class="source-code">ALLEGRO_NOFRAME</span> then it does work as expected.</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_windows.h&gt;</span>
<span class="number">  2</span>
<span class="number">  3</span><span class="c">// ...</span>
<span class="number">  4</span>
<span class="number">  5</span><span class="k1">int</span> adapter_to_pick <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span> <span class="c">// the monitor to display it on</span>
<span class="number">  6</span>
<span class="number">  7</span><span class="c">// grab the monitor info</span>
<span class="number">  8</span><a href="http://www.allegro.cc/manual/ALLEGRO_MONITOR_INFO"><span class="a">ALLEGRO_MONITOR_INFO</span></a> monitor_info<span class="k2">;</span>
<span class="number">  9</span><a href="http://www.allegro.cc/manual/al_get_monitor_info"><span class="a">al_get_monitor_info</span></a><span class="k2">(</span>adapter_to_pick, <span class="k3">&amp;</span>monitor_info<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 10</span><span class="k1">int</span> monitor_width <span class="k3">=</span> monitor_info.x2 <span class="k3">-</span> monitor_info.x1<span class="k2">;</span>
<span class="number"> 11</span><span class="k1">int</span> monitor_height <span class="k3">=</span> monitor_info.y2 <span class="k3">-</span> monitor_info.y1<span class="k2">;</span>
<span class="number"> 12</span>
<span class="number"> 13</span><span class="c">// create the display</span>
<span class="number"> 14</span><a href="http://www.allegro.cc/manual/al_set_new_display_adapter"><span class="a">al_set_new_display_adapter</span></a><span class="k2">(</span>adapter_to_pick<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 15</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="k2">)</span><span class="k2">;</span>
<span class="number"> 16</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> <a href="http://www.allegro.cc/manual/al_create_display"><span class="a">al_create_display</span></a><span class="k2">(</span>width, height<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 17</span>
<span class="number"> 18</span><span class="c">// make it a fullscreen window that is always on top, and does not move or resize</span>
<span class="number"> 19</span>HWND window_handle <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_get_win_window_handle"><span class="a">al_get_win_window_handle</span></a><span class="k2">(</span>display<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 20</span>SetWindowPos<span class="k2">(</span>window_handle, HWND_TOPMOST, <span class="n">0</span>, <span class="n">0</span>, <span class="n">0</span>, <span class="n">0</span>, SWP_NOMOVE <span class="k3">+</span> SWP_NOSIZE<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 21</span>
<span class="number"> 22</span><span class="c">// prevent the mouse cursor from showing as well</span>
<span class="number"> 23</span><a href="http://www.allegro.cc/manual/al_hide_mouse_cursor"><span class="a">al_hide_mouse_cursor</span></a><span class="k2">(</span>display<span class="k2">)</span><span class="k2">;</span>
</div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mark Oates)</author>
		<pubDate>Sat, 30 Mar 2013 10:27:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
SWP_NOMOVE + SWP_NOSIZE
</p></div></div><p>

Nit pick, but those mean don&#39;t honor the position and size parameters from the call, not what the comment says. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Sat, 30 Mar 2013 11:35:07 +0000</pubDate>
	</item>
</rss>
