gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/as_object.cpp server/as_...


From: Benjamin Wolsey
Subject: [Gnash-commit] gnash ChangeLog server/as_object.cpp server/as_...
Date: Sun, 09 Mar 2008 15:09:16 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Benjamin Wolsey <bwy>   08/03/09 15:09:16

Modified files:
        .              : ChangeLog 
        server         : as_object.cpp as_object.h gnash.h 
        server/asobj   : Mouse.cpp 
        gui            : Player.cpp Player.h gui.cpp gui.h 

Log message:
                * server/gnash.h: add "interfaceEventCallback" callback for 
passing
                  AS events to the gui.
                * server/as_object.{cpp,h}: make callback a static method of 
as_object
                  class, as that's where it's used.
                * gui/Player.{h,cpp}: register Player as a listener for 
interface event
                  callbacks and pass on to gui.
                * gui/gui.{cpp,h}: make Mouse.hide and Mouse.show unimplemented 
in the
                  gui, not in mouse_as_object.
                * server/asobj/Mouse.cpp: send mouse events using callback.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5850&r2=1.5851
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.cpp?cvsroot=gnash&r1=1.100&r2=1.101
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.h?cvsroot=gnash&r1=1.94&r2=1.95
http://cvs.savannah.gnu.org/viewcvs/gnash/server/gnash.h?cvsroot=gnash&r1=1.115&r2=1.116
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Mouse.cpp?cvsroot=gnash&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Player.cpp?cvsroot=gnash&r1=1.82&r2=1.83
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Player.h?cvsroot=gnash&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.cpp?cvsroot=gnash&r1=1.134&r2=1.135
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.h?cvsroot=gnash&r1=1.75&r2=1.76

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5850
retrieving revision 1.5851
diff -u -b -r1.5850 -r1.5851
--- ChangeLog   8 Mar 2008 00:04:19 -0000       1.5850
+++ ChangeLog   9 Mar 2008 15:09:14 -0000       1.5851
@@ -1,3 +1,15 @@
+2008-03-09 Benjamin Wolsey <address@hidden>
+
+       * server/gnash.h: add "interfaceEventCallback" callback for passing
+         AS events to the gui.
+       * server/as_object.{cpp,h}: make callback a static method of as_object
+         class, as that's where it's used.
+       * gui/Player.{h,cpp}: register Player as a listener for interface event
+         callbacks and pass on to gui.
+       * gui/gui.{cpp,h}: make Mouse.hide and Mouse.show unimplemented in the
+         gui, not in mouse_as_object.
+       * server/asobj/Mouse.cpp: send mouse events using callback.
+
 2008-03-07 Bastiaan Jacques <address@hidden>
 
        * server/StringPredicates.h: Use boost string algorithms instead of

Index: server/as_object.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_object.cpp,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -b -r1.100 -r1.101
--- server/as_object.cpp        6 Mar 2008 14:52:20 -0000       1.100
+++ server/as_object.cpp        9 Mar 2008 15:09:15 -0000       1.101
@@ -783,6 +783,9 @@
 
 }
 
+gnash::interfaceEventCallback
+as_object::interfaceHandle = NULL;
+
 as_object::as_object()
        :
        _members(),

Index: server/as_object.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_object.h,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -b -r1.94 -r1.95
--- server/as_object.h  6 Mar 2008 14:52:20 -0000       1.94
+++ server/as_object.h  9 Mar 2008 15:09:15 -0000       1.95
@@ -917,6 +917,13 @@
 
        /// @} Common ActionScript getter-setters for characters
        
+       static gnash::interfaceEventCallback interfaceHandle;
+
+       static void registerEventCallback(interfaceEventCallback handler)
+       {
+               interfaceHandle = handler;
+       }
+       
 protected:
 
        /// Get a property value by name

Index: server/gnash.h
===================================================================
RCS file: /sources/gnash/gnash/server/gnash.h,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -b -r1.115 -r1.116
--- server/gnash.h      20 Feb 2008 14:46:27 -0000      1.115
+++ server/gnash.h      9 Mar 2008 15:09:15 -0000       1.116
@@ -122,6 +122,14 @@
 /// script to fscommand().
 DSOEXPORT void  register_fscommand_callback(fscommand_callback handler);
 
+/// Signature of interface event callback.
+typedef void (*interfaceEventCallback)(const std::string& event, const 
std::string& arg);
+
+/// Use this to register listeners for as_object 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);
+
 /// Use this to register gnash extension
 //
 /// WARNING: does not convert name, make sure to pass a lowercase

Index: server/asobj/Mouse.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Mouse.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- server/asobj/Mouse.cpp      21 Jan 2008 20:55:56 -0000      1.16
+++ server/asobj/Mouse.cpp      9 Mar 2008 15:09:15 -0000       1.17
@@ -89,15 +89,20 @@
 
 as_value mouse_hide(const fn_call& fn)
 {
+
     boost::intrusive_ptr<mouse_as_object> 
obj=ensureType<mouse_as_object>(fn.this_ptr);
     UNUSED(obj);
 
-    static bool warned=false;
-    if ( ! warned )
+       if (as_object::interfaceHandle)
+       {
+               (*as_object::interfaceHandle)("Mouse.hide", "");
+       }
+       else
     {
-        log_unimpl (__FUNCTION__);
-        warned=true;
+               log_error(_("No callback to handle Mouse.hide"));
     }
+
+       /// Returns nothing
     return as_value();
 }
 
@@ -106,12 +111,15 @@
     boost::intrusive_ptr<mouse_as_object> 
obj=ensureType<mouse_as_object>(fn.this_ptr);
     UNUSED(obj);
 
-    static bool warned=false;
-    if ( ! warned )
+       if (as_object::interfaceHandle)
+       {
+               (*as_object::interfaceHandle)("Mouse.show", "");
+       }
+       else
     {
-        log_unimpl (__FUNCTION__);
-        warned=true;
+               log_error(_("No callback to handle Mouse.show"));
     }
+       /// Returns nothing
     return as_value();
 }
 

Index: gui/Player.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/Player.cpp,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -b -r1.82 -r1.83
--- gui/Player.cpp      19 Feb 2008 19:20:49 -0000      1.82
+++ gui/Player.cpp      9 Mar 2008 15:09:15 -0000       1.83
@@ -53,6 +53,7 @@
 gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
 }
 
+std::auto_ptr<Gui> Player::_gui(NULL);
 
 /*static private*/
 void
@@ -110,6 +111,8 @@
 
        gnash::register_fscommand_callback(fs_callback);
 
+       gnash::as_object::registerEventCallback(interfaceEventCallback);
+
 }
 
 void
@@ -395,6 +398,22 @@
     log_debug(_("fs_callback(%p): %s %s"), (void*)movie, command, args);
 }
 
+void
+Player::interfaceEventCallback(const std::string& event, const std::string& 
arg)
+{
+       if (event == "Mouse.hide")
+       {
+               _gui->showMouse(false);
+               return;
+       }
+       if (event == "Mouse.show")
+       {
+               _gui->showMouse(true);
+               return;
+       }
+       log_error(_("Unhandled callback %s with arguments %s"), event, arg);
+}
+
 /* private */
 std::auto_ptr<Gui>
 Player::getGui()

Index: gui/Player.h
===================================================================
RCS file: /sources/gnash/gnash/gui/Player.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- gui/Player.h        30 Jan 2008 14:51:47 -0000      1.22
+++ gui/Player.h        9 Mar 2008 15:09:15 -0000       1.23
@@ -160,6 +160,9 @@
        static void fs_callback(sprite_instance* movie,
                        const char* command, const char* args);
 
+       static void interfaceEventCallback(const std::string& event,
+                                                       const std::string& arg);
+
        // Movie parameters (for -P)
        std::map<std::string, std::string> params;
 
@@ -186,7 +189,7 @@
 
        std::string _baseurl;
 
-       std::auto_ptr<Gui> _gui;
+       static std::auto_ptr<Gui> _gui;
 
        std::auto_ptr<media::sound_handler> _sound_handler;
 

Index: gui/gui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -b -r1.134 -r1.135
--- gui/gui.cpp 7 Mar 2008 12:39:19 -0000       1.134
+++ gui/gui.cpp 9 Mar 2008 15:09:15 -0000       1.135
@@ -162,13 +162,24 @@
 void
 Gui::setFullscreen()
 {
-    log_unimpl("Fullscreen not yet supported in this GUI");
+    log_unimpl(_("Fullscreen not yet supported in this GUI"));
 }
 
 void
 Gui::unsetFullscreen()
 {
-    log_unimpl("Fullscreen not yet supported in this GUI");
+    log_unimpl(_("Fullscreen not yet supported in this GUI"));
+}
+
+void
+Gui::showMouse(bool show)
+{
+       static bool warned = false;
+       if (!warned)
+       {
+       log_unimpl(_("Mouse show/hide not yet supported in this GUI"));
+       warned = true;
+       }
 }
 
 void

Index: gui/gui.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.h,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -b -r1.75 -r1.76
--- gui/gui.h   7 Mar 2008 12:39:19 -0000       1.75
+++ gui/gui.h   9 Mar 2008 15:09:15 -0000       1.76
@@ -219,7 +219,7 @@
     /// Attempt to run in a fullscreen window both for plugin and
     /// standalone player.
     //
-    /// Use gui::isFullscreen() to see if gnash thinks
+    /// Use isFullscreen() to see if gnash thinks
     /// it's running in fullscreen or not. The switch to fullscreen may
     /// fail if, for instance, the window manager refuses to allow it, but
     /// the flag will be set anyway.
@@ -229,6 +229,11 @@
     ///
     virtual void unsetFullscreen();
     
+    /// Sets whether the gui should show the system mouse pointer
+    //
+    /// @param show true if the mouse should be shown.
+    virtual void showMouse(bool show);
+    
     // Toggle between fullscreen and normal mode
     void toggleFullscreen();
 




reply via email to

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