summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac37
-rw-r--r--src/evbp.c9
2 files changed, 37 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac
index 7e310d8..8333a23 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,15 +12,40 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
dnl We want C99 features
AC_PROG_CC_C99
-dnl Check for dependencies. Mozilla packages are split out because we
-dnl only want their headers.
-GTK_REQUIRED=2.14.0
+dnl Required versions of dependencies.
+GTK2_REQUIRED=2.14.0
+GTK3_REQUIRED=3.0
GLIB_REQUIRED=2.18.0
-EVINCE_API=2.32
+EVINCE2_API=2.32
+EVINCE3_API=3.0
+
+dnl Check for NPAPI. Mozilla packages are split out because we only
+dnl want their headers from MOZILLA_CFLAGS.
mozilla_pkgs="mozilla-plugin nspr"
-evince_pkgs="gtk+-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED \
- evince-view-$EVINCE_API evince-document-$EVINCE_API"
PKG_CHECK_MODULES([MOZILLA], [$mozilla_pkgs])
+
+dnl See if we want gtk2/evince2 or gtk3/evince3. This is important
+dnl because mozilla currently only support gtk2 plugins and epiphany
+dnl only supports gtk3 plugins. Default to gtk2 for now since firefox is
+dnl the more likely browser.
+AC_MSG_CHECKING([which GTK+ version to use])
+AC_ARG_ENABLE([gtk3],
+ [AC_HELP_STRING([--enable-gtk3],
+ [use GTK+ version 3 (default: no, gtk2)])],
+ [],
+ [enable_gtk3=no])
+if test "x$enable_gtk3" = xno; then
+ gtk=gtk+-2.0
+ gtk_required=$GTK2_REQUIRED
+ evince_api=$EVINCE2_API
+else
+ gtk=gtk+-3.0
+ gtk_required=$GTK3_REQUIRED
+ evince_api=$EVINCE3_API
+fi
+AC_MSG_RESULT([$gtk])
+evince_pkgs="$gtk >= $gtk_required gio-2.0 >= $GLIB_REQUIRED \
+ evince-view-$evince_api evince-document-$evince_api"
PKG_CHECK_MODULES([EVINCE], [$evince_pkgs])
GETTEXT_PACKAGE="$PACKAGE"
diff --git a/src/evbp.c b/src/evbp.c
index 1b5093a..83cf4dd 100644
--- a/src/evbp.c
+++ b/src/evbp.c
@@ -29,6 +29,9 @@
#include <prtypes.h>
#include <glib.h>
#include <gtk/gtk.h>
+#if GTK_MAJOR_VERSION > 2
+#include <gtk/gtkx.h>
+#endif
#include <gdk/gdkx.h>
#include <evince-document.h>
#include <evince-view.h>
@@ -165,7 +168,7 @@ static NPError
evbp_set_window(NPP instance, NPWindow *window)
{
evbp_priv_t *priv = instance->pdata;
- GdkNativeWindow id;
+ Window id;
GtkWidget *plug;
g_debug("%s", __func__);
@@ -179,8 +182,8 @@ evbp_set_window(NPP instance, NPWindow *window)
priv->window = window;
/* Create a plug from the window id we were told about */
- id = (GdkNativeWindow)(unsigned long)window->window;
- g_debug("plugging into window id %u", id);
+ id = (Window)window->window;
+ g_debug("plugging into window id %lu", (unsigned long)id);
plug = gtk_plug_new(id);
gtk_container_add(GTK_CONTAINER(plug), priv->viewer);
gtk_widget_show_all(plug);