[Top][All Lists]
[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: |
Mon, 10 Mar 2008 08:19:41 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Benjamin Wolsey <bwy> 08/03/10 08:19:41
Modified files:
. : ChangeLog
server : as_object.cpp as_object.h gnash.h
movie_root.cpp movie_root.h
server/asobj : Mouse.cpp
server/vm : ActionExec.cpp
libbase : rc.cpp rc.h
gui : Player.cpp Player.h gui.cpp gui.h
utilities : processor.cpp
Log message:
* server/gnash.h: make interfaceEventCallback return bool to
allow response from the gui. Rename
register_fscommand_callback
to registerFSCommandCallback and make it take const
std::string&
arguments.
* server/as_object.{h,cpp}: remove callback from as_object and
* server/movie_root.{h,cpp}: put it in movie_root for use with
other events (e.g. ActionLimits hit).
* server/asobj/Mouse.cpp: update callback to movie_root.
* server/vm/ActionExec.cpp: update registerFSCommandCallback.
* gui/Player.{h,cpp}: adapt interfaceEventCallback methods,
implement some fscommands (quit, fullscreen).
* gui/gui.{h,cpp}: add isPlugin() method for deciding whether to
handle fscommands.
* libbase/rc.{cpp,h}: add ignoreFSCommands directive to allow,
well,
ignoring fscommands. Set to true by default.
* utilities/processor.cpp: update registerFSCommandCallback.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5852&r2=1.5853
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.cpp?cvsroot=gnash&r1=1.101&r2=1.102
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.h?cvsroot=gnash&r1=1.95&r2=1.96
http://cvs.savannah.gnu.org/viewcvs/gnash/server/gnash.h?cvsroot=gnash&r1=1.116&r2=1.117
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.cpp?cvsroot=gnash&r1=1.165&r2=1.166
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.h?cvsroot=gnash&r1=1.110&r2=1.111
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Mouse.cpp?cvsroot=gnash&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ActionExec.cpp?cvsroot=gnash&r1=1.68&r2=1.69
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/rc.cpp?cvsroot=gnash&r1=1.64&r2=1.65
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/rc.h?cvsroot=gnash&r1=1.47&r2=1.48
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Player.cpp?cvsroot=gnash&r1=1.83&r2=1.84
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Player.h?cvsroot=gnash&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.cpp?cvsroot=gnash&r1=1.135&r2=1.136
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.h?cvsroot=gnash&r1=1.76&r2=1.77
http://cvs.savannah.gnu.org/viewcvs/gnash/utilities/processor.cpp?cvsroot=gnash&r1=1.87&r2=1.88
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5852
retrieving revision 1.5853
diff -u -b -r1.5852 -r1.5853
--- ChangeLog 10 Mar 2008 00:38:51 -0000 1.5852
+++ ChangeLog 10 Mar 2008 08:19:37 -0000 1.5853
@@ -1,3 +1,22 @@
+2008-03-10 Benjamin Wolsey <address@hidden>
+
+ * server/gnash.h: make interfaceEventCallback return bool to
+ allow response from the gui. Rename register_fscommand_callback
+ to registerFSCommandCallback and make it take const std::string&
+ arguments.
+ * server/as_object.{h,cpp}: remove callback from as_object and
+ * server/movie_root.{h,cpp}: put it in movie_root for use with
+ other events (e.g. ActionLimits hit).
+ * server/asobj/Mouse.cpp: update callback to movie_root.
+ * server/vm/ActionExec.cpp: update registerFSCommandCallback.
+ * gui/Player.{h,cpp}: adapt interfaceEventCallback methods,
+ implement some fscommands (quit, fullscreen).
+ * gui/gui.{h,cpp}: add isPlugin() method for deciding whether to
+ handle fscommands.
+ * libbase/rc.{cpp,h}: add ignoreFSCommands directive to allow, well,
+ ignoring fscommands. Set to true by default.
+ * utilities/processor.cpp: update registerFSCommandCallback.
+
2008-03-09 Bastiaan Jacques <address@hidden>
* server/StringPredicates.h: Use std::lexicographical_compare instead
Index: server/as_object.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_object.cpp,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -b -r1.101 -r1.102
--- server/as_object.cpp 9 Mar 2008 15:09:15 -0000 1.101
+++ server/as_object.cpp 10 Mar 2008 08:19:38 -0000 1.102
@@ -783,9 +783,6 @@
}
-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.95
retrieving revision 1.96
diff -u -b -r1.95 -r1.96
--- server/as_object.h 9 Mar 2008 15:09:15 -0000 1.95
+++ server/as_object.h 10 Mar 2008 08:19:38 -0000 1.96
@@ -917,13 +917,6 @@
/// @} 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.116
retrieving revision 1.117
diff -u -b -r1.116 -r1.117
--- server/gnash.h 9 Mar 2008 15:09:15 -0000 1.116
+++ server/gnash.h 10 Mar 2008 08:19:39 -0000 1.117
@@ -32,7 +32,8 @@
#include <memory> // for auto_ptr
#include <cctype> // for poxy wchar_t
#include <cstdarg> // for va_list arg to sprite_instance::call_method_args()
-#include <string> // for movie_definition*
create_movie(std::auto_ptr<tu_file> in, const std::string& url);
+#include <string> // for movie_definition*
create_movie(std::auto_ptr<tu_file>
+ // in, const std::string& url);
// FIXME: The local usage of these constants should probably be renamed in this
// file because they conflict with definitions in the system header files.
Luckily
@@ -109,7 +110,8 @@
void register_progress_callback(progress_callback progress_handle);
/// Signature of fscommand callback function
-typedef void (*fscommand_callback)(sprite_instance* movie, const char*
command, const char* arg);
+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
@@ -120,14 +122,14 @@
/// 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 register_fscommand_callback(fscommand_callback handler);
+DSOEXPORT void registerFSCommandCallback(fscommand_callback handler);
/// Signature of interface event callback.
-typedef void (*interfaceEventCallback)(const std::string& event, const
std::string& arg);
+typedef bool (*interfaceEventCallback)(const std::string& event, const
std::string& arg);
-/// Use this to register listeners for as_object events that should
+/// 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.
+/// user of the gnash core libs).
DSOEXPORT void registerEventCallback(interfaceEventCallback handler);
/// Use this to register gnash extension
Index: server/movie_root.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.cpp,v
retrieving revision 1.165
retrieving revision 1.166
diff -u -b -r1.165 -r1.166
--- server/movie_root.cpp 6 Mar 2008 19:25:58 -0000 1.165
+++ server/movie_root.cpp 10 Mar 2008 08:19:39 -0000 1.166
@@ -53,6 +53,9 @@
namespace gnash
{
+gnash::interfaceEventCallback
+movie_root::interfaceHandle = NULL;
+
inline bool
movie_root::testInvariant() const
{
Index: server/movie_root.h
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.h,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -b -r1.110 -r1.111
--- server/movie_root.h 5 Mar 2008 03:55:59 -0000 1.110
+++ server/movie_root.h 10 Mar 2008 08:19:39 -0000 1.111
@@ -656,6 +656,15 @@
return _hostfd;
}
+ /// A callback to the GUI for sending events and receiving
+ /// replies.
+ static gnash::interfaceEventCallback interfaceHandle;
+
+ static void registerEventCallback(interfaceEventCallback handler)
+ {
+ interfaceHandle = handler;
+ }
+
private:
/// A load movie request
Index: server/asobj/Mouse.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Mouse.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- server/asobj/Mouse.cpp 9 Mar 2008 15:09:15 -0000 1.17
+++ server/asobj/Mouse.cpp 10 Mar 2008 08:19:39 -0000 1.18
@@ -30,6 +30,7 @@
#include "VM.h" // for registerNative
#include "Object.h" // for getObjectInterface
#include "AsBroadcaster.h" // for initializing self as a broadcaster
+#include "movie_root.h" // for GUI callback
namespace gnash {
@@ -93,9 +94,9 @@
boost::intrusive_ptr<mouse_as_object>
obj=ensureType<mouse_as_object>(fn.this_ptr);
UNUSED(obj);
- if (as_object::interfaceHandle)
+ if (movie_root::interfaceHandle)
{
- (*as_object::interfaceHandle)("Mouse.hide", "");
+ (*movie_root::interfaceHandle)("Mouse.hide", "");
}
else
{
@@ -111,9 +112,9 @@
boost::intrusive_ptr<mouse_as_object>
obj=ensureType<mouse_as_object>(fn.this_ptr);
UNUSED(obj);
- if (as_object::interfaceHandle)
+ if (movie_root::interfaceHandle)
{
- (*as_object::interfaceHandle)("Mouse.show", "");
+ (*movie_root::interfaceHandle)("Mouse.show", "");
}
else
{
Index: server/vm/ActionExec.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ActionExec.cpp,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -b -r1.68 -r1.69
--- server/vm/ActionExec.cpp 5 Mar 2008 03:56:04 -0000 1.68
+++ server/vm/ActionExec.cpp 10 Mar 2008 08:19:39 -0000 1.69
@@ -66,7 +66,7 @@
// External interface (to be moved under swf/ASHandlers)
fscommand_callback s_fscommand_handler = NULL;
-void register_fscommand_callback(fscommand_callback handler)
+void registerFSCommandCallback(fscommand_callback handler)
{
s_fscommand_handler = handler;
}
Index: libbase/rc.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/rc.cpp,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -b -r1.64 -r1.65
--- libbase/rc.cpp 5 Mar 2008 09:16:22 -0000 1.64
+++ libbase/rc.cpp 10 Mar 2008 08:19:40 -0000 1.65
@@ -97,7 +97,8 @@
_solreadonly(false),
_sollocaldomain(false),
_lcdisabled(false),
- _lctrace(true)
+ _lctrace(true),
+ _ignoreFSCommand(true)
{
@@ -485,6 +486,8 @@
||
extractDouble(_streamsTimeout, "StreamsTimeout", variable,
value)
||
+ extractSetting(_ignoreFSCommand, "ignoreFsCommand", variable,
value)
+ ||
cerr << _("Warning: unrecognized directive \"") << variable
<< _("\" in rcfile.") << endl;
}
@@ -576,6 +579,7 @@
cmd << "localConnection " << _lcdisabled << endl <<
cmd << "LCTrace " << _lctrace << endl <<
cmd << "LCShmkey " << std::hex << (boost::uint32_t) _lcshmkey << endl <<
+ cmd << "ignoreFSCommand " << _ignoreFSCommand << endl <<
// Strings.
Index: libbase/rc.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/rc.h,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- libbase/rc.h 5 Mar 2008 09:16:22 -0000 1.47
+++ libbase/rc.h 10 Mar 2008 08:19:40 -0000 1.48
@@ -225,6 +225,9 @@
key_t getLCShmKey() const { return static_cast<key_t>(_lcshmkey); }
void setLCShmKey(bool x) { _lcshmkey = x; }
+ bool ignoreFSCommand() const { return _ignoreFSCommand; }
+ void ignoreFSCommand(bool value) { _ignoreFSCommand = value; }
+
void dump();
private:
@@ -346,6 +349,10 @@
/// compatibility with other players.)
boost::uint32_t _lcshmkey;
+ /// Whether the player should respond to fscommands
+ /// (showmenu, quit etc)
+ bool _ignoreFSCommand;
+
// A function only for writing path lists to an outstream.
void writeList(const PathList& list, std::ostream& o);
Index: gui/Player.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/Player.cpp,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -b -r1.83 -r1.84
--- gui/Player.cpp 9 Mar 2008 15:09:15 -0000 1.83
+++ gui/Player.cpp 10 Mar 2008 08:19:40 -0000 1.84
@@ -109,9 +109,9 @@
set_use_cache_files(false);
- gnash::register_fscommand_callback(fs_callback);
+ gnash::registerFSCommandCallback(fs_callback);
- gnash::as_object::registerEventCallback(interfaceEventCallback);
+ gnash::movie_root::registerEventCallback(&interfaceEventCallback);
}
@@ -391,27 +391,56 @@
}
/*static private*/
-void
-Player::fs_callback(gnash::sprite_instance* movie, const char* command, const
char* args)
// For handling notification callbacks from ActionScript.
+void
+Player::fs_callback(gnash::sprite_instance* movie, const std::string& command,
+ const
std::string& args)
{
log_debug(_("fs_callback(%p): %s %s"), (void*)movie, command, args);
+
+ gnash::RcInitFile& rcfile = gnash::RcInitFile::getDefaultInstance();
+
+ /// Fscommands can be ignored using an rcfile setting. As a
+ /// plugin they are always ignored.
+ if (_gui->isPlugin())
+ {
+ log_debug(_("Running as plugin: ignoring fscommand %s."),
command);
+ return;
+ }
+
+ if (rcfile.ignoreFSCommand()) return;
+
+ if (command == "quit")
+ {
+ _gui->quit();
+ }
+
+ if (command == "fullscreen")
+ {
+ if (args == "true") _gui->setFullscreen();
+ else if (args == "false") _gui->unsetFullscreen();
+ return;
+ }
+
}
-void
+bool
Player::interfaceEventCallback(const std::string& event, const std::string&
arg)
{
if (event == "Mouse.hide")
{
_gui->showMouse(false);
- return;
+ return true;
}
+
if (event == "Mouse.show")
{
_gui->showMouse(true);
- return;
+ return true;
}
+
log_error(_("Unhandled callback %s with arguments %s"), event, arg);
+ return false;
}
/* private */
Index: gui/Player.h
===================================================================
RCS file: /sources/gnash/gnash/gui/Player.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- gui/Player.h 9 Mar 2008 15:09:15 -0000 1.23
+++ gui/Player.h 10 Mar 2008 08:19:40 -0000 1.24
@@ -158,9 +158,9 @@
void setFlashVars(const std::string& varstr);
static void fs_callback(sprite_instance* movie,
- const char* command, const char* args);
+ const std::string& command, const std::string& args);
- static void interfaceEventCallback(const std::string& event,
+ static bool interfaceEventCallback(const std::string& event,
const std::string& arg);
// Movie parameters (for -P)
Index: gui/gui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -b -r1.135 -r1.136
--- gui/gui.cpp 9 Mar 2008 15:09:15 -0000 1.135
+++ gui/gui.cpp 10 Mar 2008 08:19:40 -0000 1.136
@@ -172,7 +172,7 @@
}
void
-Gui::showMouse(bool show)
+Gui::showMouse(bool /* show */)
{
static bool warned = false;
if (!warned)
Index: gui/gui.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.h,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -b -r1.76 -r1.77
--- gui/gui.h 9 Mar 2008 15:09:15 -0000 1.76
+++ gui/gui.h 10 Mar 2008 08:19:40 -0000 1.77
@@ -265,6 +265,9 @@
/// See stop(), play() and pause()
bool isStopped() const { return _stopped; }
+ /// Whether gnash is is running as a plugin
+ bool isPlugin() const { return (( _xid )); }
+
/** @name Menu callbacks
* These callbacks will be called when a menu item is clicked.
* @{
Index: utilities/processor.cpp
===================================================================
RCS file: /sources/gnash/gnash/utilities/processor.cpp,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -b -r1.87 -r1.88
--- utilities/processor.cpp 5 Mar 2008 11:54:33 -0000 1.87
+++ utilities/processor.cpp 10 Mar 2008 08:19:41 -0000 1.88
@@ -127,11 +127,11 @@
//
static int quitrequested = false;
-void execFsCommand(sprite_instance* movie, const char* command, const char*
args)
+void execFsCommand(sprite_instance* movie, const std::string& command, const
std::string& args)
{
log_debug(_("fs_callback(%p): %s %s"), (void*)movie, command, args);
- if ( ! strcasecmp(command, "quit") ) quitrequested=true;
+ if ( command == "quit" ) quitrequested = true;
}
int
@@ -264,7 +264,7 @@
exit(1);
}
- register_fscommand_callback(execFsCommand);
+ registerFSCommandCallback(execFsCommand);
// Play through all the movies.
for (int i = 0, n = infiles.size(); i < n; i++) {