Getting windowless plugin stuff into
git-svn-id: svn://10.0.0.236/trunk@33030 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
5f8254e1e3
commit
4cc6799ade
@ -148,6 +148,7 @@ public:
|
||||
NS_IMETHOD Init(nsIPresContext *aPresContext, nsObjectFrame *aFrame);
|
||||
|
||||
nsPluginPort* GetPluginPort();
|
||||
void ReleasePluginPort();//~~~
|
||||
|
||||
private:
|
||||
nsPluginWindow mPluginWindow;
|
||||
@ -2445,12 +2446,30 @@ nsPluginPort* nsPluginInstanceOwner::GetPluginPort()
|
||||
{
|
||||
// TODO: fix Windows widget code to support NS_NATIVE_PLUGIN_PORT selector.
|
||||
nsPluginPort* result = NULL;
|
||||
if (mWidget != NULL) {
|
||||
result = (nsPluginPort*) mWidget->GetNativeData(NS_NATIVE_PLUGIN_PORT);
|
||||
if (mWidget != NULL)
|
||||
{//~~~
|
||||
#ifdef XP_WIN
|
||||
if(mPluginWindow.type == nsPluginWindowType_Drawable)
|
||||
result = (nsPluginPort*) mWidget->GetNativeData(NS_NATIVE_GRAPHIC);
|
||||
else
|
||||
#endif
|
||||
result = (nsPluginPort*) mWidget->GetNativeData(NS_NATIVE_PLUGIN_PORT);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//~~~
|
||||
void nsPluginInstanceOwner::ReleasePluginPort()
|
||||
{
|
||||
#ifdef XP_WIN
|
||||
if (mWidget != NULL)
|
||||
{
|
||||
if(mPluginWindow.type == nsPluginWindowType_Drawable)
|
||||
mWidget->FreeNativeData((HDC)mPluginWindow.window, NS_NATIVE_GRAPHIC);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void)
|
||||
{
|
||||
nsIView *view;
|
||||
@ -2480,8 +2499,9 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void)
|
||||
|
||||
if (PR_TRUE == windowless)
|
||||
{
|
||||
mPluginWindow.window = nsnull; //XXX this needs to be a HDC
|
||||
//mPluginWindow.window = nsnull; //XXX this needs to be a HDC
|
||||
mPluginWindow.type = nsPluginWindowType_Drawable;
|
||||
mPluginWindow.window = GetPluginPort();//~~~
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -148,6 +148,7 @@ public:
|
||||
NS_IMETHOD Init(nsIPresContext *aPresContext, nsObjectFrame *aFrame);
|
||||
|
||||
nsPluginPort* GetPluginPort();
|
||||
void ReleasePluginPort();//~~~
|
||||
|
||||
private:
|
||||
nsPluginWindow mPluginWindow;
|
||||
@ -2445,12 +2446,30 @@ nsPluginPort* nsPluginInstanceOwner::GetPluginPort()
|
||||
{
|
||||
// TODO: fix Windows widget code to support NS_NATIVE_PLUGIN_PORT selector.
|
||||
nsPluginPort* result = NULL;
|
||||
if (mWidget != NULL) {
|
||||
result = (nsPluginPort*) mWidget->GetNativeData(NS_NATIVE_PLUGIN_PORT);
|
||||
if (mWidget != NULL)
|
||||
{//~~~
|
||||
#ifdef XP_WIN
|
||||
if(mPluginWindow.type == nsPluginWindowType_Drawable)
|
||||
result = (nsPluginPort*) mWidget->GetNativeData(NS_NATIVE_GRAPHIC);
|
||||
else
|
||||
#endif
|
||||
result = (nsPluginPort*) mWidget->GetNativeData(NS_NATIVE_PLUGIN_PORT);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//~~~
|
||||
void nsPluginInstanceOwner::ReleasePluginPort()
|
||||
{
|
||||
#ifdef XP_WIN
|
||||
if (mWidget != NULL)
|
||||
{
|
||||
if(mPluginWindow.type == nsPluginWindowType_Drawable)
|
||||
mWidget->FreeNativeData((HDC)mPluginWindow.window, NS_NATIVE_GRAPHIC);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void)
|
||||
{
|
||||
nsIView *view;
|
||||
@ -2480,8 +2499,9 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void)
|
||||
|
||||
if (PR_TRUE == windowless)
|
||||
{
|
||||
mPluginWindow.window = nsnull; //XXX this needs to be a HDC
|
||||
//mPluginWindow.window = nsnull; //XXX this needs to be a HDC
|
||||
mPluginWindow.type = nsPluginWindowType_Drawable;
|
||||
mPluginWindow.window = GetPluginPort();//~~~
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -65,6 +65,7 @@ static NS_DEFINE_IID(kIPluginTagInfoIID, NS_IPLUGINTAGINFO_IID);
|
||||
static NS_DEFINE_IID(kIPluginTagInfo2IID, NS_IPLUGINTAGINFO2_IID);
|
||||
static NS_DEFINE_IID(kIJVMPluginTagInfoIID, NS_IJVMPLUGINTAGINFO_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIWindowlessPluginInstancePeerIID, NS_IWINDOWLESSPLUGININSTANCEPEER_IID);//~~~
|
||||
|
||||
NS_IMPL_ADDREF(nsPluginInstancePeerImpl);
|
||||
NS_IMPL_RELEASE(nsPluginInstancePeerImpl);
|
||||
@ -81,6 +82,13 @@ nsresult nsPluginInstancePeerImpl::QueryInterface(const nsIID& iid, void** insta
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (iid.Equals(kIWindowlessPluginInstancePeerIID))//~~~
|
||||
{
|
||||
*instance = (void *)(nsIWindowlessPluginInstancePeer*)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (iid.Equals(kIPluginTagInfoIID))
|
||||
{
|
||||
*instance = (void *)(nsIPluginTagInfo *)this;
|
||||
|
||||
@ -65,6 +65,7 @@ static NS_DEFINE_IID(kIPluginTagInfoIID, NS_IPLUGINTAGINFO_IID);
|
||||
static NS_DEFINE_IID(kIPluginTagInfo2IID, NS_IPLUGINTAGINFO2_IID);
|
||||
static NS_DEFINE_IID(kIJVMPluginTagInfoIID, NS_IJVMPLUGINTAGINFO_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIWindowlessPluginInstancePeerIID, NS_IWINDOWLESSPLUGININSTANCEPEER_IID);//~~~
|
||||
|
||||
NS_IMPL_ADDREF(nsPluginInstancePeerImpl);
|
||||
NS_IMPL_RELEASE(nsPluginInstancePeerImpl);
|
||||
@ -81,6 +82,13 @@ nsresult nsPluginInstancePeerImpl::QueryInterface(const nsIID& iid, void** insta
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (iid.Equals(kIWindowlessPluginInstancePeerIID))//~~~
|
||||
{
|
||||
*instance = (void *)(nsIWindowlessPluginInstancePeer*)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (iid.Equals(kIPluginTagInfoIID))
|
||||
{
|
||||
*instance = (void *)(nsIPluginTagInfo *)this;
|
||||
|
||||
@ -491,6 +491,7 @@ class nsIWidget : public nsISupports {
|
||||
virtual void AddChild(nsIWidget* aChild) = 0;
|
||||
virtual void RemoveChild(nsIWidget* aChild) = 0;
|
||||
virtual void* GetNativeData(PRUint32 aDataType) = 0;
|
||||
virtual void FreeNativeData(void * data, PRUint32 aDataType) = 0;//~~~
|
||||
virtual nsIRenderingContext* GetRenderingContext() = 0;
|
||||
virtual nsIDeviceContext* GetDeviceContext() = 0;
|
||||
virtual nsIAppShell *GetAppShell() = 0;
|
||||
|
||||
@ -1059,6 +1059,10 @@ void* nsWindow::GetNativeData(PRUint32 aDataType)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//~~~
|
||||
void nsWindow::FreeNativeData(void * data, PRUint32 aDataType)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
|
||||
@ -110,6 +110,7 @@ public:
|
||||
NS_IMETHOD Invalidate(const nsRect &aRect, PRBool aIsSynchronous);
|
||||
NS_IMETHOD Update();
|
||||
virtual void* GetNativeData(PRUint32 aDataType);
|
||||
virtual void FreeNativeData(void * data, PRUint32 aDataType);//~~~
|
||||
virtual nsIRenderingContext* GetRenderingContext();
|
||||
NS_IMETHOD SetColorMap(nsColorMap *aColorMap);
|
||||
virtual nsIDeviceContext* GetDeviceContext();
|
||||
|
||||
@ -1251,6 +1251,23 @@ void* nsWindow::GetNativeData(PRUint32 aDataType)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//~~~
|
||||
void nsWindow::FreeNativeData(void * data, PRUint32 aDataType)
|
||||
{
|
||||
switch(aDataType)
|
||||
{
|
||||
case NS_NATIVE_GRAPHIC:
|
||||
::ReleaseDC(mWnd, (HDC)data);
|
||||
case NS_NATIVE_WIDGET:
|
||||
case NS_NATIVE_WINDOW:
|
||||
case NS_NATIVE_PLUGIN_PORT:
|
||||
case NS_NATIVE_COLORMAP:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Set the colormap of the window
|
||||
|
||||
@ -110,6 +110,7 @@ public:
|
||||
NS_IMETHOD Invalidate(const nsRect & aRect, PRBool aIsSynchronous);
|
||||
NS_IMETHOD Update();
|
||||
virtual void* GetNativeData(PRUint32 aDataType);
|
||||
virtual void FreeNativeData(void * data, PRUint32 aDataType);//~~~
|
||||
NS_IMETHOD SetColorMap(nsColorMap *aColorMap);
|
||||
NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect);
|
||||
NS_IMETHOD SetTitle(const nsString& aTitle);
|
||||
|
||||
@ -91,6 +91,7 @@ public:
|
||||
NS_IMETHOD SetVerticalScrollbar(nsIWidget * aScrollbar);
|
||||
NS_IMETHOD EnableFileDrop(PRBool aEnable);
|
||||
virtual void ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY) {}
|
||||
virtual void FreeNativeData(void * data, PRUint32 aDataType) {}//~~~
|
||||
protected:
|
||||
|
||||
virtual void DrawScaledRect(nsIRenderingContext& aRenderingContext, const nsRect & aRect, float aScale, float aAppUnits);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user