r=mkaply, sr=blizzard (platform specific) a=mkaply
OS/2 only - cleanup PS code - accidental reuse of presentation spaces
This commit is contained in:
mkaply%us.ibm.com 2003-05-22 21:50:09 +00:00
parent 81f8daa616
commit afa398f442
2 changed files with 13 additions and 52 deletions

View File

@ -165,8 +165,6 @@ nsWindow::nsWindow() : nsBaseWidget()
mlHave = 0; mlHave = 0;
mlUsed = 0; mlUsed = 0;
mFrameIcon = 0; mFrameIcon = 0;
mPS = 0;
mPSRefs = 0;
mNativeDrag = FALSE; mNativeDrag = FALSE;
mDeadKey = 0; mDeadKey = 0;
mHaveDeadKey = FALSE; mHaveDeadKey = FALSE;
@ -1904,42 +1902,26 @@ NS_IMETHODIMP nsWindow::Update()
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
void* nsWindow::GetNativeData(PRUint32 aDataType) void* nsWindow::GetNativeData(PRUint32 aDataType)
{ {
void *rc = NULL;
switch(aDataType) { switch(aDataType) {
case NS_NATIVE_WIDGET: case NS_NATIVE_WIDGET:
case NS_NATIVE_WINDOW: case NS_NATIVE_WINDOW:
case NS_NATIVE_PLUGIN_PORT: case NS_NATIVE_PLUGIN_PORT:
rc = (void*) mWnd; return (void*)mWnd;
break;
case NS_NATIVE_GRAPHIC: case NS_NATIVE_GRAPHIC:
if( !mPS) HPS hps;
{ if (mNativeDrag) {
if( mNativeDrag) { hps = DrgGetPS(mWnd);
mPS = DrgGetPS(mWnd); } else {
} else { hps = WinGetPS(mWnd);
mPS = WinGetPS(mWnd);
}
nsPaletteOS2::SelectGlobalPalette(mPS, mWnd);
} }
mPSRefs++; nsPaletteOS2::SelectGlobalPalette(hps, mWnd);
rc = (void*) mPS; return (void*)hps;
break;
case NS_NATIVE_COLORMAP: case NS_NATIVE_COLORMAP:
case NS_NATIVE_DISPLAY:
case NS_NATIVE_REGION:
case NS_NATIVE_OFFSETX:
case NS_NATIVE_OFFSETY: // could do this, I suppose; but why?
// OTOH, this might make plugins work!
break;
default: default:
#ifdef DEBUG
printf( "*** Someone's added a new NS_NATIVE value...\n");
#endif
break; break;
} }
return rc; return NULL;
} }
//~~~ //~~~
@ -1948,32 +1930,18 @@ void nsWindow::FreeNativeData(void * data, PRUint32 aDataType)
switch(aDataType) switch(aDataType)
{ {
case NS_NATIVE_GRAPHIC: case NS_NATIVE_GRAPHIC:
mPSRefs--; if (mNativeDrag) {
if( !mPSRefs) DrgReleasePS((HPS)data);
{ } else {
BOOL rc; WinReleasePS((HPS)data);
if( mNativeDrag) rc = DrgReleasePS( mPS);
else rc = WinReleasePS((HPS)data);
#ifdef DEBUG
if( !rc)
printf( "Error from {Win/Drg}ReleasePS()\n");
#endif
mPS = 0;
} }
break; break;
case NS_NATIVE_DISPLAY:
case NS_NATIVE_REGION:
case NS_NATIVE_OFFSETX:
case NS_NATIVE_OFFSETY:
case NS_NATIVE_WIDGET: case NS_NATIVE_WIDGET:
case NS_NATIVE_WINDOW: case NS_NATIVE_WINDOW:
case NS_NATIVE_PLUGIN_PORT: case NS_NATIVE_PLUGIN_PORT:
case NS_NATIVE_COLORMAP: case NS_NATIVE_COLORMAP:
break; break;
default: default:
#ifdef DEBUG
printf( "*** Someone's added a new NS_NATIVE value...\n");
#endif
break; break;
} }
} }
@ -2730,11 +2698,6 @@ void nsWindow::OnDestroy()
mSWPs = 0; mSWPs = 0;
mlHave = mlUsed = 0; mlHave = mlUsed = 0;
// release any ps (erm, probably an error if this is necessary)
if( mPS)
WinReleasePS( mPS);
mPS = 0;
// release references to context, toolkit, appshell, children // release references to context, toolkit, appshell, children
nsBaseWidget::OnDestroy(); nsBaseWidget::OnDestroy();

View File

@ -242,8 +242,6 @@ protected:
PSWP mSWPs; // SWPs for deferred window positioning PSWP mSWPs; // SWPs for deferred window positioning
ULONG mlHave, mlUsed; // description of mSWPs array ULONG mlHave, mlUsed; // description of mSWPs array
HPOINTER mFrameIcon; // current frame icon HPOINTER mFrameIcon; // current frame icon
HPS mPS; // cache PS for window
ULONG mPSRefs; // number of refs to cache ps
BOOL mNativeDrag; // is the drag from outside Mozilla BOOL mNativeDrag; // is the drag from outside Mozilla
VDKEY mDeadKey; // dead key from previous keyevent VDKEY mDeadKey; // dead key from previous keyevent
BOOL mHaveDeadKey; // is mDeadKey valid [0 may be a valid dead key, for all I know] BOOL mHaveDeadKey; // is mDeadKey valid [0 may be a valid dead key, for all I know]