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:
av%netscape.com 1999-05-27 23:20:09 +00:00
parent 5f8254e1e3
commit 4cc6799ade
10 changed files with 87 additions and 6 deletions

View File

@ -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
{

View File

@ -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
{

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -1059,6 +1059,10 @@ void* nsWindow::GetNativeData(PRUint32 aDataType)
return NULL;
}
//~~~
void nsWindow::FreeNativeData(void * data, PRUint32 aDataType)
{
}
//-------------------------------------------------------------------------
//

View File

@ -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();

View File

@ -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

View File

@ -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);

View File

@ -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);