[Laszlo-checkins] r12781 - in openlaszlo/trunk: WEB-INF/lps/lfc/compiler WEB-INF/lps/lfc/kernel/swf9 WEB-INF/lps/lfc/services lps/includes/source
max@openlaszlo.org
max at openlaszlo.org
Sat Feb 7 05:27:41 PST 2009
Author: max
Date: 2009-02-07 05:27:34 -0800 (Sat, 07 Feb 2009)
New Revision: 12781
Modified:
openlaszlo/trunk/WEB-INF/lps/lfc/compiler/LzRuntime.lzs
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzMouseKernel.as
openlaszlo/trunk/WEB-INF/lps/lfc/services/LzUtils.lzs
openlaszlo/trunk/lps/includes/source/embednew.js
Log:
Change 20090207-maxcarlson-v by maxcarlson at Bank.local on 2009-02-07 04:48:08 PST
in /Users/maxcarlson/openlaszlo/trunk-clean
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Send mouseup events when mouse goes up outside the app in swf9 for Firefox on Windows
Bugs Fixed: LPP-7724 - Mouse events behave wrong in opaque mode (FireFox)
Technical Reviewer: andre.bargull at udo.edu
QA Reviewer: hminsky
Details: LzMouseKernel - Refactor processing code to separate __mouseUpOutsideHandler() method so it can be called from the browser.
LzUtils - Fix safeEval() to handle method calls with no arguments properly.
LzRuntime - Add lookup for global LzMouseKernel so safeEval() can find it in swf9.
embednew - When the mouse goes up outside the app, call LzMouseKernel.__mouseUpOutsideHandler() from the browser DOM.
Tests: See LPP-7724 on Firefox Windows
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/compiler/LzRuntime.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/compiler/LzRuntime.lzs 2009-02-07 12:54:21 UTC (rev 12780)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/compiler/LzRuntime.lzs 2009-02-07 13:27:34 UTC (rev 12781)
@@ -163,8 +163,9 @@
* of the LFCApplication.
*/
var globalValue = function (name:String) {
- // remove this when LPP-7574 is fixed
+ // remove these when LPP-7574 is fixed
if (name == 'lz') return lz;
+ if (name == 'LzMouseKernel') return LzMouseKernel;
// Semi-kludge: We name our tag classes <tagname>. Since <> are
// not valid symbol constituents, there is no confusion here
if (name.charAt(0) == '<' && name.charAt(name.length-1) == '>') {
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzMouseKernel.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzMouseKernel.as 2009-02-07 12:54:21 UTC (rev 12780)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzMouseKernel.as 2009-02-07 13:27:34 UTC (rev 12781)
@@ -54,18 +54,24 @@
LzMouseKernel.__lastMouseDown.__globalmouseup(event);
__lastMouseDown = null;
} else {
- if (__mouseLeft && event.buttonDown && LzMouseKernel.__lastMouseDown != null) {
+ if (__mouseLeft && event.buttonDown) {
__mouseLeft = false;
- //Debug.write(eventname, event.buttonDown, LzMouseKernel.__lastMouseDown);
- var ev = new MouseEvent('mouseup');
- LzMouseKernel.__lastMouseDown.__globalmouseup(ev);
- LzMouseKernel.__lastMouseDown = null;
+ LzMouseKernel.__mouseUpOutsideHandler();
}
LzMouseKernel.__sendEvent(null, eventname);
}
}
- // handles MOUSE_LEAVES event
+ // sends mouseup and calls __globalmouseup when the mouse goes up outside the app - see LPP-7724
+ static function __mouseUpOutsideHandler():void {
+ if (LzMouseKernel.__lastMouseDown != null) {
+ var ev = new MouseEvent('mouseup');
+ LzMouseKernel.__lastMouseDown.__globalmouseup(ev);
+ LzMouseKernel.__lastMouseDown = null;
+ }
+ }
+
+ // handles MOUSE_LEAVE event
static function __mouseLeavesHandler(event:Event):void {
var eventname = 'on' + event.type.toLowerCase();
LzMouseKernel.__mouseLeft = true;
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/services/LzUtils.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/services/LzUtils.lzs 2009-02-07 12:54:21 UTC (rev 12780)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/services/LzUtils.lzs 2009-02-07 13:27:34 UTC (rev 12781)
@@ -313,6 +313,7 @@
// Unpack a javascript list from a string, giving each item the appropriate type
function __unpackList(argstr:String, scope = null) {
+ if (argstr == '') return [];
if (scope == null) scope = canvas;
var args = argstr.split(',');
// cast arguments to type
@@ -344,7 +345,7 @@
//Debug.write('found property', args[i], a);
}
}
- //Debug.write('__unpackList', args);
+ //Debug.write('__unpackList', argstr, args);
return args;
}
@@ -357,9 +358,10 @@
//Debug.write('safeEval', js);
var s = js.indexOf('(')
+ var argstr = null;
if (s != -1) {
var e = js.indexOf(')')
- var args = (js.substring(s + 1, e))
+ argstr = (js.substring(s + 1, e))
js = js.substring(0, s);
}
@@ -377,16 +379,14 @@
//Debug.write('final val', val, scope);
}
- if (args != null) {
- var args = lz.Utils.__unpackList(args, scope);
- }
-
- if (! args || args.length == 0) {
+ if (argstr == null) {
//Debug.write('no args, found val', val);
return val;
}
- //Debug.write('found val', val,'in', scope, 'args', args, 'for path', path, arglist);
+ var args = lz.Utils.__unpackList(argstr, scope);
+
+ //Debug.write('found val', val,'in', scope, 'args', args);
// return values don't work for global scopes in swf9, e.g. 'lz.Browser.getVersion()' - see LPP-7008
if (val) {
var result = val.apply(scope, args);
Modified: openlaszlo/trunk/lps/includes/source/embednew.js
===================================================================
--- openlaszlo/trunk/lps/includes/source/embednew.js 2009-02-07 12:54:21 UTC (rev 12780)
+++ openlaszlo/trunk/lps/includes/source/embednew.js 2009-02-07 13:27:34 UTC (rev 12781)
@@ -154,6 +154,24 @@
lz.embed.mousewheel.setCallback(app, '_sendMouseWheel');
}
}
+ if ((swfargs.wmode == 'transparent' || swfargs.wmode == 'opaque') && lz.embed.browser.OS == 'Windows' && (lz.embed.browser.isOpera || lz.embed.browser.isFirefox)) {
+ // fix for LPP-7724
+ var div = swfargs.appenddiv;
+ div.onmouseout = function(e) {
+ div.mouseisoutside = true;
+ }
+ div.onmouseover = function(e) {
+ div.mouseisoutside = false;
+ }
+ //lz.embed.attachEventHandler(document, 'mouseup', div, '_gotmouseup');
+ div._gotmouseup = document.onmouseup = function(e) {
+ if (div.mouseisoutside) {
+ // tell flash that the button went up outside
+ app.callMethod('LzMouseKernel.__mouseUpOutsideHandler()');
+ //console.log('mouseup ', lz.embed[app._id]);
+ }
+ }
+ }
}
,/**
More information about the Laszlo-checkins
mailing list