+videolink (1.2.3) unstable; urgency=low
+
+ * Added support for XULRunner 1.9
+
+ -- Ben Hutchings <ben@decadent.org.uk> Tue, 08 Apr 2008 01:22:08 +0100
+
videolink (1.2.2) unstable; urgency=low
* Fixed build failure with g++ 4.3
docdir := $(sharedir)/doc
mandir := $(sharedir)/man
-# Prefer XULRunner to the old Mozilla
-ifeq ($(shell pkg-config --exists xulrunner-gtkmozembed && echo yes),yes)
+ifeq ($(shell pkg-config --atleast-version 1.9 mozilla-gtkmozembed-embedding && echo yes),yes)
+ moz_name := xulrunner-1.9
+ moz_pc := mozilla-gtkmozembed-embedding
+ moz_cppflags_extra := $(shell pkg-config --cflags xulrunner-nspr)
+ moz_unstable_cppflags_extra :=
+ moz_ldflags_extra :=
+else
+ ifeq ($(shell pkg-config --exists xulrunner-gtkmozembed && echo yes),yes)
moz_name := xulrunner
moz_pc := xulrunner-gtkmozembed
-else
+ else
moz_name := mozilla
moz_pc := mozilla-gtkmozembed
+ endif
+ moz_unstable_cppflags_extra = \
+ $(addprefix -I$(moz_include_dir)/, \
+ content docshell dom gfx imglib2 layout locale necko uconv webshell widget) \
+ -DMOZILLA_INTERNAL_API
+ moz_ldflags_extra = -Wl,-rpath,$(moz_lib_dir)
endif
moz_prefix := $(shell pkg-config --variable=prefix $(moz_pc))
CXXFLAGS := -ansi -Wall -Wunused
LDFLAGS := -lpthread \
$(shell pkg-config --libs gtkmm-2.4 $(moz_pc)) \
- -Wl,-rpath -Wl,$(moz_lib_dir) -lexpat
+ $(moz_ldflags_extra) -lexpat
ifdef NDEBUG
CPPFLAGS += -DNDEBUG
endif
cxxsources := \
- auto_proc.cpp browser_widget.cpp child_iterator.cpp generate_dvd.cpp \
- link_iterator.cpp null_prompt_service.cpp pixbufs.cpp style_sheets.cpp \
- temp_file.cpp video.cpp vob_list.cpp videolink.cpp warp_pointer.cpp \
+ auto_proc.cpp browser_widget.cpp child_iterator.cpp \
+ event_state_manager.cpp generate_dvd.cpp link_iterator.cpp \
+ null_prompt_service.cpp pixbufs.cpp style_sheets.cpp temp_file.cpp \
+ video.cpp vob_list.cpp videolink.cpp warp_pointer.cpp \
x_frame_buffer.cpp xml_utils.cpp xpcom_support.cpp
csources := jquant2.c
browser_widget.cpp generate_dvd.cpp pixbufs.cpp temp_file.cpp \
vob_list.cpp videolink.cpp warp_pointer.cpp
sources_using_moz := \
- browser_widget.cpp child_iterator.cpp link_iterator.cpp \
- null_prompt_service.cpp style_sheets.cpp videolink.cpp xpcom_support.cpp
+ browser_widget.cpp child_iterator.cpp event_state_manager.cpp \
+ link_iterator.cpp null_prompt_service.cpp style_sheets.cpp \
+ videolink.cpp xpcom_support.cpp
sources_using_moz_unstable := \
- link_iterator.cpp null_prompt_service.cpp style_sheets.cpp videolink.cpp
+ browser_widget.cpp event_state_manager.cpp link_iterator.cpp \
+ null_prompt_service.cpp style_sheets.cpp videolink.cpp
videolink : $(cxxsources:%.cpp=.objs/%.o) $(csources:%.c=.objs/%.o)
$(CXX) $^ $(LDFLAGS) -o $@
: CPPFLAGS += $(shell pkg-config --cflags gtkmm-2.4)
$(sources_using_moz:%.cpp=.objs/%.o) \
- : CPPFLAGS += $(shell pkg-config --cflags $(moz_pc))
+ : CPPFLAGS += $(shell pkg-config --cflags $(moz_pc)) $(moz_cppflags_extra)
# Non-virtual destructors are fine in XPCOM interface classes since
# instances are only ever called by the Release function which is virtual.
$(sources_using_moz:%.cpp=.objs/%.o) : CXXFLAGS += -Wno-non-virtual-dtor
$(sources_using_moz_unstable:%.cpp=.objs/%.o) \
- : CPPFLAGS += $(addprefix -I$(moz_include_dir)/, \
- content docshell dom gfx imglib2 layout locale \
- necko uconv webshell widget) \
- -DMOZILLA_INTERNAL_API \
+ : CPPFLAGS += $(moz_unstable_cppflags_extra) \
-DMOZ_VERSION_MAJOR=$(moz_version_major) \
-DMOZ_VERSION_MINOR=$(moz_version_minor)
-// Copyright 2005 Ben Hutchings <ben@decadent.org.uk>.
+// Copyright 2005-8 Ben Hutchings <ben@decadent.org.uk>.
// See the file "COPYING" for licence details.
#include "browser_widget.hpp"
#include <cassert>
+#include <cstring>
+
+#include <limits.h>
#include <gtkmozembed_internal.h>
+#if MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR == 9
+#include <gtkmozembed_glue.cpp>
+#endif
+
+#include "xpcom_support.hpp"
+
+using xpcom_support::check;
browser_widget::browser_widget()
: Gtk::Bin(GTK_BIN(gtk_moz_embed_new()))
browser_widget::initialiser::initialiser()
{
+#if MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR == 9
+ static const GREVersionRange gre_versions = {
+ "1.9a", PR_TRUE,
+ "1.9.*", PR_TRUE
+ };
+ char path[PATH_MAX];
+ check(GRE_GetGREPathWithProperties(&gre_versions, 1, 0, 0,
+ path, sizeof(path)));
+
+ check(XPCOMGlueStartup(path));
+ check(GTKEmbedGlueStartup());
+
+ char * last_slash = std::strrchr(path, '/');
+ if (last_slash != path)
+ *last_slash = '\0';
+ gtk_moz_embed_set_path(path);
+#else
gtk_moz_embed_set_comp_path(MOZ_LIB_DIR);
+#endif
+
gtk_moz_embed_push_startup();
wrap_register(gtk_moz_embed_get_type(), wrap_new);
browser_widget::initialiser::~initialiser()
{
gtk_moz_embed_pop_startup();
+
+#if MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR == 9
+ XPCOMGlueShutdown();
+#endif
}
namespace Glib
--- /dev/null
+// Copyright 2008 Ben Hutchings <ben@decadent.org.uk>.
+// See the file "COPYING" for licence details.
+
+#ifndef MOZILLA_INTERNAL_API
+#define MOZILLA_INTERNAL_API
+#endif
+#include <nsIDocShell.h>
+#include <nsPresContext.h>
+
+#include "event_state_manager.hpp"
+#include "xpcom_support.hpp"
+
+using xpcom_support::check;
+
+nsIEventStateManager * get_event_state_manager(nsIDocShell * doc_shell)
+{
+ nsCOMPtr<nsPresContext> pres_context;
+ check(doc_shell->GetPresContext(getter_AddRefs(pres_context)));
+ return pres_context->EventStateManager();
+}
--- /dev/null
+// Copyright 2008 Ben Hutchings <ben@decadent.org.uk>.
+// See the file "COPYING" for licence details.
+
+#ifndef INC_EVENT_STATE_MANAGER_HPP
+#define INC_EVENT_STATE_MANAGER_HPP
+
+class nsIDocShell;
+class nsIEventStateManager;
+
+// This function works with nsPresContext, defined in
+// <nsPresContext.h>, which includes <nsString.h>, which is mutually
+// exclusive with including <nsStringAPI.h>. What a mess.
+nsIEventStateManager * get_event_state_manager(nsIDocShell * doc_shell);
+
+#endif // !INC_EVENT_STATE_MANAGER_HPP
-// Copyright 2005-6 Ben Hutchings <ben@decadent.org.uk>.
+// Copyright 2005-8 Ben Hutchings <ben@decadent.org.uk>.
// See the file "COPYING" for licence details.
#include <cassert>
#include <gtkmm/window.h>
#include <ImageErrors.h>
+#if MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR == 9
+#include <nsWeakPtr.h>
+/* For some reason <nsWeakPtr.h> no longer defines this */
+typedef nsCOMPtr<nsIWeakReference> nsWeakPtr;
+#endif
#include <nsGUIEvent.h>
#include <nsIBoxObject.h>
#include <nsIContent.h>
#include <nsIURI.h> // required before nsILink.h
#include <nsILink.h>
#include <nsIPrefBranch.h>
-#include <nsPresContext.h>
#include <nsIPrefService.h>
#include <nsIPresShell.h>
#include <nsServiceManagerUtils.h>
#include <nsIWebBrowser.h>
+#ifdef MOZILLA_INTERNAL_API
#include <nsString.h>
+#else
+#include <nsStringAPI.h>
+#endif
#include "browser_widget.hpp"
#include "child_iterator.hpp"
#include "dvd.hpp"
+#include "event_state_manager.hpp"
#include "generate_dvd.hpp"
#include "geometry.hpp"
#include "link_iterator.hpp"
bool process_links(
page_state * state,
nsIDOMDocument * basic_doc,
- nsIPresShell * pres_shell,
- nsPresContext * pres_context,
+ nsIDocShell * doc_shell,
nsIDOMWindow * dom_window);
std::string output_dir_;
nsCOMPtr<nsIWebBrowser> browser(browser_widget_.get_browser());
nsCOMPtr<nsIDocShell> doc_shell(do_GetInterface(browser));
assert(doc_shell);
- nsCOMPtr<nsIPresShell> pres_shell;
- check(doc_shell->GetPresShell(getter_AddRefs(pres_shell)));
- nsCOMPtr<nsPresContext> pres_context;
- check(doc_shell->GetPresContext(getter_AddRefs(pres_context)));
nsCOMPtr<nsIDOMWindow> dom_window;
check(browser->GetContentDOMWindow(getter_AddRefs(dom_window)));
new page_state(
get_screenshot(),
basic_doc, frame_params_.width, frame_params_.height));
- if (!process_links(
- page_state_.get(),
- basic_doc, pres_shell, pres_context, dom_window))
+ if (!process_links(page_state_.get(), basic_doc, doc_shell, dom_window))
{
// We've finished work on the links so generate the
// menu VOB.
bool conversion_window::process_links(
page_state * state,
nsIDOMDocument * basic_doc,
- nsIPresShell * pres_shell,
- nsPresContext * pres_context,
+ nsIDocShell * doc_shell,
nsIDOMWindow * dom_window)
{
Glib::RefPtr<Gdk::Window> window(get_window());
nsCOMPtr<nsIDOMNSDocument> ns_doc(do_QueryInterface(basic_doc));
assert(ns_doc);
+ nsCOMPtr<nsIPresShell> pres_shell;
+ check(doc_shell->GetPresShell(getter_AddRefs(pres_shell)));
nsCOMPtr<nsIEventStateManager> event_state_man(
- pres_context->EventStateManager()); // does not AddRef
+ get_event_state_manager(doc_shell));
assert(event_state_man);
nsCOMPtr<nsIDOMDocumentEvent> event_factory(
do_QueryInterface(basic_doc));
{
nsCString link_target_ns;
check(uri_iface->GetSpec(link_target_ns));
- state->link_target.assign(link_target_ns.BeginReading(),
- link_target_ns.EndReading());
+ const char * str;
+ PRUint32 len = NS_CStringGetData(link_target_ns, &str);
+ state->link_target.assign(str, len);
std::size_t hash_pos = state->link_target.find('#');
uri.assign(state->link_target, 0, hash_pos);