summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan Nicholson <dbn.lists@gmail.com>2012-03-18 18:53:51 -0700
committerDan Nicholson <dbn.lists@gmail.com>2012-06-06 21:59:26 -0700
commite764289af5c0c764f10414d2ff32c3dff72ad1fd (patch)
tree307b8ca0daf518f02692ed820bcee58831618619 /src
parentc527cff025300224867cb61cb6f46508d6157381 (diff)
Optionally build against gtk3 and evince3
The current not ideal situation for NPAPI plugins is that only gtk2 is supported on mozilla browsers and only gtk3 is supported on epiphany. Thus, a choice needs to be made whether to link in one gtk version or the other depending on the intended usage. The viewer code is entirely compatible with gtk3 and evince3, but GtkPlug needs a little adjustment. However, the plugin immediately crashes on firefox since it's still running gtk2 and our plugin is in the same address space. To use gtk3 unconditionally we'll either need to run the plugin in a separate process like totem or just wait patiently for gtk3 to be supported by firefox. I choose the latter for now and default to gtk2 since firefox is by far the more popular browser.
Diffstat (limited to 'src')
-rw-r--r--src/evbp.c9
1 files changed, 6 insertions, 3 deletions
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);