mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 1286317 - part 2 - remove Qt widget usage from plugins. r=jrmuizel
This commit is contained in:
parent
16ca3223d9
commit
0e1e833b40
@ -8,10 +8,6 @@
|
||||
#include <gtk/gtk.h>
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
#include "nsQAppInstance.h"
|
||||
#endif
|
||||
|
||||
#include "ContentChild.h"
|
||||
|
||||
#include "BlobChild.h"
|
||||
@ -619,11 +615,6 @@ ContentChild::Init(MessageLoop* aIOLoop,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
// sigh, seriously
|
||||
nsQAppInstance::AddRef();
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_X11
|
||||
// Do this after initializing GDK, or GDK will install its own handler.
|
||||
XRE_InstallX11ErrorHandler();
|
||||
|
@ -168,7 +168,7 @@ if CONFIG['OS_ARCH'] != 'WINNT':
|
||||
|
||||
DEFINES['BIN_SUFFIX'] = '"%s"' % CONFIG['BIN_SUFFIX']
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gtk2', 'gonk', 'qt'):
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gtk2', 'gonk'):
|
||||
DEFINES['MOZ_ENABLE_FREETYPE'] = True
|
||||
|
||||
if CONFIG['MOZ_TOOLKIT_SEARCH']:
|
||||
|
@ -160,6 +160,6 @@ TEST_DIRS += [
|
||||
'imptests',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'cocoa', 'windows', 'android', 'qt'):
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'cocoa', 'windows', 'android'):
|
||||
TEST_DIRS += ['plugins/test']
|
||||
|
||||
|
@ -77,10 +77,6 @@ else:
|
||||
SOURCES += [
|
||||
'nsPluginNativeWindowGtk.cpp',
|
||||
]
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
|
||||
UNIFIED_SOURCES += [
|
||||
'nsPluginNativeWindowQt.cpp',
|
||||
]
|
||||
else:
|
||||
UNIFIED_SOURCES += [
|
||||
'nsPluginNativeWindow.cpp',
|
||||
|
@ -1811,7 +1811,7 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
|
||||
return NPERR_GENERIC_ERROR;
|
||||
#endif
|
||||
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
case NPNVnetscapeWindow: {
|
||||
if (!npp || !npp->ndata)
|
||||
return NPERR_INVALID_INSTANCE_ERROR;
|
||||
@ -1860,10 +1860,6 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
|
||||
*((NPNToolkitType*)result) = NPNVGtk2;
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
/* Fake toolkit so flash plugin works */
|
||||
*((NPNToolkitType*)result) = NPNVGtk2;
|
||||
#endif
|
||||
if (*(NPNToolkitType*)result)
|
||||
return NPERR_NO_ERROR;
|
||||
|
||||
@ -1873,11 +1869,6 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
|
||||
case NPNVSupportsXEmbedBool: {
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
*(NPBool*)result = 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 = true;
|
||||
#else
|
||||
*(NPBool*)result = false;
|
||||
#endif
|
||||
@ -1898,7 +1889,7 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
|
||||
|
||||
case NPNVSupportsWindowless: {
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX) || \
|
||||
(defined(MOZ_X11) && (defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)))
|
||||
(defined(MOZ_X11) && defined(MOZ_WIDGET_GTK))
|
||||
*(NPBool*)result = true;
|
||||
#else
|
||||
*(NPBool*)result = false;
|
||||
|
@ -763,7 +763,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetNetscapeWindow(void *value)
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
#elif (defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)) && defined(MOZ_X11)
|
||||
#elif defined(MOZ_WIDGET_GTK) && defined(MOZ_X11)
|
||||
// X11 window managers want the toplevel window for WM_TRANSIENT_FOR.
|
||||
nsIWidget* win = mPluginFrame->GetNearestWidget();
|
||||
if (!win)
|
||||
@ -2616,8 +2616,6 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
||||
}
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
Window root = GDK_ROOT_WINDOW();
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
Window root = RootWindowOfScreen(DefaultScreenOfDisplay(mozilla::DefaultXDisplay()));
|
||||
#else
|
||||
Window root = None; // Could XQueryTree, but this is not important.
|
||||
#endif
|
||||
|
@ -46,12 +46,8 @@ class PuppetWidget;
|
||||
using mozilla::widget::PuppetWidget;
|
||||
|
||||
#ifdef MOZ_X11
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
#include "gfxQtNativeRenderer.h"
|
||||
#else
|
||||
#include "gfxXlibNativeRenderer.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
class nsPluginInstanceOwner final : public nsIPluginInstanceOwner
|
||||
, public nsIDOMEventListener
|
||||
@ -395,12 +391,7 @@ private:
|
||||
int mLastMouseDownButtonType;
|
||||
|
||||
#ifdef MOZ_X11
|
||||
class Renderer
|
||||
#if defined(MOZ_WIDGET_QT)
|
||||
: public gfxQtNativeRenderer
|
||||
#else
|
||||
: public gfxXlibNativeRenderer
|
||||
#endif
|
||||
class Renderer : public gfxXlibNativeRenderer
|
||||
{
|
||||
public:
|
||||
Renderer(NPWindow* aWindow, nsPluginInstanceOwner* aInstanceOwner,
|
||||
|
@ -1,89 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:expandtab:shiftwidth=2:tabstop=2:
|
||||
*/
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/**
|
||||
* This file is the Qt implementation of plugin native window.
|
||||
*/
|
||||
|
||||
#include "nsDebug.h"
|
||||
#include "nsPluginNativeWindow.h"
|
||||
#include "npapi.h"
|
||||
|
||||
/**
|
||||
* Qt implementation of plugin window
|
||||
*/
|
||||
class nsPluginNativeWindowQt : public nsPluginNativeWindow
|
||||
{
|
||||
public:
|
||||
nsPluginNativeWindowQt();
|
||||
virtual ~nsPluginNativeWindowQt();
|
||||
|
||||
virtual nsresult CallSetWindow(RefPtr<nsNPAPIPluginInstance> &aPluginInstance);
|
||||
private:
|
||||
|
||||
NPSetWindowCallbackStruct mWsInfo;
|
||||
};
|
||||
|
||||
nsPluginNativeWindowQt::nsPluginNativeWindowQt() : nsPluginNativeWindow()
|
||||
{
|
||||
//Initialize member variables
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,"\n\n\nCreating plugin native window %p\n\n\n", (void *) this);
|
||||
#endif
|
||||
window = nullptr;
|
||||
x = 0;
|
||||
y = 0;
|
||||
width = 0;
|
||||
height = 0;
|
||||
memset(&clipRect, 0, sizeof(clipRect));
|
||||
ws_info = &mWsInfo;
|
||||
type = NPWindowTypeWindow;
|
||||
mWsInfo.type = 0;
|
||||
#if defined(MOZ_X11)
|
||||
mWsInfo.display = nullptr;
|
||||
mWsInfo.visual = nullptr;
|
||||
mWsInfo.colormap = 0;
|
||||
mWsInfo.depth = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
nsPluginNativeWindowQt::~nsPluginNativeWindowQt()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,"\n\n\nDestoying plugin native window %p\n\n\n", (void *) this);
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult PLUG_NewPluginNativeWindow(nsPluginNativeWindow **aPluginNativeWindow)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPluginNativeWindow);
|
||||
*aPluginNativeWindow = new nsPluginNativeWindowQt();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult PLUG_DeletePluginNativeWindow(nsPluginNativeWindow * aPluginNativeWindow)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPluginNativeWindow);
|
||||
nsPluginNativeWindowQt *p = (nsPluginNativeWindowQt *)aPluginNativeWindow;
|
||||
delete p;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsPluginNativeWindowQt::CallSetWindow(RefPtr<nsNPAPIPluginInstance> &aPluginInstance)
|
||||
{
|
||||
if (aPluginInstance) {
|
||||
if (type == NPWindowTypeWindow) {
|
||||
return NS_ERROR_FAILURE;
|
||||
} // NPWindowTypeWindow
|
||||
aPluginInstance->SetWindow(this);
|
||||
}
|
||||
else if (mPluginInstance)
|
||||
mPluginInstance->SetWindow(nullptr);
|
||||
|
||||
SetPluginInstance(aPluginInstance);
|
||||
return NS_OK;
|
||||
}
|
@ -841,7 +841,7 @@ nsresult nsPluginStreamListenerPeer::ServeStreamAsFile(nsIRequest *request,
|
||||
if (owner) {
|
||||
NPWindow* window = nullptr;
|
||||
owner->GetWindow(window);
|
||||
#if (MOZ_WIDGET_GTK == 2) || defined(MOZ_WIDGET_QT)
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
// Should call GetPluginPort() here.
|
||||
// This part is copied from nsPluginInstanceOwner::GetPluginPort().
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
|
@ -1,16 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef PluginHelperQt_h_
|
||||
#define PluginHelperQt_h_
|
||||
|
||||
class PluginHelperQt
|
||||
{
|
||||
public:
|
||||
static bool AnswerProcessSomeEvents();
|
||||
};
|
||||
|
||||
#endif // PluginHelperQt_h_
|
@ -54,9 +54,6 @@ using namespace std;
|
||||
#include <gdk/gdk.h>
|
||||
#include "gtk2xtbin.h"
|
||||
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
#undef KeyPress
|
||||
#undef KeyRelease
|
||||
#elif defined(OS_WIN)
|
||||
|
||||
#include <windows.h>
|
||||
@ -1386,8 +1383,6 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow)
|
||||
|
||||
#elif defined(ANDROID)
|
||||
// TODO: Need Android impl
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
// TODO: Need QT-nonX impl
|
||||
#elif defined(MOZ_WIDGET_UIKIT)
|
||||
// Don't care
|
||||
#else
|
||||
|
@ -287,9 +287,6 @@ PluginInstanceParent::AnswerNPN_GetValue_NPNVnetscapeWindow(NativeWindowHandle*
|
||||
#elif defined(ANDROID)
|
||||
// TODO: Need Android impl
|
||||
int id;
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
// TODO: Need Qt non X impl
|
||||
int id;
|
||||
#else
|
||||
#warning Implement me
|
||||
#endif
|
||||
|
@ -102,7 +102,7 @@ struct NPRemoteWindow
|
||||
typedef HWND NativeWindowHandle;
|
||||
#elif defined(MOZ_X11)
|
||||
typedef XID NativeWindowHandle;
|
||||
#elif defined(XP_DARWIN) || defined(ANDROID) || defined(MOZ_WIDGET_QT)
|
||||
#elif defined(XP_DARWIN) || defined(ANDROID)
|
||||
typedef intptr_t NativeWindowHandle; // never actually used, will always be 0
|
||||
#else
|
||||
#error Need NativeWindowHandle for this platform
|
||||
|
@ -4,12 +4,6 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
#include <QtCore/QTimer>
|
||||
#include "nsQAppInstance.h"
|
||||
#include "NestedLoopTimer.h"
|
||||
#endif
|
||||
|
||||
#include "mozilla/plugins/PluginModuleChild.h"
|
||||
|
||||
/* This must occur *after* plugins/PluginModuleChild.h to avoid typedefs conflicts. */
|
||||
@ -73,12 +67,6 @@ namespace {
|
||||
PluginModuleChild* gChromeInstance = nullptr;
|
||||
} // namespace
|
||||
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
typedef void (*_gtk_init_fn)(int argc, char **argv);
|
||||
static _gtk_init_fn s_gtk_init = nullptr;
|
||||
static PRLibrary *sGtkLib = nullptr;
|
||||
#endif
|
||||
|
||||
#ifdef XP_WIN
|
||||
// Hooking CreateFileW for protected-mode magic
|
||||
static WindowsDllInterceptor sKernel32Intercept;
|
||||
@ -131,8 +119,6 @@ PluginModuleChild::PluginModuleChild(bool aIsChrome)
|
||||
, mGetEntryPointsFunc(0)
|
||||
#elif defined(MOZ_WIDGET_GTK)
|
||||
, mNestedLoopTimerId(0)
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
, mNestedLoopTimerObject(0)
|
||||
#endif
|
||||
#ifdef OS_WIN
|
||||
, mNestedEventHook(nullptr)
|
||||
@ -548,26 +534,6 @@ PluginModuleChild::ExitedCxxStack()
|
||||
g_source_remove(mNestedLoopTimerId);
|
||||
mNestedLoopTimerId = 0;
|
||||
}
|
||||
#elif defined (MOZ_WIDGET_QT)
|
||||
|
||||
void
|
||||
PluginModuleChild::EnteredCxxStack()
|
||||
{
|
||||
MOZ_ASSERT(mNestedLoopTimerObject == nullptr,
|
||||
"previous timer not descheduled");
|
||||
mNestedLoopTimerObject = new NestedLoopTimer(this);
|
||||
QTimer::singleShot(kNestedLoopDetectorIntervalMs,
|
||||
mNestedLoopTimerObject, SLOT(timeOut()));
|
||||
}
|
||||
|
||||
void
|
||||
PluginModuleChild::ExitedCxxStack()
|
||||
{
|
||||
MOZ_ASSERT(mNestedLoopTimerObject != nullptr,
|
||||
"nested loop timeout not scheduled");
|
||||
delete mNestedLoopTimerObject;
|
||||
mNestedLoopTimerObject = nullptr;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -628,19 +594,6 @@ PluginModuleChild::InitGraphics()
|
||||
real_gtk_plug_embedded = *embedded;
|
||||
*embedded = wrap_gtk_plug_embedded;
|
||||
|
||||
#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");
|
||||
#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
|
||||
@ -654,15 +607,6 @@ PluginModuleChild::InitGraphics()
|
||||
void
|
||||
PluginModuleChild::DeinitGraphics()
|
||||
{
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
nsQAppInstance::Release();
|
||||
if (sGtkLib) {
|
||||
PR_UnloadLibrary(sGtkLib);
|
||||
sGtkLib = nullptr;
|
||||
s_gtk_init = nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_X11) && defined(NS_FREE_PERMANENT_DATA)
|
||||
// We free some data off of XDisplay close hooks, ensure they're
|
||||
// run. Closing the display is pretty scary, so we only do it to
|
||||
@ -1149,7 +1093,7 @@ _getvalue(NPP aNPP,
|
||||
switch (aVariable) {
|
||||
// Copied from nsNPAPIPlugin.cpp
|
||||
case NPNVToolkit:
|
||||
#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
*static_cast<NPNToolkitType*>(aValue) = NPNVGtk2;
|
||||
return NPERR_NO_ERROR;
|
||||
#endif
|
||||
|
@ -52,11 +52,6 @@ class PCrashReporterChild;
|
||||
|
||||
namespace plugins {
|
||||
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
class NestedLoopTimer;
|
||||
static const int kNestedLoopDetectorIntervalMs = 90;
|
||||
#endif
|
||||
|
||||
class PluginInstanceChild;
|
||||
|
||||
class PluginModuleChild : public PPluginModuleChild
|
||||
@ -261,10 +256,6 @@ private:
|
||||
static gboolean DetectNestedEventLoop(gpointer data);
|
||||
static gboolean ProcessBrowserEvents(gpointer data);
|
||||
|
||||
virtual void EnteredCxxStack() override;
|
||||
virtual void ExitedCxxStack() override;
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
|
||||
virtual void EnteredCxxStack() override;
|
||||
virtual void ExitedCxxStack() override;
|
||||
#endif
|
||||
@ -328,8 +319,6 @@ private:
|
||||
// MessagePumpForUI.
|
||||
int mTopLoopDepth;
|
||||
# endif
|
||||
#elif defined (MOZ_WIDGET_QT)
|
||||
NestedLoopTimer *mNestedLoopTimerObject;
|
||||
#endif
|
||||
|
||||
public: // called by PluginInstanceChild
|
||||
|
@ -4,10 +4,6 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
#include "PluginHelperQt.h"
|
||||
#endif
|
||||
|
||||
#include "mozilla/plugins/PluginModuleParent.h"
|
||||
|
||||
#include "base/process_util.h"
|
||||
@ -2859,18 +2855,7 @@ PluginModuleParent::ContentsScaleFactorChanged(NPP instance, double aContentsSca
|
||||
}
|
||||
#endif // #if defined(XP_MACOSX)
|
||||
|
||||
#if defined(MOZ_WIDGET_QT)
|
||||
bool
|
||||
PluginModuleParent::AnswerProcessSomeEvents()
|
||||
{
|
||||
PLUGIN_LOG_DEBUG(("Spinning mini nested loop ..."));
|
||||
PluginHelperQt::AnswerProcessSomeEvents();
|
||||
PLUGIN_LOG_DEBUG(("... quitting mini nested loop"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#elif defined(XP_MACOSX)
|
||||
#if defined(XP_MACOSX)
|
||||
bool
|
||||
PluginModuleParent::AnswerProcessSomeEvents()
|
||||
{
|
||||
|
@ -6,9 +6,7 @@
|
||||
|
||||
toolkit = CONFIG['MOZ_WIDGET_TOOLKIT']
|
||||
|
||||
if toolkit == 'qt':
|
||||
DIRS += ['qt']
|
||||
elif toolkit == 'windows':
|
||||
if toolkit == 'windows':
|
||||
DIRS += ['windows']
|
||||
elif toolkit == 'cocoa':
|
||||
DIRS += ['mac']
|
||||
|
@ -10,7 +10,7 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
|
||||
DIRS += ['mac']
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
|
||||
DIRS += ['android']
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] in ('qt', 'gtk2', 'gtk3'):
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'):
|
||||
DIRS += ['unix']
|
||||
else:
|
||||
DIRS += ['emacs']
|
||||
|
Loading…
Reference in New Issue
Block a user