[gtk-vnc-devel] [PATCH] Browser plugin - further fixes



This patch contains further fixes to the browser plugin:

(1) As Dan suggested, use -module -avoid-version. This still installs a static library and the linker script, both of which are unhelpful to have in the plugins directory, so I have to delete them by hand. Couldn't see any option in the libtool info to not have it build or install those.

(2) Use the global ENABLE_DEBUG setting to turn on/off debug messages.

(3) Move the debug() function into a common header file.

(4) Include test.html, which I missed out from the first patch.

(5) Put #if 1 ... #endif around the Gtk toolkit test. I'll probably remove this test altogether in future since (in theory) XEmbed should let you embed a widget from any toolkit in any other toolkit, so this test doesn't really matter.

Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
diff -r 1b674865392b .hgignore
--- a/.hgignore	Fri Jan 11 09:41:04 2008 -0600
+++ b/.hgignore	Fri Jan 11 16:15:14 2008 +0000
@@ -33,8 +33,8 @@ Makefile\.in$
 ^src/vncmarshal\.[ch]$
 ^plugin/\.deps/
 ^plugin/\.libs/
-^plugin/libgtk_vnc_plugin.la$
-^plugin/libgtk_vnc_plugin_la-.*
+^plugin/gtk-vnc-plugin.la$
+^plugin/gtk_vnc_plugin_la-.*
 ^plugin/gtk-vnc-plugin.so
 
 syntax: glob
diff -r 1b674865392b plugin/Makefile.am
--- a/plugin/Makefile.am	Fri Jan 11 09:41:04 2008 -0600
+++ b/plugin/Makefile.am	Fri Jan 11 16:15:14 2008 +0000
@@ -1,34 +1,29 @@ if ENABLE_PLUGIN
 if ENABLE_PLUGIN
 
-# What we really want is 'noinst_LTLIBRARIES', so that it builds the
-# shared library but lets us control how we install it.  However
-# if you do that, automake thinks you're trying to build a "libtool
-# convenience library" and no longer builds a shared library at all.
-# Very unhelpful.  So instead build and install the library in libdir
-# but delete it in the install hook below and install it where we want.
-# I hate automake and libtool.
-lib_LTLIBRARIES = libgtk-vnc-plugin.la
+plugindir	= $(libdir)/mozilla/plugins
+plugin_LTLIBRARIES = gtk-vnc-plugin.la
 
-libgtk_vnc_plugin_la_SOURCES = \
+gtk_vnc_plugin_la_SOURCES = \
 	gtk-vnc-plugin.c gtk-vnc-plugin.h npshell.c npunix.c
-libgtk_vnc_plugin_la_LIBADD = \
+gtk_vnc_plugin_la_LIBADD = \
 	../src/libgtk-vnc-1.0.la @GTK_LIBS@ @FIREFOX_PLUGIN_LIBS@
-libgtk_vnc_plugin_la_CFLAGS = \
+gtk_vnc_plugin_la_LDFLAGS = \
+	-module -avoid-version
+gtk_vnc_plugin_la_CFLAGS = \
 	-I$(top_srcdir)/src @GTK_CFLAGS@ @FIREFOX_PLUGIN_CFLAGS@ \
-	@WARNING_CFLAGS@ @WERROR_CFLAGS@
+	@WARNING_CFLAGS@ @WERROR_CFLAGS@ @DEBUG_CFLAGS@
 
 all-local: gtk-vnc-plugin.so
 
-gtk-vnc-plugin.so: libgtk-vnc-plugin.la
-	cp .libs/libgtk-vnc-plugin.so.0.0.0 $@
+gtk-vnc-plugin.so: gtk-vnc-plugin.la
+	cp .libs/gtk-vnc-plugin.so $@
 
-install-exec-hook:
-	rm -f $(libdir)/libgtk-vnc-plugin.*
-	$(install_sh) -d $(libdir)/mozilla/plugins
-	$(install_sh) -c -m 0755 gtk-vnc-plugin.so $(libdir)/mozilla/plugins
+# Only leave the .so file in the plugins directory.
+install-data-hook:
+	rm -f $(plugindir)/gtk-vnc-plugin.a $(plugindir)/gtk-vnc-plugin.la
 
 EXTRA_DIST = README
 
 CLEANFILES = gtk-vnc-plugin.so
 
-endif
\ No newline at end of file
+endif
diff -r 1b674865392b plugin/gtk-vnc-plugin.c
--- a/plugin/gtk-vnc-plugin.c	Fri Jan 11 09:41:04 2008 -0600
+++ b/plugin/gtk-vnc-plugin.c	Fri Jan 11 16:15:14 2008 +0000
@@ -40,18 +40,6 @@
 #include "gtk-vnc-plugin.h"
 
 static void
-debug (const char *msg, ...)
-{
-  va_list args;
-
-  va_start (args, msg);
-  vfprintf (stderr, msg, args);
-  va_end (args);
-  fprintf (stderr, "\n");
-  fflush (stderr);
-}
-
-static void
 vnc_connected (GtkWidget *vnc G_GNUC_UNUSED, void *Thisv)
 {
   PluginInstance *This = (PluginInstance *) Thisv;
diff -r 1b674865392b plugin/gtk-vnc-plugin.h
--- a/plugin/gtk-vnc-plugin.h	Fri Jan 11 09:41:04 2008 -0600
+++ b/plugin/gtk-vnc-plugin.h	Fri Jan 11 16:15:14 2008 +0000
@@ -63,4 +64,20 @@ extern NPError GtkVNCDestroyWindow (NPP 
 extern NPError GtkVNCDestroyWindow (NPP instance);
 extern int16 GtkVNCXHandleEvent (NPP instance, void* event);
 
+#ifdef ENABLE_DEBUG
+static inline void
+debug (const char *msg, ...)
+{
+  va_list args;
+
+  va_start (args, msg);
+  vfprintf (stderr, msg, args);
+  va_end (args);
+  fprintf (stderr, "\n");
+  fflush (stderr);
+}
+#else
+static inline void debug (const char *msg G_GNUC_UNUSED, ...) { }
+#endif
+
 #endif /* GTK_VNC_PLUGIN_H */
diff -r 1b674865392b plugin/npshell.c
--- a/plugin/npshell.c	Fri Jan 11 09:41:04 2008 -0600
+++ b/plugin/npshell.c	Fri Jan 11 16:15:14 2008 +0000
@@ -84,18 +84,6 @@ Contributor(s): Adobe Systems Incorporat
 #include <npupp.h>
 
 #include "gtk-vnc-plugin.h"
-
-static void
-debug (const char *msg, ...)
-{
-  va_list args;
-
-  va_start (args, msg);
-  vfprintf (stderr, msg, args);
-  va_end (args);
-  fprintf (stderr, "\n");
-  fflush (stderr);
-}
 
 /***********************************************************************
  *
@@ -186,11 +174,13 @@ NPP_New(NPMIMEType pluginType G_GNUC_UNU
   if (err != NPERR_NO_ERROR || supportsXEmbed != PR_TRUE)
     return NPERR_INCOMPATIBLE_VERSION_ERROR;
 
+#if 1
   err = NPN_GetValue (instance,
                       NPNVToolkit,
                       (void *)&toolkit);
   if (err != NPERR_NO_ERROR || toolkit != NPNVGtk2)
     return NPERR_INCOMPATIBLE_VERSION_ERROR;
+#endif
 
   instance->pdata = NPN_MemAlloc(sizeof(PluginInstance));
 
diff -r 1b674865392b plugin/test.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugin/test.html	Fri Jan 11 16:15:14 2008 +0000
@@ -0,0 +1,18 @@
+<html>
+<body>
+
+  <h1>Gtk-VNC test</h1>
+
+  <p>You will need to edit the source to
+  set <code>host</code>, <code>port</code> etc.</p>
+
+  <embed type="application/x-gtk-vnc"
+    width="800"
+    height="600"
+    host="192.168.2.129" port="5900">
+  </embed>
+
+  <p>End of page</p>
+
+</body>
+</html>

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]