summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-03-13 02:42:19 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-03-13 02:42:19 +0000
commit790391e3a90a709160301953e47bd8f2fdc39c07 (patch)
treefda62a7cc51ea534c00a75e8e546b1a456c613fb
parentc4a00b7ddb3f1fc632080c2ecc670f568b37d179 (diff)
downloadtdebase-790391e3a90a709160301953e47bd8f2fdc39c07.tar.gz
tdebase-790391e3a90a709160301953e47bd8f2fdc39c07.zip
Enhance support for Flash in Konqueror (closes Bug 351)
Patch courtesy of Ilya git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1224648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
-rw-r--r--nsplugins/viewer/nsplugin.cpp20
-rw-r--r--nsplugins/viewer/nsplugin.h4
2 files changed, 24 insertions, 0 deletions
diff --git a/nsplugins/viewer/nsplugin.cpp b/nsplugins/viewer/nsplugin.cpp
index f91e3fd9f..a349468da 100644
--- a/nsplugins/viewer/nsplugin.cpp
+++ b/nsplugins/viewer/nsplugin.cpp
@@ -1330,6 +1330,9 @@ DCOPRef NSPluginViewer::newClass( TQString plugin )
/****************************************************************************/
+bool NSPluginClass::s_initedGTK = false;
+
+typedef void gtkInitFunc(int *argc, char ***argv);
NSPluginClass::NSPluginClass( const TQString &library,
TQObject *parent, const char *name )
@@ -1377,6 +1380,23 @@ NSPluginClass::NSPluginClass( const TQString &library,
// initialize plugin
kdDebug(1431) << "Plugin library " << library << " loaded!" << endl;
+
+ // see if it uses gtk
+ if (!s_initedGTK) {
+ gtkInitFunc* gtkInit = (gtkInitFunc*)_handle->symbol("gtk_init");
+ if (gtkInit) {
+ kdDebug(1431) << "Calling gtk_init for the plugin" << endl;
+ // Prevent gtk_init() from replacing the X error handlers, since the Gtk
+ // handlers abort when they receive an X error, thus killing the viewer.
+ int (*old_error_handler)(Display*,XErrorEvent*) = XSetErrorHandler(0);
+ int (*old_io_error_handler)(Display*) = XSetIOErrorHandler(0);
+ gtkInit(0, 0);
+ XSetErrorHandler(old_error_handler);
+ XSetIOErrorHandler(old_io_error_handler);
+ s_initedGTK = true;
+ }
+ }
+
_constructed = true;
_error = initialize()!=NPERR_NO_ERROR;
}
diff --git a/nsplugins/viewer/nsplugin.h b/nsplugins/viewer/nsplugin.h
index e968eb684..1c241cc8e 100644
--- a/nsplugins/viewer/nsplugin.h
+++ b/nsplugins/viewer/nsplugin.h
@@ -315,6 +315,10 @@ private:
TQPtrList<NSPluginInstance> _trash;
TQCString _app;
+
+ // If plugins use gtk, we call the gtk_init function for them ---
+ // but only do it once.
+ static bool s_initedGTK;
};