This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goclient. commit 9274e2c679a41a8c3cdbb8ac8c1c6fb241532fc5 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Mar 14 02:20:50 2018 +0100 x2gobrowserplugin-2.4_1/: remove. --- debian/changelog | 1 + x2gobrowserplugin-2.4_1/src/qtbrowserplugin.cpp | 1703 -------------------- x2gobrowserplugin-2.4_1/src/qtbrowserplugin.def | 4 - x2gobrowserplugin-2.4_1/src/qtbrowserplugin.h | 176 -- x2gobrowserplugin-2.4_1/src/qtbrowserplugin.pri | 74 - .../src/qtbrowserplugin_mac.cpp | 560 ------- x2gobrowserplugin-2.4_1/src/qtbrowserplugin_p.h | 94 -- .../src/qtbrowserplugin_win.cpp | 194 --- .../src/qtbrowserplugin_x11.cpp | 150 -- x2gobrowserplugin-2.4_1/src/qtbrowserpluginax.def | 9 - x2gobrowserplugin-2.4_1/src/qtnpapi.h | 555 ------- x2gobrowserplugin-2.4_1/src/res/x2goplugin.rc | 37 - 12 files changed, 1 insertion(+), 3556 deletions(-) diff --git a/debian/changelog b/debian/changelog index 450013e..dfe23cc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -35,6 +35,7 @@ x2goclient (4.1.2.0-0x2go1) UNRELEASED; urgency=medium and translation files for now. - Makefile: remove plugin references. - Makefile: remove x2goclient_*.qm files in clean rule. + - x2gobrowserplugin-2.4_1/: remove. * x2goclient.spec: - Remove plugin references. * debian/rules: diff --git a/x2gobrowserplugin-2.4_1/src/qtbrowserplugin.cpp b/x2gobrowserplugin-2.4_1/src/qtbrowserplugin.cpp deleted file mode 100644 index 06010d1..0000000 --- a/x2gobrowserplugin-2.4_1/src/qtbrowserplugin.cpp +++ /dev/null @@ -1,1703 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of a Qt Solutions component. -** -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -****************************************************************************/ - -#include <QtGui> - -#include "qtnpapi.h" - -#include "qtbrowserplugin.h" -#include "qtbrowserplugin_p.h" - -#ifndef WINAPI -# ifdef Q_WS_WIN -# define WINAPI __stdcall -# else -# define WINAPI -# endif -#endif - -#ifdef Q_WS_X11 -# ifdef Bool -# undef Bool -# endif - -/* -static void debuginfo(const QString &str) -{ - static bool inited = false; - QFile file("/tmp/qnsdebug.txt"); - if (file.open(QFile::WriteOnly | QFile::Append)) { - if (!inited) { - file.write("\n\n*** New run started ***\n"); - inited = true; - } - file.write(qtNPFactory()->pluginName().toLatin1() + ": " + str.toLatin1() + '\n'); - file.close(); - } -} -*/ - -#endif - -static QtNPFactory *qNP = 0; -static NPNetscapeFuncs *qNetscapeFuncs = 0; - -// The single global plugin -QtNPFactory *qtNPFactory() -{ - extern QtNPFactory *qtns_instantiate(); - - if (!qNP) { - qNP = qtns_instantiate(); - } - - return qNP; -} - -// NPN functions, forwarding to function pointers provided by browser -void NPN_Version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor) -{ - Q_ASSERT(qNetscapeFuncs); - *plugin_major = NP_VERSION_MAJOR; - *plugin_minor = NP_VERSION_MINOR; - *netscape_major = qNetscapeFuncs->version >> 8; // Major version is in high byte - *netscape_minor = qNetscapeFuncs->version & 0xFF; // Minor version is in low byte -} - -#define NPN_Prolog(x) \ - Q_ASSERT(qNetscapeFuncs); \ - Q_ASSERT(qNetscapeFuncs->x); \ - - -const char *NPN_UserAgent(NPP instance) -{ - NPN_Prolog(uagent); - return FIND_FUNCTION_POINTER(NPN_UserAgentFP, qNetscapeFuncs->uagent)(instance); -} - -void NPN_Status(NPP instance, const char* message) -{ - NPN_Prolog(status); - FIND_FUNCTION_POINTER(NPN_StatusFP, qNetscapeFuncs->status)(instance, message); -} - -NPError NPN_GetURL(NPP instance, const char* url, const char* window) -{ - NPN_Prolog(geturl); - return FIND_FUNCTION_POINTER(NPN_GetURLFP, qNetscapeFuncs->geturl)(instance, url, window); -} - -NPError NPN_GetURLNotify(NPP instance, const char* url, const char* window, void* notifyData) -{ - if ((qNetscapeFuncs->version & 0xFF) < NPVERS_HAS_NOTIFICATION) - return NPERR_INCOMPATIBLE_VERSION_ERROR; - - NPN_Prolog(geturlnotify); - return FIND_FUNCTION_POINTER(NPN_GetURLNotifyFP, qNetscapeFuncs->geturlnotify)(instance, url, window, notifyData); -} - -NPError NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file, void* notifyData) -{ - if ((qNetscapeFuncs->version & 0xFF) < NPVERS_HAS_NOTIFICATION) - return NPERR_INCOMPATIBLE_VERSION_ERROR; - - NPN_Prolog(posturlnotify); - return FIND_FUNCTION_POINTER(NPN_PostURLNotifyFP, qNetscapeFuncs->posturlnotify)(instance, url, window, len, buf, file, notifyData); -} - -void* NPN_MemAlloc(uint32 size) -{ - NPN_Prolog(memalloc); - return FIND_FUNCTION_POINTER(NPN_MemAllocFP, qNetscapeFuncs->memalloc)(size); -} - -void NPN_MemFree(void* ptr) -{ - NPN_Prolog(memfree); - FIND_FUNCTION_POINTER(NPN_MemFreeFP, qNetscapeFuncs->memfree)(ptr); -} - -uint32 NPN_MemFlush(uint32 size) -{ - NPN_Prolog(memflush); - return FIND_FUNCTION_POINTER(NPN_MemFlushFP, qNetscapeFuncs->memflush)(size); -} - -NPError NPN_GetValue(NPP instance, NPNVariable variable, void *ret_value) -{ - NPN_Prolog(getvalue); - return FIND_FUNCTION_POINTER(NPN_GetValueFP, qNetscapeFuncs->getvalue)(instance, variable, ret_value); -} - -NPError NPN_SetValue(NPP instance, NPPVariable variable, void *ret_value) -{ - NPN_Prolog(setvalue); - return FIND_FUNCTION_POINTER(NPN_SetValueFP, qNetscapeFuncs->setvalue)(instance, variable, ret_value); -} - -NPIdentifier NPN_GetStringIdentifier(const char* name) -{ - NPN_Prolog(getstringidentifier); - return FIND_FUNCTION_POINTER(NPN_GetStringIdentifierFP, qNetscapeFuncs->getstringidentifier)(name); -} - -void NPN_GetStringIdentifiers(const char** names, int32 nameCount, NPIdentifier* identifiers) -{ - NPN_Prolog(getstringidentifiers); - FIND_FUNCTION_POINTER(NPN_GetStringIdentifiersFP, qNetscapeFuncs->getstringidentifiers)(names, nameCount, identifiers); -} - -NPIdentifier NPN_GetIntIdentifier(int32 intid) -{ - NPN_Prolog(getintidentifier); - return FIND_FUNCTION_POINTER(NPN_GetIntIdentifierFP, qNetscapeFuncs->getintidentifier)(intid); -} - -bool NPN_IdentifierIsString(NPIdentifier identifier) -{ - NPN_Prolog(identifierisstring); - return FIND_FUNCTION_POINTER(NPN_IdentifierIsStringFP, qNetscapeFuncs->identifierisstring)(identifier); -} - -char* NPN_UTF8FromIdentifier(NPIdentifier identifier) -{ - NPN_Prolog(utf8fromidentifier); - return FIND_FUNCTION_POINTER(NPN_UTF8FromIdentifierFP, qNetscapeFuncs->utf8fromidentifier)(identifier); -} - -int32 NPN_IntFromIdentifier(NPIdentifier identifier) -{ - NPN_Prolog(intfromidentifier); - return FIND_FUNCTION_POINTER(NPN_IntFromIdentifierFP, qNetscapeFuncs->intfromidentifier)(identifier); -} - -NPObject* NPN_CreateObject(NPP npp, NPClass *aClass) -{ - NPN_Prolog(createobject); - return FIND_FUNCTION_POINTER(NPN_CreateObjectFP, qNetscapeFuncs->createobject)(npp, aClass); -} - -NPObject* NPN_RetainObject(NPObject *obj) -{ - NPN_Prolog(retainobject); - return FIND_FUNCTION_POINTER(NPN_RetainObjectFP, qNetscapeFuncs->retainobject)(obj); -} - -void NPN_ReleaseObject(NPObject *obj) -{ - NPN_Prolog(releaseobject); - FIND_FUNCTION_POINTER(NPN_ReleaseObjectFP, qNetscapeFuncs->releaseobject)(obj); -} - -// Scripting implementation (QObject calling JavaScript in browser) - we don't use those -bool NPN_Invoke(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, int32 argCount, NPVariant *result) -{ - NPN_Prolog(invoke); - return FIND_FUNCTION_POINTER(NPN_InvokeFP, qNetscapeFuncs->invoke)(npp, obj, methodName, args, argCount, result); -} - -bool NPN_InvokeDefault(NPP npp, NPObject* obj, const NPVariant *args, int32 argCount, NPVariant *result) -{ - NPN_Prolog(invokedefault); - return FIND_FUNCTION_POINTER(NPN_InvokeDefaultFP, qNetscapeFuncs->invokedefault)(npp, obj, args, argCount, result); -} - -bool NPN_Evaluate(NPP npp, NPObject *obj, NPString *script, NPVariant *result) -{ - NPN_Prolog(evaluate); - return FIND_FUNCTION_POINTER(NPN_EvaluateFP, qNetscapeFuncs->evaluate)(npp, obj, script, result); -} - -bool NPN_GetProperty(NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result) -{ - NPN_Prolog(getproperty); - return FIND_FUNCTION_POINTER(NPN_GetPropertyFP, qNetscapeFuncs->getproperty)(npp, obj, propertyName, result); -} - -bool NPN_SetProperty(NPP npp, NPObject *obj, NPIdentifier propertyName, const NPVariant *value) -{ - NPN_Prolog(setproperty); - return FIND_FUNCTION_POINTER(NPN_SetPropertyFP, qNetscapeFuncs->setproperty)(npp, obj, propertyName, value); -} - -bool NPN_RemoveProperty(NPP npp, NPObject *obj, NPIdentifier propertyName) -{ - NPN_Prolog(removeproperty); - return FIND_FUNCTION_POINTER(NPN_RemovePropertyFP, qNetscapeFuncs->removeproperty)(npp, obj, propertyName); -} - -bool NPN_HasProperty(NPP npp, NPObject *obj, NPIdentifier propertyName) -{ - NPN_Prolog(hasproperty); - return FIND_FUNCTION_POINTER(NPN_HasPropertyFP, qNetscapeFuncs->hasproperty)(npp, obj, propertyName); -} - -bool NPN_HasMethod(NPP npp, NPObject *obj, NPIdentifier methodName) -{ - NPN_Prolog(hasmethod); - return FIND_FUNCTION_POINTER(NPN_HasMethodFP, qNetscapeFuncs->hasmethod)(npp, obj, methodName); -} - -void NPN_ReleaseVariantValue(NPVariant *variant) -{ - NPN_Prolog(releasevariantvalue); - FIND_FUNCTION_POINTER(NPN_ReleaseVariantValueFP, qNetscapeFuncs->releasevariantvalue)(variant); -} - -void NPN_SetException(NPObject *obj, const char *message) -{ - qDebug("NPN_SetException: %s", message); - NPN_Prolog(setexception); - FIND_FUNCTION_POINTER(NPN_SetExceptionFP, qNetscapeFuncs->setexception)(obj, message); -} - -// Scripting implementation (JavaScript calling QObject) -#define NPClass_Prolog \ - if (!npobj->_class) return false; \ - if (!npobj->_class->qtnp) return false; \ - QtNPInstance *This = npobj->_class->qtnp; \ - if (!This->qt.object) return false; \ - QObject *qobject = This->qt.object \ - - -static NPObject *NPAllocate(NPP npp, NPClass *aClass) -{ - Q_UNUSED(npp); - Q_UNUSED(aClass); - - Q_ASSERT(false); - return 0; -} - -static void NPDeallocate(NPObject *npobj) -{ - Q_UNUSED(npobj); - - Q_ASSERT(false); - return; -} - -static void NPInvalidate(NPObject *npobj) -{ - if (npobj) - delete npobj->_class; - npobj->_class = 0; -} - -enum MetaOffset { MetaProperty, MetaMethod }; - -static int metaOffset(const QMetaObject *metaObject, MetaOffset offsetType) -{ - int classInfoIndex = metaObject->indexOfClassInfo("ToSuperClass"); - if (classInfoIndex == -1) - return 0; - QByteArray ToSuperClass = metaObject->classInfo(classInfoIndex).value(); - int offset = offsetType == MetaProperty ? metaObject->propertyOffset() - : metaObject->methodOffset(); - - while (ToSuperClass != metaObject->className()) { - metaObject = metaObject->superClass(); - if (!metaObject) - break; - offset -= offsetType == MetaProperty ? metaObject->propertyCount() - : metaObject->methodCount(); - } - return offset; -} - -static int publicMethodIndex(NPObject *npobj, const QByteArray &slotName, int argCount = -1) -{ - NPClass_Prolog; - const QMetaObject *metaObject = qobject->metaObject(); - for (int slotIndex = metaOffset(metaObject, MetaMethod); slotIndex < metaObject->methodCount(); ++slotIndex) { - const QMetaMethod slot = qobject->metaObject()->method(slotIndex); - if (slot.access() != QMetaMethod::Public || slot.methodType() == QMetaMethod::Signal) - continue; - QByteArray signature = slot.signature(); - if (signature.left(signature.indexOf('(')) == slotName) { - if (argCount == -1 || slot.parameterTypes().count() == argCount) - return slotIndex; - } - } - return -1; -} - -static bool NPClass_HasMethod(NPObject *npobj, NPIdentifier name) -{ - NPClass_Prolog; - Q_UNUSED(qobject); - return publicMethodIndex(npobj, NPN_UTF8FromIdentifier(name)) != -1; -} - -static bool NPClass_Invoke(NPObject *npobj, NPIdentifier name, const NPVariant *args, uint32 argCount, NPVariant *result) -{ - NPClass_Prolog; - const QByteArray slotName = NPN_UTF8FromIdentifier(name); - int slotIndex = publicMethodIndex(npobj, slotName, static_cast<int>(argCount)); - if (slotIndex == -1) { - NPN_SetException(npobj, QByteArray("No method '" + slotName + "' with " + QByteArray::number(argCount) + " parameters").constData()); - return false; - } - - const QMetaMethod slot = qobject->metaObject()->method(slotIndex); - QList<QByteArray> parameterTypes = slot.parameterTypes(); - if (parameterTypes.count() != static_cast<int>(argCount)) { - NPN_SetException(npobj, QByteArray("Wrong parameter count for method " + slotName).constData()); - return false; - } - - QVariant returnVariant(QVariant::nameToType(slot.typeName()), (void*)0); - QVector<QVariant> variants(parameterTypes.count()); // keep data alive - QVector<const void*> metacallArgs(parameterTypes.count() + 1); // arguments for qt_metacall - metacallArgs[0] = returnVariant.data(); // args[0] == return value - - for (int p = 0; p < parameterTypes.count(); ++p) { - QVariant::Type type = QVariant::nameToType(parameterTypes.at(p)); - if (type == QVariant::Invalid && parameterTypes.at(p) != "QVariant") { - NPN_SetException(npobj, QString("Parameter %1 in method '%2' has invalid type") - .arg(p).arg(QString::fromUtf8(slotName)).toAscii().constData()); - return false; - } - QVariant qvar = args[p]; - if (type != QVariant::Invalid && !qvar.convert(type)) { - NPN_SetException(npobj, QString("Parameter %1 to method '%2' needs to be convertible to '%3'") - .arg(p).arg(QString::fromUtf8(slotName)).arg(QString::fromAscii(parameterTypes.at(p))).toAscii().constData()); - return false; - } - - variants[p] = qvar; - if (type == QVariant::Invalid) - metacallArgs[p + 1] = &variants.at(p); - else - metacallArgs[p + 1] = variants.at(p).constData(); // must not detach! - } - - qobject->qt_metacall(QMetaObject::InvokeMetaMethod, slotIndex, const_cast<void**>(metacallArgs.data())); - if (returnVariant.isValid() && result) - *result = NPVariant::fromQVariant(This, returnVariant); - - return true; -} - -static bool NPClass_InvokeDefault(NPObject * /*npobj*/, const NPVariant * /*args*/, uint32 /*argCount*/, NPVariant * /*result*/) -{ - return false; -} - -static bool NPClass_HasProperty(NPObject *npobj, NPIdentifier name) -{ - NPClass_Prolog; - const QByteArray qname = NPN_UTF8FromIdentifier(name); - const QMetaObject *metaObject = qobject->metaObject(); - int propertyIndex = metaObject->indexOfProperty(qname); - if (propertyIndex == -1 || propertyIndex < metaOffset(metaObject, MetaProperty)) - return false; - QMetaProperty property = qobject->metaObject()->property(propertyIndex); - if (!property.isScriptable()) - return false; - - return true; -} - -static bool NPClass_GetProperty(NPObject *npobj, NPIdentifier name, NPVariant *result) -{ - NPClass_Prolog; - const QByteArray qname = NPN_UTF8FromIdentifier(name); - QVariant qvar = qobject->property(qname); - if (!qvar.isValid()) { - NPN_SetException(npobj, QByteArray("Failed to get value for property " + qname).constData()); - return false; - } - *result = NPVariant::fromQVariant(This, qvar); - return true; -} - -static bool NPClass_SetProperty(NPObject *npobj, NPIdentifier name, const NPVariant *result) -{ - NPClass_Prolog; - const QByteArray qname = NPN_UTF8FromIdentifier(name); - QVariant qvar = *result; - return qobject->setProperty(qname, qvar); -} - -static bool NPClass_RemoveProperty(NPObject * /*npobj*/, NPIdentifier /*name*/) -{ - return false; -} - -NPClass::NPClass(QtNPInstance *This) -{ - structVersion = NP_CLASS_STRUCT_VERSION; - allocate = 0; - deallocate = 0; - invalidate = NPInvalidate; - hasMethod = NPClass_HasMethod; - invoke = NPClass_Invoke; - invokeDefault = NPClass_InvokeDefault; - hasProperty = NPClass_HasProperty; - getProperty = NPClass_GetProperty; - setProperty = NPClass_SetProperty; - removeProperty = NPClass_RemoveProperty; - qtnp = This; - delete_qtnp = false; -} - -NPClass::~NPClass() -{ - if (delete_qtnp) - delete qtnp; -} - -// Type conversions -NPString NPString::fromQString(const QString &qstr) -{ - NPString npstring; - const QByteArray qutf8 = qstr.toUtf8(); - - npstring.utf8length = qutf8.length(); - npstring.utf8characters = (char*)NPN_MemAlloc(npstring.utf8length); - memcpy((char*)npstring.utf8characters, qutf8.constData(), npstring.utf8length); - - return npstring; -} - -NPString::operator QString() const -{ - return QString::fromUtf8(utf8characters, utf8length); -} - -NPVariant NPVariant::fromQVariant(QtNPInstance *This, const QVariant &qvariant) -{ - Q_ASSERT(This); - NPVariant npvar; - npvar.type = Null; - - QVariant qvar(qvariant); - switch(qvariant.type()) { - case QVariant::Bool: - npvar.value.boolValue = qvar.toBool(); - npvar.type = Boolean; - break; - case QVariant::Int: - npvar.value.intValue = qvar.toInt(); - npvar.type = Int32; - break; - case QVariant::Double: - npvar.value.doubleValue = qvar.toDouble(); - npvar.type = Double; - break; - case QVariant::UserType: - { - QByteArray userType = qvariant.typeName(); - if (userType.endsWith('*')) { - QtNPInstance *that = new QtNPInstance; - that->npp = This->npp; - that->qt.object = *(QObject**)qvariant.constData(); - NPClass *npclass = new NPClass(that); - npclass->delete_qtnp = true; - npvar.value.objectValue = NPN_CreateObject(This->npp, npclass); - npvar.type = Object; - } - } - break; - default: // including QVariant::String - if (!qvar.convert(QVariant::String)) - break; - npvar.type = String; - npvar.value.stringValue = NPString::fromQString(qvar.toString()); - break; - } - - return npvar; -} - -NPVariant::operator QVariant() const -{ - switch(type) { - case Void: - case Null: - return QVariant(); - case Object: - { - if (!value.objectValue || !value.objectValue->_class) - break; - NPClass *aClass = value.objectValue->_class; - // not one of ours? - if (aClass->invoke != NPClass_Invoke) - break; - // or just empty for some reason - QObject *qobject = aClass->qtnp->qt.object; - if (!qobject) - break; - QByteArray typeName = qobject->metaObject()->className(); - int userType = QMetaType::type(typeName + "*"); - if (userType == QVariant::Invalid) - break; - QVariant result(userType, &aClass->qtnp->qt.object); - // sanity check - Q_ASSERT(*(QObject**)result.constData() == aClass->qtnp->qt.object); - return result; - } - case Boolean: - return value.boolValue; - case Int32: - return value.intValue; - case Double: - return value.doubleValue; - case String: - return QString(value.stringValue); - default: - break; - } - return QVariant(); -} - -// Helper class for handling incoming data -class QtNPStream -{ -public: - QtNPStream(NPP instance, NPStream *st); - virtual ~QtNPStream() - { - } - - QString url() const; - bool finish(QtNPBindable *bindable); - - QByteArray buffer; - QFile file; - QString mime; - - NPError reason; - - NPP npp; - NPStream* stream; - -protected: - qint64 readData(char *, qint64); - qint64 writeData(const char *, qint64); -}; - -QtNPStream::QtNPStream(NPP instance, NPStream *st) - : reason(NPRES_DONE), npp(instance), stream(st) -{ -} - -/*! - Returns the URL from which the stream was created, or the empty string - for write-only streams. -*/ -QString QtNPStream::url() const -{ - if (!stream) - return QString(); - return QString::fromLocal8Bit(stream->url); -} - -class ErrorBuffer : public QBuffer -{ - friend class QtNPStream; -}; - -bool QtNPStream::finish(QtNPBindable *bindable) -{ - if (!bindable) - return false; - - bool res = false; - if (bindable) { - switch(reason) { - case NPRES_DONE: - // no data at all? url is probably local file (Opera) - if (buffer.isEmpty() && file.fileName().isEmpty()) { - QUrl u = QUrl::fromEncoded(stream->url); - QString lfn = u.toLocalFile(); - if (lfn.startsWith("//localhost/")) - lfn = lfn.mid(12); - file.setFileName(lfn); - } - - if (file.exists()) { - file.setObjectName(url()); - res = bindable->readData(&file, mime); - } else { - QBuffer io(&buffer); - io.setObjectName(url()); - res = bindable->readData(&io, mime); - } - break; - case NPRES_USER_BREAK: - { - ErrorBuffer empty; - empty.setObjectName(url()); - empty.setErrorString("User cancelled operation."), - res = bindable->readData(&empty, mime); - } - break; - case NPRES_NETWORK_ERR: - { - ErrorBuffer empty; - empty.setObjectName(url()); - empty.setErrorString("Network error during download."), - res = bindable->readData(&empty, mime); - } - break; - default: - break; - } - } - stream->pdata = 0; - delete this; - return res; -} - -// Helper class for forwarding signal emissions to the respective JavaScript -class QtSignalForwarder : public QObject -{ -public: - QtSignalForwarder(QtNPInstance *that) - : This(that), domNode(0) - { - } - - ~QtSignalForwarder() - { - if (domNode) - NPN_ReleaseObject(domNode); - } - - int qt_metacall(QMetaObject::Call call, int index, void **args); - -private: - QtNPInstance *This; - NPObject *domNode; -}; - -int QtSignalForwarder::qt_metacall(QMetaObject::Call call, int index, void **args) -{ - // no support for QObject method/properties etc! - if (!This || !This->npp || call != QMetaObject::InvokeMetaMethod - || !This->qt.object) - return index; - - switch (index) { - case -1: - { - QString msg = *(QString*)args[1]; - NPN_Status(This->npp, msg.toLocal8Bit().constData()); - } - break; - default: - { - QObject *qobject = This->qt.object; - if (!domNode) - NPN_GetValue(This->npp, NPNVPluginElementNPObject, &domNode); - if (!domNode) - break; - const QMetaObject *metaObject = qobject->metaObject(); - if (index < metaOffset(metaObject, MetaMethod)) - break; - - const QMetaMethod method = metaObject->method(index); - Q_ASSERT(method.methodType() == QMetaMethod::Signal); - - QByteArray signalSignature = method.signature(); - QByteArray scriptFunction = signalSignature.left(signalSignature.indexOf('(')); - NPIdentifier id = NPN_GetStringIdentifier(scriptFunction.constData()); - if (NPN_HasMethod(This->npp, domNode, id)) { - QList<QByteArray> parameterTypes = method.parameterTypes(); - QVector<NPVariant> parameters; - NPVariant result; - bool error = false; - for (int p = 0; p < parameterTypes.count(); ++p) { - QVariant::Type type = QVariant::nameToType(parameterTypes.at(p)); - if (type == QVariant::Invalid) { - NPN_SetException(domNode, QByteArray("Unsupported parameter type in ") + scriptFunction); - error = true; - break; - } - QVariant qvar(type, args[p + 1]); - NPVariant npvar = NPVariant::fromQVariant(This, qvar); - if (npvar.type == NPVariant::Null || npvar.type == NPVariant::Void) { - NPN_SetException(domNode, QByteArray("Unsupported parameter value in ") + scriptFunction); - error =true; - break; - } - parameters += npvar; - } - if (error) - break; - - NPError nperror = NPN_Invoke(This->npp, domNode, id, parameters.constData(), parameters.count(), &result); - if (nperror != NPERR_NO_ERROR && false) { // disabled, as NPN_Invoke seems to always return GENERICERROR - NPN_SetException(domNode, QByteArray("Error invoking event handler ") + scriptFunction); - } - // ### TODO: update return value (args[0]) (out-parameters not supported anyway) - NPN_ReleaseVariantValue(&result); - } - } - break; - } - - return index; -} - - -// Plugin functions -extern "C" NPError -NPP_GetValue(NPP instance, NPPVariable variable, void *value) -{ - if (!instance || !instance->pdata) - return NPERR_INVALID_INSTANCE_ERROR; - - QtNPInstance* This = (QtNPInstance*) instance->pdata; - - switch (variable) { - case NPPVpluginNameString: - { - static QByteArray name = qtNPFactory()->pluginName().toLocal8Bit(); - *(const char**)value = name.constData(); - } - break; - case NPPVpluginDescriptionString: - { - static QByteArray description = qtNPFactory()->pluginDescription().toLocal8Bit(); - *(const char**)value = description.constData(); - } - break; - -#ifdef Q_WS_X11 - case NPPVpluginNeedsXEmbed: - *(int*)value = true; // PRBool = int - break; -#endif - - case NPPVpluginScriptableNPObject: - { - NPObject *object = NPN_CreateObject(instance, new NPClass(This)); - *(NPObject**)value = object; - } - break; - case NPPVformValue: - { - QObject *object = This->qt.object; - const QMetaObject *metaObject = object->metaObject(); - int defaultIndex = metaObject->indexOfClassInfo("DefaultProperty"); - if (defaultIndex == -1) - return NPERR_GENERIC_ERROR; - QByteArray defaultProperty = metaObject->classInfo(defaultIndex).value(); - if (defaultProperty.isEmpty()) - return NPERR_GENERIC_ERROR; - QVariant defaultValue = object->property(defaultProperty); - if (!defaultValue.isValid()) - return NPERR_GENERIC_ERROR; - defaultProperty = defaultValue.toString().toUtf8(); - int size = defaultProperty.size(); - char *utf8 = (char*)NPN_MemAlloc(size + 1); - memcpy(utf8, defaultProperty.constData(), size); - utf8[size] = 0; // null-terminator - *(void**)value = utf8; - } - break; - default: - return NPERR_GENERIC_ERROR; - } - - return NPERR_NO_ERROR; -} - -extern "C" NPError -NPP_SetValue(NPP instance, NPPVariable variable, void *value) -{ - Q_UNUSED(variable); - Q_UNUSED(value); - - if (!instance || !instance->pdata) - return NPERR_INVALID_INSTANCE_ERROR; - - /* - switch(variable) { - default: - return NPERR_GENERIC_ERROR; - } - */ - return NPERR_NO_ERROR; -} - -extern "C" int16 NPP_Event(NPP instance, NPEvent* event) -{ - if (!instance || !instance->pdata) - return NPERR_INVALID_INSTANCE_ERROR; - - QtNPInstance* This = (QtNPInstance*) instance->pdata; - extern bool qtns_event(QtNPInstance *, NPEvent *); - return qtns_event(This, event) ? 1 : 0; -} - -#ifdef Q_WS_X11 -// Instance state information about the plugin. -extern "C" char* -NP_GetMIMEDescription(void) -{ - static QByteArray mime = qtNPFactory()->mimeTypes().join(";").toLocal8Bit(); - return (char*)mime.constData(); -} - -extern "C" NPError -NP_GetValue(void*, NPPVariable aVariable, void *aValue) -{ - NPError err = NPERR_NO_ERROR; - - static QByteArray name = qtNPFactory()->pluginName().toLocal8Bit(); - static QByteArray descr = qtNPFactory()->pluginDescription().toLocal8Bit(); - - switch (aVariable) { - case NPPVpluginNameString: - *static_cast<const char **> (aValue) = name.constData(); - break; - case NPPVpluginDescriptionString: - *static_cast<const char **>(aValue) = descr.constData(); - break; - case NPPVpluginNeedsXEmbed: - *static_cast<int*>(aValue) = true; - break; - case NPPVpluginTimerInterval: - case NPPVpluginKeepLibraryInMemory: - default: - err = NPERR_INVALID_PARAM; - break; - } - return err; -} -#endif - -/* -** NPP_New is called when your plugin is instantiated (i.e. when an EMBED -** tag appears on a page). -*/ -extern "C" NPError -NPP_New(NPMIMEType pluginType, - NPP instance, - uint16 mode, - int16 argc, - char* argn[], - char* argv[], - NPSavedData* /*saved*/) -{ - if (!instance) - return NPERR_INVALID_INSTANCE_ERROR; - - QtNPInstance* This = new QtNPInstance; - if (!This) - return NPERR_OUT_OF_MEMORY_ERROR; - - instance->pdata = This; - This->filter = 0; - This->bindable = 0; - This->npp = instance; - This->fMode = mode; // NP_EMBED, NP_FULL, or NP_BACKGROUND (see npapi.h) - This->window = 0; - This->qt.object = 0; -#ifdef Q_WS_MAC - This->rootWidget = 0; -#endif - This->pendingStream = 0; // stream might be created before instance - This->mimetype = QString::fromLatin1(pluginType); - This->notificationSeqNum = 0; - - for (int i = 0; i < argc; i++) { - QByteArray name = QByteArray(argn[i]).toLower(); - if (name == "id") - This->htmlID = argv[i]; - This->parameters[name] = QVariant(argv[i]); - } - - return NPERR_NO_ERROR; -} - -extern "C" NPError -NPP_Destroy(NPP instance, NPSavedData** /*save*/) -{ - if (!instance || !instance->pdata) - return NPERR_INVALID_INSTANCE_ERROR; - - QtNPInstance* This = (QtNPInstance*) instance->pdata; - -#ifdef Q_WS_X11 - //This->widget->destroy(false, false); // X has destroyed all windows -#endif - delete This->qt.object; - This->qt.object = 0; - delete This->filter; - This->filter = 0; - extern void qtns_destroy(QtNPInstance *This); - qtns_destroy(This); - delete This; - instance->pdata = 0; - - return NPERR_NO_ERROR; -} - -static QtNPInstance *next_pi = 0; // helper to connect to QtNPBindable - -extern "C" NPError -NPP_SetWindow(NPP instance, NPWindow* window) -{ - if (!instance) - return NPERR_INVALID_INSTANCE_ERROR; - - QtNPInstance* This = (QtNPInstance*) instance->pdata; - extern void qtns_setGeometry(QtNPInstance*, const QRect &, const QRect &); - - const QRect clipRect(window->clipRect.left, window->clipRect.top, - window->clipRect.right - window->clipRect.left, - window->clipRect.bottom - window->clipRect.top); - if (window) - This->geometry = QRect(window->x, window->y, window->width, window->height); - - // take a shortcut if all that was changed is the geometry - if (qobject_cast<QWidget*>(This->qt.object) && window && This->window == (QtNPInstance::Widget)window->window) { - qtns_setGeometry(This, This->geometry, clipRect); - return NPERR_NO_ERROR; - } - - delete This->qt.object; - This->qt.object = 0; - extern void qtns_destroy(QtNPInstance *This); - qtns_destroy(This); - - if (!window) { - This->window = 0; - return NPERR_NO_ERROR; - } - - This->window = (QtNPInstance::Widget)window->window; -#ifdef Q_WS_X11 - //This->display = ((NPSetWindowCallbackStruct *)window->ws_info)->display; -#endif - - extern void qtns_initialize(QtNPInstance*); - qtns_initialize(This); - - next_pi = This; - This->qt.object = qtNPFactory()->createObject(This->mimetype); - next_pi = 0; - - if (!This->qt.object) - return NPERR_NO_ERROR; - - if (!This->htmlID.isEmpty()) - This->qt.object->setObjectName(QLatin1String(This->htmlID)); - - This->filter = new QtSignalForwarder(This); - QStatusBar *statusbar = qFindChild<QStatusBar*>(This->qt.object); - if (statusbar) { - int statusSignal = statusbar->metaObject()->indexOfSignal("messageChanged(QString)"); - if (statusSignal != -1) { - QMetaObject::connect(statusbar, statusSignal, This->filter, -1); - statusbar->hide(); - } - } - - const QMetaObject *mo = This->qt.object->metaObject(); - for (int p = 0; p < mo->propertyCount(); ++p) { - const QMetaProperty property = mo->property(p); - QByteArray name(property.name()); - QVariant value = This->parameters.value(name.toLower()); - if (value.isValid()) - property.write(This->qt.object, value); - } - for (int methodIndex = 0; methodIndex < mo->methodCount(); ++methodIndex) { - const QMetaMethod method = mo->method(methodIndex); - if (method.methodType() == QMetaMethod::Signal) - QMetaObject::connect(This->qt.object, methodIndex, This->filter, methodIndex); - } - - if (This->pendingStream) { - This->pendingStream->finish(This->bindable); - This->pendingStream = 0; - } - - if (!qobject_cast<QWidget*>(This->qt.object)) - return NPERR_NO_ERROR; - - extern void qtns_embed(QtNPInstance*); - qtns_embed(This); - - QEvent e(QEvent::EmbeddingControl); - QApplication::sendEvent(This->qt.widget, &e); - - if (!This->qt.widget->testAttribute(Qt::WA_PaintOnScreen)) - This->qt.widget->setAutoFillBackground(true); - This->qt.widget->raise(); - qtns_setGeometry(This, This->geometry, clipRect); - This->qt.widget->show(); - - return NPERR_NO_ERROR; -} - -extern "C" NPError -NPP_NewStream(NPP instance, - NPMIMEType type, - NPStream *stream, - NPBool /*seekable*/, - uint16 *stype) -{ - if (!instance) - return NPERR_INVALID_INSTANCE_ERROR; - - QtNPInstance* This = (QtNPInstance*) instance->pdata; - if (!This) - return NPERR_NO_ERROR; - - QtNPStream *qstream = new QtNPStream(instance, stream); - qstream->mime = QString::fromLocal8Bit(type); - stream->pdata = qstream; - - // Workaround bug in Firefox/Gecko/Mozilla; observed in version 3.0.5 on Windows: - // On page reload, it does not call StreamAsFile() even when stype is AsFileOnly - if (QByteArray(NPN_UserAgent(instance)).contains("Mozilla")) - *stype = NP_NORMAL; - else - *stype = NP_ASFILEONLY; - - return NPERR_NO_ERROR; -} - -extern "C" int32 -NPP_WriteReady(NPP, NPStream *stream) -{ - if (stream->pdata) - return 0x0FFFFFFF; - return 0; -} - -// Both Netscape and FireFox call this for OnDemand streams as well... -extern "C" int32 -NPP_Write(NPP instance, NPStream *stream, int32 /*offset*/, int32 len, void *buffer) -{ - if (!instance || !stream || !stream->pdata) - return NPERR_INVALID_INSTANCE_ERROR; - - // this should not be called, as we always demand a download - QtNPStream *qstream = (QtNPStream*)stream->pdata; - QByteArray data((const char*)buffer, len); // make deep copy - qstream->buffer += data; - - return len; -} - -// Opera calls this for OnDemand streams without calling NPP_Write first -extern "C" NPError -NPP_DestroyStream(NPP instance, NPStream *stream, NPError reason) -{ - if (!instance || !instance->pdata || !stream || !stream->pdata) - return NPERR_INVALID_INSTANCE_ERROR; - - QtNPInstance *This = (QtNPInstance*)instance->pdata; - QtNPStream *qstream = (QtNPStream*)stream->pdata; - qstream->reason = reason; - - if (!This->qt.object) { // not yet initialized - This->pendingStream = qstream; - return NPERR_NO_ERROR; - } - - This->pendingStream = 0; - qstream->finish(This->bindable); - - return NPERR_NO_ERROR; -} - -extern "C" void -NPP_StreamAsFile(NPP instance, NPStream *stream, const char* fname) -{ - if (!instance || !stream || !stream->pdata) - return; - - QString path = QString::fromLocal8Bit(fname); -#ifdef Q_WS_MAC - path = "/" + path.section(':', 1).replace(':', '/'); -#endif - - QtNPStream *qstream = (QtNPStream*)stream->pdata; - qstream->file.setFileName(path); -} - -extern "C" void -NPP_URLNotify(NPP instance, - const char* url, - NPReason reason, - void* notifyData) -{ - if (!instance) - return; - QtNPInstance* This = (QtNPInstance*) instance->pdata; - if (!This->bindable) - return; - - QtNPBindable::Reason r; - switch (reason) { - case NPRES_DONE: - r = QtNPBindable::ReasonDone; - break; - case NPRES_USER_BREAK: - r = QtNPBindable::ReasonBreak; - break; - case NPRES_NETWORK_ERR: - r = QtNPBindable::ReasonError; - break; - default: - r = QtNPBindable::ReasonUnknown; - break; - } - - qint32 id = static_cast<qint32>(reinterpret_cast<size_t>(notifyData)); - if (id < 0) // Sanity check - id = 0; - - This->bindable->transferComplete(QString::fromLocal8Bit(url), id, r); -} - -extern "C" void -NPP_Print(NPP instance, NPPrint* printInfo) -{ - if(!printInfo || !instance) - return; - - QtNPInstance* This = (QtNPInstance*) instance->pdata; - if (!This->bindable) - return; - -/* - if (printInfo->mode == NP_FULL) { - printInfo->print.fullPrint.pluginPrinted = This->bindable->printFullPage(); - } else if (printInfo->mode == NP_EMBED) { - extern void qtns_print(QtNPInstance*, NPPrint*); - qtns_print(This, printInfo); - } -*/ -} - -// Plug-in entrypoints - these are called by the browser - -// Fills in functiontable used by browser to call entry points in plugin. -extern "C" NPError WINAPI NP_GetEntryPoints(NPPluginFuncs* pFuncs) -{ - if(!pFuncs) - return NPERR_INVALID_FUNCTABLE_ERROR; - if(!pFuncs->size) - pFuncs->size = sizeof(NPPluginFuncs); - else if (pFuncs->size < sizeof(NPPluginFuncs)) - return NPERR_INVALID_FUNCTABLE_ERROR; - - pFuncs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR; - pFuncs->newp = MAKE_FUNCTION_POINTER(NPP_New); - pFuncs->destroy = MAKE_FUNCTION_POINTER(NPP_Destroy); - pFuncs->setwindow = MAKE_FUNCTION_POINTER(NPP_SetWindow); - pFuncs->newstream = MAKE_FUNCTION_POINTER(NPP_NewStream); - pFuncs->destroystream = MAKE_FUNCTION_POINTER(NPP_DestroyStream); - pFuncs->asfile = MAKE_FUNCTION_POINTER(NPP_StreamAsFile); - pFuncs->writeready = MAKE_FUNCTION_POINTER(NPP_WriteReady); - pFuncs->write = MAKE_FUNCTION_POINTER(NPP_Write); - pFuncs->print = MAKE_FUNCTION_POINTER(NPP_Print); - pFuncs->event = MAKE_FUNCTION_POINTER(NPP_Event); - pFuncs->urlnotify = MAKE_FUNCTION_POINTER(NPP_URLNotify); - pFuncs->javaClass = 0; - pFuncs->getvalue = MAKE_FUNCTION_POINTER(NPP_GetValue); - pFuncs->setvalue = MAKE_FUNCTION_POINTER(NPP_SetValue); - return NPERR_NO_ERROR; -} - -enum NPNToolkitType -{ - NPNVGtk12 = 1, - NPNVGtk2 -}; - -#ifndef Q_WS_X11 -extern "C" NPError WINAPI NP_Initialize(NPNetscapeFuncs* pFuncs) -{ - if(!pFuncs) - return NPERR_INVALID_FUNCTABLE_ERROR; - - qNetscapeFuncs = pFuncs; - int navMajorVers = qNetscapeFuncs->version >> 8; - - // if the plugin's major version is lower than the Navigator's, - // then they are incompatible, and should return an error - if(navMajorVers > NP_VERSION_MAJOR) - return NPERR_INCOMPATIBLE_VERSION_ERROR; - - return NPERR_NO_ERROR; -} -#else -extern "C" NPError WINAPI NP_Initialize(NPNetscapeFuncs* nFuncs, NPPluginFuncs* pFuncs) -{ - if(!nFuncs) - return NPERR_INVALID_FUNCTABLE_ERROR; - - qNetscapeFuncs = nFuncs; - int navMajorVers = qNetscapeFuncs->version >> 8; - - // if the plugin's major version is lower than the Navigator's, - // then they are incompatible, and should return an error - if(navMajorVers > NP_VERSION_MAJOR) - return NPERR_INCOMPATIBLE_VERSION_ERROR; - - // check if the Browser supports the XEmbed protocol - int supportsXEmbed = 0; - NPError err = NPN_GetValue(0, NPNVSupportsXEmbedBool, (void *)&supportsXEmbed); - if (err != NPERR_NO_ERROR ||!supportsXEmbed) - return NPERR_INCOMPATIBLE_VERSION_ERROR; - - return NP_GetEntryPoints(pFuncs); -} -#endif - -extern "C" NPError WINAPI NP_Shutdown() -{ - delete qNP; - qNP = 0; - - extern void qtns_shutdown(); - qtns_shutdown(); - - qNetscapeFuncs = 0; - return NPERR_NO_ERROR; -} - - -/*! - \class QtNPBindable qtnetscape.h - \brief The QtNPBindable class provides an interface between a widget and the web browser. - - Inherit your plugin widget class from both QWidget (or QObject) and QtNPBindable - to be able to call the functions of this class, and to reimplement the virtual - functions. The \l{moc}{meta-object compiler} requires you to inherit from the - QObject subclass first. - - \code - class PluginWidget : public QWidget, public QtNPBindable - { - Q_OBJECT - public: - PluginWidget(QWidget *parent = 0) - { - } - - //... - }; - \endcode -*/ - -/*! - \enum QtNPBindable::DisplayMode - - \brief This enum specifies the different display modes of a plugin - - \value Embedded The plugin widget is embedded in a web page, usually - with the <EMBED> or the <OBJECT> tag. - \value Fullpage The plugin widget is the primary content of the web browser, which - is usually the case when the web browser displays a file the plugin supports. -*/ - -/*! - \enum QtNPBindable::Reason - - \brief This enum specifies how an URL operation was completed - - \value ReasonDone - \value ReasonBreak - \value ReasonError - \value ReasonUnknown -*/ - -/*! - Constructs a QtNPBindable object. - - This can only happen when the plugin object is created. -*/ -QtNPBindable::QtNPBindable() -: pi(next_pi) -{ - if (pi) - pi->bindable = this; - next_pi = 0; -} - -/*! - Destroys the object. - - This can only happen when the plugin object is destroyed. -*/ -QtNPBindable::~QtNPBindable() -{ -} - -/*! - Returns the parameters passed to the plugin instance. - - The framework sets the properties of the plugin to the corresponding - parameters when the plugin object has been created, but you can - use this function to process additional parameters. - - Note that the SGML specification does not permit multiple - arguments with the same name. -*/ -QMap<QByteArray, QVariant> QtNPBindable::parameters() const -{ - if (!pi) - return QMap<QByteArray, QVariant>(); - return pi->parameters; -} - -/*! - Returns the user agent (browser name) containing this plugin. - - This is a wrapper around NPN_UserAgent. - - \sa getBrowserVersion() -*/ -QString QtNPBindable::userAgent() const -{ - if (!pi) - return QString(); - return QString::fromLocal8Bit(NPN_UserAgent(pi->npp)); -} - -/*! - Extracts the version of the plugin API used by this plugin into \a major - and \a minor. - - See http://devedge-temp.mozilla.org/library/manuals/2002/plugin/1.0/ - for an explanation of those values. - - \sa getBrowserVersion() userAgent() -*/ -void QtNPBindable::getNppVersion(int *major, int *minor) const -{ - int dummy = 0; - if (pi) - NPN_Version(major, minor, &dummy, &dummy); -} - -/*! - Extracts the version of the browser into \a major and \a minor. - - See http://devedge-temp.mozilla.org/library/manuals/2002/plugin/1.0/ - for an explanation of those values. - - \sa getNppVersion() userAgent() -*/ -void QtNPBindable::getBrowserVersion(int *major, int *minor) const -{ - int dummy = 0; - if (pi) - NPN_Version(&dummy, &dummy, major, minor); -} - -/*! - Returns the display mode of the plugin. -*/ -QtNPBindable::DisplayMode QtNPBindable::displayMode() const -{ - if (!pi) - return Embedded; - return (QtNPBindable::DisplayMode)pi->fMode; -} - -/*! - Returns the mime type this plugin has been instantiated for. -*/ -QString QtNPBindable::mimeType() const -{ - if (!pi) - return QString(); - return pi->mimetype; -} - -/*! - Returns the browser's plugin instance associated with this plugin object. - The instance is required to call functions in the Netscape Plugin API, - i.e. NPN_GetJavaPeer(). - - The instance returned is only valid as long as this object is. - - See http://devedge-temp.mozilla.org/library/manuals/2002/plugin/1.0/ - for documentation of the \c NPP type. -*/ -NPP QtNPBindable::instance() const -{ - if (!pi) - return 0; - return pi->npp; -} - -/*! - Reimplement this function to read data from \a source provided with - mime type \a format. The data is the one specified in the \c src or - \c data attribute of the \c{<EMBED>} or \c{<OBJECT>} tag of in - HTML page. This function is called once for every stream the browser - creates for the plugin. - - Return true to indicate successfull processing of the data, otherwise - return false. The default implementation does nothing and returns false. -*/ - -bool QtNPBindable::readData(QIODevice *source, const QString &format) -{ - Q_UNUSED(source); - Q_UNUSED(format); - return false; -} - -/*! - Requests that the \a url be retrieved and sent to the named \a window (or - a new window if \a window is empty), and returns the ID of the request that is - delivered to transferComplete() when the get-operation has finished. Returns 0 when - the browser or the system doesn't support notification, or -1 when an error occured. - - \code - void MyPlugin::aboutQtSoftware() - { - openUrl("http://qt.nokia.com"); - } - \endcode - - See Netscape's JavaScript documentation for an explanation of window names. - - \sa transferComplete() uploadData() uploadFile() -*/ -int QtNPBindable::openUrl(const QString &url, const QString &window) -{ - if (!pi) - return -1; - QString wnd = window; - if (wnd.isEmpty()) - wnd = "_blank"; - - qint32 id = pi->getNotificationSeqNum(); - NPError err = NPN_GetURLNotify(pi->npp, url.toLocal8Bit().constData(), wnd.toLocal8Bit().constData(), reinterpret_cast<void*>(id)); - if (err != NPERR_NO_ERROR) - id = -1; - - if (err == NPERR_INCOMPATIBLE_VERSION_ERROR) { - err = NPN_GetURL(pi->npp, url.toLocal8Bit().constData(), wnd.toLocal8Bit().constData()); - if (NPERR_NO_ERROR == err) - id = 0; - else - id = -1; - } - return id; -} - -/*! - Posts \a data to \a url, and displays the result in \a window. Returns the ID of the request - that is delivered to transferComplete() when the post-operation has finished. Returns 0 when - the browser or the system doesn't support notification, or -1 when an error occured. - - \code - void MyPlugin::sendMail() - { - uploadData("mailto:fred@somewhere.com", QString(), "There is a new file for you!"); - } - \endcode - - See Netscape's JavaScript documentation for an explanation of window names. - - \sa transferComplete() openUrl() uploadFile() -*/ -int QtNPBindable::uploadData(const QString &url, const QString &window, const QByteArray &data) -{ - if (!pi) - return -1; - - int id = pi->getNotificationSeqNum(); - if (NPERR_NO_ERROR != NPN_PostURLNotify(pi->npp, url.toLocal8Bit().constData(), window.isEmpty() ? 0 : window.toLocal8Bit().constData(), data.size(), data.constData(), false, reinterpret_cast<void*>(id))) - id = -1; - - return id; -} - -/*! - Posts \a filename to \a url, and displays the result in \a window. Returns the ID of - the request that is delivered to transferComplete() when the post-operation has finished. - Returns 0 when the browser or the system doesn't support notification, or -1 when an - error occured. - - \code - void MyPlugin::uploadFile() - { - uploadFile("ftp://ftp.somewhere.com/incoming", "response", "c:\\temp\\file.txt"); - } - \endcode - - See Netscape's JavaScript documentation for an explanation of window names. - - \sa transferComplete() uploadData() openUrl() -*/ - -int QtNPBindable::uploadFile(const QString &url, const QString &window, const QString &filename) -{ - if (!pi) - return -1; - - QByteArray data = filename.toLocal8Bit(); - int id = pi->getNotificationSeqNum(); - if (NPERR_NO_ERROR != NPN_PostURLNotify(pi->npp, url.toLocal8Bit().constData(), window.isEmpty() ? 0 : window.toLocal8Bit().constData(), data.size(), data.constData(), true, reinterpret_cast<void*>(id))) - id = -1; - - return id; -} - -/*! - Called as a result of a call to openUrl, uploadData or uploadFile. - \a url corresponds to the respective parameter, and \a id to value returned - by the call. \a reason indicates how the transfer was completed. -*/ -void QtNPBindable::transferComplete(const QString &url, int id, Reason reason) -{ - Q_UNUSED(url) - Q_UNUSED(id) - Q_UNUSED(reason) -} - - -/****************************************************************************** - * The plugin itself - only one ever exists, created by QtNPFactory::create() - *****************************************************************************/ - - -/*! - \class QtNPFactory qtbrowserplugin.h - \brief The QtNPFactory class provides the factory for plugin objects. - - Implement this factory once in your plugin project to provide information - about the plugin and to create the plugin objects. Subclass QtNPFactory and - implement the pure virtual functions, and export the factory using the - \c QTNPFACTORY_EXPORT() macro. - - If you use the Q_CLASSINFO macro in your object classes you can use the - \c QTNPFACTORY_BEGIN(), \c QTNPCLASS() and \c QTNPFACTORY_END() macros to - generate a factory implementation: - - \code - class Widget : public QWidget - { - Q_OBJECT - Q_CLASSINFO("MIME", "application/x-graphable:g1n:Graphable data") - public: - ... - }; - - QTNPFACTORY_BEGIN("Plugin name", "Plugin description") - QTNPCLASS(WidgetClass) - QTNPFACTORY_END() - \endcode - - The classes exposed must provide a constructor. - - If Qt is linked to the plugin as a dynamic library, only one instance of - QApplication will exist \e{across all plugins that have been made with Qt}. - So, your plugin should tread lightly on global settings. Do not, for example, - use QApplication::setFont() - that will change the font in every widget of - every Qt-based plugin currently loaded! -*/ - -/*! - Creates a QtNPFactory. -*/ -QtNPFactory::QtNPFactory() -{ -} - -/*! - Destroys the QtNPFactory. - - This is called by the plugin binding code just before the plugin is - about to be unloaded from memory. If createObject() has been called, - a QApplication will still exist at this time, but will be deleted - shortly after, just before the plugin is deleted. -*/ -QtNPFactory::~QtNPFactory() -{ -} - - -/*! - \fn QStringList QtNPFactory::mimeTypes() const - - Reimplement this function to return the MIME types of the data formats - supported by your plugin. The format of each string is - mime:extension(s):description: - - \code - QStringList mimeTypes() const - { - QStringList list; - list << "image/x-png:png:PNG Image" - << "image/png:png:PNG Image" - << "image/jpeg:jpg,jpeg:JPEG Image"; - return list; - } - \endcode -*/ - -/*! - \fn QObject *QtNPFactory::createObject(const QString &type) - - Reimplement this function to return the QObject or QWidget subclass - supporting the mime type \a type, or 0 if the factory doesn't support - the type requested. - - \a type will be in the same form as the leftmost (mime) part of - the string(s) returned by mimeTypes(), e.g. "image/png". -*/ - -/*! - \fn QString QtNPFactory::pluginName() const - - Reimplement this function to return the name of the plugin. -*/ - -/*! - \fn QString QtNPFactory::pluginDescription() const - - Reimplement this function to return the description of the plugin. -*/ diff --git a/x2gobrowserplugin-2.4_1/src/qtbrowserplugin.def b/x2gobrowserplugin-2.4_1/src/qtbrowserplugin.def deleted file mode 100644 index ce7f119..0000000 --- a/x2gobrowserplugin-2.4_1/src/qtbrowserplugin.def +++ /dev/null @@ -1,4 +0,0 @@ -EXPORTS - NP_GetEntryPoints @1 - NP_Initialize @2 - NP_Shutdown @3 diff --git a/x2gobrowserplugin-2.4_1/src/qtbrowserplugin.h b/x2gobrowserplugin-2.4_1/src/qtbrowserplugin.h deleted file mode 100644 index 6b87bfb..0000000 --- a/x2gobrowserplugin-2.4_1/src/qtbrowserplugin.h +++ /dev/null @@ -1,176 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of a Qt Solutions component. -** -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -****************************************************************************/ - -#ifndef QTNETSCAPE_H -#define QTNETSCAPE_H - -#include <QtCore/QMetaObject> -#include <QtCore/QFile> -#include <QtCore/QDateTime> -#include <QtGui/QPainter> - - -struct QtNPInstance; -class QtNPBindable; -class QtNPStreamPrivate; - -struct NPP_t; -typedef NPP_t* NPP; - -class QtNPBindable -{ - friend class QtNPStream; -public: - enum Reason { - ReasonDone = 0, - ReasonBreak = 1, - ReasonError = 2, - ReasonUnknown = -1 - }; - enum DisplayMode - { - Embedded = 1, - Fullpage = 2 - }; - - QMap<QByteArray, QVariant> parameters() const; - DisplayMode displayMode() const; - QString mimeType() const; - - QString userAgent() const; - void getNppVersion(int *major, int *minor) const; - void getBrowserVersion(int *major, int *minor) const; - - // incoming streams (SRC=... tag) - virtual bool readData(QIODevice *source, const QString &format); - - // URL stuff - int openUrl(const QString &url, const QString &window = QString()); - int uploadData(const QString &url, const QString &window, const QByteArray &data); - int uploadFile(const QString &url, const QString &window, const QString &filename); - virtual void transferComplete(const QString &url, int id, Reason r); - - NPP instance() const; - -protected: - QtNPBindable(); - virtual ~QtNPBindable(); - -private: - QtNPInstance* pi; -}; - -class QtNPFactory { -public: - QtNPFactory(); - virtual ~QtNPFactory(); - - virtual QStringList mimeTypes() const = 0; - virtual QObject* createObject(const QString &type) = 0; - - virtual QString pluginName() const = 0; - virtual QString pluginDescription() const = 0; -}; - -extern QtNPFactory *qtNPFactory(); - -template<class T> -class QtNPClass : public QtNPFactory -{ -public: - QtNPClass() {} - - QObject *createObject(const QString &key) - { - foreach (QString mime, mimeTypes()) { - if (mime.left(mime.indexOf(':')) == key) - return new T; - } - return 0; - } - - QStringList mimeTypes() const - { - const QMetaObject &mo = T::staticMetaObject; - return QString::fromLatin1(mo.classInfo(mo.indexOfClassInfo("MIME")).value()).split(';'); - } - - QString pluginName() const { return QString(); } - QString pluginDescription() const { return QString(); } -}; - -#define QTNPFACTORY_BEGIN(Name, Description) \ -class QtNPClassList : public QtNPFactory \ -{ \ - QHash<QString, QtNPFactory*> factories; \ - QStringList mimeStrings; \ - QString m_name, m_description; \ -public: \ - QtNPClassList() \ - : m_name(Name), m_description(Description) \ - { \ - QtNPFactory *factory = 0; \ - QStringList keys; \ - -#define QTNPCLASS(Class) \ - { \ - factory = new QtNPClass<Class>; \ - keys = factory->mimeTypes(); \ - foreach (QString key, keys) { \ - mimeStrings.append(key); \ - factories.insert(key.left(key.indexOf(':')), factory); \ - } \ - } \ - -#define QTNPFACTORY_END() \ - } \ - ~QtNPClassList() { /*crashes? qDeleteAll(factories);*/ } \ - QObject *createObject(const QString &mime) { \ - QtNPFactory *factory = factories.value(mime); \ - return factory ? factory->createObject(mime) : 0; \ - } \ - QStringList mimeTypes() const { return mimeStrings; } \ - QString pluginName() const { return m_name; } \ - QString pluginDescription() const { return m_description; } \ -}; \ -QtNPFactory *qtns_instantiate() { return new QtNPClassList; } \ - -#define QTNPFACTORY_EXPORT(Class) \ -QtNPFactory *qtns_instantiate() { return new Class; } - -#endif // QTNETSCAPE_H diff --git a/x2gobrowserplugin-2.4_1/src/qtbrowserplugin.pri b/x2gobrowserplugin-2.4_1/src/qtbrowserplugin.pri deleted file mode 100644 index 6b5f08d..0000000 --- a/x2gobrowserplugin-2.4_1/src/qtbrowserplugin.pri +++ /dev/null @@ -1,74 +0,0 @@ -TEMPLATE = lib -CONFIG += dll -win32-* { - # Uncomment the following line to build a plugin that can be used also in - # Internet Explorer, through ActiveX. - # CONFIG += qaxserver -} else { - CONFIG += plugin -} - -INCLUDEPATH += $$PWD -DEPENDPATH += $$PWD - -SOURCES += $$PWD/qtbrowserplugin.cpp -HEADERS += $$PWD/qtbrowserplugin.h qtnpapi.h - -win32-* { - SOURCES += $$PWD/qtbrowserplugin_win.cpp - !isEmpty(TARGET) { - TARGET = np$$TARGET - } - LIBS += -luser32 - - qaxserver { - DEF_FILE += $$PWD/qtbrowserpluginax.def - } else { - DEF_FILE += $$PWD/qtbrowserplugin.def - } - - firefox { - exists("c:/program files/mozilla firefox/plugins") { - DLLDESTDIR += "c:/program files/mozilla firefox/plugins" - } else { - message("Firefox not found at default location") - } - } - opera { - exists("c:/program files/opera/program/plugins") { - DLLDESTDIR += "c:/program files/opera/program/plugins" - } else { - message("Opera not found at default location") - } - } - netscape { - exists("c:/program files/netscape/netscape browser/plugins") { - DLLDESTDIR += "c:/program files/netscape/netscape browser/plugins" - } else { - message("Netscape not found at default location") - } - } -} else:mac { - CONFIG += plugin_bundle - SOURCES += $$PWD/qtbrowserplugin_mac.cpp - #target.path = /Library/Internet\ Plugins - #INSTALLS += target -} else { - SOURCES += $$PWD/qtbrowserplugin_x11.cpp - INCLUDEPATH += /usr/include/X11 - - # Avoiding symbol clash with other instances of the Qt library - # (ref. developingplugins.html in the doc.): - # - # For Qt 4.4 and later, just configure Qt to use a separate namespace: - # configure -qtnamespace SomeNamespace - # - # For Qt 4.3: Uncomment the line below. - # It makes the dynamic linker prefer our own Qt symbols for the plugin, - # provided that our Qt is statically built and linked into the - # plugin. Note that to force the linker to prefer the static Qt - # libraries (.a files), the dynamic libraries (.so) files must not - # be present in the lib directory. - # - # QMAKE_LFLAGS += -Wl,-Bsymbolic -} diff --git a/x2gobrowserplugin-2.4_1/src/qtbrowserplugin_mac.cpp b/x2gobrowserplugin-2.4_1/src/qtbrowserplugin_mac.cpp deleted file mode 100644 index c757bda..0000000 --- a/x2gobrowserplugin-2.4_1/src/qtbrowserplugin_mac.cpp +++ /dev/null @@ -1,560 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of a Qt Solutions component. -** -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -****************************************************************************/ - -#include <QtGui/QApplication> -#include <QtCore/QStringList> -#include <QtCore/QPointer> -#include <QtGui/QWidget> -#include <QtCore/QEvent> -#include <QtCore/QDebug> -#include <QtCore/QRect> -#include <QtGui/QMouseEvent> -#include <QtGui/QHoverEvent> -#include <QtGui/QKeyEvent> - -#include <Carbon/Carbon.h> - -#include "qtnpapi.h" - -#include "qtbrowserplugin.h" -#include "qtbrowserplugin_p.h" - -static bool ownsqapp = false; -extern void qt_mac_set_native_menubar(bool b); -const UInt32 kWidgetCreatorQt = 'cute'; -enum { - kWidgetPropertyQWidget = 'QWId' //QWidget * -}; - -class -QMacBrowserRoot : public QWidget -{ - Q_OBJECT -public: - QMacBrowserRoot(HIViewRef root) : QWidget() - { - // make sure we're not registered with Qt before create - WindowRef window = HIViewGetWindow(root); - QWidget *oldwindow=0; - OSErr err; - err = GetWindowProperty(window, - kWidgetCreatorQt, - kWidgetPropertyQWidget, - sizeof(oldwindow), - 0, - &oldwindow); - if (err == noErr) - RemoveWindowProperty(window, kWidgetCreatorQt, kWidgetPropertyQWidget); - - create((WId)root); - - // re-register the root window with Qt - err = SetWindowProperty(window, - kWidgetCreatorQt, - kWidgetPropertyQWidget, - sizeof(oldwindow), - &oldwindow); - if (err != noErr) { - qWarning("Error, couldn't register Window with Qt: (%s:%d:%d)", __FILE__, __LINE__, err); - } - - QPalette pal = palette(); - pal.setColor(QPalette::Window,Qt::transparent); - setPalette(pal); - - setAttribute(Qt::WA_WState_Polished); - } - - ~QMacBrowserRoot() { } -}; -#include "qtbrowserplugin_mac.moc" - -struct key_sym -{ - int mac_code; - int qt_code; - const char *desc; -}; - -static key_sym modifier_syms[] = { -{ shiftKey, Qt::ShiftModifier, "Qt::ShiftModifier" }, -{ controlKey, Qt::MetaModifier, "Qt::MetaModifier" }, -{ rightControlKey, Qt::MetaModifier, "Qt::MetaModifier" }, -{ optionKey, Qt::AltModifier, "Qt::AltModifier" }, -{ rightOptionKey, Qt::AltModifier, "Qt::AltModifier" }, -{ cmdKey, Qt::ControlModifier, "Qt::ControlModifier" }, -{ 0, 0, NULL } -}; -static Qt::KeyboardModifiers get_modifiers(int key) -{ - Qt::KeyboardModifiers ret = 0; - for(int i = 0; modifier_syms[i].desc; i++) { - if(key & modifier_syms[i].mac_code) { - ret |= Qt::KeyboardModifier(modifier_syms[i].qt_code); - } - } - return ret; -} - -static key_sym key_syms[] = { -{ kHomeCharCode, Qt::Key_Home, "Qt::Home" }, -{ kEnterCharCode, Qt::Key_Enter, "Qt::Key_Enter" }, -{ kEndCharCode, Qt::Key_End, "Qt::Key_End" }, -{ kBackspaceCharCode, Qt::Key_Backspace, "Qt::Backspace" }, -{ kTabCharCode, Qt::Key_Tab, "Qt::Tab" }, -{ kPageUpCharCode, Qt::Key_PageUp, "Qt::PageUp" }, -{ kPageDownCharCode, Qt::Key_PageDown, "Qt::PageDown" }, -{ kReturnCharCode, Qt::Key_Return, "Qt::Key_Return" }, -//function keys? -{ kEscapeCharCode, Qt::Key_Escape, "Qt::Key_Escape" }, -{ kLeftArrowCharCode, Qt::Key_Left, "Qt::Key_Left" }, -{ kRightArrowCharCode, Qt::Key_Right, "Qt::Key_Right" }, -{ kUpArrowCharCode, Qt::Key_Up, "Qt::Key_Up" }, -{ kDownArrowCharCode, Qt::Key_Down, "Qt::Key_Down" }, -{ kDeleteCharCode, Qt::Key_Delete, "Qt::Key_Delete" } -}; -static int get_key(int key) -{ - for(int i = 0; key_syms[i].desc; i++) { - if(key_syms[i].mac_code == key) { - return key_syms[i].qt_code; - } - } - return key; -} - -struct qt_last_mouse_down_struct { - unsigned int when; - int x, y; -} qt_last_mouse_down = { 0, 0, 0 }; - -//nasty, copied code - -static void qt_dispatchEnterLeave(QWidget* enter, QWidget* leave) { -#if 0 - if(leave) { - QEvent e(QEvent::Leave); - QApplication::sendEvent(leave, & e); - } - if(enter) { - QEvent e(QEvent::Enter); - QApplication::sendEvent(enter, & e); - } - return; -#endif - - QWidget* w ; - if(!enter && !leave) - return; - QWidgetList leaveList; - QWidgetList enterList; - - bool sameWindow = leave && enter && leave->window() == enter->window(); - if(leave && !sameWindow) { - w = leave; - do { - leaveList.append(w); - } while(!w->isWindow() && (w = w->parentWidget())); - } - if(enter && !sameWindow) { - w = enter; - do { - enterList.prepend(w); - } while(!w->isWindow() && (w = w->parentWidget())); - } - if(sameWindow) { - int enterDepth = 0; - int leaveDepth = 0; - w = enter; - while(!w->isWindow() && (w = w->parentWidget())) - enterDepth++; - w = leave; - while(!w->isWindow() && (w = w->parentWidget())) - leaveDepth++; - QWidget* wenter = enter; - QWidget* wleave = leave; - while(enterDepth > leaveDepth) { - wenter = wenter->parentWidget(); - enterDepth--; - } - while(leaveDepth > enterDepth) { - wleave = wleave->parentWidget(); - leaveDepth--; - } - while(!wenter->isWindow() && wenter != wleave) { - wenter = wenter->parentWidget(); - wleave = wleave->parentWidget(); - } - - w = leave; - while(w != wleave) { - leaveList.append(w); - w = w->parentWidget(); - } - w = enter; - while(w != wenter) { - enterList.prepend(w); - w = w->parentWidget(); - } - } - - QEvent leaveEvent(QEvent::Leave); - for (int i = 0; i < leaveList.size(); ++i) { - w = leaveList.at(i); - QApplication::sendEvent(w, &leaveEvent); -#if 0 - if(w->testAttribute(Qt::WA_Hover)) { - Q_ASSERT(instance()); - QHoverEvent he(QEvent::HoverLeave, QPoint(-1, -1), - w->mapFromGlobal(QApplicationPrivate::instance()->hoverGlobalPos)); - QApplication::sendEvent(w, &he); - } -#endif - } - QPoint posEnter = QCursor::pos(); - QEvent enterEvent(QEvent::Enter); - for (int i = 0; i < enterList.size(); ++i) { - w = enterList.at(i); - QApplication::sendEvent(w, &enterEvent); - if(w->testAttribute(Qt::WA_Hover)) { - QHoverEvent he(QEvent::HoverEnter, w->mapFromGlobal(posEnter), QPoint(-1, -1)); - QApplication::sendEvent(w, &he); - } - } -} - - -extern "C" bool qtns_event(QtNPInstance *This, NPEvent *event) -{ - static QPointer<QWidget> lastWidget; - static QPointer<QWidget> qt_button_down; - static Point lastPosition = { 0, 0 }; - if(event->what == nullEvent || event->what == adjustCursorEvent) { - if(event->what == nullEvent) { - qApp->processEvents(); - QApplication::sendPostedEvents(); - } - - //watch for mouse moves - Point currentPosition; - GetMouse(¤tPosition); - LocalToGlobal(¤tPosition); - if(currentPosition.h != lastPosition.h || currentPosition.v != lastPosition.v) { - lastPosition = currentPosition; - - WindowPtr wp; - FindWindow(currentPosition, &wp); - QWidget *widget = 0; - if(wp == GetWindowFromPort((CGrafPtr)This->window->port)) - widget = This->rootWidget->childAt(This->rootWidget->mapFromGlobal(QPoint(event->where.h, event->where.v))); - else - widget = QApplication::widgetAt(event->where.h, event->where.v); - if(widget != lastWidget) { - qt_dispatchEnterLeave(widget, lastWidget); - lastWidget = widget; - } - if(widget) { - QPoint p(currentPosition.h, currentPosition.v); - QPoint plocal(widget->mapFromGlobal(p)); - QMouseEvent qme(QEvent::MouseMove, plocal, p, Button() ? Qt::LeftButton : Qt::NoButton, - 0, get_modifiers(GetCurrentKeyModifiers())); - QApplication::sendEvent(widget, &qme); - } - } - return true; - } else if(QWidget *widget = qobject_cast<QWidget*>(This->qt.object)) { - if(event->what == updateEvt) { - widget->repaint(); - return true; - } else if(event->what == keyUp || event->what == keyDown) { - QWidget *widget = 0; - if(QWidget::keyboardGrabber()) - widget = QWidget::keyboardGrabber(); - else if(QApplication::focusWidget()) - widget = QApplication::focusWidget(); - else //last ditch effort - widget = QApplication::widgetAt(event->where.h, event->where.v); - - if(widget) { -#if 0 - if(app_do_modal && !qt_try_modal(widget, er)) - return 1; -#endif - - int mychar=get_key(event->message & charCodeMask); - QEvent::Type etype = event->what == keyUp ? QEvent::KeyRelease : QEvent::KeyPress; - QKeyEvent ke(etype, mychar, get_modifiers(event->modifiers), QString(QChar(mychar))); - QApplication::sendEvent(widget,&ke); - return true; - } - } else if(event->what == mouseDown || event->what == mouseUp) { - QEvent::Type etype = QEvent::None; - Qt::KeyboardModifiers keys = get_modifiers(event->modifiers); - Qt::MouseButton button = Qt::LeftButton; - - if(event->what == mouseDown) { - if (lastWidget) - qt_button_down = lastWidget; - //check if this is the second click, there must be a way to make the - //mac do this for us, FIXME!! - if(qt_last_mouse_down.when && - (event->when - qt_last_mouse_down.when <= (uint)QApplication::doubleClickInterval())) { - int x = event->where.h, y = event->where.v; - if(x >= (qt_last_mouse_down.x-2) && x <= (qt_last_mouse_down.x+4) && - y >= (qt_last_mouse_down.y-2) && y <= (qt_last_mouse_down.y+4)) { - etype = QEvent::MouseButtonDblClick; - qt_last_mouse_down.when = 0; - } - } - - if(etype == QEvent::None) { //guess it's just a press - etype = QEvent::MouseButtonPress; - qt_last_mouse_down.when = event->when; - qt_last_mouse_down.x = event->where.h; - qt_last_mouse_down.y = event->where.v; - } - } else { - etype = QEvent::MouseButtonRelease; - } - - WindowPtr wp; - FindWindow(event->where, &wp); - - //handle popup's first - QWidget *popupwidget = NULL; - if(QApplication::activePopupWidget()) { - if(wp) { - QWidget *clt=QWidget::find((WId)wp); - if(clt && clt->windowType() == Qt::Popup) - popupwidget = clt; - } - if(!popupwidget) - popupwidget = QApplication::activePopupWidget(); - if(QWidget *child = popupwidget->childAt(popupwidget->mapFromGlobal(QPoint(event->where.h, event->where.v)))) - popupwidget = child; - - QPoint p(event->where.h, event->where.v); - QPoint plocal(popupwidget->mapFromGlobal(p)); - QMouseEvent qme(etype, plocal, p, button, 0, keys); - QApplication::sendEvent(popupwidget, &qme); - } - - { - QWidget *widget = 0; //figure out which widget to send it to - if(event->what == mouseUp && qt_button_down) - widget = qt_button_down; - else if(QWidget::mouseGrabber()) - widget = QWidget::mouseGrabber(); - else if(wp == GetWindowFromPort((CGrafPtr)This->window->port)) - widget = This->rootWidget->childAt(This->rootWidget->mapFromGlobal(QPoint(event->where.h, event->where.v))); - else - widget = QApplication::widgetAt(event->where.h, event->where.v); - - //setup the saved widget - qt_button_down = event->what == mouseDown ? widget : 0; - - //finally send the event to the widget if its not the popup - if(widget && widget != popupwidget) { -#if 0 - if(app_do_modal && !qt_try_modal(widget, er)) - return 1; -#endif - if(event->what == mouseDown) { - QWidget* w = widget; - while(w->focusProxy()) - w = w->focusProxy(); - if(w->focusPolicy() & Qt::ClickFocus) - w->setFocus(Qt::MouseFocusReason); - if(QWidget *tlw = widget->topLevelWidget()) { - tlw->raise(); - if(tlw->isTopLevel() && tlw->windowType() != Qt::Popup && - (tlw->isModal() || tlw->windowType() != Qt::Dialog)) - QApplication::setActiveWindow(tlw); - } - } - - QPoint p(event->where.h, event->where.v); - QPoint plocal(widget->mapFromGlobal( p )); - QMouseEvent qme(etype, plocal, p, button, 0, keys); - QApplication::sendEvent(widget, &qme); - return true; - } - } - } else { - //qDebug("%d", event->what); - } - } - return false; -} - -#ifdef QTBROWSER_USE_CFM -static bool qtbrowser_use_cfm = false; -static UInt32 gGlueTemplate[6] = { 0x3D800000, 0x618C0000, 0x800C0000, - 0x804C0004, 0x7C0903A6, 0x4E800420 }; -struct TVector_rec -{ - ProcPtr fProcPtr; - void *fTOC; -}; - -void *CFMFunctionPointerForMachOFunctionPointer(void *inMachProcPtr) -{ - if(!qtbrowser_use_cfm) - return inMachProcPtr; - TVector_rec *vTVector = (TVector_rec*)malloc(sizeof(TVector_rec)); - if(MemError() == noErr && vTVector != 0) { - vTVector->fProcPtr = (ProcPtr)inMachProcPtr; - vTVector->fTOC = 0; // ignored - } - return((void *)vTVector); -} - -void DisposeCFMFunctionPointer(void *inCfmProcPtr) -{ - if(!qtbrowser_use_cfm) - return; - if(inCfmProcPtr) - free(inCfmProcPtr); -} - -void* MachOFunctionPointerForCFMFunctionPointer(void* inCfmProcPtr) -{ - if(!qtbrowser_use_cfm) - return inCfmProcPtr; - UInt32 *vMachProcPtr = (UInt32*)NewPtr(sizeof(gGlueTemplate)); - vMachProcPtr[0] = gGlueTemplate[0] | ((UInt32)inCfmProcPtr >> 16); - vMachProcPtr[1] = gGlueTemplate[1] | ((UInt32)inCfmProcPtr & 0xFFFF); - vMachProcPtr[2] = gGlueTemplate[2]; - vMachProcPtr[3] = gGlueTemplate[3]; - vMachProcPtr[4] = gGlueTemplate[4]; - vMachProcPtr[5] = gGlueTemplate[5]; - MakeDataExecutable(vMachProcPtr, sizeof(gGlueTemplate)); - return(vMachProcPtr); -} -#endif - - -extern "C" void qtns_initialize(QtNPInstance *) -{ - qt_mac_set_native_menubar(false); - if(!qApp) { - ownsqapp = true; - static int argc=0; - static char **argv={ 0 }; - (void)new QApplication(argc, argv); - } -} - -extern "C" void qtns_destroy(QtNPInstance *This) -{ - delete This->rootWidget; - This->rootWidget = 0; -} - -extern "C" void qtns_shutdown() -{ - if(!ownsqapp) - return; - - // TODO: find out if other plugin DLL's still need qApp - delete qApp; - ownsqapp = false; -} - -extern "C" void qtns_embed(QtNPInstance *This) -{ - Q_ASSERT(qobject_cast<QWidget*>(This->qt.object)); - - WindowPtr windowptr = GetWindowFromPort((CGrafPtr)This->window->port); - HIViewRef root = 0; - OSErr err; - err = GetRootControl(windowptr,&root); - if(!root) - root = HIViewGetRoot(windowptr); - if(!root) { - qDebug("No window composition!"); - } else { - This->rootWidget = new QMacBrowserRoot(root); - This->qt.widget->setParent(This->rootWidget); - } -} - -extern "C" void qtns_setGeometry(QtNPInstance *This, const QRect &rect, const QRect &clipRect) -{ - Q_ASSERT(qobject_cast<QWidget*>(This->qt.object)); - - WindowPtr windowptr = GetWindowFromPort((CGrafPtr)This->window->port); - Rect content_r; - GetWindowBounds(windowptr, kWindowContentRgn, &content_r); - Rect structure_r; - GetWindowBounds(windowptr, kWindowStructureRgn, &structure_r); - - QRect geom(rect.translated(content_r.left-structure_r.left, content_r.top-structure_r.top)); - if(rect != clipRect) { - QRegion clipRegion(QRect(clipRect.x()-geom.x(), clipRect.y()-geom.y(), clipRect.width(), clipRect.height()) - .translated(content_r.left-structure_r.left, content_r.top-structure_r.top)); - if(clipRegion.isEmpty()) - clipRegion = QRegion(-1, -1, 1, 1); //eww ### FIXME - This->qt.widget->setMask(clipRegion); - } else { - This->qt.widget->clearMask(); - } - This->qt.widget->setGeometry(geom); -} - -typedef void (*NPP_ShutdownUPP)(void); - -extern "C" void NPP_MacShutdown() -{ - //extern NPError NP_Shutdown(); - //NP_Shutdown(); -} - -extern "C" int main(NPNetscapeFuncs *npn_funcs, NPPluginFuncs *np_funcs, NPP_ShutdownUPP *shutdown) -{ - qtbrowser_use_cfm = true; //quite the heuristic.. - - NPError ret; - extern NPError NP_Initialize(NPNetscapeFuncs*); - if((ret=NP_Initialize(npn_funcs)) != NPERR_NO_ERROR) - return ret; - extern NPError NP_GetEntryPoints(NPPluginFuncs*); - if((ret=NP_GetEntryPoints(np_funcs)) != NPERR_NO_ERROR) - return ret; - *shutdown = (NPP_ShutdownUPP)MAKE_FUNCTION_POINTER(NPP_MacShutdown); - return NPERR_NO_ERROR; -} diff --git a/x2gobrowserplugin-2.4_1/src/qtbrowserplugin_p.h b/x2gobrowserplugin-2.4_1/src/qtbrowserplugin_p.h deleted file mode 100644 index ebca24a..0000000 --- a/x2gobrowserplugin-2.4_1/src/qtbrowserplugin_p.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of a Qt Solutions component. -** -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -****************************************************************************/ - -#include <QtCore/QVariant> -#include <QtCore/QMutexLocker> -#include <QtGui/QWidget> - -#ifdef Q_WS_X11 -# include <X11/Xlib.h> -class QtNPStream; -class QtNPBindable; -#endif - - -struct QtNPInstance -{ - NPP npp; - - short fMode; - -#ifdef Q_WS_WIN - typedef HWND Widget; -#endif -#ifdef Q_WS_X11 - typedef Window Widget; - Display *display; -#endif -#ifdef Q_WS_MAC - typedef NPPort* Widget; - QWidget *rootWidget; -#endif - - Widget window; - - QRect geometry; - QString mimetype; - QByteArray htmlID; - union { - QObject* object; - QWidget* widget; - } qt; - QtNPStream *pendingStream; - QtNPBindable* bindable; - QObject *filter; - - QMap<QByteArray, QVariant> parameters; - - qint32 notificationSeqNum; - QMutex seqNumMutex; - qint32 getNotificationSeqNum() - { - QMutexLocker locker(&seqNumMutex); - - if (++notificationSeqNum < 0) - notificationSeqNum = 1; - return notificationSeqNum; - } - -}; diff --git a/x2gobrowserplugin-2.4_1/src/qtbrowserplugin_win.cpp b/x2gobrowserplugin-2.4_1/src/qtbrowserplugin_win.cpp deleted file mode 100644 index a9bb884..0000000 --- a/x2gobrowserplugin-2.4_1/src/qtbrowserplugin_win.cpp +++ /dev/null @@ -1,194 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of a Qt Solutions component. -** -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -****************************************************************************/ - -#include <QtGui> - -#include "qtbrowserplugin.h" -#include "qtbrowserplugin_p.h" - -#include <windows.h> -#include "qtnpapi.h" - -static HHOOK hhook = 0; -static bool ownsqapp = false; -Q_GUI_EXPORT int qt_translateKeyCode(int); - -LRESULT CALLBACK FilterProc( int nCode, WPARAM wParam, LPARAM lParam ) -{ - if (qApp) - qApp->sendPostedEvents(0, -1); - - if (nCode < 0 || !(wParam & PM_REMOVE)) - return CallNextHookEx(hhook, nCode, wParam, lParam); - - MSG *msg = (MSG*)lParam; - bool processed = false; - - // (some) support for key-sequences via QAction and QShortcut - if(msg->message == WM_KEYDOWN || msg->message == WM_SYSKEYDOWN) { - QWidget *focusWidget = QWidget::find(msg->hwnd); - if (focusWidget) { - int key = msg->wParam; - if (!(key >= 'A' && key <= 'Z') && !(key >= '0' && key <= '9')) - key = qt_translateKeyCode(msg->wParam); - - Qt::KeyboardModifiers modifiers = 0; - int modifierKey = 0; - if (GetKeyState(VK_SHIFT) < 0) { - modifierKey |= Qt::SHIFT; - modifiers |= Qt::ShiftModifier; - } - if (GetKeyState(VK_CONTROL) < 0) { - modifierKey |= Qt::CTRL; - modifiers |= Qt::ControlModifier; - } - if (GetKeyState(VK_MENU) < 0) { - modifierKey |= Qt::ALT; - modifiers |= Qt::AltModifier; - } - QKeySequence shortcutKey(modifierKey + key); - if (!shortcutKey.isEmpty()) { - QKeyEvent override(QEvent::ShortcutOverride, key, modifiers); - override.ignore(); - QApplication::sendEvent(focusWidget, &override); - processed = override.isAccepted(); - - if (!processed) { - QList<QAction*> actions = qFindChildren<QAction*>(focusWidget->window()); - for (int i = 0; i < actions.count() && !processed; ++i) { - QAction *action = actions.at(i); - if (!action->isEnabled() || action->shortcut() != shortcutKey) - continue; - QShortcutEvent event(shortcutKey, 0); - processed = QApplication::sendEvent(action, &event); - } - } - if (!processed) { - QList<QShortcut*> shortcuts = qFindChildren<QShortcut*>(focusWidget->window()); - for (int i = 0; i < shortcuts.count() && !processed; ++i) { - QShortcut *shortcut = shortcuts.at(i); - if (!shortcut->isEnabled() || shortcut->key() != shortcutKey) - continue; - QShortcutEvent event(shortcutKey, shortcut->id()); - processed = QApplication::sendEvent(shortcut, &event); - } - } - } - } - } - - return CallNextHookEx(hhook, nCode, wParam, lParam); -} - -extern "C" bool qtns_event(QtNPInstance *, NPEvent *) -{ - return false; -} - -extern Q_CORE_EXPORT void qWinMsgHandler(QtMsgType t, const char* str); - -extern "C" void qtns_initialize(QtNPInstance*) -{ - if (!qApp) { - qInstallMsgHandler(qWinMsgHandler); - ownsqapp = true; - static int argc=0; - static char **argv={ 0 }; - (void)new QApplication(argc, argv); - - QT_WA({ - hhook = SetWindowsHookExW( WH_GETMESSAGE, FilterProc, 0, GetCurrentThreadId() ); - }, { - hhook = SetWindowsHookExA( WH_GETMESSAGE, FilterProc, 0, GetCurrentThreadId() ); - }); - } -} - -extern "C" void qtns_destroy(QtNPInstance *) -{ -} - -extern "C" void qtns_shutdown() -{ - if (!ownsqapp) - return; - - // check if qApp still runs widgets (in other DLLs) - QWidgetList widgets = qApp->allWidgets(); - int count = widgets.count(); - for (int w = 0; w < widgets.count(); ++w) { - // ignore all Qt generated widgets - QWidget *widget = widgets.at(w); - if (widget->windowFlags() & Qt::Desktop) - count--; - } - if (count) // qApp still used - return; - - delete qApp; - ownsqapp = false; - if ( hhook ) - UnhookWindowsHookEx( hhook ); - hhook = 0; -} - -extern "C" void qtns_embed(QtNPInstance *This) -{ - Q_ASSERT(qobject_cast<QWidget*>(This->qt.object)); - - LONG oldLong = GetWindowLong(This->window, GWL_STYLE); - ::SetWindowLong(This->window, GWL_STYLE, oldLong | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); - ::SetWindowLong(This->qt.widget->winId(), GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); - ::SetParent(This->qt.widget->winId(), This->window); -} - -extern "C" void qtns_setGeometry(QtNPInstance *This, const QRect &rect, const QRect &) -{ - Q_ASSERT(qobject_cast<QWidget*>(This->qt.object)); - - This->qt.widget->setGeometry(QRect(0, 0, rect.width(), rect.height())); -} - -/* -extern "C" void qtns_print(QtNPInstance * This, NPPrint *printInfo) -{ - NPWindow* printWindow = &(printInfo->print.embedPrint.window); - void* platformPrint = printInfo->print.embedPrint.platformPrint; - // #### Nothing yet. -} -*/ diff --git a/x2gobrowserplugin-2.4_1/src/qtbrowserplugin_x11.cpp b/x2gobrowserplugin-2.4_1/src/qtbrowserplugin_x11.cpp deleted file mode 100644 index c988a34..0000000 --- a/x2gobrowserplugin-2.4_1/src/qtbrowserplugin_x11.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of a Qt Solutions component. -** -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -****************************************************************************/ - -#include <QtGui> -#include <QtGui/QX11EmbedWidget> - -#include "qtbrowserplugin.h" -#include "qtbrowserplugin_p.h" - -#include "qtnpapi.h" - -#include <stdlib.h> - -static bool ownsqapp = false; -static QMap<QtNPInstance*, QX11EmbedWidget*> clients; - -extern "C" bool qtns_event(QtNPInstance *, NPEvent *) -{ - return false; -} - -extern "C" void qtns_initialize(QtNPInstance* This) -{ - if (!qApp) { - ownsqapp = true; - static int argc = 0; - static char **argv = {0}; - - // Workaround to avoid re-initilaziation of glib - char* envvar = qstrdup("QT_NO_THREADED_GLIB=1"); - // Unavoidable memory leak; the variable must survive plugin unloading - ::putenv(envvar); - - (void)new QApplication(argc, argv); - } - if (!clients.contains(This)) { - QX11EmbedWidget* client = new QX11EmbedWidget; - QHBoxLayout* layout = new QHBoxLayout(client); - layout->setMargin(0); - clients.insert(This, client); - } -} - -extern "C" void qtns_destroy(QtNPInstance* This) -{ - QMap<QtNPInstance*, QX11EmbedWidget*>::iterator it = clients.find(This); - if (it == clients.end()) - return; - delete it.value(); - clients.erase(it); -} - -extern "C" void qtns_shutdown() -{ - if (clients.count() > 0) { - QMap<QtNPInstance*, QX11EmbedWidget*>::iterator it = clients.begin(); - while (it != clients.end()) { - delete it.value(); - ++it; - } - clients.clear(); - } - - if (!ownsqapp) - return; - - // check if qApp still runs widgets (in other DLLs) - QWidgetList widgets = qApp->allWidgets(); - int count = widgets.count(); - for (int w = 0; w < widgets.count(); ++w) { - // ignore all Qt generated widgets - QWidget *widget = widgets.at(w); - if (widget->windowFlags() & Qt::Desktop) - count--; - } - if (count) // qApp still used - return; - - delete qApp; - ownsqapp = false; -} - -extern "C" void qtns_embed(QtNPInstance *This) -{ - Q_ASSERT(qobject_cast<QWidget*>(This->qt.object)); - - QMap<QtNPInstance*, QX11EmbedWidget*>::iterator it = clients.find(This); - if (it == clients.end()) - return; - QX11EmbedWidget* client = it.value(); - This->qt.widget->setParent(client); - client->layout()->addWidget(This->qt.widget); - client->embedInto(This->window); - client->show(); -} - -extern "C" void qtns_setGeometry(QtNPInstance *This, const QRect &rect, const QRect &) -{ - Q_ASSERT(qobject_cast<QWidget*>(This->qt.object)); - - QMap<QtNPInstance*, QX11EmbedWidget*>::iterator it = clients.find(This); - if (it == clients.end()) - return; - QX11EmbedWidget* client = it.value(); - client->setGeometry(QRect(0, 0, rect.width(), rect.height())); -} - -/* -extern "C" void qtns_print(QtNPInstance * This, NPPrint *printInfo) -{ - NPWindow* printWindow = &(printInfo->print.embedPrint.window); - void* platformPrint = printInfo->print.embedPrint.platformPrint; - // #### Nothing yet. -} -*/ diff --git a/x2gobrowserplugin-2.4_1/src/qtbrowserpluginax.def b/x2gobrowserplugin-2.4_1/src/qtbrowserpluginax.def deleted file mode 100644 index df2dedb..0000000 --- a/x2gobrowserplugin-2.4_1/src/qtbrowserpluginax.def +++ /dev/null @@ -1,9 +0,0 @@ -EXPORTS - NP_GetEntryPoints @1 - NP_Initialize @2 - NP_Shutdown @3 - DllCanUnloadNow PRIVATE - DllGetClassObject PRIVATE - DllRegisterServer PRIVATE - DllUnregisterServer PRIVATE - DumpIDL PRIVATE diff --git a/x2gobrowserplugin-2.4_1/src/qtnpapi.h b/x2gobrowserplugin-2.4_1/src/qtnpapi.h deleted file mode 100644 index d9b5357..0000000 --- a/x2gobrowserplugin-2.4_1/src/qtnpapi.h +++ /dev/null @@ -1,555 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of a Qt Solutions component. -** -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -****************************************************************************/ - -// see http://www.mozilla.org/projects/plugins/ for details regarding the structs and API prototypes - -#ifndef QTNPAPI_H -#define QTNPAPI_H - -// Plugin API version -#define NP_VERSION_MAJOR 0 -#define NP_VERSION_MINOR 17 - -// basic types -typedef unsigned short uint16; -typedef short int16; -typedef unsigned int uint32; -typedef int int32; - -typedef unsigned char NPBool; -typedef int16 NPError; -typedef int16 NPReason; -typedef char* NPMIMEType; - -typedef void *NPRegion; -typedef void *NPIdentifier; - -// Java stuff -typedef void* jref; -typedef void* JRIGlobalRef; -typedef void* JRIEnv; // ### not quite correct, but we don't use it anyway - -// NP-types -struct NPP_t -{ - void* pdata; // plug-in private data - void* ndata; // browser private data -}; -typedef NPP_t* NPP; - -struct NPRect -{ - uint16 top; - uint16 left; - uint16 bottom; - uint16 right; -}; - -#ifdef Q_WS_WIN -struct NPEvent -{ - uint16 event; - uint32 wParam; - uint32 lParam; -}; -#elif defined(Q_WS_X11) -# include <X11/Xlib.h> -typedef XEvent NPEvent; -#elif defined (Q_WS_MAC) -typedef struct EventRecord NPEvent; -#endif - -// Variable names for NPP_GetValue -enum NPPVariable { - NPPVpluginNameString = 1, - NPPVpluginDescriptionString, - NPPVpluginWindowBool, - NPPVpluginTransparentBool, - NPPVjavaClass, - NPPVpluginWindowSize, - NPPVpluginTimerInterval, - - NPPVpluginScriptableInstance = 10, - NPPVpluginScriptableIID = 11, - - // Introduced in Mozilla 0.9.9 - NPPVjavascriptPushCallerBool = 12, - - // Introduced in Mozilla 1.0 - NPPVpluginKeepLibraryInMemory = 13, - NPPVpluginNeedsXEmbed = 14, - - // Introduced in Firefox 1.0 - NPPVpluginScriptableNPObject = 15, - NPPVformValue = 16 -} ; - -// Variable names for NPN_GetValue -enum NPNVariable { - NPNVxDisplay = 1, - NPNVxtAppContext, - NPNVnetscapeWindow, - NPNVjavascriptEnabledBool, - NPNVasdEnabledBool, - NPNVisOfflineBool, - - // Introduced in Mozilla 0.9.4 - NPNVserviceManager = 10, - NPNVDOMElement = 11, - // Introduced in Mozilla 1.2 - NPNVDOMWindow = 12, - NPNVToolkit = 13, - NPNVSupportsXEmbedBool = 14, - - NPNVWindowNPObject = 15, - NPNVPluginElementNPObject = 16 -}; - - -enum NPWindowType { - NPWindowTypeWindow = 1, // Windowed plug-in. The window field holds a platform-specific handle to a window. - NPWindowTypeDrawable // Windows: HDC; Mac OS: pointer to NP_Port structure. -}; - -struct NPWindow -{ - // Platform-specific handle to a native window element in the browser's window hierarchy - // XEmbed: "In the NPP_SetWindow call, the window parameter will be the XID of the hosting - // XEmbed window. As an implementation note, this is really the XID of a GtkSocket window." - void* window; - // The x and y coordinates for the top left corner of the plug-in relative to the page - // (and thus relative to the origin of the drawable) - uint32 x, y; - // The height and width of the plug-in area. Should not be modified by the plug-in. - uint32 width, height; - // Used by MAC only (Clipping rectangle in port coordinates) - NPRect clipRect; -#ifdef Q_WS_X11 - // Contains information about the plug-in's Unix window environment - // points to an NPSetWindowCallbackStruct - void* ws_info; // probably obsolete with XEmbed -#endif - // The type field indicates the NPWindow type of the target area - NPWindowType type; -}; - -struct NPPort -{ - void *port; - int32 portx; - int32 porty; -}; - -struct NPFullPrint -{ - NPBool pluginPrinted; // true if plugin handled fullscreen printing - NPBool printOne; // true if plugin should print one copy to default printer - void* platformPrint; // Platform-specific printing info -}; - -struct NPEmbedPrint -{ - NPWindow window; - void* platformPrint; // Platform-specific printing info -}; - -struct NPPrint -{ - uint16 mode; // NP_FULL or NP_EMBED - union { - NPFullPrint fullPrint; - NPEmbedPrint embedPrint; - } print; -}; - -struct NPSavedData -{ - int32 len; - void* buf; -}; - -struct NPStream -{ - void* pdata; - void* ndata; - const char* url; - uint32 end; - uint32 lastmodified; - void* notifyData; -}; - -struct NPByteRange -{ - int32 offset; // negative offset means from the end - uint32 length; - NPByteRange* next; -}; - -// Values for mode passed to NPP_New: -#define NP_EMBED 1 -#define NP_FULL 2 - -// Values for stream type passed to NPP_NewStream: -#define NP_NORMAL 1 -#define NP_SEEK 2 -#define NP_ASFILE 3 -#define NP_ASFILEONLY 4 - -#define NP_MAXREADY (((unsigned)(~0)<<1)>>1) - -// Values of type NPError: -#define NPERR_NO_ERROR 0 -#define NPERR_GENERIC_ERROR 1 -#define NPERR_INVALID_INSTANCE_ERROR 2 -#define NPERR_INVALID_FUNCTABLE_ERROR 3 -#define NPERR_MODULE_LOAD_FAILED_ERROR 4 -#define NPERR_OUT_OF_MEMORY_ERROR 5 -#define NPERR_INVALID_PLUGIN_ERROR 6 -#define NPERR_INVALID_PLUGIN_DIR_ERROR 7 -#define NPERR_INCOMPATIBLE_VERSION_ERROR 8 -#define NPERR_INVALID_PARAM 9 -#define NPERR_INVALID_URL 10 -#define NPERR_FILE_NOT_FOUND 11 -#define NPERR_NO_DATA 12 -#define NPERR_STREAM_NOT_SEEKABLE 13 - -// Values of type NPReason: -#define NPRES_DONE 0 -#define NPRES_NETWORK_ERR 1 -#define NPRES_USER_BREAK 2 - -// Version feature information -#define NPVERS_HAS_STREAMOUTPUT 8 -#define NPVERS_HAS_NOTIFICATION 9 -#define NPVERS_HAS_LIVECONNECT 9 -#define NPVERS_WIN16_HAS_LIVECONNECT 10 - -// Mac specifics -#ifdef Q_WS_MAC -# define getFocusEvent (osEvt + 16) -# define loseFocusEvent (osEvt + 17) -# define adjustCursorEvent (osEvt + 18) -# define QTBROWSER_USE_CFM -#endif - -#ifdef QTBROWSER_USE_CFM - extern void *CFMFunctionPointerForMachOFunctionPointer(void*); - extern void DisposeCFMFunctionPointer(void *); - extern void* MachOFunctionPointerForCFMFunctionPointer(void*); -# define FUNCTION_POINTER(t) void* -# define MAKE_FUNCTION_POINTER(f) CFMFunctionPointerForMachOFunctionPointer((void*)f) -# define DESTROY_FUNCTION_POINTER(n) DisposeCFMFunctionPointer(n) -# define FIND_FUNCTION_POINTER(t, n) (*(t)MachOFunctionPointerForCFMFunctionPointer(n)) -#else -# define FUNCTION_POINTER(t) t -# define MAKE_FUNCTION_POINTER(f) f -# define DESTROY_FUNCTION_POINTER(n) -# define FIND_FUNCTION_POINTER(t, n) (*n) -#endif - -// Plugin function prototypes -typedef NPError (*NPP_NewFP)(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved); -typedef NPError (*NPP_DestroyFP)(NPP instance, NPSavedData** save); -typedef NPError (*NPP_SetWindowFP)(NPP instance, NPWindow* window); -typedef NPError (*NPP_NewStreamFP)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype); -typedef NPError (*NPP_DestroyStreamFP)(NPP instance, NPStream* stream, NPReason reason); -typedef void (*NPP_StreamAsFileFP)(NPP instance, NPStream* stream, const char* fname); -typedef int32 (*NPP_WriteReadyFP)(NPP instance, NPStream* stream); -typedef int32 (*NPP_WriteFP)(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer); -typedef void (*NPP_PrintFP)(NPP instance, NPPrint* platformPrint); -typedef int16 (*NPP_HandleEventFP)(NPP instance, NPEvent* event); -typedef void (*NPP_URLNotifyFP)(NPP instance, const char* url, NPReason reason, void* notifyData); -typedef NPError (*NPP_GetValueFP)(NPP instance, NPPVariable variable, void *value); -typedef NPError (*NPP_SetValueFP)(NPP instance, NPPVariable variable, void *value); - -// table of functions implemented by the plugin -struct NPPluginFuncs { - uint16 size; - uint16 version; - FUNCTION_POINTER(NPP_NewFP) newp; - FUNCTION_POINTER(NPP_DestroyFP) destroy; - FUNCTION_POINTER(NPP_SetWindowFP) setwindow; - FUNCTION_POINTER(NPP_NewStreamFP) newstream; - FUNCTION_POINTER(NPP_DestroyStreamFP) destroystream; - FUNCTION_POINTER(NPP_StreamAsFileFP) asfile; - FUNCTION_POINTER(NPP_WriteReadyFP) writeready; - FUNCTION_POINTER(NPP_WriteFP) write; - FUNCTION_POINTER(NPP_PrintFP) print; - FUNCTION_POINTER(NPP_HandleEventFP) event; - FUNCTION_POINTER(NPP_URLNotifyFP) urlnotify; - JRIGlobalRef javaClass; - FUNCTION_POINTER(NPP_GetValueFP) getvalue; - FUNCTION_POINTER(NPP_SetValueFP) setvalue; -} ; - - -// forward declarations -struct NPObject; -struct NPClass; -struct NPVariant; -struct NPString; -struct QtNPInstance; - -// NPObject is the type used to express objects exposed by either -// the plugin or by the browser. Implementation specific (i.e. plugin -// specific, or browser specific) members can come after the struct. -// In our case, the plugin specific member (aka QObject) lives in NPClass. -struct NPObject -{ - NPClass *_class; - uint32 refCount; -}; - -// NPClass is what virtual function tables would look like if -// there was no C++... -typedef NPObject *(*NPAllocateFP)(NPP npp, NPClass *aClass); -typedef void (*NPDeallocateFP)(NPObject *npobj); -typedef void (*NPInvalidateFP)(NPObject *npobj); -typedef bool (*NPHasMethodFP)(NPObject *npobj, NPIdentifier name); -typedef bool (*NPInvokeFP)(NPObject *npobj, NPIdentifier name,const NPVariant *args, uint32 argCount,NPVariant *result); -typedef bool (*NPInvokeDefaultFP)(NPObject *npobj,const NPVariant *args,uint32 argCount,NPVariant *result); -typedef bool (*NPHasPropertyFP)(NPObject *npobj, NPIdentifier name); -typedef bool (*NPGetPropertyFP)(NPObject *npobj, NPIdentifier name, NPVariant *result); -typedef bool (*NPSetPropertyFP)(NPObject *npobj, NPIdentifier name, const NPVariant *value); -typedef bool (*NPRemovePropertyFP)(NPObject *npobj, NPIdentifier name); - -#define NP_CLASS_STRUCT_VERSION 1 - -struct NPClass -{ - NPClass(QtNPInstance *qtnp); - ~NPClass(); - - // NP API - uint32 structVersion; - NPAllocateFP allocate; - NPDeallocateFP deallocate; - NPInvalidateFP invalidate; - NPHasMethodFP hasMethod; - NPInvokeFP invoke; - NPInvokeDefaultFP invokeDefault; - NPHasPropertyFP hasProperty; - NPGetPropertyFP getProperty; - NPSetPropertyFP setProperty; - NPRemovePropertyFP removeProperty; - - // User data lives here - QtNPInstance *qtnp; - bool delete_qtnp; -}; - -struct NPString { - const char *utf8characters; - uint32 utf8length; - - // Qt specific conversion routines - // (no c'tor as it would be misleading that there is no d'tor in spite of memory allocation) - static NPString fromQString(const QString &qstr); - operator QString() const; -}; - -struct NPVariant { - enum Type { - Void, - Null, - Boolean, - Int32, - Double, - String, - Object - }; - Type type; - union { - bool boolValue; - uint32 intValue; - double doubleValue; - NPString stringValue; - NPObject *objectValue; - } value; - - NPVariant() - : type(Null) - {} - - // Qt specific conversion routines - // (no c'tor as the NPP instance is required) - static NPVariant fromQVariant(QtNPInstance *This, const QVariant &qvariant); - operator QVariant() const; - -private: -}; - -#ifdef Q_WS_X11 -extern "C" { -#endif - -// Browser function prototypes -typedef NPError (*NPN_GetURLFP)(NPP instance, const char* url, const char* window); -typedef NPError (*NPN_PostURLFP)(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file); -typedef NPError (*NPN_RequestReadFP)(NPStream* stream, NPByteRange* rangeList); -typedef NPError (*NPN_NewStreamFP)(NPP instance, NPMIMEType type, const char* window, NPStream** stream); -typedef int32 (*NPN_WriteFP)(NPP instance, NPStream* stream, int32 len, void* buffer); -typedef NPError (*NPN_DestroyStreamFP)(NPP instance, NPStream* stream, NPReason reason); -typedef void (*NPN_StatusFP)(NPP instance, const char* message); -typedef const char* (*NPN_UserAgentFP)(NPP instance); -typedef void* (*NPN_MemAllocFP)(uint32 size); -typedef void (*NPN_MemFreeFP)(void* ptr); -typedef uint32 (*NPN_MemFlushFP)(uint32 size); -typedef void (*NPN_ReloadPluginsFP)(NPBool reloadPages); -typedef JRIEnv* (*NPN_GetJavaEnvFP)(void); -typedef jref (*NPN_GetJavaPeerFP)(NPP instance); -typedef NPError (*NPN_GetURLNotifyFP)(NPP instance, const char* url, const char* window, void* notifyData); -typedef NPError (*NPN_PostURLNotifyFP)(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file, void* notifyData); -typedef NPError (*NPN_GetValueFP)(NPP instance, NPNVariable variable, void *ret_value); -typedef NPError (*NPN_SetValueFP)(NPP instance, NPPVariable variable, void *ret_value); -typedef void (*NPN_InvalidateRectFP)(NPP instance, NPRect *rect); -typedef void (*NPN_InvalidateRegionFP)(NPP instance, NPRegion *region); -typedef void (*NPN_ForceRedrawFP)(NPP instance); -typedef NPIdentifier (*NPN_GetStringIdentifierFP)(const char* name); -typedef void (*NPN_GetStringIdentifiersFP)(const char** names, int32 nameCount, NPIdentifier* identifiers); -typedef NPIdentifier (*NPN_GetIntIdentifierFP)(int32 intid); -typedef bool (*NPN_IdentifierIsStringFP)(NPIdentifier identifier); -typedef char* (*NPN_UTF8FromIdentifierFP)(NPIdentifier identifier); -typedef int32 (*NPN_IntFromIdentifierFP)(NPIdentifier identifier); -typedef NPObject* (*NPN_CreateObjectFP)(NPP npp, NPClass *aClass); -typedef NPObject* (*NPN_RetainObjectFP)(NPObject *obj); -typedef void (*NPN_ReleaseObjectFP)(NPObject *obj); -typedef bool (*NPN_InvokeFP)(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, int32 argCount, NPVariant *result); -typedef bool (*NPN_InvokeDefaultFP)(NPP npp, NPObject* obj, const NPVariant *args, int32 argCount, NPVariant *result); -typedef bool (*NPN_EvaluateFP)(NPP npp, NPObject *obj, NPString *script, NPVariant *result); -typedef bool (*NPN_GetPropertyFP)(NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result); -typedef bool (*NPN_SetPropertyFP)(NPP npp, NPObject *obj, NPIdentifier propertyName, const NPVariant *value); -typedef bool (*NPN_RemovePropertyFP)(NPP npp, NPObject *obj, NPIdentifier propertyName); -typedef bool (*NPN_HasPropertyFP)(NPP npp, NPObject *obj, NPIdentifier propertyName); -typedef bool (*NPN_HasMethodFP)(NPP npp, NPObject *obj, NPIdentifier methodName); -typedef void (*NPN_ReleaseVariantValueFP)(NPVariant *variant); -typedef void (*NPN_SetExceptionFP)(NPObject *obj, const char *message); - -// function declarations -NPError NPN_GetURL(NPP instance, const char* url, const char* window); -NPError NPN_PostURL(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file); -NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList); -NPError NPN_NewStream(NPP instance, NPMIMEType type, const char* window, NPStream** stream); -int32 NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer); -NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPReason reason); -void NPN_Status(NPP instance, const char* message); -const char* NPN_UserAgent(NPP instance); -void* NPN_MemAlloc(uint32 size); -void NPN_MemFree(void* ptr); -uint32 NPN_MemFlush(uint32 size); -void NPN_ReloadPlugins(NPBool reloadPages); -JRIEnv* NPN_GetJavaEnv(void); -jref NPN_GetJavaPeer(NPP instance); -NPError NPN_GetURLNotify(NPP instance, const char* url, const char* window, void* notifyData); -NPError NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file, void* notifyData); -NPError NPN_GetValue(NPP instance, NPNVariable variable, void *ret_value); -NPError NPN_SetValue(NPP instance, NPPVariable variable, void *ret_value); -void NPN_InvalidateRect(NPP instance, NPRect *rect); -void NPN_InvalidateRegion(NPP instance, NPRegion *region); -void NPN_ForceRedraw(NPP instance); -NPIdentifier NPN_GetStringIdentifier(const char* name); -void NPN_GetStringIdentifiers(const char** names, int32 nameCount, NPIdentifier* identifiers); -NPIdentifier NPN_GetIntIdentifier(int32 intid); -bool NPN_IdentifierIsString(NPIdentifier identifier); -char* NPN_UTF8FromIdentifier(NPIdentifier identifier); -int32 NPN_IntFromIdentifier(NPIdentifier identifier); -NPObject* NPN_CreateObject(NPP npp, NPClass *aClass); -NPObject* NPN_RetainObject(NPObject *obj); -void NPN_ReleaseObject(NPObject *obj); -bool NPN_Invoke(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, int32 argCount, NPVariant *result); -bool NPN_InvokeDefault(NPP npp, NPObject* obj, const NPVariant *args, int32 argCount, NPVariant *result); -bool NPN_Evaluate(NPP npp, NPObject *obj, NPString *script, NPVariant *result); -bool NPN_GetProperty(NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result); -bool NPN_SetProperty(NPP npp, NPObject *obj, NPIdentifier propertyName, const NPVariant *value); -bool NPN_RemoveProperty(NPP npp, NPObject *obj, NPIdentifier propertyName); -bool NPN_HasProperty(NPP npp, NPObject *obj, NPIdentifier propertyName); -bool NPN_HasMethod(NPP npp, NPObject *obj, NPIdentifier methodName); -void NPN_ReleaseVariantValue(NPVariant *variant); -void NPN_SetException(NPObject *obj, const char *message); - -// table of function implemented by the browser -struct NPNetscapeFuncs { - uint16 size; - uint16 version; - FUNCTION_POINTER(NPN_GetURLFP) geturl; - FUNCTION_POINTER(NPN_PostURLFP) posturl; - FUNCTION_POINTER(NPN_RequestReadFP) requestread; - FUNCTION_POINTER(NPN_NewStreamFP) newstream; - FUNCTION_POINTER(NPN_WriteFP) write; - FUNCTION_POINTER(NPN_DestroyStreamFP) destroystream; - FUNCTION_POINTER(NPN_StatusFP) status; - FUNCTION_POINTER(NPN_UserAgentFP) uagent; - FUNCTION_POINTER(NPN_MemAllocFP) memalloc; - FUNCTION_POINTER(NPN_MemFreeFP) memfree; - FUNCTION_POINTER(NPN_MemFlushFP) memflush; - FUNCTION_POINTER(NPN_ReloadPluginsFP) reloadplugins; - FUNCTION_POINTER(NPN_GetJavaEnvFP) getJavaEnv; - FUNCTION_POINTER(NPN_GetJavaPeerFP) getJavaPeer; - FUNCTION_POINTER(NPN_GetURLNotifyFP) geturlnotify; - FUNCTION_POINTER(NPN_PostURLNotifyFP) posturlnotify; - FUNCTION_POINTER(NPN_GetValueFP) getvalue; - FUNCTION_POINTER(NPN_SetValueFP) setvalue; - FUNCTION_POINTER(NPN_InvalidateRectFP) invalidaterect; - FUNCTION_POINTER(NPN_InvalidateRegionFP) invalidateregion; - FUNCTION_POINTER(NPN_ForceRedrawFP) forceredraw; - FUNCTION_POINTER(NPN_GetStringIdentifierFP) getstringidentifier; - FUNCTION_POINTER(NPN_GetStringIdentifiersFP) getstringidentifiers; - FUNCTION_POINTER(NPN_GetIntIdentifierFP) getintidentifier; - FUNCTION_POINTER(NPN_IdentifierIsStringFP) identifierisstring; - FUNCTION_POINTER(NPN_UTF8FromIdentifierFP) utf8fromidentifier; - FUNCTION_POINTER(NPN_IntFromIdentifierFP) intfromidentifier; - FUNCTION_POINTER(NPN_CreateObjectFP) createobject; - FUNCTION_POINTER(NPN_RetainObjectFP) retainobject; - FUNCTION_POINTER(NPN_ReleaseObjectFP) releaseobject; - FUNCTION_POINTER(NPN_InvokeFP) invoke; - FUNCTION_POINTER(NPN_InvokeDefaultFP) invokedefault; - FUNCTION_POINTER(NPN_EvaluateFP) evaluate; - FUNCTION_POINTER(NPN_GetPropertyFP) getproperty; - FUNCTION_POINTER(NPN_SetPropertyFP) setproperty; - FUNCTION_POINTER(NPN_RemovePropertyFP) removeproperty; - FUNCTION_POINTER(NPN_HasPropertyFP) hasproperty; - FUNCTION_POINTER(NPN_HasMethodFP) hasmethod; - FUNCTION_POINTER(NPN_ReleaseVariantValueFP) releasevariantvalue; - FUNCTION_POINTER(NPN_SetExceptionFP) setexception; -}; - -#ifdef Q_WS_X11 -} -#endif - -#endif diff --git a/x2gobrowserplugin-2.4_1/src/res/x2goplugin.rc b/x2gobrowserplugin-2.4_1/src/res/x2goplugin.rc deleted file mode 100644 index c037281..0000000 --- a/x2gobrowserplugin-2.4_1/src/res/x2goplugin.rc +++ /dev/null @@ -1,37 +0,0 @@ -1 TYPELIB "x2goplugin.rc" - -1 VERSIONINFO - FILEVERSION 4.1.2.0 - PRODUCTVERSION 4.1.2.0 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "CompanyName", "Obviously Nice\0" - VALUE "FileDescription", "Allows you to start X2Go session in a webbrowser\0" - VALUE "FileExtents", "x2go\0" - VALUE "FileOpenName", "Configuration File for X2Go Session (*.x2go)\0" - VALUE "FileVersion", "4, 1, 2, 0\0" - VALUE "InternalName", "x2goplugin\0" - VALUE "LegalCopyright", "Copyright � 2010-2018 X2Go Project\0" - VALUE "MIMEType", "application/x2go\0" - VALUE "OriginalFilename", "npx2goplugin.dll\0" - VALUE "ProductName", "X2GoClient Plug-in 4.1.2.0\0" - VALUE "ProductVersion", "4, 1, 2, 0\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goclient.git