<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>[A5] how to trigger expose event programmatically?</title>
		<link>http://www.allegro.cc/forums/view/608513</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Wed, 05 Oct 2011 17:50:52 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi all. Is there a way in Allegro 5 to trigger an expose event programmatically? I need this for my GUI in order to avoid redrawing the whole widget tree each time there is a change in a widget. </p><p>I do not want to make a user expose event, because it is dumb to have two events doing the same thing.</p><p>It would be optional, of course. The default would be to redraw the whole GUI each time, as this is more appropriate for games.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Tue, 04 Oct 2011 15:52:54 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="source-code snippet"><div class="inner"><pre><span class="p">#include &lt;allegro5/internal/aintern_events.h&gt; // for _al_event_source_emit_event</span>
ALLEGRO_EVENT_DISPLAY_EXPOSE event<span class="k2">;</span>
event.display.x <span class="k3">=</span> x<span class="k2">;</span>
event.display.y <span class="k3">=</span> y<span class="k2">;</span>
event.display.w <span class="k3">=</span> w<span class="k2">;</span>
event.display.h <span class="k3">=</span> h<span class="k2">;</span>
_al_event_source_emit_event<span class="k2">(</span><a href="http://www.allegro.cc/manual/al_get_display_event_source"><span class="a">al_get_display_event_source</span></a><span class="k2">(</span>display<span class="k2">)</span>, <span class="k3">&amp;</span>event<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Tue, 04 Oct 2011 16:14:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I cannot compile the code after inserting the internal events header. The error is that the symbol ALLEGRO_INTERNAL_THREAD_HEADER is not found.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Tue, 04 Oct 2011 18:50:32 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You always need to include allegro5/allegro.h first. Possibly also allegro5/internal/alconfig.h.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Tue, 04 Oct 2011 19:21:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Now I have another error, after including allegro5/allegro.h first: the macro ASSERT is not found.</p><p>EDIT:</p><p>ALLEGRO_EVENT_DISPLAY_EXPOSE is also not found.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Tue, 04 Oct 2011 19:28:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Guess you need some more internal headers in the right order then.<br />Since they aren&#39;t really supposed to be used that way they don&#39;t include dependencies it seems.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Tue, 04 Oct 2011 20:07:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I think you can just create a general event, fill in the fields mentioned by Elias in the first post (and set the event type, I think you need to do that regardless) and emit the event. Shouldn&#39;t need too many internal headers for that.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Tue, 04 Oct 2011 21:10:08 +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/608513/933039#target">Evert</a> said:</div><div class="quote"><p> I think you can just create a general event, fill in the fields mentioned by Elias in the first post (and set the event type, I think you need to do that regardless) and emit the event. Shouldn&#39;t need too many internal headers for that.</p></div></div><p>So, can I do the following?</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/ALLEGRO_EVENT"><span class="a">ALLEGRO_EVENT</span></a> event<span class="k2">;</span>
event.display.type <span class="k3">=</span> ALLEGRO_EVENT_DISPLAY_EXPOSE<span class="k2">;</span>
event.display.x <span class="k3">=</span> update_x<span class="k2">;</span>
event.display.y <span class="k3">=</span> update_y<span class="k2">;</span>
event.display.width <span class="k3">=</span> update_width<span class="k2">;</span>
event.display.height <span class="k3">=</span> update_height<span class="k2">;</span>
<a href="http://www.allegro.cc/manual/al_emit_user_event"><span class="a">al_emit_user_event</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/al_get_display_event_source"><span class="a">al_get_display_event_source</span></a><span class="k2">(</span>my_display<span class="k2">)</span>, <span class="k3">&amp;</span>ev, NULL<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Wed, 05 Oct 2011 16:45:15 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I think so. It depends on whether <span class="source-code"><a href="http://www.allegro.cc/manual/al_emit_user_event"><span class="a">al_emit_user_event</span></a></span> sets the evernt type for you or not, but that should be easy to check.<br />Mind you, the only time I made my own &quot;user events&quot; predates the official user events in A5, so there may be a nuance I&#39;m missing.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Wed, 05 Oct 2011 17:19:11 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hm, not sure you can emit anything but user events with al_emit_user_event. I don&#39;t see a reason why not though so even if it doesn&#39;t work right now we probably should make it work.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Wed, 05 Oct 2011 17:50:52 +0000</pubDate>
	</item>
</rss>
