]> git.decadent.org.uk Git - videolink.git/blobdiff - videolink.cpp
Release versions 1.2.11 and 1.2.11-1
[videolink.git] / videolink.cpp
index 9ed174675f2a85d45f58737ded4d62a1d802677c..a15bbea1bfe125a2cf9c67e152935203a1e3e2a3 100644 (file)
 #include <gtkmm/main.h>
 #include <gtkmm/window.h>
 
+#include "videolink.hpp"
 #include "wchar_t_short.h"
 #include <ImageErrors.h>
-#if MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR == 9
+#if MOZ_VERSION_GE(1,9,0)
 #include <nsWeakPtr.h>
 /* For some reason <nsWeakPtr.h> no longer defines this */
 typedef nsCOMPtr<nsIWeakReference> nsWeakPtr;
@@ -80,14 +81,17 @@ using xpcom_support::check;
 
 namespace
 {
-    rectangle get_elem_rect(nsIDOMNSDocument * ns_doc,
-                           nsIDOMElement * elem)
+#if MOZ_VERSION_GE(2,0,-1)
+    rectangle get_elem_rect(nsIDocument * doc, nsIDOMElement * elem)
+#else
+    rectangle get_elem_rect(nsIDOMNSDocument * doc, nsIDOMElement * elem)
+#endif
     {
        rectangle result;
 
        // Start with this element's bounding box
        nsCOMPtr<nsIBoxObject> box;
-       check(ns_doc->GetBoxObjectFor(elem, getter_AddRefs(box)));
+       check(doc->GetBoxObjectFor(elem, getter_AddRefs(box)));
        int width, height;
        check(box->GetScreenX(&result.left));
        check(box->GetScreenY(&result.top));
@@ -106,7 +110,7 @@ namespace
            {
                nsCOMPtr<nsIDOMElement> child_elem(
                    do_QueryInterface(child_node));
-               result |= get_elem_rect(ns_doc, child_elem);
+               result |= get_elem_rect(doc, child_elem);
            }
        }
 
@@ -419,7 +423,9 @@ namespace
        {
            // Check whether the load was successful, ignoring this
            // pseudo-error.
+#ifdef NS_IMAGELIB_ERROR_LOAD_ABORTED
            if (status != NS_IMAGELIB_ERROR_LOAD_ABORTED)
+#endif
                check(status);
 
            pending_window_update_ = false;
@@ -581,6 +587,10 @@ namespace
 
        nsCOMPtr<nsIDOMNSDocument> ns_doc(do_QueryInterface(basic_doc));
        assert(ns_doc);
+#if MOZ_VERSION_GE(2,0,-1)
+       nsCOMPtr<nsIDocument> doc(do_QueryInterface(basic_doc));
+       assert(doc);
+#endif
        nsCOMPtr<nsIPresShell> pres_shell;
        check(doc_shell->GetPresShell(getter_AddRefs(pres_shell)));
        nsCOMPtr<nsIEventStateManager> event_state_man(
@@ -607,10 +617,17 @@ namespace
            nsCOMPtr<nsIDOMNode> node(*state->links_it);
 
            // Find the link URI and separate any fragment from it.
+           nsCOMPtr<nsIURI> uri_iface;
+#if MOZ_VERSION_GE(2,0,-1)
+           nsCOMPtr<nsIContent> content(do_QueryInterface(node));
+           assert(content);
+           uri_iface = content->GetHrefURI();
+           assert(uri_iface);
+#else
            nsCOMPtr<nsILink> link(do_QueryInterface(node));
            assert(link);
-           nsCOMPtr<nsIURI> uri_iface;
            check(link->GetHrefURI(getter_AddRefs(uri_iface)));
+#endif
            std::string uri, fragment;
            {
                nsCString link_target_ns;
@@ -633,7 +650,11 @@ namespace
                // window.
                nsCOMPtr<nsIDOMElement> elem(do_QueryInterface(node));
                assert(elem);
+#if MOZ_VERSION_GE(2,0,-1)
+               state->link_rect = get_elem_rect(doc, elem);
+#else
                state->link_rect = get_elem_rect(ns_doc, elem);
+#endif
                state->link_rect &= window_rect;
 
                if (state->link_rect.empty())