From 99e4995e0cc45aac43ae85fdb47650c19f115841 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 3 Mar 2011 02:48:37 +0000 Subject: [PATCH] Update version checks for XULRunner 2.0 (beta) --- browser_widget.cpp | 14 +++++++++----- videolink.cpp | 3 ++- videolink.hpp | 10 ++++++++++ 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/browser_widget.cpp b/browser_widget.cpp index 01ce4cb..d45970a 100644 --- a/browser_widget.cpp +++ b/browser_widget.cpp @@ -8,9 +8,10 @@ #include +#include "videolink.hpp" #include "wchar_t_short.h" #include -#if MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR == 9 +#if MOZ_VERSION_GE(1,9,0) #include #endif #include "wchar_t_default.h" @@ -530,14 +531,17 @@ Glib::ObjectBase * browser_widget::wrap_new(GObject * gobject) browser_widget::initialiser::initialiser() { -#if MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR == 9 +#if MOZ_VERSION_GE(1,9,0) static const GREVersionRange gre_versions = { -#if MOZ_VERSION_MICRO == 0 +#if MOZ_VERSION_EQ(1,9,0) "1.9a", PR_TRUE, "1.9.1", PR_FALSE -#elif MOZ_VERSION_MICRO == 1 +#elif MOZ_VERSION_EQ(1,9,1) "1.9.1", PR_TRUE, "1.9.2", PR_FALSE +#elif MOZ_VERSION_EQ(2,0,-1) || MOZ_VERSION_EQ(2,0,0) + "2.0b", PR_TRUE, + "2.0.1", PR_FALSE #else #error "version is unsupported, but you could try continuing the pattern above" #endif @@ -567,7 +571,7 @@ browser_widget::initialiser::~initialiser() { gtk_moz_embed_pop_startup(); -#if MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR == 9 +#if MOZ_VERSION_GE(1,9,0) XPCOMGlueShutdown(); #endif } diff --git a/videolink.cpp b/videolink.cpp index 9ed1746..e0b71d8 100644 --- a/videolink.cpp +++ b/videolink.cpp @@ -22,9 +22,10 @@ #include #include +#include "videolink.hpp" #include "wchar_t_short.h" #include -#if MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR == 9 +#if MOZ_VERSION_GE(1,9,0) #include /* For some reason no longer defines this */ typedef nsCOMPtr nsWeakPtr; diff --git a/videolink.hpp b/videolink.hpp index db3eede..c2c1e89 100644 --- a/videolink.hpp +++ b/videolink.hpp @@ -5,4 +5,14 @@ void fatal_error(const std::string & message); +#define MOZ_VERSION_EQ(major, minor, micro) \ + (MOZ_VERSION_MAJOR == (major) && \ + MOZ_VERSION_MINOR == (minor) && \ + MOZ_VERSION_MICRO == (micro)) +#define MOZ_VERSION_GE(major, minor, micro) \ + (MOZ_VERSION_MAJOR > (major) || \ + (MOZ_VERSION_MAJOR == (major) && \ + (MOZ_VERSION_MINOR > (minor) || \ + (MOZ_VERSION_MINOR == (minor) && MOZ_VERSION_MICRO >= (micro))))) + #endif // !INC_VIDEOLINK_HPP -- 2.39.2