<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi All,<div><br></div><div>    this morning I've looked at some platform even t code to address an issue with scrolling that Chris Muller was bitten by.  In reading the code I've tried to make the code comprehensible to others who may come to read it. In particular I changed this code in platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m</div><div><br></div><div><div>        evt.charCode = keyCode;</div><div>        evt.utf32Code = 0;</div><div>        evt.reserved1 = 0;</div><div>        evt.modifiers = (CtrlKeyBit | OptionKeyBit | CommandKeyBit | ShiftKeyBit);<br></div><div>        evt.windowIndex = windowIndex;</div><div>        [self pushEventToQueue:(sqInputEvent *) &evt];</div></div><div><br></div><div>to read</div><div><div>        evt.charCode = keyCode;</div><div>        evt.utf32Code = 0;</div><div>        evt.reserved1 = 0;</div><div>       /* Set every meta bit to distinguish the fake event from a real right/left</div><div>        * arrow.</div><div>        */</div><div>        evt.modifiers = (CtrlKeyBit | OptionKeyBit | CommandKeyBit | ShiftKeyBit);</div><div>        evt.windowIndex = windowIndex;</div><div>        [self pushEventToQueue:(sqInputEvent *) &evt];</div></div><div><br></div><div>After all, what the code does is obvious, but /why/ the code does what it does is not at all obvious.</div><div><br></div><div>In reading similar code on the other platforms I see things like this, an example from platforms/win32/vm/sqWin32Window.c:</div><div><br></div><div><div>      evt->modifiers = CtrlKeyBit;</div><div>#ifdef PharoVM<br></div><div>     evt->utf32Code = evt->charCode;</div><div>#else</div><div>      evt->utf32Code = 0;</div><div>#endif</div><div>      evt->reserved1 = 0;</div></div><div><br></div><div>Again, *why* the code sets utf32Code but not on Squeak, Newspeak, etc, is not at all obvious and it would be really helpful if it were commented so that the decision as to whether the ifdef might be eliminated and the code always set6 (surely preferable) would be made easier.</div><div><br></div><div>The lack of such comments makes managing this code very hard for those of us that are not platform experts but must maintain the code across all platforms because that's our lot in life.  The absence of such comments, when one is struggling to figure out what the hell is going on, feels like passive aggression ;-)  So if you've made some m modification to the platform code in the past few years and you haven't commented it to explain the *why*, please feel free to comment the code and commit or submit a pull request; it will be warmly appreciated.</div><div><br></div><div>Thank you!</div><div><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div></div></div></div></div></div></div></div>