This is great!  A few things:

+ Do you plan n adding a swf8 implementation? You may want to set the DHTML and swf8 fullscreen capability to false for now. You could check for the capability and then warn if it's not true in LaszloCanvas.lzs#showFullScreen()

+ It seems like showFullScreen() really wants to be a setter so it can be invoked by canvas.setAttribute('fullscreen', ...) - just rename to $lzc$set_fullscreen().

+ You could move the try/catch from LZScreenKernel.as#showFullScreen() to the canvas method. It would catch all errors this way - even for swf8.

+ It looks like you need a separate callback for fullScreenEventHandler() because there's no guarantee the screen state will change at the same time as showFullScreen() call. I'd suggest delegating the event sending to a callback method on the canvas. Also, it's probably not a good idea to leak the runtime-specific FullScreenEvent property to the runtime through sendEvent() - please coerce to a true/false value - the canvas.fullscreen property also need to be set to this value.

+ Is the canvas.displaystate property actually required? It seems like the canvas.fullscreen attribute should provide enough information.

+ Your editor has inserted little bits of whitespace in various places, making the diff a little hard to follow - not sure why!

I'm looking forward to using this!

Raju Bitter wrote:
Sarah, Max,

here's how you can test the updated version:
Compile test/fullscreen/fullscreentest1.lzx?lzr=swf9

There's a new attribute on canvas: @fullscreen

@fullscreen is set to "true", that means you can switch to fullscreen mode by calling canvas.showFullScreen(true). That method call has to be triggered either by a keypress or mouse click to work (Flash security!).

If you set fullscreen="false" and compile, clicking on the "Toggle Fullscreen" button will give you an error message in the debug window. I've changed the template for lzt=html as well, so app-console.xslt and html-reponse.xslt are the only ones that work for now.

What do you think of this approach? Feedback welcome!

- Raju

Change 20090613-raju-r by r...@atlantia on 2009-06-13 23:52:31 CEST
    in /Users/rajubitter/src/svn/openlaszlo/trunk
    for http://[email protected]/openlaszlo/trunk

Summary: Add support for Flash Player's ability to switch to full screen mode for SWFx

New Features:

Bugs Fixed: LPP-8107

Technical Reviewer: max
QA Reviewer: (pending)
Doc Reviewer: (pending)

Documentation:
The documentation has to be updated, to reflect the new functionality.

Release Notes:
Works with Flash Player version 9.0.28. and all later versions.

Details:
http://jira.openlaszlo.org/jira/browse/LPP-8107

Embedding code
  lps/includes/sources/embednew.js
    + method lz.embed.swf
       - added allowFullScreen: properties.fullscreen
  lps/includes/sources/flash.js
    + method lz.embed.dojo
      + added value to defaults: fullscreen: true
    + lz.embed.dojo.Embed.prototype.write
      object.html: added param/attribute allowFullScreen

LFC changes for all runtimes
  WEB-INF/lps/lfc/views/LaszloCanvas.lzs
    + @initarg documentation added for fullscreen
    + public var fullscreen added
    + onfullscreen event added
    + public var diplaystate added
    + handling of @initarg fullscreen added to construct() method
+ Warning for runtimes that don't support fullscreen (DHTML) added to construct method
    + method function showFullScreen(fullscreen=true) added

SWF9 specific changes
  WEB-INF/lps/lfc/kernel/swf9/LzScreenKernel.as
    + Added method showFullScreen
    + Added handler for FullScreenEvent fullScreenEventHandler
  WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
    + added fullscreen: true to capabilities

Compiler (Java classes)
  WEB-INF/lps/server/src/org/openlaszlo/compiler/CanvasCompiler.java
    + private static final boolean DEFAULT_FULLSCREEN = false;
    +  /** Fullscreen setting for canvas */
       private boolean mFullscreen = false;
    + methods setFullscreen() and isFullscreen()
    + in method public String getXML(String content) {
      - added "fullscreen='" + isFullscreen() + "' " + to buffer
  WEB-INF/lps/server/src/org/openlaszlo/compiler/Canvas.java
+ in method public void initializeFromElement(Canvas canvas, Element elt)
        if (fullscreen != null) {
            canvas.setFullscreen(fullscreen.equals("true"));
        }

XSLT template files
  WEB-INF/lps/templates/html-response.xslt
  WEB-INF/lps/templates/app-console.xslt
+ added allowFullScreen: '<xsl:value-of select="/canvas/@fullscreen"/>' to lz.embed.dhtml({})

Tests:
test/fullscreen/fullscreen1.lzx
Simple test file for to go into fullscreen mode by clicking a button.

Files:
A       test/fullscreen
A       test/fullscreen/fullscreentest1.lzx
M       WEB-INF/lps/lfc/kernel/swf9/LzScreenKernel.as
M       WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
M       WEB-INF/lps/lfc/views/LaszloCanvas.lzs
M       WEB-INF/lps/server/src/org/openlaszlo/compiler/CanvasCompiler.java
M       WEB-INF/lps/server/src/org/openlaszlo/compiler/Canvas.java
M       WEB-INF/lps/templates/html-response.xslt
M       WEB-INF/lps/templates/app-console.xslt
M       lps/includes/source/embednew.js
M       lps/includes/source/flash.js

Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20090613-raju-r.tar

--
Regards,
Max Carlson
OpenLaszlo.org

Reply via email to