The NPAPI plugin launches gtk-gnash or the GNASH_PLAYER env variable.
Setting GNASH_PLAYER to the kde4-gnash program works to embed the kde4
gui. However, the NPAPI plugin would only build if gtk gui is
configured.

I'm attaching a patch for review that does the following:
1) Builds the NPAPI plugin if gtk or kde4 gui is enabled
2) The plugin will launch gtk-gnash or kde4-gnash, whichever exists. If
both are installed, gtk-gnash dominates.

I'm no expert with the auto* suite, so I may have overlooked some
things. But if no one sees a problem with this, I'll go ahead and check
it in next week.

I think the sdl and fltk GUIs also support XEmbed, so should they be
supported in this manner also?

John Wimer
=== modified file 'configure.ac'
--- configure.ac	2009-12-16 00:09:04 +0000
+++ configure.ac	2009-12-31 17:57:43 +0000
@@ -1384,18 +1384,20 @@
   *)   AC_MSG_ERROR([bad value ${enableval} for --disable-kparts4 option]) ;;
 esac],build_kparts4=$build_kde4)
 
-dnl ----------------------------------------------------
-dnl Add NPAPI support, if specified or GTK gui is built
-dnl ----------------------------------------------------
+dnl -----------------------------------------------------------
+dnl Add NPAPI support, if specified or GTK or KDE4 gui is built
+dnl -----------------------------------------------------------
 
 AC_ARG_ENABLE(npapi,
-  AC_HELP_STRING([--disable-npapi], [Disable NPAPI plugin build (default: enabled if gtk gui is)]),
+  AC_HELP_STRING([--disable-npapi], [Disable NPAPI plugin build (default: enabled if gtk or kde4 gui is)]),
   [case "${enableval}" in
     yes) npapi=yes ;;
     no)  npapi=no ;;
     *)   AC_MSG_ERROR([bad value ${enableval} for disable-npapi option]) ;;
   esac],
-  npapi=$build_gtk
+  if test x$build_gtk = xyes -o x$build_kde4 = xyes; then
+    npapi=yes
+  fi
 )
 
 dnl -----------------------------------------------------------------
@@ -1868,8 +1870,10 @@
 
 AM_CONDITIONAL(HAVE_GLIB, [ test x$has_glib = xyes ])
 
-if test x$build_gtk = xno -a x$npapi = xyes; then
-  AC_MSG_WARN(["Enabled NPAPI plugin, but you aren't building a GTK based GUI!"])
+if test x$build_gtk = xno -o x$build_kde4 = xno; then
+  if test x$npapi =xyes; then
+    AC_MSG_WARN(["Enabled NPAPI plugin, but it's not supported by the selected GUI"])
+  fi
 fi
 
 if test x$windows = xyes -a x$npapi = xyes; then
@@ -1881,6 +1885,11 @@
   fi
 fi
 
+dnl Need GLIB for NPAPI plugin
+if test x$npapi = xyes; then
+  GNASH_PATH_GLIB
+fi
+
 dnl if kde isn't installed, even if it's specified, don't try to build
 dnl the KPARTS plugin, which is KDE based.
 if test x$has_kde3 = xno -a x$build_kparts3 = xyes; then

=== modified file 'plugin/plugin.cpp'
--- plugin/plugin.cpp	2009-12-16 00:09:04 +0000
+++ plugin/plugin.cpp	2009-12-31 18:24:49 +0000
@@ -1108,17 +1108,47 @@
 nsPluginInstance::startProc(Window win)
 {
     std::string procname;
+    bool process_found = false;
+    struct stat procstats;
+
     char *gnash_env = std::getenv("GNASH_PLAYER");
+
 #ifdef GNASH_XPI_PLUGIN
     if (getHome(procname) >= 0)
-        ;
+        process_found = true;
     else
 #endif // def GNASH_XPI_PLUGIN
-    if (gnash_env == NULL) {
-        procname = GNASHBINDIR;
-        procname += "/gtk-gnash";
-    } else {
+    if (gnash_env)
+    {
         procname = gnash_env;
+        process_found = (0 == stat(procname.c_str(), &procstats));
+        if (!process_found)
+        {
+#ifdef GNASH_PLUGIN_DEBUG
+            std::cout << "Invalid path to gnash executable: " << 
+                procname << std::endl;
+#endif
+            return;
+        }
+    }
+
+    if (!process_found)
+    {
+        procname = GNASHBINDIR "/gtk-gnash";
+        process_found = (0 == stat(procname.c_str(), &procstats));
+    }
+    if (!process_found)
+    {
+        procname = GNASHBINDIR "/kde4-gnash";
+        process_found = (0 == stat(procname.c_str(), &procstats));
+    }
+
+    if (!process_found)
+    {
+#ifdef GNASH_PLUGIN_DEBUG
+        std::cout << "Unable to find Gnash in " GNASHBINDIR << std::endl;
+#endif
+        return;
     }
 
     const char* pageurl = getCurrentPageURL();
@@ -1129,17 +1159,6 @@
 #endif
     }
 
-    struct stat procstats;
-
-    // See if the file actually exists, otherwise we can't spawn it
-    if (stat(procname.c_str(), &procstats) == -1) {
-#ifdef GNASH_PLUGIN_DEBUG
-        std::cout << "Invalid path to standalone executable: " << 
-            procname << std::endl;
-#endif
-        return;
-    }
-
     dumpCookies();
 
     // 0 For reading, 1 for writing.

=== modified file 'plugin/plugin.h'
--- plugin/plugin.h	2009-02-25 22:33:03 +0000
+++ plugin/plugin.h	2009-12-31 10:56:01 +0000
@@ -43,6 +43,8 @@
 #include <X11/cursorfont.h>
 #ifdef HAVE_GTK2
 #include <gtk/gtk.h>
+#else
+#include <glib.h>
 #endif
 #include <string>
 #include <map>

_______________________________________________
Gnash-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnash-dev

Reply via email to