From c90a9ed422d683840b59fc50c7d201e63cbd2028 Mon Sep 17 00:00:00 2001 From: Romain Perier <mrpouet@gentoo.org> Date: Mon, 8 Feb 2010 18:27:29 +0100 Subject: Fix backward compatibility with xulrunner-1.9.2 1)° xulrunner-1.9.2 no longer installs libxul-unstable 2)° Since 1.9.2 nsIPresShell has an API change (RenderDocument), so we've to check LIBXUL_VERSION --- m4/libxul.m4 | 9 +++++++-- src/Makefile.am | 1 + src/Writer.cpp | 8 ++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) --- a/m4/libxul.m4 +++ b/m4/libxul.m4 @@ -50,7 +50,7 @@ if test "$libxul_cv_have_libxul" != "yes"; then AC_MSG_ERROR([libxul not found]) fi -libxul_cv_version="$($PKG_CONFIG --modversion $libxul_cv_libxul_pkg)" +libxul_cv_version="$($PKG_CONFIG --modversion $libxul_cv_libxul_pkg | sed 's:\.::g')" libxul_cv_prefix="$($PKG_CONFIG --variable=prefix $libxul_cv_libxul_pkg)" libxul_cv_include_root="$($PKG_CONFIG --variable=includedir $libxul_cv_libxul_pkg)" libxul_cv_sdkdir="$($PKG_CONFIG --variable=sdkdir $libxul_cv_libxul_pkg)" @@ -59,7 +59,12 @@ libxul_cv_sdkdir="$($PKG_CONFIG --variable=sdkdir $libxul_cv_libxul_pkg)" # I can figure this out, do it like this: libxul_cv_libdir="$($PKG_CONFIG --variable=sdkdir $libxul_cv_libxul_pkg)/bin" -libxul_cv_includes="$($PKG_CONFIG --cflags-only-I libxul-unstable libxul)" +libxul_cv_includes="$($PKG_CONFIG --cflags-only-I libxul)" + +# xulrunner-1.9.2 no longer installs libxul-unstable +if $($PKG_CONFIG --exists libxul-unstable); then + libxul_cv_includes+="$($PKG_CONFIG --cflags-only-I libxul-unstable)" +fi AC_DEFINE([HAVE_LIBXUL],[1],[Define for libxul]) --- a/src/Makefile.am +++ b/src/Makefile.am @@ -42,6 +42,7 @@ gnome_web_photo_CPPFLAGS = \ -DLOCALEDIR=\"$(datadir)/locale\" \ -DGECKO_HOME=\"$(GECKO_HOME)\" \ -DGECKO_PREFIX=\"$(GECKO_PREFIX)\" \ + -DLIBXUL_VERSION=$(LIBXUL_VERSION) \ -DXPCOM_GLUE_USE_NSPR \ -DXPCOM_GLUE \ $(AM_CPPFLAGS) --- a/src/Writer.cpp +++ b/src/Writer.cpp @@ -196,9 +196,13 @@ Writer::Write() width = NSAppUnitsToIntPixels(cutout.width, p2a); height = NSAppUnitsToIntPixels(cutout.height, p2a); - - rv = presShell->RenderDocument(cutout, PR_FALSE, PR_TRUE, +#if LIBXUL_VERSION >= 192 + rv = presShell->RenderDocument(cutout, nsIPresShell::RENDER_IGNORE_VIEWPORT_SCROLLING, NS_RGB(255, 255, 255), context); +#else + rv = presShell->RenderDocument(cutout, PR_FALSE, PR_TRUE, + NS_RGB(255, 255, 255), context); +#endif if (NS_SUCCEEDED(rv)) { imgContext->DrawSurface(surface, gfxSize(width, height)); }