]> git.decadent.org.uk Git - videolink.git/commitdiff
Updated for Mozilla 1.8 and XULRunner.
authorBen Hutchings <ben@decadent.org.uk>
Tue, 15 Aug 2006 00:35:02 +0000 (00:35 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 2 Nov 2008 23:57:10 +0000 (23:57 +0000)
ChangeLog
INSTALL
Makefile
README
debian/control
debian/rules
null_prompt_service.cpp
style_sheets.cpp
videolink.cpp

index db243315f25709f3dddca70b594d67069390864b..cfa9ab1f54523a70d1a12486696f49fb2c58c397 100644 (file)
--- 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 61da8553cbba7c4654526c9cb920f1437a1f70a5..30d94c5600f630f0b5a4c5eb76c7114c479ca7b4 100644 (file)
--- 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.
index 069a59fa8a2114f26dd4f12b55bc8220058d4af3..81566a7d843db5cb5e476dd2b3e47044cca68244 100644 (file)
--- 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 dfa4ff5fbbf3a6d8b4264eee90796d36eb85f28c..a752c963c085c8c5628ce6d0ad39091d6fd28fda 100644 (file)
--- 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)
 
index 2de560bc1d064737b03621b1c155ae851960837f..fc313c3ca1a1cc90b9c2d85ccd62c6e304984865 100644 (file)
@@ -2,7 +2,7 @@ Source: videolink
 Maintainer: Ben Hutchings <ben@decadent.org.uk>
 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
index f5a20beafbc7e9f2e1d4b7bb65f5c37ada5b545f..2bc03aa1c8b469ec07a5328d564e2adcc890ef1d 100755 (executable)
@@ -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 \
index 901c5880ce7ebc6affc9a90c65f6a8ab17133cee..28156d58dcc378743888e1df432fe20a5006aec2 100644 (file)
 #include <nsICharsetConverterManager.h>
 #include <nsIComponentManager.h>
 #include <nsIFactory.h>
-#include <nsIServiceManagerUtils.h>
+#if MOZ_VERSION_MAJOR > 1 || (MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR >= 8)
+#   include <nsIComponentRegistrar.h>
+#   include <nsServiceManagerUtils.h>
+#else
+#   include <nsIServiceManagerUtils.h>
+#endif
 #include <nsIUnicodeEncoder.h>
 
 #include "null_prompt_service.hpp"
@@ -193,10 +198,21 @@ void null_prompt_service::install()
        {0xb4, 0x6a, 0x25, 0xc0, 0xb3, 0x8, 0xcb, 0xd0}
     };
     nsCOMPtr<nsIFactory> 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<nsIComponentRegistrar> 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
 }
index 568c8e8228216a7f067d8c9f350d3030336eee55..4b00ce49d7bcb328df50b109e381f82f5b9c2131 100644 (file)
@@ -7,7 +7,11 @@
 #include <nsICSSLoader.h>
 #include <nsICSSStyleSheet.h>
 #include <nsIPresShell.h>
-#include <nsIServiceManagerUtils.h>
+#if MOZ_VERSION_MAJOR > 1 || (MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR >= 8)
+#   include <nsServiceManagerUtils.h>
+#else
+#   include <nsIServiceManagerUtils.h>
+#endif
 #include <nsIURI.h>
 #include <nsNetUtil.h>
 
@@ -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
 }
-
index 030aece0e3bfc447029126c50b06256643e2cac8..f26bd5d2809a7a1dbf7d050a792f6c1d71efb1b4 100644 (file)
 #include <nsIURI.h> // required before nsILink.h
 #include <nsILink.h>
 #include <nsIPrefBranch.h>
+#if MOZ_VERSION_MAJOR > 1 || (MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR >= 8)
+#   include <nsPresContext.h>
+#else
+#   include <nsIPresContext.h>
+    typedef nsIPresContext nsPresContext; // ugh
+#endif
 #include <nsIPrefService.h>
-#include <nsIPresContext.h>
 #include <nsIPresShell.h>
-#include <nsIServiceManagerUtils.h>
+#if MOZ_VERSION_MAJOR > 1 || (MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR >= 8)
+#   include <nsServiceManagerUtils.h>
+#else
+#   include <nsIServiceManagerUtils.h>
+#endif
 #include <nsIWebBrowser.h>
 #include <nsString.h>
 
@@ -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<nsIPresShell> pres_shell;
        check(doc_shell->GetPresShell(getter_AddRefs(pres_shell)));
-       nsCOMPtr<nsIPresContext> pres_context;
+       nsCOMPtr<nsPresContext> pres_context;
        check(doc_shell->GetPresContext(getter_AddRefs(pres_context)));
        nsCOMPtr<nsIDOMWindow> 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<Gdk::Window> 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