Bug 566845 - Make desktop flash plugin works on Fennec QT. r=dougt.

This commit is contained in:
Oleg Romashin 2010-05-21 13:19:57 -04:00
parent d5708bb5a7
commit 3c481f45ca
2 changed files with 31 additions and 1 deletions

View File

@ -73,6 +73,12 @@ namespace {
PluginModuleChild* gInstance = nsnull;
}
#ifdef MOZ_WIDGET_QT
typedef void (*_gtk_init_fn)(int argc, char **argv);
static _gtk_init_fn s_gtk_init = nsnull;
static PRLibrary *sGtkLib = nsnull;
#endif
#ifdef XP_WIN
// Used with fix for flash fullscreen window loosing focus.
static bool gDelayFlashFocusReplyUntilEval = false;
@ -106,6 +112,11 @@ PluginModuleChild::~PluginModuleChild()
}
#ifdef MOZ_WIDGET_QT
nsQAppInstance::Release();
if (sGtkLib) {
PR_UnloadLibrary(sGtkLib);
sGtkLib = nsnull;
s_gtk_init = nsnull;
}
#endif
gInstance = nsnull;
}
@ -471,6 +482,20 @@ PluginModuleChild::InitGraphics()
#elif defined(MOZ_WIDGET_QT)
nsQAppInstance::AddRef();
// Work around plugins that don't interact well without gtk initialized
// see bug 566845
#if defined(MOZ_X11)
if (!sGtkLib)
sGtkLib = PR_LoadLibrary("libgtk-x11-2.0.so.0");
#elif defined(MOZ_DFB)
if (!sGtkLib)
sGtkLib = PR_LoadLibrary("libgtk-directfb-2.0.so.0");
#endif
if (sGtkLib) {
s_gtk_init = (_gtk_init_fn)PR_FindFunctionSymbol(sGtkLib, "gtk_init");
if (s_gtk_init)
s_gtk_init(0, 0);
}
#else
// may not be necessary on all platforms
#endif
@ -857,7 +882,7 @@ _getvalue(NPP aNPP,
switch (aVariable) {
// Copied from nsNPAPIPlugin.cpp
case NPNVToolkit:
#ifdef MOZ_WIDGET_GTK2
#if defined(MOZ_WIDGET_GTK2) || defined(MOZ_WIDGET_QT)
*static_cast<NPNToolkitType*>(aValue) = NPNVGtk2;
return NPERR_NO_ERROR;
#endif

View File

@ -1980,6 +1980,11 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
case NPNVSupportsXEmbedBool: {
#ifdef MOZ_WIDGET_GTK2
*(NPBool*)result = PR_TRUE;
#elif defined(MOZ_WIDGET_QT)
// Desktop Flash fail to initialize if browser does not support NPNVSupportsXEmbedBool
// even when wmode!=windowed, lets return fake support
fprintf(stderr, "Fake support for XEmbed plugins in Qt port\n");
*(NPBool*)result = PR_TRUE;
#else
*(NPBool*)result = PR_FALSE;
#endif