[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog gui/Player.cpp plugin/plugin.cp...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog gui/Player.cpp plugin/plugin.cp... |
Date: |
Fri, 04 Apr 2008 14:23:45 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 08/04/04 14:23:45
Modified files:
. : ChangeLog
gui : Player.cpp
plugin : plugin.cpp plugin.h
Log message:
* gui/Player.cpp (fs_callback): if an host-fd is given, always
send an INVOKE request for fscommands, no matter how we've
been called (standalone or plugin).
* plugin/plugin.{cpp,h}: remember instance 'name' (as set by
<object> attribute); support INVOKE command in the
gnash-to-host
interface.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6180&r2=1.6181
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Player.cpp?cvsroot=gnash&r1=1.93&r2=1.94
http://cvs.savannah.gnu.org/viewcvs/gnash/plugin/plugin.cpp?cvsroot=gnash&r1=1.102&r2=1.103
http://cvs.savannah.gnu.org/viewcvs/gnash/plugin/plugin.h?cvsroot=gnash&r1=1.38&r2=1.39
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6180
retrieving revision 1.6181
diff -u -b -r1.6180 -r1.6181
--- ChangeLog 4 Apr 2008 13:27:25 -0000 1.6180
+++ ChangeLog 4 Apr 2008 14:23:44 -0000 1.6181
@@ -1,3 +1,12 @@
+2008-04-04 Sandro Santilli <address@hidden>
+
+ * gui/Player.cpp (fs_callback): if an host-fd is given, always
+ send an INVOKE request for fscommands, no matter how we've
+ been called (standalone or plugin).
+ * plugin/plugin.{cpp,h}: remember instance 'name' (as set by
+ <object> attribute); support INVOKE command in the gnash-to-host
+ interface.
+
2008-04-04 Benjamin Wolsey <address@hidden>
* server/asobj/Date.cpp: add timeZoneOffset functions. Now to
Index: gui/Player.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/Player.cpp,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -b -r1.93 -r1.94
--- gui/Player.cpp 4 Apr 2008 07:44:24 -0000 1.93
+++ gui/Player.cpp 4 Apr 2008 14:23:45 -0000 1.94
@@ -408,11 +408,40 @@
gnash::RcInitFile& rcfile = gnash::RcInitFile::getDefaultInstance();
+ int hostfd = VM::get().getRoot().getHostFD(); // it's _hostfd, but
we're a static method...
+ if ( hostfd != -1 )
+ {
+ //log_debug("user-provided host requests fd is %d", hostfd);
+ std::stringstream request;
+ request << "INVOKE " << command << ":" << args;
+
+ string requestString = request.str();
+ const char* cmd = requestString.c_str();
+ size_t len = requestString.length();
+ // TODO: should mutex-protect this ?
+ // NOTE: we assuming the hostfd is set in blocking mode here..
+ //log_debug("Attempt to write INVOKE requests fd %d", hostfd);
+ int ret = write(hostfd, cmd, len);
+ if ( ret == -1 )
+ {
+ log_error("Could not write to user-provided host
requests fd %d: %s", hostfd, strerror(errno));
+ }
+ if ( (size_t)ret < len )
+ {
+ log_error("Could only write %d bytes over "SIZET_FMT"
required to user-provided host requests fd %d",
+ ret, len, hostfd);
+ }
+ log_debug(_("Sent request '%s' to host fd %d"), cmd, hostfd);
+ }
+
/// 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);
+ log_debug(_("Running as plugin: skipping internal handling of
fscommand %s%s."),
+ command,
+ (hostfd != -1) ? _(" (but INVOKE request was still sent
to host application)")
+ : _(" (and no host fd given)"));
return;
}
@@ -468,7 +497,8 @@
return;
}
- log_error(_("Unhandled FSCommand %s (%s)"), command, args);
+ log_debug(_("FSCommand '%s(%s)' not handled by the standalone player
(might have been by the hosting app)"),
+ command, args);
}
Index: plugin/plugin.cpp
===================================================================
RCS file: /sources/gnash/gnash/plugin/plugin.cpp,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -b -r1.102 -r1.103
--- plugin/plugin.cpp 24 Mar 2008 00:40:46 -0000 1.102
+++ plugin/plugin.cpp 4 Apr 2008 14:23:45 -0000 1.103
@@ -60,6 +60,7 @@
#include <string>
#include <vector>
#include <iostream>
+#include <sstream>
// Mozilla SDK headers
#include "prinit.h"
@@ -286,7 +287,8 @@
_ichan(0),
_ichanWatchId(0),
_childpid(0),
- _filefd(-1)
+ _filefd(-1),
+ _name()
{
for (size_t i=0, n=data->argc; i<n; ++i)
{
@@ -301,7 +303,13 @@
{
val = data->argv[i];
}
- //log_debug("PARAM: %s = %s", name.c_str(), val.c_str());
+
+ if ( ! strcasecmp(name.c_str(), "name") )
+ {
+ _name = val;
+ }
+
+ cerr << "PARAM: " << name << " = " << val << endl;
_params[name] = val;
}
}
@@ -622,12 +630,8 @@
return false;
}
- if ( strncmp(buf, "GET ", 4) )
+ if ( ! strncmp(buf, "GET ", 4) )
{
- cout << "Unknown player request: " << buf << endl;
- return false;
- }
-
char* target = buf+4;
if ( ! *target )
{
@@ -643,13 +647,49 @@
}
else
{
- cout << "No colon found after target string" << endl;
+ cout << "No colon found after GETURL target string" <<
endl;
return false;
}
cout << "Asked to get URL '" << url << "' in target '" << target << "'"
<< endl;
NPN_GetURL(_instance, url, target);
return true;
+
+ }
+ else if ( ! strncmp(buf, "INVOKE ", 7) )
+ {
+ char* command = buf+7;
+ if ( ! *command ) {
+ cout << "No command found after INVOKE request" << endl;
+ return false;
+ }
+ char* arg = command;
+ while (*arg && *arg != ':') ++arg;
+ if ( *arg ) {
+ *arg='\0';
+ ++arg;
+ } else {
+ cout << "No colon found after INVOKE command string" <<
endl;
+ return false;
+ }
+
+ std::string name = _name;
+
+ std::stringstream jsurl;
+ jsurl << "javascript:" << name << "_DoFSCommand('" << command
<< "','" << arg <<"')";
+
+ // TODO: check if _self is a good target for this
+ static const char* tgt = "_self";
+
+ cout << "Calling NPN_GetURL(" << jsurl.str() << ", '" << tgt <<
"');" << endl;
+ NPN_GetURL(_instance, jsurl.str().c_str(), tgt);
+ return true;
+ }
+ else
+ {
+ cout << "Unknown player request: '" << buf << "'" << endl;
+ return false;
+ }
}
void
Index: plugin/plugin.h
===================================================================
RCS file: /sources/gnash/gnash/plugin/plugin.h,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- plugin/plugin.h 5 Mar 2008 03:55:57 -0000 1.38
+++ plugin/plugin.h 4 Apr 2008 14:23:45 -0000 1.39
@@ -127,6 +127,9 @@
pid_t _childpid;
int _filefd;
+ /// Name of the plugin instance element in the dom
+ std::string _name;
+
const char* getCurrentPageURL() const;
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog gui/Player.cpp plugin/plugin.cp...,
Sandro Santilli <=