gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog server/character.h server/gnash...


From: Benjamin Wolsey
Subject: [Gnash-commit] gnash ChangeLog server/character.h server/gnash...
Date: Wed, 21 May 2008 13:24:07 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Benjamin Wolsey <bwy>   08/05/21 13:24:07

Modified files:
        .              : ChangeLog 
        server         : character.h gnash.h impl.h movie_root.cpp 
                         movie_root.h 
        server/asobj   : Mouse.cpp System.cpp 
        server/parser  : bitmap_character_def.h 
        server/swf     : ControlTag.h 
        server/vm      : ASHandlers.cpp ActionExec.cpp 
        gui            : Player.cpp 
        utilities      : processor.cpp 

Log message:
                * server/movie_root.{cpp,h}: make AS callback handlers and
                  registering functions into non-static members of movie_root
                  (FScommand and interfaceEvent).
                * server/vm/ActionExec.cpp: registerFSCommandCallback moved to
                  movie_root.
                * server/ASHandlers.cpp: get FScommand callback from movie_root,
                  reduces use of globals and 'extern'.
                * gui/Player.cpp, utilities/processor.cpp: update registering
                  callback handlers (after VM is initialized).
                * server/gnash.h: drop declaration of callback-registering
                  functions (done in movie_root now).
                * server/character.h, server/impl.h, server/swf/ControlTag.h,
                  server/parser/bitmap_character_def.h   
        
        It seems that it might be possible for FsCommands to be called before
        the VM is initialized, and this change means they'll be ignored. It 
        appears not (and really ought not) to make a difference (at least for
        the testsuite and my own tests).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6663&r2=1.6664
http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.h?cvsroot=gnash&r1=1.144&r2=1.145
http://cvs.savannah.gnu.org/viewcvs/gnash/server/gnash.h?cvsroot=gnash&r1=1.120&r2=1.121
http://cvs.savannah.gnu.org/viewcvs/gnash/server/impl.h?cvsroot=gnash&r1=1.55&r2=1.56
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.cpp?cvsroot=gnash&r1=1.194&r2=1.195
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.h?cvsroot=gnash&r1=1.129&r2=1.130
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Mouse.cpp?cvsroot=gnash&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/System.cpp?cvsroot=gnash&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/bitmap_character_def.h?cvsroot=gnash&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/ControlTag.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.236&r2=1.237
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ActionExec.cpp?cvsroot=gnash&r1=1.74&r2=1.75
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Player.cpp?cvsroot=gnash&r1=1.112&r2=1.113
http://cvs.savannah.gnu.org/viewcvs/gnash/utilities/processor.cpp?cvsroot=gnash&r1=1.97&r2=1.98

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6663
retrieving revision 1.6664
diff -u -b -r1.6663 -r1.6664
--- ChangeLog   21 May 2008 11:21:54 -0000      1.6663
+++ ChangeLog   21 May 2008 13:24:04 -0000      1.6664
@@ -1,3 +1,19 @@
+2008-05-21 Benjamin Wolsey <address@hidden>
+
+       * server/movie_root.{cpp,h}: make AS callback handlers and
+         registering functions into non-static members of movie_root
+         (FScommand and interfaceEvent).
+       * server/vm/ActionExec.cpp: registerFSCommandCallback moved to
+         movie_root.
+       * server/ASHandlers.cpp: get FScommand callback from movie_root,
+         reduces use of globals and 'extern'.
+       * gui/Player.cpp, utilities/processor.cpp: update registering
+         callback handlers (after VM is initialized).
+       * server/gnash.h: drop declaration of callback-registering
+         functions (done in movie_root now).
+       * server/character.h, server/impl.h, server/swf/ControlTag.h,
+         server/parser/bitmap_character_def.h    
+
 2008-05-21 Sandro Santilli <address@hidden>
 
        * testsuite/misc-ming.all/NetStream-SquareTest.c: fix the test

Index: server/character.h
===================================================================
RCS file: /sources/gnash/gnash/server/character.h,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -b -r1.144 -r1.145
--- server/character.h  19 May 2008 13:03:53 -0000      1.144
+++ server/character.h  21 May 2008 13:24:05 -0000      1.145
@@ -39,7 +39,6 @@
 #endif
 
 #include <map>
-#include <cstdarg>
 #include <string>
 #include <cassert>
 #include <typeinfo>

Index: server/gnash.h
===================================================================
RCS file: /sources/gnash/gnash/server/gnash.h,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -b -r1.120 -r1.121
--- server/gnash.h      27 Mar 2008 10:50:14 -0000      1.120
+++ server/gnash.h      21 May 2008 13:24:05 -0000      1.121
@@ -109,24 +109,9 @@
 typedef void (*fscommand_callback)(sprite_instance* movie,
                                                const std::string& command, 
const std::string& arg);
 
-/// ActionScripts embedded in a movie can use the built-in
-/// fscommand() function to send data back to the host
-/// application.  If you are interested in this data, register
-/// a handler, which will be called when the embedded scripts
-/// call fscommand().
-///
-/// The handler gets the sprite_instance* that the script is
-/// embedded in, and the two string arguments passed by the
-/// script to fscommand().
-DSOEXPORT void registerFSCommandCallback(fscommand_callback handler);
-
 /// Signature of interface event callback.
-typedef std::string (*interfaceEventCallback)(const std::string& event, const 
std::string& arg);
-
-/// Use this to register listeners for core events that should
-/// trigger an event in the user interface (GUI or any other
-/// user of the gnash core libs).
-DSOEXPORT void registerEventCallback(interfaceEventCallback handler);
+typedef std::string (*interfaceEventCallback)(const std::string& event,
+                                              const std::string& arg);
 
 /// Use this to register gnash extension
 //

Index: server/impl.h
===================================================================
RCS file: /sources/gnash/gnash/server/impl.h,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -b -r1.55 -r1.56
--- server/impl.h       19 May 2008 13:03:53 -0000      1.55
+++ server/impl.h       21 May 2008 13:24:05 -0000      1.56
@@ -26,7 +26,6 @@
 #include "smart_ptr.h"
 #include "swf/TagLoadersTable.h"
 
-#include <cstdarg>
 #include <cassert>
 
 namespace gnash {

Index: server/movie_root.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.cpp,v
retrieving revision 1.194
retrieving revision 1.195
diff -u -b -r1.194 -r1.195
--- server/movie_root.cpp       19 May 2008 13:03:54 -0000      1.194
+++ server/movie_root.cpp       21 May 2008 13:24:05 -0000      1.195
@@ -71,7 +71,6 @@
 namespace gnash
 {
 
-gnash::interfaceEventCallback movie_root::interfaceHandle = NULL;
 
 inline bool
 movie_root::testInvariant() const
@@ -88,6 +87,8 @@
 
 movie_root::movie_root()
        :
+       interfaceHandle(0),
+       fsCommandHandle(0),
        m_viewport_x0(0),
        m_viewport_y0(0),
        m_viewport_width(1),

Index: server/movie_root.h
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.h,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -b -r1.129 -r1.130
--- server/movie_root.h 30 Apr 2008 14:29:38 -0000      1.129
+++ server/movie_root.h 21 May 2008 13:24:05 -0000      1.130
@@ -710,15 +710,35 @@
         return _hostfd;
     }
 
-       /// A callback to the GUI for sending events and receiving
-       /// replies.
-       static gnash::interfaceEventCallback interfaceHandle;
+       /// A callback to the GUI (or whatever is listening) for sending
+       /// events and receiving replies. Used for ActionScript interface
+       /// with the gui (Mouse visibility, Stage alignment etc and System
+       /// information, for instance).
+       gnash::interfaceEventCallback interfaceHandle;
 
-       static void registerEventCallback(interfaceEventCallback handler)
+       DSOEXPORT void registerEventCallback(interfaceEventCallback handler)
        {
                interfaceHandle = handler;
        }
 
+    // Callback to send FsCommands somewhere.
+    gnash::fscommand_callback fsCommandHandle;
+
+
+    /// ActionScript embedded in a movie can use the built-in
+    /// fscommand() function to send data back to the host
+    /// application.  If you are interested in this data, register
+    /// a handler, which will be called when the embedded scripts
+    /// call fscommand().
+    ///
+    /// The handler gets the sprite_instance* that the script is
+    /// embedded in, and the two string arguments passed by the
+    /// script to fscommand().
+    DSOEXPORT void registerFSCommandCallback(fscommand_callback handler)
+    {
+        fsCommandHandle = handler;
+    }
+
 #ifdef USE_SWFTREE
     typedef std::pair<std::string, std::string> StringPair;
     void getMovieInfo(tree<StringPair>& tr, tree<StringPair>::iterator it);

Index: server/asobj/Mouse.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Mouse.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- server/asobj/Mouse.cpp      16 Apr 2008 11:16:37 -0000      1.21
+++ server/asobj/Mouse.cpp      21 May 2008 13:24:06 -0000      1.22
@@ -66,9 +66,11 @@
 
     int success = 0;
 
-       if (movie_root::interfaceHandle)
+    movie_root& m = VM::get().getRoot();
+
+       if (m.interfaceHandle)
        {
-               success = ((*movie_root::interfaceHandle)("Mouse.hide", "") == 
"true") ? 1 : 0;
+               success = ((*m.interfaceHandle)("Mouse.hide", "") == "true") ? 
1 : 0;
        }
        else
        {
@@ -88,9 +90,11 @@
 
     int success = 0;
 
-       if (movie_root::interfaceHandle)
+    movie_root& m = VM::get().getRoot();
+
+       if (m.interfaceHandle)
        {
-               success = ((*movie_root::interfaceHandle)("Mouse.show", "") == 
"true") ? 1 : 0;
+               success = ((*m.interfaceHandle)("Mouse.show", "") == "true") ? 
1 : 0;
        }
        else
        {

Index: server/asobj/System.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/System.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- server/asobj/System.cpp     17 Apr 2008 08:14:18 -0000      1.31
+++ server/asobj/System.cpp     21 May 2008 13:24:06 -0000      1.32
@@ -91,7 +91,9 @@
     // "Windows XP", "Windows 2000", "Windows NT", "Windows 98/ME",
     // "Windows 95", "Windows CE", "Linux", "MacOS"
     // Override in gnashrc
-    const std::string os = VM::get().getOSName();
+    VM& vm = VM::get();
+    
+    const std::string os = vm.getOSName();
 
     const std::string language = systemLanguage();
 
@@ -130,21 +132,23 @@
 
     std::istringstream ss;
 
-    if (movie_root::interfaceHandle) {
-        
ss.str((*movie_root::interfaceHandle)("System.capabilities.screenResolutionX", 
""));
+    const movie_root& m = vm.getRoot();
+
+    if (m.interfaceHandle) {
+        ss.str((*m.interfaceHandle)("System.capabilities.screenResolutionX", 
""));
         ss >> screenResolutionX;
         
         ss.clear();
-        
ss.str((*movie_root::interfaceHandle)("System.capabilities.screenResolutionY", 
""));
+        ss.str((*m.interfaceHandle)("System.capabilities.screenResolutionY", 
""));
         ss >> screenResolutionY;
 
         ss.clear();
-        ss.str((*movie_root::interfaceHandle)("System.capabilities.screenDPI", 
""));
+        ss.str((*m.interfaceHandle)("System.capabilities.screenDPI", ""));
         ss >> screenDPI;
         
-        pixelAspectRatio = 
(*movie_root::interfaceHandle)("System.capabilities.pixelAspectRatio", "");
-        playerType = 
(*movie_root::interfaceHandle)("System.capabilities.playerType", "");
-        screenColor = 
(*movie_root::interfaceHandle)("System.capabilities.screenColor", "");
+        pixelAspectRatio = 
(*m.interfaceHandle)("System.capabilities.pixelAspectRatio", "");
+        playerType = (*m.interfaceHandle)("System.capabilities.playerType", 
"");
+        screenColor = (*m.interfaceHandle)("System.capabilities.screenColor", 
"");
     }
 
     //

Index: server/parser/bitmap_character_def.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/bitmap_character_def.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- server/parser/bitmap_character_def.h        19 May 2008 13:03:54 -0000      
1.23
+++ server/parser/bitmap_character_def.h        21 May 2008 13:24:06 -0000      
1.24
@@ -26,7 +26,6 @@
 #include "bitmap_info.h" // for dtor visibility by intrusive_ptr
 #include "GC.h" // for GcResource (markReachableResources)
 
-#include <cstdarg>
 #include <cassert>
 #include <memory> // for auto_ptr
 

Index: server/swf/ControlTag.h
===================================================================
RCS file: /sources/gnash/gnash/server/swf/ControlTag.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/swf/ControlTag.h     30 Apr 2008 09:15:03 -0000      1.4
+++ server/swf/ControlTag.h     21 May 2008 13:24:06 -0000      1.5
@@ -18,11 +18,6 @@
 #ifndef GNASH_EXECUTE_TAG_H
 #define GNASH_EXECUTE_TAG_H
 
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
-
-#include <cstdarg>
 #include <cassert>
 
 namespace gnash {

Index: server/vm/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v
retrieving revision 1.236
retrieving revision 1.237
diff -u -b -r1.236 -r1.237
--- server/vm/ASHandlers.cpp    7 May 2008 09:41:14 -0000       1.236
+++ server/vm/ASHandlers.cpp    21 May 2008 13:24:06 -0000      1.237
@@ -78,11 +78,6 @@
 //
 #undef REALLY_WAIT_ON_WAIT_FOR_FRAME
 
-// Forward declarations
-namespace gnash {
-       extern fscommand_callback s_fscommand_handler;
-}
-
 namespace gnash {
 
 namespace SWF { // gnash::SWF
@@ -2242,14 +2237,16 @@
                target_string = target.to_string();
        }
 
+
+    movie_root& m = VM::get().getRoot();
        // If the url starts with "FSCommand:", then this is
        // a message for the host app.
        if (strncasecmp(url_c, "FSCommand:", 10) == 0)
        {
-               if (s_fscommand_handler)
+               if (m.fsCommandHandle)
                {
                        // Call into the app.
-                       (*s_fscommand_handler)(env.get_target()->get_root(), 
url_c + 10, target_string.c_str());
+                       (*m.fsCommandHandle)(env.get_target()->get_root(), 
url_c + 10, target_string.c_str());
                }
 
                return;

Index: server/vm/ActionExec.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ActionExec.cpp,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -b -r1.74 -r1.75
--- server/vm/ActionExec.cpp    17 May 2008 20:10:37 -0000      1.74
+++ server/vm/ActionExec.cpp    21 May 2008 13:24:06 -0000      1.75
@@ -70,13 +70,6 @@
 static Debugger& debugger = Debugger::getDefaultInstance();
 #endif
 
-// External interface (to be moved under swf/ASHandlers)
-fscommand_callback s_fscommand_handler = NULL;
-void   registerFSCommandCallback(fscommand_callback handler)
-{
-    s_fscommand_handler = handler;
-}
-
 ActionExec::ActionExec(const swf_function& func, as_environment& newEnv, 
as_value* nRetVal, as_object* this_ptr)
        :
        with_stack(),

Index: gui/Player.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/Player.cpp,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -b -r1.112 -r1.113
--- gui/Player.cpp      21 May 2008 09:08:58 -0000      1.112
+++ gui/Player.cpp      21 May 2008 13:24:06 -0000      1.113
@@ -112,10 +112,6 @@
 
     set_use_cache_files(false);
 
-    gnash::registerFSCommandCallback(fs_callback);
-    
-    gnash::movie_root::registerEventCallback(&interfaceEventCallback);
-
 }
 
 void
@@ -385,6 +381,10 @@
     SystemClock clock; // use system clock here...
     movie_root& root = VM::init(*_movieDef, clock).getRoot();
 
+    // Register Player to receive events from the core (Mouse, Stage,
+    // System etc)
+    root.registerEventCallback(&interfaceEventCallback);
+
     // Set host requests fd (if any)
     if ( _hostfd != -1 ) root.setHostFD(_hostfd);
 

Index: utilities/processor.cpp
===================================================================
RCS file: /sources/gnash/gnash/utilities/processor.cpp,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -b -r1.97 -r1.98
--- utilities/processor.cpp     14 Apr 2008 08:37:14 -0000      1.97
+++ utilities/processor.cpp     21 May 2008 13:24:07 -0000      1.98
@@ -323,9 +323,6 @@
        exit(1);
     }
 
-    registerFSCommandCallback(execFsCommand);
-    gnash::movie_root::registerEventCallback(&eventCallback);
-
     // Play through all the movies.
     for (int i = 0, n = infiles.size(); i < n; i++) {
 
@@ -406,12 +403,18 @@
     long clockAdvance = fpsDelay/1000;
     long localDelay = delay == -1 ? fpsDelay : delay; // microseconds
 
-    log_debug("Will sleep %ld microseconds between iterations - fps is %g, 
clockAdvance is %lu\n", localDelay, fps, clockAdvance);
+    log_debug("Will sleep %ld microseconds between iterations - fps is %g, 
clockAdvance is %lu", 
+                        localDelay, fps, clockAdvance);
 
     // Use a clock advanced at every iteration to match exact FPS speed.
     ManualClock cl;
     gnash::movie_root& m = VM::init(*md, cl).getRoot();
 
+    // Register processor to receive ActionScript events (Mouse, Stage
+    // System etc).
+    m.registerEventCallback(&eventCallback);
+    m.registerFSCommandCallback(&execFsCommand);
+
     md->completeLoad();
 
     std::auto_ptr<movie_instance> mi ( md->create_movie_instance() );




reply via email to

[Prev in Thread] Current Thread [Next in Thread]