From: Ben Hutchings Date: Tue, 15 Aug 2006 00:35:02 +0000 (+0000) Subject: Updated for Mozilla 1.8 and XULRunner. X-Git-Tag: 0.9~5 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=194f5f8a53d16a8a07c61df2311a13b3cd3994bf;p=videolink.git Updated for Mozilla 1.8 and XULRunner. --- diff --git a/ChangeLog b/ChangeLog index db24331..cfa9ab1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ videolink (0.9) unstable; urgency=low - Made documentation installation independent of Debian package - Removed bogus distclean target - Enabled more warnings + * Updated to work with Mozilla 1.8 and with XULRunner -- diff --git a/INSTALL b/INSTALL index 61da855..30d94c5 100644 --- a/INSTALL +++ b/INSTALL @@ -4,10 +4,11 @@ Building VideoLink VideoLink is written in C++ and requires a recent C++ compiler e.g. g++ 3.3. -It requires headers and libraries for Boost, gtkmm, Mozilla and expat. -I have developed and tested it with Boost 1.32, gtkmm 2.2.12, Mozilla -1.7.8 and expat 1.95.8 but it may well work with earlier or later -versions of these. +It requires headers and libraries for Boost, gtkmm, Mozilla or +XULRunner, and expat. I have developed and tested it with Boost 1.32, +gtkmm 2.2.12, Mozilla 1.7.8 and expat 1.95.8 but it may well work with +earlier or later versions of these. I have also tested with Mozilla +1.7.12 and XULRunner 1.8.0.5. I use Debian Linux and have not yet attempted to build it on other systems, but it should work on most modern Unix-like systems. diff --git a/Makefile b/Makefile index 069a59f..81566a7 100644 --- a/Makefile +++ b/Makefile @@ -5,10 +5,16 @@ sharedir := $(prefix)/share docdir := $(sharedir)/doc mandir := $(sharedir)/man -moz_include_dir := \ - $(shell pkg-config --variable=prefix mozilla-gtkmozembed)/include/mozilla -moz_lib_dir := \ - $(shell pkg-config --variable=prefix mozilla-gtkmozembed)/lib/mozilla +# Prefer XULRunner to the old Mozilla +ifeq ($(shell pkg-config --exists xulrunner-gtkmozembed && echo yes),yes) + mozilla := xulrunner +else + mozilla := mozilla +endif + +moz_prefix := $(shell pkg-config --variable=prefix $(mozilla)-gtkmozembed) +moz_include_dir := $(moz_prefix)/include/$(mozilla) +moz_lib_dir := $(moz_prefix)/lib/$(mozilla) moz_version := \ $(shell sed 's/\#define MOZILLA_VERSION "\(.*\)"/\1/; t; d' \ @@ -20,7 +26,8 @@ moz_version_patchlevel := $(word 3,$(subst ., ,$(moz_version))) CFLAGS := -ansi -Wall -Wunused -Wno-unused-parameter CPPFLAGS := -D_REENTRANT CXXFLAGS := -ansi -Wall -Wunused -LDFLAGS := -lpthread $(shell pkg-config --libs gtkmm-2.0 mozilla-gtkmozembed) \ +LDFLAGS := -lpthread \ + $(shell pkg-config --libs gtkmm-2.0 $(mozilla)-gtkmozembed) \ -Wl,-rpath -Wl,$(moz_lib_dir) -lexpat ifdef NDEBUG @@ -63,19 +70,16 @@ install : .objs/browser_widget.% : CPPFLAGS += -DMOZ_LIB_DIR='"$(moz_lib_dir)"' .objs/videolink.% \ - : CPPFLAGS += -DVIDEOLINK_SHARE_DIR='"$(sharedir)/videolink"' \ - -DMOZ_VERSION_MAJOR=$(moz_version_major) \ - -DMOZ_VERSION_MINOR=$(moz_version_minor) \ - -DMOZ_VERSION_PATCHLEVEL=$(moz_version_patchlevel) + : CPPFLAGS += -DVIDEOLINK_SHARE_DIR='"$(sharedir)/videolink"' .objs/browser_widget.% .objs/generate_dvd.% .objs/pixbufs.% \ .objs/temp_file.% .objs/vob_list.% .objs/videolink.% \ : CPPFLAGS += $(shell pkg-config --cflags gtkmm-2.0) -.objs/browser_widget.% .objs/child_iterator.% .objs/link_iterator.% \ -.objs/null_prompt_service.% .objs/style_sheets.% .objs/videolink.% \ -.objs/xpcom_support.% \ - : CPPFLAGS += $(shell pkg-config --cflags mozilla-gtkmozembed) +.objs/browser_widget.% .objs/child_iterator.% .objs/link_iterator.% \ +.objs/null_prompt_service.% .objs/style_sheets.% .objs/videolink.% \ +.objs/xpcom_support.% \ + : CPPFLAGS += $(shell pkg-config --cflags $(mozilla)-gtkmozembed) # Non-virtual destructors are fine in XPCOM interface classes since # instances are only ever called by the Release function which is virtual. .objs/browser_widget.% .objs/child_iterator.% .objs/link_iterator.% \ @@ -84,11 +88,15 @@ install : : CXXFLAGS += -Wno-non-virtual-dtor # These dig a bit deeper into Mozilla -.objs/link_iterator.% .objs/style_sheets.% .objs/videolink.% \ - : CPPFLAGS += $(addprefix -I$(moz_include_dir)/, \ - content docshell dom gfx layout necko webshell widget) - -.objs/null_prompt_service.% : CPPFLAGS += -I$(moz_include_dir)/uconv +.objs/link_iterator.% .objs/null_prompt_service.% .objs/style_sheets.% \ +.objs/videolink.% \ + : CPPFLAGS += $(addprefix -I$(moz_include_dir)/, \ + content docshell dom gfx layout locale necko uconv \ + webshell widget) \ + -DMOZILLA_INTERNAL_API \ + -DMOZ_VERSION_MAJOR=$(moz_version_major) \ + -DMOZ_VERSION_MINOR=$(moz_version_minor) \ + -DMOZ_VERSION_PATCHLEVEL=$(moz_version_patchlevel) .objs/%.d : %.cpp .objs/.created $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MM -MF $@ $< diff --git a/README b/README index dfa4ff5..a752c96 100644 --- a/README +++ b/README @@ -19,7 +19,7 @@ VideoLink depends on the following software: - expat 1.x - Gtkmm 2.0 - ffmpeg or mjpegtools -- Mozilla 1.7.x (later versions may work but are untested) +- Mozilla 1.7.8 or later, or XULRunner - netpbm - Xvfb (from XFree86 or X.org) diff --git a/debian/control b/debian/control index 2de560b..fc313c3 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: videolink Maintainer: Ben Hutchings Section: graphics Priority: extra -Build-Depends: debhelper (>=4), libboost-dev, libgtkmm2.0-dev, mozilla-dev, libexpat1-dev +Build-Depends: debhelper (>=4), libboost-dev, libgtkmm2.0-dev, libxul-dev | mozilla-dev, libexpat1-dev Standards-Version: 3.6.2 Package: videolink diff --git a/debian/rules b/debian/rules index f5a20be..2bc03aa 100755 --- a/debian/rules +++ b/debian/rules @@ -10,9 +10,13 @@ binary-arch : build make DESTDIR=debian/videolink prefix=/usr install dh_strip dh_shlibdeps - @echo "Despite the warnings from dh_shlibdeps, this should complete dependencies:" - MOZ_VERSION=$$(dpkg-query -W --showformat='$${version}' mozilla-browser | sed 's/+b[0-9]*$$//') \ - && echo "mozilla:Depends=mozilla-browser (>= $$MOZ_VERSION), mozilla-browser (<= $${MOZ_VERSION}+b99)" >> debian/videolink.substvars + if pkg-config --exists xulrunner-gtkmozembed; then \ + MOZ_VERSION=$$(dpkg-query -W --showformat='$${version}' xulrunner | sed 's/+b[0-9]*$$//') \ + && echo "mozilla:Depends=xulrunner (>= $$MOZ_VERSION), xulrunner (<< $${MOZ_VERSION}a)" >> debian/videolink.substvars ; \ + else \ + MOZ_VERSION=$$(dpkg-query -W --showformat='$${version}' mozilla-browser | sed 's/+b[0-9]*$$//') \ + && echo "mozilla:Depends=mozilla-browser (>= $$MOZ_VERSION), mozilla-browser (<< $${MOZ_VERSION}+b99)" >> debian/videolink.substvars ; \ + fi mkdir -p -m755 debian/videolink/usr/share/doc/videolink install -m644 debian/copyright debian/videolink/usr/share/doc/videolink/copyright mv debian/videolink/usr/share/doc/videolink/ChangeLog.gz \ diff --git a/null_prompt_service.cpp b/null_prompt_service.cpp index 901c588..28156d5 100644 --- a/null_prompt_service.cpp +++ b/null_prompt_service.cpp @@ -10,7 +10,12 @@ #include #include #include -#include +#if MOZ_VERSION_MAJOR > 1 || (MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR >= 8) +# include +# include +#else +# include +#endif #include #include "null_prompt_service.hpp" @@ -193,10 +198,21 @@ void null_prompt_service::install() {0xb4, 0x6a, 0x25, 0xc0, 0xb3, 0x8, 0xcb, 0xd0} }; nsCOMPtr prompt_factory(new null_prompt_service_factory); - check(nsComponentManager::RegisterFactory( - prompt_service_cid, - "Prompt Service", - "@mozilla.org/embedcomp/prompt-service;1", - prompt_factory, - PR_TRUE)); // replace existing +# if MOZ_VERSION_MAJOR > 1 \ + || (MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR >= 8) + nsCOMPtr comp_registrar; + check(NS_GetComponentRegistrar(getter_AddRefs(comp_registrar))); + check(comp_registrar->RegisterFactory( + prompt_service_cid, + "Prompt Service", + "@mozilla.org/embedcomp/prompt-service;1", + prompt_factory)); +# else + check(nsComponentManager::RegisterFactory( + prompt_service_cid, + "Prompt Service", + "@mozilla.org/embedcomp/prompt-service;1", + prompt_factory, + PR_TRUE)); // replace existing +# endif } diff --git a/style_sheets.cpp b/style_sheets.cpp index 568c8e8..4b00ce4 100644 --- a/style_sheets.cpp +++ b/style_sheets.cpp @@ -7,7 +7,11 @@ #include #include #include -#include +#if MOZ_VERSION_MAJOR > 1 || (MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR >= 8) +# include +#else +# include +#endif #include #include @@ -41,10 +45,18 @@ void apply_style_sheet(nsIStyleSheet * style_sheet, nsIPresShell * pres_shell) check(style_sheets.InsertObjectAt(style_sheet, 0)); check(pres_shell->SetAgentStyleSheets(style_sheets)); - check(pres_shell->EnablePrefStyleRules(false)); + // FIXME: We need to find an alternative that works in Mozilla 1.8. +# if MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR < 8 + check(pres_shell->EnablePrefStyleRules(false)); +# endif // Update the display - check(pres_shell->ReconstructStyleData()); - check(pres_shell->FlushPendingNotifications(true)); +# if MOZ_VERSION_MAJOR > 1 \ + || (MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR >= 8) + pres_shell->ReconstructStyleData(); + check(pres_shell->FlushPendingNotifications(Flush_Display)); +# else + check(pres_shell->ReconstructStyleData()); + check(pres_shell->FlushPendingNotifications(true)); +# endif } - diff --git a/videolink.cpp b/videolink.cpp index 030aece..f26bd5d 100644 --- a/videolink.cpp +++ b/videolink.cpp @@ -43,10 +43,19 @@ #include // required before nsILink.h #include #include +#if MOZ_VERSION_MAJOR > 1 || (MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR >= 8) +# include +#else +# include + typedef nsIPresContext nsPresContext; // ugh +#endif #include -#include #include -#include +#if MOZ_VERSION_MAJOR > 1 || (MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR >= 8) +# include +#else +# include +#endif #include #include @@ -178,7 +187,7 @@ namespace bool process_page(); void save_screenshot(); void process_links(nsIPresShell * pres_shell, - nsIPresContext * pres_context, + nsPresContext * pres_context, nsIDOMWindow * dom_window); video::frame_params frame_params_; @@ -422,7 +431,7 @@ namespace assert(doc_shell); nsCOMPtr pres_shell; check(doc_shell->GetPresShell(getter_AddRefs(pres_shell))); - nsCOMPtr pres_context; + nsCOMPtr pres_context; check(doc_shell->GetPresContext(getter_AddRefs(pres_context))); nsCOMPtr dom_window; check(browser->GetContentDOMWindow(getter_AddRefs(dom_window))); @@ -526,7 +535,7 @@ namespace }; void videolink_window::process_links(nsIPresShell * pres_shell, - nsIPresContext * pres_context, + nsPresContext * pres_context, nsIDOMWindow * dom_window) { Glib::RefPtr window(get_window()); @@ -703,7 +712,12 @@ namespace check(event_state_man->SetContentState(content, NS_EVENT_STATE_HOVER)); - pres_shell->FlushPendingNotifications(true); +# if MOZ_VERSION_MAJOR > 1 \ + || (MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR >= 8) + pres_shell->FlushPendingNotifications(Flush_Display); +# else + pres_shell->FlushPendingNotifications(true); +# endif // We may have to exit and wait for image loading // to complete, at which point we will be called