https://wiki.cdot.senecacollege.ca/w/index.php?title=Where_to_store_the_state_info_(e.g.,_previous_position)_between_mouse_events%3F&feed=atom&action=historyWhere to store the state info (e.g., previous position) between mouse events? - Revision history2024-03-29T15:18:47ZRevision history for this page on the wikiMediaWiki 1.30.0https://wiki.cdot.senecacollege.ca/w/index.php?title=Where_to_store_the_state_info_(e.g.,_previous_position)_between_mouse_events%3F&diff=74490&oldid=prevDavid.humphrey at 03:00, 20 November 20112011-11-20T03:00:51Z<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr style="vertical-align: top;" lang="en">
<td colspan="2" style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: white; color:black; text-align: center;">Revision as of 03:00, 20 November 2011</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l62" >Line 62:</td>
<td colspan="2" class="diff-lineno">Line 62:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>20:56 < khuey> sure, np</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>20:56 < khuey> sure, np</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div></pre></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div></pre></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">My current thinking, confirmed by my conversation with Kyle, is to store the x/y state on nsEventStateManager, and to pass it up with the event by extending nsEvent with prevRefPoint, to match its current refPoint member.  A logical place to do this might be  in nsEventStateManager::GenerateMouseEnterExit.  I've emailed smaug for his thoughts before I make these changes.</ins></div></td></tr>
</table>David.humphreyhttps://wiki.cdot.senecacollege.ca/w/index.php?title=Where_to_store_the_state_info_(e.g.,_previous_position)_between_mouse_events%3F&diff=74488&oldid=prevDavid.humphrey: Created page with 'Discussion from #introduction with khuey <pre> 20:40 <@humph> evening 20:41 <@humph> any content/dom folks about? 20:41 <@humph> I need to bounce some ideas off someone 20:43 < …'2011-11-20T02:35:46Z<p>Created page with 'Discussion from #introduction with khuey <pre> 20:40 <@humph> evening 20:41 <@humph> any content/dom folks about? 20:41 <@humph> I need to bounce some ideas off someone 20:43 < …'</p>
<p><b>New page</b></p><div>Discussion from #introduction with khuey<br />
<br />
<pre><br />
20:40 <@humph> evening<br />
20:41 <@humph> any content/dom folks about?<br />
20:41 <@humph> I need to bounce some ideas off someone<br />
20:43 < khuey> sure<br />
20:43 <@humph> hey<br />
20:43 <@humph> so here's my issue<br />
20:43 <@humph> working on mouselock, and I need to keep track of some state between mouse events<br />
20:44 <@humph> basically, screenX/Y for this event - screenX/Y from last event is my delta<br />
20:44 -!- knaszradi [knaszradi@6D77304.CB647380.581B62B0.IP] has joined #introduction<br />
20:44 <@humph> the screenX stuff works like this http://zenit.senecac.on.ca/wiki/index.php/Stack_Trace_for_nsDOMMouseEvent::GetScreenX<br />
20:44 <@humph> I'm trying to figure out where to stick my state between events<br />
20:45 < khuey> mmm<br />
20:45 < khuey> good question<br />
20:45 < khuey> how doe "mouselock" work?<br />
20:45 <@humph> for purposes of what we're discussing here<br />
20:46 <@humph> you have two new things on nsIDOMMouseEvent<br />
20:46 <@humph> movementX and movementY<br />
20:46 -!- jking [jking@9DCF6B6E.4B6AD646.67AC9B1.IP] has quit [Ping timeout]<br />
20:46 <@humph> and this is a delta of screenX and screenY<br />
20:46 -!- knaszradi [knaszradi@6D77304.CB647380.581B62B0.IP] has quit [Quit: knaszradi]<br />
20:46 <@humph> since last movement<br />
20:46 <@humph> so I'm thinking I have to put this state on something as I'm building the dom/ui event<br />
20:47 <@humph> such that I can reach down from the nsDOMMouseEvent and get it (or else pass it into it when I init)<br />
20:47 <@humph> I'm struggling to find a perfect shelf for this, as it were<br />
20:47 < khuey> so, the right place is probably nsEventStateManager<br />
20:47 <@humph> I wondered this<br />
20:47 <@humph> leave it on there as the event is being created?<br />
20:47 < khuey> it stores things like http://mxr.mozilla.org/mozilla-central/source/content/events/src/nsEventStateManager.h#506<br />
20:48 < khuey> right<br />
20:48 <@humph> yes, this looks right<br />
20:48 < khuey> not sure exactly where the right place to set things is<br />
20:49 <@humph> how do I get back to it from within nsDOMMouseEvent<br />
20:49 <@humph> well, I can just bang it in for now to explore<br />
20:49 < khuey> maybe nsEventStateManager::CheckForAndDispatchClick<br />
20:49 <@humph> http://zenit.senecac.on.ca/wiki/index.php/Stack_Trace_for_nsDOMMouseEvent::nsDOMMouseEvent_ctor<br />
20:50 <@humph> but it will have various paths depending on the type of event<br />
20:50 <@humph> that's the general path<br />
20:50 < khuey> mmm, yeah, that's a synthetic event click<br />
20:50 < khuey> that's actually not the general path<br />
20:50 <@humph> no?<br />
20:51 < khuey> no, that's the path that's taken when we synthesize a click cause reflow or js or whatever changed what's actually under the cursor<br />
20:51 <@humph> I see<br />
20:51 <@humph> I see what you mean in PresShell<br />
20:52 < khuey> so, the other fun bit is that nsEventStateManagers are per presContext<br />
20:52 < khuey> so each document has a different one<br />
20:52 < khuey> that may or may not be a problem for you<br />
20:53 <@humph> that will work, since you can't hold a lock on multiple docs at once<br />
20:53 < khuey> ok<br />
20:53 <@humph> only one element can be locked<br />
20:53 <@humph> so it's not a click, but a mousemove I need to deal with<br />
20:54 <@humph> well, actually, I guess it's any mouse event<br />
20:54 <@humph> anything that will expose a MouseEvent<br />
20:54 < khuey> ah, right<br />
20:54 <@humph> maybe in DispatchMouseEvent I can grab the refPoint<br />
20:55 < khuey> so I think those all go through nsESM::GenerateMouseEnterExit<br />
20:55 < khuey> but I'm not certain<br />
20:56 <@humph> ok, I'll poke<br />
20:56 <@humph> this has been helpful, thanks<br />
20:56 < khuey> sure, np<br />
</pre></div>David.humphrey