[Laszlo-dev] [Laszlo-checkins] r12194 - openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9

P T Withington ptw at pobox.com
Fri Dec 19 04:47:54 PST 2008


I predict a bug that will be because we miss a key up event...  But, I  
guess that is common these days.  In the good old days, stuck keys  
were prevented because the keyboard also sent 'all keys up', just in  
case a key transition was missed.

On 2008-12-19, at 00:09EST, max at openlaszlo.org wrote:

> Author: max
> Date: 2008-12-18 21:09:23 -0800 (Thu, 18 Dec 2008)
> New Revision: 12194
>
> Modified:
>   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzKeyboardKernel.as
> Log:
> Change 20081218-maxcarlson-N by maxcarlson at Bank.lan on 2008-12-18  
> 18:19:24 PST
>    in /Users/maxcarlson/openlaszlo/trunk-clean
>    for http://svn.openlaszlo.org/openlaszlo/trunk
>
> Summary: Better prevention of duplicate key events in swf9
>
> Bugs Fixed: LPP-7432 - onkeydown event keep firing
>
> Technical Reviewer: andre.bargull at udo.edu
> QA Reviewer: promanik
>
> Details: Use a hash to track keyboard state, to handle modifier keys  
> accurately.
>
> Tests: See LPP-7432
>
>
>
> Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/ 
> LzKeyboardKernel.as
> ===================================================================
> --- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzKeyboardKernel.as	 
> 2008-12-19 02:21:14 UTC (rev 12193)
> +++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzKeyboardKernel.as	 
> 2008-12-19 05:09:23 UTC (rev 12194)
> @@ -16,20 +16,18 @@
>         var s, k = e.keyCode;
>         var keyisdown = t == 'onkeydown';
>         s = String.fromCharCode(k).toLowerCase();
> -        if (keyisdown) {
> -            // prevent duplicate onkeydown events - see LPP-7432
> -            if (k == __lastkeydown) return;
> -            __lastkeydown = k;
> -        } else {
> -            __lastkeydown = null;
> -        }
> +
> +        // prevent duplicate onkeydown events - see LPP-7432
> +        if (__keyState[k] == keyisdown) return;
> +        __keyState[k] = keyisdown;
> +
>         delta[s] = keyisdown;
>         if (this.__callback) this.__scope[this.__callback](delta, k,  
> t);
>     }
>
>     var __callback = null;
>     var __scope = null;
> -    var __lastkeydown = null;
> +    var __keyState:Object = {};
>
>     function setCallback (scope, funcname) {
>         this.__scope = scope;
>
>
> _______________________________________________
> Laszlo-checkins mailing list
> Laszlo-checkins at openlaszlo.org
> http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins



More information about the Laszlo-dev mailing list