[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r12293: add improved Haiku support.
From: |
Rob Savoye |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r12293: add improved Haiku support. |
Date: |
Sat, 10 Jul 2010 12:18:22 -0600 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 12293 [merge]
author: Adrian Panasiuk <address@hidden>
committer: Rob Savoye <address@hidden>
branch nick: trunk
timestamp: Sat 2010-07-10 12:18:22 -0600
message:
add improved Haiku support.
modified:
.bzrignore
Makefile.am
configure.ac
gui/am-frag/haiku.am
gui/haiku.cpp
gui/haiku_agg_glue.cpp
gui/haikusup.h
libbase/Makefile.am
libbase/rc.cpp
libbase/utility.h
libcore/Makefile.am
plugin/npapi/Makefile.am
plugin/npapi/mozilla-sdk/include/npapi.h
plugin/npapi/mozilla-sdk/include/npfunctions.h
plugin/npapi/mozilla-sdk/np_entry.cpp
plugin/npapi/plugin.cpp
=== modified file '.bzrignore'
--- a/.bzrignore 2010-06-10 12:35:45 +0000
+++ b/.bzrignore 2010-07-06 09:50:41 +0000
@@ -5,6 +5,8 @@
.libs
*.lo
*.la
+bzrversion.h
+gnash.pc
*site.bak
aclocal.m4
autom4te.cache
@@ -32,6 +34,8 @@
utilities/gprocessor
utilities/soldumper
testsuite/gnashrc
+testsuite/libbase.all/gnashrc
+testsuite/libbase.all/gnashrc-local
macros/lt*.m4
macros/libtool.m4
macros/argz.m4
=== modified file 'Makefile.am'
--- a/Makefile.am 2010-04-04 22:55:35 +0000
+++ b/Makefile.am 2010-07-06 10:21:25 +0000
@@ -258,7 +258,7 @@
@echo " XFT_CFLAGS is $(XFT_CFLAGS)"
@echo " XFT_LIBS is $(XFT_LIBS)"
endif
-if BUILD_HAIKU_GUI
+if HAIKU
@echo " HAIKU_LIBS is $(HAIKU_LIBS)"
endif
if BUILD_GTK_GUI
=== modified file 'configure.ac'
--- a/configure.ac 2010-07-03 10:06:04 +0000
+++ b/configure.ac 2010-07-09 23:45:26 +0000
@@ -185,6 +185,7 @@
AM_CONDITIONAL(PLUGIN_LINK_UNDEFINED, test x$openbsd_os = xopenbsd)
AM_CONDITIONAL(WIN32, test x$windows = xyes)
+AM_CONDITIONAL(HAIKU, test x$haiku = xyes)
dnl Get build date for helping us debugging
BUILDDATE="`date +%Y%m%d`"
@@ -827,13 +828,13 @@
pixelformat=all
AC_ARG_WITH(pixelformat,
AC_HELP_STRING([--with-pixelformat=], [Use the specified pixel format for
AGG (default=all)]),
- if test -n ${withval}; then
+ [if test -n ${withval}; then
pixelformat="${withval}"
withval=`echo ${withval} | tr '\054' ' ' `
fi
while test -n "${withval}" ; do
val=`echo ${withval} | cut -d ' ' -f 1`
- [case "${val}" in
+ case "${val}" in
all)
# allow special value "all" set by user (handled below)
;;
@@ -863,12 +864,16 @@
;;
*) AC_MSG_ERROR([invalid pixel format ${withval} given (accept:
all|RGB555|RGB565|RGB24|BGR24|BGRA32|RGBA32|ARGB32|ABGR32)])
;;
- esac]
+ esac
withval=`echo ${withval} | cut -d ' ' -f 2-6`
if test "x$val" = "x$withval"; then
break;
fi
- done
+ done],
+ [if test x$build_haiku = xyes -a x$build_sdl != xyes; then
+ AC_DEFINE(PIXELFORMAT_BGRA32, [1], [BGRA32])
+ pixelformat=BGRA32
+ fi]
)
if test x$pixelformat = xall; then
=== modified file 'gui/am-frag/haiku.am'
--- a/gui/am-frag/haiku.am 2010-02-23 16:26:50 +0000
+++ b/gui/am-frag/haiku.am 2010-07-06 11:00:34 +0000
@@ -32,7 +32,7 @@
if BUILD_AGG_RENDERER
haiku_gnash_CPPFLAGS += $(AGG_CFLAGS)
# -lbe must be after -lagg
-haiku_gnash_LDADD += $(top_builddir)/backend/libgnashagg.la \
+haiku_gnash_LDADD += $(top_builddir)/librender/libgnashrender.la \
$(AGG_LIBS) $(HAIKU_LIBS)
haiku_gnash_SOURCES += haiku_agg_glue.cpp haiku_agg_glue.h
endif # BUILD_AGG_RENDERER
=== modified file 'gui/haiku.cpp'
--- a/gui/haiku.cpp 2010-07-10 08:30:45 +0000
+++ b/gui/haiku.cpp 2010-07-10 18:18:22 +0000
@@ -23,6 +23,8 @@
#include "RunResources.h"
+#include <boost/format.hpp>
+
#include "gnash.h"
#include "adipe.h"
#include "haikusup.h"
@@ -33,7 +35,6 @@
#include <Alert.h>
#include <Window.h>
#include <Screen.h>
-#include <MessageRunner.h>
using namespace std;
@@ -45,6 +46,8 @@
{
const int32 GNASH_PULSE = 'GPLS';
+const int32 GNASH_SEND_PULSE = 'GSPL';
+const int32 GNASH_QUITTING = 'GQUI';
class BeWin : public BWindow
@@ -119,6 +122,7 @@
{
HaikuGui *_gui;
BWindow *_win;
+ thread_id _pulse_tid;
time_t _start_t;
time_t _timeout;
int32 _mouse_moves_this_pulse;
@@ -126,10 +130,72 @@
public:
BeApp(HaikuGui *gui)
: BApplication("application/gnash-player"),
- _gui(gui), _win(NULL), _start_t(time(NULL)),
- _timeout(0), _mouse_moves_this_pulse(0),
+ _gui(gui), _win(NULL),
+ _pulse_tid(-1),
+ _start_t(time(NULL)),
+ _timeout(0),
+ _mouse_moves_this_pulse(0),
_mousemovedx(0), _mousemovedy(0)
{
+ _pulse_tid = spawn_thread(SendPulses, "Pulses", B_NORMAL_PRIORITY,
this);
+ if (_pulse_tid <= 0) {
+ throw runtime_error(_("spawn_thread failed"));
+ }
+ if (B_OK != resume_thread(_pulse_tid)) {
+ throw runtime_error(_("resume_thread failed"));
+ }
+
+ }
+
+ static int32
+ SendPulses(void *data)
+ {
+ BeApp *that =
+ static_cast<BeApp*>(data);
+ assert(that != NULL);
+ int32 i = that->SendPulsesEtc();
+ if (i != 0) {
+ boost::format fmt(_("pulses thread returned %d"));
+ fmt = fmt % i;
+ log_error(fmt.str());
+ }
+ return i;
+ }
+
+
+ int32
+ SendPulsesEtc()
+ {
+ BMessage m(GNASH_PULSE);
+ int32 code;
+ thread_id sender;
+
+ while (true)
+ {
+ if (B_OK != be_app_messenger.SendMessage(&m))
+ return -1;
+
+ unsigned int interval =
+ _gui->getInterval();
+ if (interval == 0)
+ interval = 15;
+ // interval in miliseconds, 1000 * interval in microseconds
+ usleep(1000 * interval);
+
+ do {
+ code = receive_data(&sender, NULL, 0);
+ } while (code == B_INTERRUPTED);
+ switch (code)
+ {
+ case GNASH_SEND_PULSE:
+ break;
+ case GNASH_QUITTING:
+ return 0;
+ default:
+ return -1;
+ };
+ }
+ return 0;
}
void setTimeout(time_t timeout)
@@ -139,6 +205,12 @@
virtual ~BeApp()
{
+ status_t st, exit_value;
+ do {
+ st = send_data(_pulse_tid, GNASH_QUITTING, NULL, 0);
+ } while (st == B_INTERRUPTED);
+ if (st == B_OK)
+ wait_for_thread(_pulse_tid, &exit_value);
}
bool QuitRequested()
@@ -173,6 +245,10 @@
_gui->notifyMouseMove(_mousemovedx, _mousemovedy);
_mouse_moves_this_pulse = 0;
_gui->GnashPulse();
+ if (B_OK != send_data(_pulse_tid, GNASH_SEND_PULSE, NULL, 0)) {
+ log_error(_("send_data failed"));
+ Quit();
+ }
break;
case GNASH_RESIZE:
{
@@ -272,7 +348,8 @@
HaikuGui::HaikuGui(unsigned long xid, float scale, bool loop, RunResources& r)
- : Gui(xid, scale, loop, r), _app(NULL), _rnr(NULL), _glue(this, xid),
_timeout(0)
+ : Gui(xid, scale, loop, r), _app(NULL),
+ _glue(this, xid), _timeout(0)
{
QQ(8);
}
@@ -280,7 +357,7 @@
HaikuGui::~HaikuGui()
{
GNASH_REPORT_FUNCTION;
- delete _rnr;
+
delete _app;
}
@@ -315,9 +392,6 @@
opterr = origopterr;
- BMessage m(GNASH_PULSE);
- be_app_messenger.SendMessage(&m);
-
_glue.init(argc, argv, _app->GetWinAddr(), _sharefilename);
_renderer.reset(_glue.createRenderHandler(32));
@@ -486,15 +560,14 @@
return ;
}
- delete _rnr;
- BMessage m(GNASH_PULSE);
- _rnr = new BMessageRunner(BMessenger(NULL, _app), &m, 20000, 1);
- if (_rnr->InitCheck() != B_OK)
- abort();
-
Gui::advance_movie(this);
}
+unsigned int
+HaikuGui::getInterval()
+{
+ return _interval;
+}
void
HaikuGui::resize_view(int width, int height)
=== modified file 'gui/haiku_agg_glue.cpp'
--- a/gui/haiku_agg_glue.cpp 2010-02-16 20:28:47 +0000
+++ b/gui/haiku_agg_glue.cpp 2010-07-06 11:12:20 +0000
@@ -22,6 +22,7 @@
#include "log.h"
#include "Renderer.h"
#include "Renderer_agg.h"
+#include "GnashException.h"
#include "gui.h"
#include <cerrno>
#include <ostream>
@@ -392,6 +393,8 @@
if (_xid != 0)
{
+ if (ftruncate(_sharefd, _bufsize) != 0)
+ perror("ftruncate");
_sharebuf =
static_cast<unsigned char*>(
mmap(
=== modified file 'gui/haikusup.h'
--- a/gui/haikusup.h 2010-03-11 01:47:08 +0000
+++ b/gui/haikusup.h 2010-07-06 11:17:41 +0000
@@ -34,7 +34,7 @@
#include <string>
-class BMessageRunner;
+#include "OS.h"
namespace gnash
@@ -46,7 +46,6 @@
class HaikuGui : public Gui
{
BeApp *_app;
- BMessageRunner *_rnr;
#ifdef RENDERER_AGG
HaikuAggGlue _glue;
#endif
@@ -75,6 +74,7 @@
virtual bool yesno(const std::string &question);
void GnashPulse();
+ unsigned int getInterval();
virtual void resize_view(int width, int height);
void Shown();
void Hidden();
=== modified file 'libbase/Makefile.am'
--- a/libbase/Makefile.am 2010-04-04 22:55:35 +0000
+++ b/libbase/Makefile.am 2010-07-06 10:21:25 +0000
@@ -92,12 +92,13 @@
if ANDROID
libgnashbase_la_SOURCES += SharedMemHaiku.cpp
-endif
-if BUILD_HAIKU_GUI
+else
+if HAIKU
libgnashbase_la_SOURCES += SharedMemHaiku.cpp
else
libgnashbase_la_SOURCES += SharedMem.cpp
endif
+endif
edit = sed \
-e 's|@address@hidden|$(DEFAULT_FLASH_PLATFORM_ID)|g' \
@@ -133,7 +134,7 @@
endif
-if BUILD_HAIKU_GUI
+if HAIKU
libgnashbase_la_LIBADD += $(HAIKU_LIBS)
endif
=== modified file 'libbase/rc.cpp'
--- a/libbase/rc.cpp 2010-03-14 02:26:46 +0000
+++ b/libbase/rc.cpp 2010-07-06 10:59:44 +0000
@@ -158,8 +158,8 @@
// Check the users home directory
const char *home = 0;
+#if defined (__amigaos4__)
//on AmigaOS we have a GNASH: assign that point to program dir
-#if defined (__amigaos4__)
home = "/gnash";
#elif defined(HAIKU_HOST)
BPath bp;
@@ -684,7 +684,6 @@
home = bp.Path();
}
#else
- //on AmigaOS we have a GNASH: assign that point to program dir
home = std::getenv("HOME");
#endif
if (home) {
=== modified file 'libbase/utility.h'
--- a/libbase/utility.h 2010-02-17 02:31:29 +0000
+++ b/libbase/utility.h 2010-07-06 11:03:58 +0000
@@ -63,38 +63,23 @@
#if defined(__HAIKU__)
namespace std {
- class wstring : public std::basic_string<wchar_t>
+ class wstring : public std::basic_string<char>
{
public:
wstring(const char *t)
- : std::basic_string<wchar_t>(_ble(t))
+ : std::basic_string<char>(t)
{
- delete [] X;
}
wstring()
{
}
wstring(const wstring &that)
- : std::basic_string<wchar_t>(that)
- {
- }
- wstring(const std::basic_string<wchar_t> &that)
- : std::basic_string<wchar_t>(that)
- {
- }
- private:
- wchar_t *X;
-
- wchar_t* _ble(const char *t)
- {
- size_t l = strlen(t);
- wchar_t *cp = new wchar_t[l+1];
- for (size_t i = 0; i < l; ++i) {
- cp[i] = t[i];
- }
- cp[l] = '\0';
- X = cp;
- return X;
+ : std::basic_string<char>(that.c_str())
+ {
+ }
+ wstring(const std::basic_string<char> &that)
+ : std::basic_string<char>(that)
+ {
}
};
};
=== modified file 'libcore/Makefile.am'
--- a/libcore/Makefile.am 2010-06-12 06:44:22 +0000
+++ b/libcore/Makefile.am 2010-07-06 10:21:25 +0000
@@ -345,7 +345,7 @@
# $(top_builddir)/libsound/libgnashsound.la
# endif
-if BUILD_HAIKU_GUI
+if HAIKU
libgnashcore_la_LIBADD += $(HAIKU_LIBS)
endif
=== modified file 'plugin/npapi/Makefile.am'
--- a/plugin/npapi/Makefile.am 2010-06-02 14:18:20 +0000
+++ b/plugin/npapi/Makefile.am 2010-07-06 11:08:40 +0000
@@ -32,7 +32,7 @@
# XP_UNIX This needs to get defined for npapi.h on unix platforms.
# PLUGIN_TRACE Enable this define to get debug prints whenever the plugin
# api gets control.
-AM_CPPFLAGS = -DPLUGIN_TRACE -DXP_UNIX -DMOZ_X11
-DGNASHBINDIR=\"$(GNASHBINDIR)\" \
+AM_CPPFLAGS = -DPLUGIN_TRACE -DGNASHBINDIR=\"$(GNASHBINDIR)\" \
-DSYSCONFDIR=\"$(sysconfdir)\" \
-I$(top_srcdir)/libcore \
-I$(top_srcdir)/libcore/parser \
@@ -43,6 +43,12 @@
$(GLIB_CFLAGS) \
$(NULL)
+if HAIKU
+ AM_CPPFLAGS += -DXP_HAIKU
+else
+ AM_CPPFLAGS += -DXP_UNIX -DMOZ_X11
+endif
+
# AM_CXXFLAGS = $(AM_CPPFLAGS)
noinst_HEADERS = plugin.h \
=== modified file 'plugin/npapi/mozilla-sdk/include/npapi.h'
--- a/plugin/npapi/mozilla-sdk/include/npapi.h 2010-06-02 16:32:55 +0000
+++ b/plugin/npapi/mozilla-sdk/include/npapi.h 2010-07-06 11:08:40 +0000
@@ -50,7 +50,7 @@
#endif
#endif
-#if defined(XP_UNIX)
+#if defined(XP_UNIX) || defined(XP_HAIKU)
# include <stdio.h>
# if defined(MOZ_X11)
# include <X11/Xlib.h>
@@ -185,7 +185,7 @@
int32_t height;
} NPSize;
-#ifdef XP_UNIX
+#if defined(XP_UNIX) || defined(XP_HAIKU)
/*
* Unix specific structures and definitions
*/
@@ -222,7 +222,7 @@
FILE* fp;
} NPPrintCallbackStruct;
-#endif /* XP_UNIX */
+#endif /* defined(XP_UNIX) || defined(XP_HAIKU) */
#ifdef XP_MACOSX
typedef enum {
@@ -259,7 +259,7 @@
* gcc 3.x generated vtables on UNIX and OSX are incompatible with
* previous compilers.
*/
-#if (defined(XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3))
+#if ((defined (XP_UNIX) || defined(XP_HAIKU)) && defined(__GNUC__) &&
(__GNUC__ >= 3))
#define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK
#else
#define _NP_ABI_MIXIN_FOR_GCC3 0
@@ -407,9 +407,9 @@
uint32_t width; /* Maximum window size */
uint32_t height;
NPRect clipRect; /* Clipping rectangle in port coordinates */
-#if defined(XP_UNIX) && !defined(XP_MACOSX)
+#if (defined(XP_UNIX) && !defined(XP_MACOSX)) || defined(XP_HAIKU)
void * ws_info; /* Platform-dependent additional data */
-#endif /* XP_UNIX */
+#endif /* XP_UNIX, XP_HAIKU */
NPWindowType type; /* Is this a window or a drawable? */
} NPWindow;
@@ -693,9 +693,9 @@
/* NPP_* functions are provided by the plugin and called by the navigator. */
-#ifdef XP_UNIX
+#if defined(XP_UNIX) || defined(XP_HAIKU)
char* NPP_GetMIMEDescription();
-#endif
+#endif /* XP_UNIX, XP_HAIKU */
NPError NP_LOADDS NPP_Initialize();
void NP_LOADDS NPP_Shutdown();
=== modified file 'plugin/npapi/mozilla-sdk/include/npfunctions.h'
--- a/plugin/npapi/mozilla-sdk/include/npfunctions.h 2010-06-02 16:32:55
+0000
+++ b/plugin/npapi/mozilla-sdk/include/npfunctions.h 2010-07-06 11:08:40
+0000
@@ -288,7 +288,7 @@
#endif
#endif
-#if defined(XP_UNIX)
+#if defined(XP_UNIX) || defined(XP_HAIKU)
/* GCC 3.3 and later support the visibility attribute. */
#if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__
>= 3))
# define NP_VISIBILITY_DEFAULT __attribute__((visibility("default")))
@@ -331,7 +331,7 @@
# pragma pack()
#endif
-#ifdef XP_UNIX
+#if defined(XP_UNIX) || defined(XP_HAIKU)
# ifdef __cplusplus
extern "C" {
#endif
=== modified file 'plugin/npapi/mozilla-sdk/np_entry.cpp'
--- a/plugin/npapi/mozilla-sdk/np_entry.cpp 2010-06-02 16:32:55 +0000
+++ b/plugin/npapi/mozilla-sdk/np_entry.cpp 2010-07-06 11:08:40 +0000
@@ -211,9 +211,10 @@
/**************************************************/
/* */
/* Unix */
+/* Haiku */
/* */
/**************************************************/
-#ifdef XP_UNIX
+#if defined(XP_UNIX) || defined(XP_HAIKU)
NPError
NP_Initialize(NPNetscapeFuncs* aNPNFuncs, NPPluginFuncs* aNPPFuncs)
@@ -243,7 +244,7 @@
return NS_PluginGetValue(aVariable, aValue);
}
-#endif //XP_UNIX
+#endif //XP_UNIX, XP_HAIKU
/**************************************************/
/* */
=== modified file 'plugin/npapi/plugin.cpp'
--- a/plugin/npapi/plugin.cpp 2010-06-18 16:02:05 +0000
+++ b/plugin/npapi/plugin.cpp 2010-07-06 10:59:44 +0000
@@ -205,14 +205,35 @@
std::string newGnashRc("GNASHRC=");
+#if !defined(__OS2__ ) && ! defined(__amigaos4__)
newGnashRc.append(SYSCONFDIR);
newGnashRc.append("/gnashpluginrc");
+#endif
- char *home = std::getenv("HOME");
+ const char *home = NULL;
+#if defined(__amigaos4__)
+ //on AmigaOS we have a GNASH: assign that point to program dir
+ home = "/gnash";
+#elif defined(__HAIKU__)
+ BPath bp;
+ if (B_OK != find_directory(B_USER_SETTINGS_DIRECTORY, &bp))
+ {
+ std::cerr << "Failed to find user settings directory" << std::endl;
+ } else {
+ bp.Append("Gnash");
+ home = bp.Path();
+ }
+#else
+ home = std::getenv("HOME");
+#endif
if ( home ) {
newGnashRc.append(":");
newGnashRc.append(home);
+#ifdef __HAIKU__
+ newGnashRc.append("/gnashpluginrc");
+#else
newGnashRc.append("/.gnashpluginrc");
+#endif
} else {
gnash::log_error("WARNING: NPAPI plugin could not find user home dir");
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r12293: add improved Haiku support.,
Rob Savoye <=