[Laszlo-checkins] r14292 - in openlaszlo/trunk: . WEB-INF/lps/lfc/kernel/swf WEB-INF/lps/lfc/kernel/swf9 WEB-INF/lps/lfc/services lps/includes/source
ptw@openlaszlo.org
ptw at openlaszlo.org
Wed Jul 8 13:25:02 PDT 2009
Author: ptw
Date: 2009-07-08 13:24:56 -0700 (Wed, 08 Jul 2009)
New Revision: 14292
Modified:
openlaszlo/trunk/
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzKeyboardKernel.as
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LFCApplication.as
openlaszlo/trunk/WEB-INF/lps/lfc/services/LzKeys.lzs
openlaszlo/trunk/lps/includes/source/embednew.js
Log:
Merged revisions 14287 via svnmerge from
http://svn.openlaszlo.org/openlaszlo/branches/4.2
.......
r14287 | ptw | 2009-07-07 22:25:49 -0400 (Tue, 07 Jul 2009) | 31 lines
Change 20090707-ptw-J by ptw at dueling-banjos.home on 2009-07-07 20:37:28 EDT
in /Users/ptw/OpenLaszlo/4.2
for http://svn.openlaszlo.org/openlaszlo/branches/4.2
Summary: Part 1 of fixing stuck keys when IE loses focus
Bugs Fixed: LPP-8283 Alt tab issue when switching tasks in IE7/Win
Technical Reviewer: max (pending)
QA Reviewer: hminsky (pending)
Details:
swf/LzSprite: Create a quirk for ActiveX which for some reason seems
to swallow browser focus events, preventing us from using the
solution that works for all other platforms of releasing all keys
when the the browser window regains focus.
swf/LzKeyboardKernel: Create a Selection listener for focus change,
call __allKeysUp when focus moves to or from the app
swf9/LFCApplication: For ActiveX embedding, create a Stage
listener for ACTIVATE, call __allKeysUp when the app is activated.
LzKeys, embednew: Add some debug info
Tests:
Still doesn't pass the test case, but it will remove the stuck key
if you click on an input element
.......
Property changes on: openlaszlo/trunk
___________________________________________________________________
Name: svnmerge-integrated
- /openlaszlo/branches/4.1:1-10153 /openlaszlo/branches/4.2:1-12154,12181,13205,13778,14112 /openlaszlo/branches/4.4:1-13936,14007 /openlaszlo/branches/devildog:1-8432 /openlaszlo/branches/pagan-deities:1-7955,8825,10756-10920,10922-10928,10930-10935,11151,11207,11554,13476,13629 /openlaszlo/branches/paperpie:1-6504,6506-6574,6576-7135,7137-7235 /openlaszlo/branches/wafflecone:1-5746,5818-6068,6070-6205,6207-6213,6216-6265,6267-6368,6370-6431,6433-6450,6497,6509,6661,7097,7872 /openlaszlo/trunk:1-3892,3894-3952,3954-4393,4395-4461,4463-4467,4469-4471,4473-5085,5087-5171,5173-5203,5205-5209,5211-5331,5333-5334
+ /openlaszlo/branches/4.1:1-10153 /openlaszlo/branches/4.2:1-12154,12181,13205,13778,14112,14287 /openlaszlo/branches/4.4:1-13936,14007 /openlaszlo/branches/devildog:1-8432 /openlaszlo/branches/pagan-deities:1-7955,8825,10756-10920,10922-10928,10930-10935,11151,11207,11554,13476,13629 /openlaszlo/branches/paperpie:1-6504,6506-6574,6576-7135,7137-7235 /openlaszlo/branches/wafflecone:1-5746,5818-6068,6070-6205,6207-6213,6216-6265,6267-6368,6370-6431,6433-6450,6497,6509,6661,7097,7872 /openlaszlo/trunk:1-3892,3894-3952,3954-4393,4395-4461,4463-4467,4469-4471,4473-5085,5087-5171,5173-5203,5205-5209,5211-5331,5333-5334
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzKeyboardKernel.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzKeyboardKernel.as 2009-07-08 17:51:15 UTC (rev 14291)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzKeyboardKernel.as 2009-07-08 20:24:56 UTC (rev 14292)
@@ -58,10 +58,32 @@
,__codes: {16: 'shift', 17: 'control', 18: 'alt'}
,__callback: null
,__scope: null
+ ,__listeneradded: false
,setCallback: function (scope, funcname) {
this.__scope = scope;
this.__callback = funcname;
- }
+ if (LzSprite.prototype.quirks.swf_swallows_focus_events) {
+ // Enable focus on sprite root so we can receive onfocus
+ // events in IE when the browser window does
+ if (this.__listeneradded == false) {
+ var listener = {
+ onSetFocus: function (o, n) {
+ if ((o == null) || (n == null)) {
+ var how = '';
+// if ($debug) {
+// how = Debug.formatToString("focus %#w -> %#w", o, n);
+// }
+ lz.Keys.__allKeysUp(how);
+// } else if ($debug) {
+// Debug.debug("focus %#w -> %#w", o, n);
+ }
+ }
+ }
+ Selection.addListener(listener);
+ this.__listeneradded = true;
+ }
+ }
+ }
// Called by lz.embed when the browser window regains focus
,__allKeysUp: function () {
var delta = {};
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as 2009-07-08 17:51:15 UTC (rev 14291)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as 2009-07-08 20:24:56 UTC (rev 14292)
@@ -24,7 +24,14 @@
is = _root.attachMovie('empty', 'spriteroot', 1000);
}
this.__LZmovieClipRef = is;
-
+ if (LzSprite.prototype.quirks.swf_swallows_focus_events) {
+ is.attachMovie( LzSprite.prototype.__LZclickregion, "$mcB",
+ LzSprite.prototype.BUTTON_DEPTH, {_width: 0, _height: 0} );
+ if (debug) {
+ is.$mcB._dbg_name = 'default focus';
+ }
+ Selection.setFocus(is.$mcB);
+ }
this.__LZsvdepth = 1;
} else {
this.__LZdepth = newowner.immediateparent.sprite.__LZsvdepth++;
@@ -50,6 +57,19 @@
};
}
+LzSprite.prototype.quirks = {
+ swf_swallows_focus_events: false
+}
+
+LzSprite.prototype.__updateQuirks = function () {
+ var quirks = this.quirks;
+ if (System.capabilities.os.indexOf('Win') == 0) {
+ quirks.swf_swallows_focus_events = true;
+ }
+}
+
+LzSprite.prototype.__updateQuirks();
+
LzSprite.prototype.capabilities = {
rotation: true
// Avoid scaling canvas to percentage values - SWF already scales the viewport size, so take window size literally to avoid scaling twice
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LFCApplication.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LFCApplication.as 2009-07-08 17:51:15 UTC (rev 14291)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LFCApplication.as 2009-07-08 20:24:56 UTC (rev 14292)
@@ -59,6 +59,9 @@
runToplevelDefinitions()
if (Capabilities.playerType == "ActiveX") {
+ // Workaround for ActiveX control swallowing browser focus events
+ stage.addEventListener(Event.ACTIVATE, allKeysUp);
+
// workaround for flash player bug FP-1355
LFCApplication.textfieldTabEnabled = true;
stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, preventFocusChange);
@@ -77,6 +80,10 @@
LzKeyboardKernel.setCallback(lz.Keys, '__keyEvent');
}
+ private function allKeysUp(event:Event):void {
+ lz.Keys.__allKeysUp('flash activate');
+ }
+
private function preventFocusChange(event:FocusEvent):void {
if (event.keyCode == 9) {
event.preventDefault();
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/services/LzKeys.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/services/LzKeys.lzs 2009-07-08 17:51:15 UTC (rev 14291)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/services/LzKeys.lzs 2009-07-08 20:24:56 UTC (rev 14292)
@@ -149,7 +149,10 @@
* Trampoline so we can call from lz.embed
* @access private
*/
- function __allKeysUp ():void {
+ function __allKeysUp (how='unknown'):void {
+// if ($debug) {
+// Debug.debug("[%6.2f] __allKeysUp: %s", (new Date).getTime() % 1000000, how);
+// }
LzKeyboardKernel.__allKeysUp();
}
Modified: openlaszlo/trunk/lps/includes/source/embednew.js
===================================================================
--- openlaszlo/trunk/lps/includes/source/embednew.js 2009-07-08 17:51:15 UTC (rev 14291)
+++ openlaszlo/trunk/lps/includes/source/embednew.js 2009-07-08 20:24:56 UTC (rev 14292)
@@ -685,18 +685,18 @@
if (d != null) this.callMethod("lz.Keys.__mousewheelEvent(" + d + ")");
}
,/** @access private */
- _gotFocus: function() {
- lz.embed._broadcastMethod('_sendAllKeysUp');
+ _gotFocus: function(how='unknown') {
+ lz.embed._broadcastMethod('_sendAllKeysUp', how);
}
,/** @access private */
- _sendAllKeysUpSWF: function () {
- this.callMethod("lz.Keys.__allKeysUp()");
+ _sendAllKeysUpSWF: function (how='unknown') {
+ this.callMethod("lz.Keys.__allKeysUp(" + how + ")");
}
,/** @access private */
- _sendAllKeysUpDHTML: function () {
+ _sendAllKeysUpDHTML: function (how='unknown') {
// How to deal with multiple DHTML apps on a page?
- if (lz.Keys && lz.Keys['__allKeysUp']) {
- lz.Keys.__allKeysUp();
+ if (lz['Keys'] && lz.Keys['__allKeysUp']) {
+ lz.Keys.__allKeysUp(how);
}
}
,/** @access private */
@@ -874,9 +874,11 @@
lz.embed.attachEventHandler(window, 'beforeunload', lz.embed, '_cleanupHandlers');
// Notice that you got focus
-lz.embed.attachEventHandler(window, 'focus', lz.embed, '_gotFocus');
if (lz.embed.browser.isIE) {
- lz.embed.attachEventHandler(window, 'activate', lz.embed, '_gotFocus');
+ // attachEventHandler does not work for IE?
+ document.onfocusin = function () { lz.embed._gotFocus('document focusin'); }
+} else {
+ lz.embed.attachEventHandler(window, 'focus', lz.embed, '_gotFocus');
}
// for backward compatibility
More information about the Laszlo-checkins
mailing list