Bug 539280 - Add support for NPNVnetscapeWindow query on Linux, r=karlt

This commit is contained in:
Benjamin Smedberg 2010-01-14 10:18:34 -05:00
Родитель 91685776a5
Коммит 53e84d481c
5 изменённых файлов: 28 добавлений и 10 удалений

Просмотреть файл

@ -49,6 +49,7 @@ using NPError;
using NPRemoteWindow;
using NPRemoteEvent;
using NPRect;
using mozilla::plugins::NativeWindowHandle;
namespace mozilla {
namespace plugins {
@ -94,7 +95,7 @@ parent:
rpc NPN_GetValue_NPNVprivateModeBool()
returns (bool value, NPError result);
rpc NPN_GetValue_NPNVnetscapeWindow()
returns (intptr_t value, NPError result);
returns (NativeWindowHandle value, NPError result);
rpc NPN_SetValue_NPPVpluginWindow(bool windowed)
returns (NPError result);

Просмотреть файл

@ -210,7 +210,7 @@ PluginInstanceChild::NPN_GetValue(NPNVariable aVar,
if (mWindow.type == NPWindowTypeDrawable) {
HWND hwnd = NULL;
NPError result;
if (!CallNPN_GetValue_NPNVnetscapeWindow((intptr_t*)&hwnd, &result)) {
if (!CallNPN_GetValue_NPNVnetscapeWindow(&hwnd, &result)) {
return NPERR_GENERIC_ERROR;
}
*static_cast<HWND*>(aValue) = hwnd;
@ -220,6 +220,10 @@ PluginInstanceChild::NPN_GetValue(NPNVariable aVar,
*static_cast<HWND*>(aValue) = mPluginWindowHWND;
return NPERR_NO_ERROR;
}
#elif defined(MOZ_X11)
NPError result;
CallNPN_GetValue_NPNVnetscapeWindow(static_cast<XID*>(aValue), &result);
return result;
#else
return NPERR_GENERIC_ERROR;
#endif

Просмотреть файл

@ -151,16 +151,20 @@ PluginInstanceParent::AnswerNPN_GetValue_NPNVisOfflineBool(bool* value,
}
bool
PluginInstanceParent::AnswerNPN_GetValue_NPNVnetscapeWindow(intptr_t* value,
PluginInstanceParent::AnswerNPN_GetValue_NPNVnetscapeWindow(NativeWindowHandle* value,
NPError* result)
{
#ifdef XP_WIN
HWND hwnd;
*result = mNPNIface->getvalue(mNPP, NPNVnetscapeWindow, &hwnd);
*value = (intptr_t)hwnd;
return true;
#endif
HWND id;
#elif defined(MOZ_X11)
XID id;
#else
return false;
#endif
*result = mNPNIface->getvalue(mNPP, NPNVnetscapeWindow, &id);
*value = id;
return true;
}
bool

Просмотреть файл

@ -104,7 +104,8 @@ public:
virtual bool
AnswerNPN_GetValue_NPNVisOfflineBool(bool* value, NPError* result);
virtual bool
AnswerNPN_GetValue_NPNVnetscapeWindow(intptr_t* value, NPError* result);
AnswerNPN_GetValue_NPNVnetscapeWindow(NativeWindowHandle* value,
NPError* result);
virtual bool
AnswerNPN_GetValue_NPNVWindowNPObject(
PPluginScriptableObjectParent** value,

Просмотреть файл

@ -109,6 +109,14 @@ struct NPRemoteWindow
#endif
};
#ifdef XP_WIN
typedef HWND NativeWindowHandle;
#elif defined(MOZ_X11)
typedef XID NativeWindowHandle;
#else
#error Need NativeWindowHandle for this platform
#endif
// XXX maybe not the best place for these. better one?
#define VARSTR(v_) case v_: return #v_