Commit 7d2885fb authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

NPWin: use the common code too

parent bf78acf1
......@@ -95,7 +95,7 @@ libvlcplugin_la_SOURCES += \
vlcplugin_win.cpp vlcplugin_win.h \
vlcwindowless_base.cpp vlcwindowless_base.h \
vlcwindowless_win.cpp vlcwindowless_win.h \
support/npwin.cpp
support/npwin.cpp support/npcommon.cpp
npvlc_la_DEPENDENCIES += $(DATA_npvlc_rc)
npvlc_la_LDFLAGS += -Wl,--kill-at -Wl,$(DATA_npvlc_rc)
......
......@@ -45,7 +45,7 @@
/***********************************************************************
* Globals
***********************************************************************/
static NPNetscapeFuncs *gNetscapeFuncs; /* Netscape Function table */
NPNetscapeFuncs *gNetscapeFuncs; /* Netscape Function table */
static inline int getMinorVersion() { return gNetscapeFuncs->version & 0xFF; }
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
......@@ -174,17 +174,6 @@ NPP_GET_MIME_CONST char * NP_GetMIMEDescription()
typically using the NP_LOADDS macro
*/
/* returns the major/minor version numbers of the Plugin API for the plugin
and the Navigator
*/
void NPN_Version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor)
{
*plugin_major = NP_VERSION_MAJOR;
*plugin_minor = NP_VERSION_MINOR;
*netscape_major = HIBYTE(gNetscapeFuncs->version);
*netscape_minor = LOBYTE(gNetscapeFuncs->version);
}
void NPN_PluginThreadAsyncCall(NPP plugin, void (*func)(void *), void *userData)
{
#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) >= 20)
......@@ -192,311 +181,3 @@ void NPN_PluginThreadAsyncCall(NPP plugin, void (*func)(void *), void *userData)
#endif
}
NPError NPN_GetValue(NPP instance, NPNVariable variable, void *result)
{
return gNetscapeFuncs->getvalue(instance, variable, result);
}
NPError NPN_SetValue(NPP instance, NPPVariable variable, void *value)
{
return gNetscapeFuncs->setvalue(instance, variable, value);
}
void NPN_InvalidateRect(NPP instance, NPRect *rect)
{
gNetscapeFuncs->invalidaterect(instance, rect);
}
void NPN_InvalidateRegion(NPP instance, NPRegion region)
{
gNetscapeFuncs->invalidateregion(instance, region);
}
void NPN_ForceRedraw(NPP instance)
{
gNetscapeFuncs->forceredraw(instance);
}
NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name)
{
int minor = getMinorVersion();
if( minor >= 14 )
{
return gNetscapeFuncs->getstringidentifier(name);
}
return NULL;
}
void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount,
NPIdentifier *identifiers)
{
int minor = getMinorVersion();
if( minor >= 14 )
gNetscapeFuncs->getstringidentifiers(names, nameCount, identifiers);
}
NPIdentifier NPN_GetIntIdentifier(int32_t intid)
{
int minor = getMinorVersion();
if( minor >= 14 )
return gNetscapeFuncs->getintidentifier(intid);
return NULL;
}
bool NPN_IdentifierIsString(NPIdentifier identifier)
{
int minor = getMinorVersion();
if( minor >= 14 )
{
return gNetscapeFuncs->identifierisstring(identifier);
}
return false;
}
NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier)
{
int minor = getMinorVersion();
if( minor >= 14 )
return gNetscapeFuncs->utf8fromidentifier(identifier);
return NULL;
}
int32_t NPN_IntFromIdentifier(NPIdentifier identifier)
{
int minor = getMinorVersion();
if( minor >= 14 )
return gNetscapeFuncs->intfromidentifier(identifier);
return 0;
}
NPObject *NPN_CreateObject(NPP instance, NPClass *aClass)
{
int minor = getMinorVersion();
if( minor >= 14 )
return gNetscapeFuncs->createobject(instance, aClass);
return NULL;
}
NPObject *NPN_RetainObject(NPObject *npobj)
{
int minor = getMinorVersion();
if( minor >= 14 )
return gNetscapeFuncs->retainobject(npobj);
return NULL;
}
void NPN_ReleaseObject(NPObject *npobj)
{
int minor = getMinorVersion();
if( minor >= 14 )
gNetscapeFuncs->releaseobject(npobj);
}
bool NPN_Invoke(NPP instance, NPObject *npobj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result)
{
int minor = getMinorVersion();
if( minor >= 14 )
return gNetscapeFuncs->invoke(instance, npobj, methodName, args, argCount, result);
return false;
}
bool NPN_InvokeDefault(NPP instance, NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result)
{
int minor = getMinorVersion();
if( minor >= 14 )
return gNetscapeFuncs->invokeDefault(instance, npobj, args, argCount, result);
return false;
}
bool NPN_Evaluate(NPP instance, NPObject *npobj, NPString *script, NPVariant *result)
{
int minor = getMinorVersion();
if( minor >= 14 )
return gNetscapeFuncs->evaluate(instance, npobj, script, result);
return false;
}
bool NPN_GetProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName, NPVariant *result)
{
int minor = getMinorVersion();
if( minor >= 14 )
return gNetscapeFuncs->getproperty(instance, npobj, propertyName, result);
return false;
}
bool NPN_SetProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName, const NPVariant *value)
{
int minor = getMinorVersion();
if( minor >= 14 )
return gNetscapeFuncs->setproperty(instance, npobj, propertyName, value);
return false;
}
bool NPN_RemoveProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName)
{
int minor = getMinorVersion();
if( minor >= 14 )
return gNetscapeFuncs->removeproperty(instance, npobj, propertyName);
return false;
}
bool NPN_HasProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName)
{
int minor = getMinorVersion();
if( minor >= 14 )
return gNetscapeFuncs->hasproperty(instance, npobj, propertyName);
return false;
}
bool NPN_HasMethod(NPP instance, NPObject *npobj, NPIdentifier methodName)
{
int minor = getMinorVersion();
if( minor >= 14 )
return gNetscapeFuncs->hasmethod(instance, npobj, methodName);
return false;
}
void NPN_ReleaseVariantValue(NPVariant *variant)
{
int minor = getMinorVersion();
if( minor >= 14 )
gNetscapeFuncs->releasevariantvalue(variant);
}
void NPN_SetException(NPObject *npobj, const NPUTF8 *message)
{
int minor = getMinorVersion();
if( minor >= 14 )
gNetscapeFuncs->setexception(npobj, message);
}
/* causes the specified URL to be fetched and streamed in
*/
NPError NPN_GetURLNotify(NPP instance, const char *url, const char *target, void* notifyData)
{
int minor = getMinorVersion();
NPError err;
if( minor >= NPVERS_HAS_NOTIFICATION ) {
err = gNetscapeFuncs->geturlnotify(instance, url, target, notifyData);
}
else {
err = NPERR_INCOMPATIBLE_VERSION_ERROR;
}
return err;
}
NPError NPN_GetURL(NPP instance, const char *url, const char *target)
{
return gNetscapeFuncs->geturl(instance, url, target);
}
NPError NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData)
{
int minor = getMinorVersion();
NPError err;
if( minor >= NPVERS_HAS_NOTIFICATION ) {
err = gNetscapeFuncs->posturlnotify(instance, url, window, len, buf, file, notifyData);
}
else {
err = NPERR_INCOMPATIBLE_VERSION_ERROR;
}
return err;
}
NPError NPN_PostURL(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file)
{
return gNetscapeFuncs->posturl(instance, url, window, len, buf, file);
}
/* Requests that a number of bytes be provided on a stream. Typically
this would be used if a stream was in "pull" mode. An optional
position can be provided for streams which are seekable.
*/
NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
{
return gNetscapeFuncs->requestread(stream, rangeList);
}
/* Creates a new stream of data from the plug-in to be interpreted
* by Netscape in the current window.
*/
NPError NPN_NewStream(NPP instance, NPMIMEType type,
const char* target, NPStream** stream)
{
int minor = getMinorVersion();
NPError err;
if( minor >= NPVERS_HAS_STREAMOUTPUT ) {
err = gNetscapeFuncs->newstream(instance, type, target, stream);
}
else {
err = NPERR_INCOMPATIBLE_VERSION_ERROR;
}
return err;
}
/* Provides len bytes of data.
*/
int32_t NPN_Write(NPP instance, NPStream *stream,
int32_t len, void *buffer)
{
int minor = getMinorVersion();
int32_t result;
if( minor >= NPVERS_HAS_STREAMOUTPUT ) {
result = gNetscapeFuncs->write(instance, stream, len, buffer);
}
else {
result = -1;
}
return result;
}
/* Closes a stream object.
* reason indicates why the stream was closed.
*/
NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason)
{
int minor = getMinorVersion();
NPError err;
if( minor >= NPVERS_HAS_STREAMOUTPUT ) {
err = gNetscapeFuncs->destroystream(instance, stream, reason);
}
else {
err = NPERR_INCOMPATIBLE_VERSION_ERROR;
}
return err;
}
/* Provides a text status message in the Netscape client user interface
*/
void NPN_Status(NPP instance, const char *message)
{
gNetscapeFuncs->status(instance, message);
}
/* returns the user agent string of Navigator, which contains version info
*/
const char* NPN_UserAgent(NPP instance)
{
return gNetscapeFuncs->uagent(instance);
}
/* allocates memory from the Navigator's memory space. Necessary so that
* saved instance data may be freed by Navigator when exiting.
*/
void *NPN_MemAlloc(uint32_t size)
{
return gNetscapeFuncs->memalloc(size);
}
/* reciprocal of MemAlloc() above
*/
void NPN_MemFree(void* ptr)
{
gNetscapeFuncs->memfree(ptr);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment