From 53e84d481c067fbc6d28f3916e534d03d13efb0e Mon Sep 17 00:00:00 2001 From: Benjamin Smedberg Date: Thu, 14 Jan 2010 10:18:34 -0500 Subject: [PATCH] Bug 539280 - Add support for NPNVnetscapeWindow query on Linux, r=karlt --- dom/plugins/PPluginInstance.ipdl | 3 ++- dom/plugins/PluginInstanceChild.cpp | 6 +++++- dom/plugins/PluginInstanceParent.cpp | 18 +++++++++++------- dom/plugins/PluginInstanceParent.h | 3 ++- dom/plugins/PluginMessageUtils.h | 8 ++++++++ 5 files changed, 28 insertions(+), 10 deletions(-) diff --git a/dom/plugins/PPluginInstance.ipdl b/dom/plugins/PPluginInstance.ipdl index 4201763e56ca..b362bdb51588 100644 --- a/dom/plugins/PPluginInstance.ipdl +++ b/dom/plugins/PPluginInstance.ipdl @@ -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); diff --git a/dom/plugins/PluginInstanceChild.cpp b/dom/plugins/PluginInstanceChild.cpp index 292e780d5e49..8975e6a5b759 100644 --- a/dom/plugins/PluginInstanceChild.cpp +++ b/dom/plugins/PluginInstanceChild.cpp @@ -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(aValue) = hwnd; @@ -220,6 +220,10 @@ PluginInstanceChild::NPN_GetValue(NPNVariable aVar, *static_cast(aValue) = mPluginWindowHWND; return NPERR_NO_ERROR; } +#elif defined(MOZ_X11) + NPError result; + CallNPN_GetValue_NPNVnetscapeWindow(static_cast(aValue), &result); + return result; #else return NPERR_GENERIC_ERROR; #endif diff --git a/dom/plugins/PluginInstanceParent.cpp b/dom/plugins/PluginInstanceParent.cpp index 2c7740eefd86..3a10040b010a 100644 --- a/dom/plugins/PluginInstanceParent.cpp +++ b/dom/plugins/PluginInstanceParent.cpp @@ -151,16 +151,20 @@ PluginInstanceParent::AnswerNPN_GetValue_NPNVisOfflineBool(bool* value, } bool -PluginInstanceParent::AnswerNPN_GetValue_NPNVnetscapeWindow(intptr_t* value, - NPError* result) +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 diff --git a/dom/plugins/PluginInstanceParent.h b/dom/plugins/PluginInstanceParent.h index e7f05eac7117..b07e2ab253b2 100644 --- a/dom/plugins/PluginInstanceParent.h +++ b/dom/plugins/PluginInstanceParent.h @@ -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, diff --git a/dom/plugins/PluginMessageUtils.h b/dom/plugins/PluginMessageUtils.h index 5b24a9354cc5..abce735da67d 100644 --- a/dom/plugins/PluginMessageUtils.h +++ b/dom/plugins/PluginMessageUtils.h @@ -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_