[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog gui/Player.cpp gui/gtk.cpp gui/...
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] gnash ChangeLog gui/Player.cpp gui/gtk.cpp gui/... |
Date: |
Wed, 09 Apr 2008 11:57:35 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Benjamin Wolsey <bwy> 08/04/09 11:57:35
Modified files:
. : ChangeLog
gui : Player.cpp gtk.cpp gtksup.h gui.h
server/asobj : System.cpp
testsuite/actionscript.all: System.as
Log message:
* server/asobj/System.cpp: fetch some information from gui. Put
in
default values for other System.capabilities members.
* gui/gui.h: virtual methods to fetch screen dimensions
and pixel aspect ratio.
* gui/gtk{sup.h,.cpp}: implement getting screen height and
width.
* gui/Player.h: add System.capabilities to callback function.
* testsuite/actionscript.all/System.as: update expected results.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6225&r2=1.6226
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Player.cpp?cvsroot=gnash&r1=1.98&r2=1.99
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk.cpp?cvsroot=gnash&r1=1.162&r2=1.163
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtksup.h?cvsroot=gnash&r1=1.70&r2=1.71
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.h?cvsroot=gnash&r1=1.82&r2=1.83
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/System.cpp?cvsroot=gnash&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/System.as?cvsroot=gnash&r1=1.18&r2=1.19
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6225
retrieving revision 1.6226
diff -u -b -r1.6225 -r1.6226
--- ChangeLog 9 Apr 2008 09:47:05 -0000 1.6225
+++ ChangeLog 9 Apr 2008 11:57:33 -0000 1.6226
@@ -1,3 +1,13 @@
+2008-04-09 Benjamin Wolsey <address@hidden>
+
+ * server/asobj/System.cpp: fetch some information from gui. Put in
+ default values for other System.capabilities members.
+ * gui/gui.h: virtual methods to fetch screen dimensions
+ and pixel aspect ratio.
+ * gui/gtk{sup.h,.cpp}: implement getting screen height and width.
+ * gui/Player.h: add System.capabilities to callback function.
+ * testsuite/actionscript.all/System.as: update expected results.
+
2008-04-09 Sandro Santilli <address@hidden>
* libbase/GC.cpp: don't need to include builtin_function.h.
Index: gui/Player.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/Player.cpp,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -b -r1.98 -r1.99
--- gui/Player.cpp 7 Apr 2008 21:44:55 -0000 1.98
+++ gui/Player.cpp 9 Apr 2008 11:57:34 -0000 1.99
@@ -45,6 +45,7 @@
#include "log.h"
#include <iostream>
+#include <sstream>
using std::endl;
using std::cerr;
@@ -535,6 +536,32 @@
return "";
}
+ if (event == "System.capabilities.screenResolutionX")
+ {
+ std::ostringstream ss;
+ ss << _gui->getScreenResX();
+ return ss.str();
+ }
+
+ if (event == "System.capabilities.screenResolutionY")
+ {
+ std::ostringstream ss;
+ ss << _gui->getScreenResY();
+ return ss.str();
+ }
+
+ if (event == "System.capabilities.pixelAspectRatio")
+ {
+ std::ostringstream ss;
+ ss << _gui->getPixelAspectRatio();
+ return ss.str();
+ }
+
+ if (event == "System.capabilities.playerType")
+ {
+ return _gui->isPlugin() ? "PlugIn" : "StandAlone";
+ }
+
log_error(_("Unhandled callback %s with arguments %s"), event, arg);
return "";
}
Index: gui/gtk.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gtk.cpp,v
retrieving revision 1.162
retrieving revision 1.163
diff -u -b -r1.162 -r1.163
--- gui/gtk.cpp 7 Apr 2008 21:44:56 -0000 1.162
+++ gui/gtk.cpp 9 Apr 2008 11:57:34 -0000 1.163
@@ -412,6 +412,28 @@
#endif
}
+double
+GtkGui::getPixelAspectRatio()
+{
+ return 0;
+}
+
+int
+GtkGui::getScreenResX()
+{
+ GdkScreen *screen = gdk_screen_get_default();
+ if (!screen) return 0;
+ return gdk_screen_get_width(screen);
+}
+
+int
+GtkGui::getScreenResY()
+{
+ GdkScreen *screen = gdk_screen_get_default();
+ if (!screen) return 0;
+ return gdk_screen_get_height(screen);
+}
+
// private
void
GtkGui::setupWindowEvents()
Index: gui/gtksup.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gtksup.h,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -b -r1.70 -r1.71
--- gui/gtksup.h 7 Apr 2008 21:44:56 -0000 1.70
+++ gui/gtksup.h 9 Apr 2008 11:57:34 -0000 1.71
@@ -76,6 +76,11 @@
virtual void setFullscreen();
virtual void unsetFullscreen();
+ /// For System.capabilities information.
+ virtual double getPixelAspectRatio();
+ virtual int getScreenResX();
+ virtual int getScreenResY();
+
/// Add a listener with default priority that listens for IN and HUP
/// events on a file descriptor.
//
Index: gui/gui.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.h,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -b -r1.82 -r1.83
--- gui/gui.h 7 Apr 2008 21:44:56 -0000 1.82
+++ gui/gui.h 9 Apr 2008 11:57:34 -0000 1.83
@@ -158,6 +158,12 @@
/// Sets the current mouse cursor for the Gui window.
virtual void setCursor(gnash_cursor_type newcursor);
+ // Information for System.capabilities to be reimplemented in
+ // each gui.
+ virtual double getPixelAspectRatio() { return 0; }
+ virtual int getScreenResX() { return 0; }
+ virtual int getScreenResY() { return 0; }
+
/// @return The value to which the movie width should be scaled.
float getXScale();
Index: server/asobj/System.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/System.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- server/asobj/System.cpp 30 Jan 2008 10:09:36 -0000 1.23
+++ server/asobj/System.cpp 9 Apr 2008 11:57:35 -0000 1.24
@@ -21,6 +21,9 @@
#include "gnashconfig.h"
#endif
+#include <sstream>
+
+#include "movie_root.h" // interface callback
#include "log.h"
#include "System.h"
#include "fn_call.h"
@@ -68,10 +71,6 @@
// Override in gnashrc
const std::string version = VM::get().getPlayerVersion();
- // Flash 7: "StandAlone", "External", "PlugIn", "ActiveX"
- // TODO: Implement properly
- const std::string playerType = "StandAlone";
-
// "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();
@@ -80,46 +79,95 @@
// Override in gnashrc
const std::string manufacturer = rcfile.getFlashSystemManufacturer();
- /* Human Interface */
- const std::string language = systemLanguage();
-
- /* Media */
+ //
+ // Media
+ //
// Is audio available?
const bool hasAudio = (get_sound_handler() != NULL);
+ const bool avHardwareDisable = false;
+
+ // TODO: these need to be implemented properly
+ const bool hasAudioEncoder = true;
+ const bool hasEmbeddedVideo = true;
+ const bool hasIME = true;
+ const bool hasMP3 = true;
+ const bool hasPrinting = true;
+ const bool hasScreenBroadcast = true;
+ const bool hasScreenPlayback = true;
+ const bool hasStreamingAudio = true;
+ const bool hasStreamingVideo = true;
+ const bool hasVideoEncoder = true;
+
+ //
+ // Human interface
+ //
+
+ const std::string language = systemLanguage();
+
+ // TODO: these need to be implemented properly.
+ const bool hasAccessibility = true;
+ const bool isDebugger = false;
+ const bool localFileReadDisable = false;
+
+ // "StandAlone", "External", "PlugIn", "ActiveX" (get from GUI)
+ std::string playerType;
+
+ // Documented to be a number, but is in fact a string.
+ std::string pixelAspectRatio;
- /* A URL-encoded string to send system info to a server.*/
- /* Boolean values are represented as t or f. */
- /* Privacy concerns should probably be addressed by */
- /* allowing this string to be sent or not; individual */
- /* values that might affect privacy can be overridden */
- /* in gnashrc. */
-
- std::string serverString =
- + "OS=" + URL::encode(os)
- + "&A=" + TF(hasAudio)
- + "&V=" + URL::encode(version)
- + "&PT=" + playerType
- + "&L=" + language
- + "&AVD=" // avHardwareDisable (bool)
- + "&ACC=" // hasAccessibility (bool)
- + "&AE=" // hasAudioEncoder (bool)
- + "&EV=" // hasEmbeddedVideo (bool)
- + "&IME=" // hasIME (bool)
- + "&MP3=" // hasMP3 (bool)
- + "&PR=" // hasPrinting (bool)
- + "&SB=" // hasScreenBroadcast (bool)
- + "&SP=" // hasScreenPlayback (bool)
- + "&SA=" // hasStreamingAudio (bool)
- + "&SV=" // hasStreamingVideo (bool)
- + "&VE=" // hasVideoEncoder (bool)
- + "&DEB=" // isDebugger (bool)
- + "&LFD=" // localFileReadDisable (bool)
- + "&M=" + URL::encode(manufacturer)
- + "&AR=" // pixelAspectRatio (double)
- + "&COL=" // screenColor (?)
- + "&DP=" // screenDPI (int?)
- + "&R=" // + screenResolutionX + "x" + screenResolutionY
+ int screenResolutionX = 0;
+ int screenResolutionY = 0;
+
+ std::istringstream ss;
+
+ if (movie_root::interfaceHandle) {
+
ss.str((*movie_root::interfaceHandle)("System.capabilities.screenResolutionX",
""));
+ ss >> screenResolutionX;
+
+ ss.clear();
+
+
ss.str((*movie_root::interfaceHandle)("System.capabilities.screenResolutionY",
""));
+ ss >> screenResolutionY;
+
+ ss.clear();
+
+ pixelAspectRatio =
(*movie_root::interfaceHandle)("System.capabilities.pixelAspectRatio", "");
+ playerType =
(*movie_root::interfaceHandle)("System.capabilities.playerType", "");
+ }
+
+ // A URL-encoded string to send system info to a server.
+ // Boolean values are represented as t or f.
+ // Privacy concerns should probably be addressed by
+ // allowing this string to be sent or not; individual
+ // values that might affect privacy can be overridden
+ // in gnashrc.
+
+ std::ostringstream serverString;
+ serverString << "OS=" << URL::encode(os)
+ << "&A=" << TF(hasAudio)
+ << "&V=" << URL::encode(version)
+ << "&PT=" << playerType
+ << "&L=" << language
+ << "&AVD=" << avHardwareDisable
+ << "&ACC=" << hasAccessibility
+ << "&AE=" << hasAudioEncoder
+ << "&EV=" << hasEmbeddedVideo
+ << "&IME=" << hasIME
+ << "&MP3=" << hasMP3
+ << "&PR=" << hasPrinting
+ << "&SB=" << hasScreenBroadcast
+ << "&SP=" << hasScreenPlayback
+ << "&SA=" << hasStreamingAudio
+ << "&SV=" << hasStreamingVideo
+ << "&VE=" << hasVideoEncoder
+ << "&DEB=" << isDebugger
+ << "&LFD=" << localFileReadDisable
+ << "&M=" << URL::encode(manufacturer)
+ << "&AR=" << pixelAspectRatio
+ << "&COL=" // screenColor (?)
+ << "&DP=" // screenDPI (int?)
+ << "&R=" << screenResolutionX << "x" <<
screenResolutionY
;
static boost::intrusive_ptr<as_object> proto;
@@ -137,8 +185,24 @@
proto->init_member("manufacturer", manufacturer, flags);
proto->init_member("language", language, flags);
proto->init_member("hasAudio", hasAudio, flags);
- proto->init_member("serverString", serverString, flags);
-
+ proto->init_member("screenResolutionX", screenResolutionX,
flags);
+ proto->init_member("screenResolutionY", screenResolutionY,
flags);
+ proto->init_member("pixelAspectRatio", pixelAspectRatio, flags);
+ proto->init_member("serverString", serverString.str(), flags);
+ proto->init_member("avHardwareDisable", avHardwareDisable,
flags);
+ proto->init_member("hasAudioEncoder", hasAudioEncoder, flags);
+ proto->init_member("hasEmbeddedVideo", hasEmbeddedVideo, flags);
+ proto->init_member("hasIME", hasIME, flags);
+ proto->init_member("hasMP3", hasMP3, flags);
+ proto->init_member("hasPrinting", hasPrinting, flags);
+ proto->init_member("hasScreenBroadcast", hasScreenBroadcast,
flags);
+ proto->init_member("hasScreenPlayback", hasScreenPlayback,
flags);
+ proto->init_member("hasStreamingAudio", hasStreamingAudio,
flags);
+ proto->init_member("hasStreamingVideo", hasStreamingVideo,
flags);
+ proto->init_member("hasVideoEncoder", hasVideoEncoder, flags);
+ proto->init_member("hasAccessibility", hasAccessibility, flags);
+ proto->init_member("isDebugger", isDebugger, flags);
+ proto->init_member("localFileReadDisable",
localFileReadDisable, flags);
}
return proto.get();
}
Index: testsuite/actionscript.all/System.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/System.as,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- testsuite/actionscript.all/System.as 11 Mar 2008 19:31:48 -0000
1.18
+++ testsuite/actionscript.all/System.as 9 Apr 2008 11:57:35 -0000
1.19
@@ -21,7 +21,7 @@
// execute it like this gnash -1 -r 0 -v out.swf
-rcsid="$Id: System.as,v 1.18 2008/03/11 19:31:48 strk Exp $";
+rcsid="$Id: System.as,v 1.19 2008/04/09 11:57:35 bwy Exp $";
#include "check.as"
check_equals(typeof(System), 'object');
@@ -65,26 +65,26 @@
check_equals(typeof(System.capabilities.manufacturer), 'string');
check_equals(typeof(System.capabilities.playerType), 'string');
check_equals(typeof(System.capabilities.serverString), 'string');
-xcheck_equals(typeof(System.capabilities.screenResolutionX), 'number');
-xcheck_equals(typeof(System.capabilities.screenResolutionY), 'number');
+check_equals(typeof(System.capabilities.screenResolutionX), 'number');
+check_equals(typeof(System.capabilities.screenResolutionY), 'number');
xcheck_equals(typeof(System.capabilities.screenDPI), 'number');
xcheck_equals(typeof(System.capabilities.screenColor), 'string');
-xcheck_equals(typeof(System.capabilities.pixelAspectRatio), 'string');
-xcheck_equals(typeof(System.capabilities.localFileReadDisable), 'boolean');
+check_equals(typeof(System.capabilities.pixelAspectRatio), 'string');
+check_equals(typeof(System.capabilities.localFileReadDisable), 'boolean');
check_equals(typeof(System.capabilities.language), 'string');
-xcheck_equals(typeof(System.capabilities.isDebugger), 'boolean');
-xcheck_equals(typeof(System.capabilities.hasVideoEncoder), 'boolean');
-xcheck_equals(typeof(System.capabilities.hasStreamingVideo), 'boolean');
-xcheck_equals(typeof(System.capabilities.hasStreamingAudio), 'boolean');
-xcheck_equals(typeof(System.capabilities.hasScreenPlayback), 'boolean');
-xcheck_equals(typeof(System.capabilities.hasScreenBroadcast), 'boolean');
-xcheck_equals(typeof(System.capabilities.hasPrinting), 'boolean');
-xcheck_equals(typeof(System.capabilities.hasMP3), 'boolean');
-xcheck_equals(typeof(System.capabilities.hasEmbeddedVideo), 'boolean');
-xcheck_equals(typeof(System.capabilities.hasAudioEncoder), 'boolean');
+check_equals(typeof(System.capabilities.isDebugger), 'boolean');
+check_equals(typeof(System.capabilities.hasVideoEncoder), 'boolean');
+check_equals(typeof(System.capabilities.hasStreamingVideo), 'boolean');
+check_equals(typeof(System.capabilities.hasStreamingAudio), 'boolean');
+check_equals(typeof(System.capabilities.hasScreenPlayback), 'boolean');
+check_equals(typeof(System.capabilities.hasScreenBroadcast), 'boolean');
+check_equals(typeof(System.capabilities.hasPrinting), 'boolean');
+check_equals(typeof(System.capabilities.hasMP3), 'boolean');
+check_equals(typeof(System.capabilities.hasEmbeddedVideo), 'boolean');
+check_equals(typeof(System.capabilities.hasAudioEncoder), 'boolean');
check_equals(typeof(System.capabilities.hasAudio), 'boolean');
-xcheck_equals(typeof(System.capabilities.hasAccessibility), 'boolean');
-xcheck_equals(typeof(System.capabilities.avHardwareDisable), 'boolean');
+check_equals(typeof(System.capabilities.hasAccessibility), 'boolean');
+check_equals(typeof(System.capabilities.avHardwareDisable), 'boolean');
#if OUTPUT_VERSION >= 6
check(this.hasOwnProperty("$version"));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog gui/Player.cpp gui/gtk.cpp gui/...,
Benjamin Wolsey <=