<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>[A5] questions about events</title>
		<link>http://www.allegro.cc/forums/view/604432</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 24 Jun 2010 17:28:18 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I have some questions regarding A5 event handling:</p><p>1) ALLEGRO_EVENT_KEY_UP does not have the unichar field. Should I keep the unichar value from ALLEGRO_EVENT_KEY_UP myself or it is going to be available in the future?</p><p>2) ALLEGRO_EVENT_MOUSE_AXES does not have the button field. Should I keep the button value from ALLEGRO_EVENT_MOUSE_BUTTON_DOWN myself or it is going to be available in the future?</p><p>3) Is the ALLEGRO_EVENT_MOUSE_ENTER_DISPLAY event followed by a ALLEGRO_EVENT_MOUSE_AXES event?</p><p>4) in the event ALLEGRO_EVENT_MOUSE_AXES, do I check if the mouse moved by checking the fields dx and dy?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Wed, 23 Jun 2010 20:48: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/604432/871863#target">axilmar</a> said:</div><div class="quote"><p>2) ALLEGRO_EVENT_MOUSE_AXES does not have the button field. Should I keep the button value from ALLEGRO_EVENT_MOUSE_BUTTON_DOWN myself or it is going to be available in the future?</p></div></div><p>I&#39;m sure it wont.  Since a mouse button press has nothing to do with the mouse moving.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mark Oates)</author>
		<pubDate>Wed, 23 Jun 2010 20:54:00 +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/604432/871869#target">Mark Oates</a> said:</div><div class="quote"><p>
I&#39;m sure it wont.  Since a mouse button press has nothing to do with the mouse moving.
</p></div></div><p>

But what if you want to know which button is pressed while the mouse is moving?</p><p>&quot;Normal&quot; event systems (<a href="http://msdn.microsoft.com/en-us/library/ms645616%28VS.85%29.aspx">like Win32</a>) report the mouse button as well as the mouse position.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Wed, 23 Jun 2010 21:24: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/604432/871879#target">axilmar</a> said:</div><div class="quote"><p>
But what if you want to know which button is pressed while the mouse is moving?
</p></div></div><p>
What if you want to know which keyboard button is pressed while the mouse is moving? At which point do you stop from including the entire input state in every input event?</p><p>Anyway, you have two solutions. The preferred way is to use those events to update a struct/class of yours that holds the mouse state. The less preferred way is to use <span class="source-code">al_get_mouse_state</span>.</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/604432/871863#target">axilmar</a> said:</div><div class="quote"><p>
4) in the event ALLEGRO_EVENT_MOUSE_AXES, do I check if the mouse moved by checking the fields dx and dy?
</p></div></div><p>
Well, in principle there&#39;s also dz which can also cause the event to be sent... but yes, that&#39;s the idea.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Wed, 23 Jun 2010 21:32:45 +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/604432/871863#target">axilmar</a> said:</div><div class="quote"><p>3) Is the ALLEGRO_EVENT_MOUSE_ENTER_DISPLAY event followed by a ALLEGRO_EVENT_MOUSE_AXES event?</p></div></div><p>Not sure if it&#39;s <i>supposed</i> to, but it doesn&#39;t seem to. My Canva5 lib handles both messages as if they are a &quot;MOUSE_AXES&quot; event, seems to make sense that way.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Wed, 23 Jun 2010 23:53:27 +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/604432/871863#target">axilmar</a> said:</div><div class="quote"><p>
1) ALLEGRO_EVENT_KEY_UP does not have the unichar field. Should I keep the unichar value from ALLEGRO_EVENT_KEY_UP myself or it is going to be available in the future?
</p></div></div><p>

It will not be made available.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Thu, 24 Jun 2010 04:28:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>What&#39;s the problem with making unichar available on key down, just out of curiousity?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Thu, 24 Jun 2010 06:18:15 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It is available on key <b>down</b>, but not key up.</p><p>I conflated two things into the KEY_DOWN event. First, it signals that the user pressed a physical key. But it also indicates that a user entered a particular character, which could be a combination of keys which were hit previously (e.g. dead keys) or currently held down (e.g. shift).</p><p>As Elias has pointed out, we should actually have separate events for physical key presses and character input.</p><p>Here&#39;s an example. Say you are using dead keys to type é, by hitting two keys in sequence: apostrophe, then E. You get a KEY_DOWN event (keycode=apostrophe, unichar=0), then another KEY_DOWN (keycode=E, unichar=é). Ok so far.</p><p>But if you hit apostrophe, then T? Assuming there is no character mapped to that sequence, with some input methods, that could produce <b>two</b> characters. At the time we send out the KEY_DOWN event for T, though, the KEY_DOWN event for apostrophe was already sent out. So we only have one event to signal two characters.</p><p>There are more complicated input methods where character input and keys are even more decoupled. e.g. press a few keys, then pick a character from a graphical list with the mouse.</p><p>So the answer is: unichar shouldn&#39;t even be provided with KEY_DOWN.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Thu, 24 Jun 2010 07:20:54 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ok. I misread it as KEY_DOWN not providing a unichar. But what you says makes sense. Is this a 5.0 or later update feature?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Thu, 24 Jun 2010 07:27:11 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I don&#39;t think anyone is planning to fix this for 5.0, but it should be fixable in a backwards compatible way later.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Thu, 24 Jun 2010 07:45:31 +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/604432/871882#target">SiegeLord</a> said:</div><div class="quote"><p>
What if you want to know which keyboard button is pressed while the mouse is moving? At which point do you stop from including the entire input state in every input event?
</p></div></div><p>

You stop at the point that the majority of use cases are covered. 99% of mouse moves that need to know the input state is limited to mouse buttons and modifier keys. That&#39;s why most Window systems report the mouse button and modifier keys in mouse move events.</p><p>I think that the mouse button and modifiers should be reported in mouse move events. The mouse event struct even has the button field available, so minimal changes are required.</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/604432/872027#target">Peter Wang</a> said:</div><div class="quote"><p>
So the answer is: unichar shouldn&#39;t even be provided with KEY_DOWN.
</p></div></div><p>

I agree, for the reasons you mention.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Thu, 24 Jun 2010 15:30:32 +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/604432/872068#target">axilmar</a> said:</div><div class="quote"><p>You stop at the point that the majority of use cases are covered. 99% of mouse moves that need to know the input state is limited to mouse buttons and modifier keys. That&#39;s why most Window systems report the mouse button and modifier keys in mouse move events.</p><p>I think that the mouse button and modifiers should be reported in mouse move events. The mouse event struct even has the button field available, so minimal changes are required.</p></div></div><p>Interesting.  I think you have a convincing point.  Using that logic, it certainly makes sense to include the mouse button state with ALLEGRO_EVENT_MOUSE_BUTTON_DOWN.  This would make some functionality (dragging, for example) more accessible.  After all, ALLEGRO_EVENT_MOUSE_BUTTON_DOWN returns the mouse wheel position, which doesn&#39;t seem nearly as practical.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mark Oates)</author>
		<pubDate>Thu, 24 Jun 2010 17:28:18 +0000</pubDate>
	</item>
</rss>
