Fix for bug #7797. JS screen property not implemented in gtk widgetry.

This commit is contained in:
ramiro%netscape.com 1999-07-07 18:12:18 +00:00
Родитель 09fadcc3a4
Коммит 961fb5e42c
4 изменённых файлов: 51 добавлений и 10 удалений

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

@ -51,6 +51,11 @@ nsDeviceContextGTK::nsDeviceContextGTK()
mPaletteInfo.numReserved = 0;
mPaletteInfo.palette = NULL;
mNumCells = 0;
mWidthFloat = 0.0f;
mHeightFloat = 0.0f;
mWidth = -1;
mHeight = -1;
}
nsDeviceContextGTK::~nsDeviceContextGTK()
@ -134,6 +139,9 @@ NS_IMETHODIMP nsDeviceContextGTK::Init(nsNativeWidget aNativeWidget)
gtk_widget_destroy(sb);
gtk_widget_unref(sb);
mWidthFloat = (float) gdk_screen_width();
mHeightFloat = (float) gdk_screen_height();
#ifdef DEBUG
static PRBool once = PR_TRUE;
if (once) {
@ -142,6 +150,8 @@ NS_IMETHODIMP nsDeviceContextGTK::Init(nsNativeWidget aNativeWidget)
}
#endif
DeviceContextImpl::CommonInit();
return NS_OK;
}
@ -182,7 +192,7 @@ NS_IMETHODIMP nsDeviceContextGTK::CreateRenderingContext(nsIRenderingContext *&a
w->allocation.width,
w->allocation.height,
gdk_rgb_get_visual()->depth);
GdkGC *gc = gdk_gc_new(win);
// init the nsDrawingSurfaceGTK
@ -368,10 +378,16 @@ NS_IMETHODIMP nsDeviceContextGTK::CheckFontExistence(const nsString& aFontName)
NS_IMETHODIMP nsDeviceContextGTK::GetDeviceSurfaceDimensions(PRInt32 &aWidth, PRInt32 &aHeight)
{
aWidth = 1;
aHeight = 1;
if (mWidth == -1)
mWidth = NSToIntRound(mWidthFloat * mDevUnitsToAppUnits);
return NS_ERROR_FAILURE;
if (mHeight == -1)
mHeight = NSToIntRound(mHeightFloat * mDevUnitsToAppUnits);
aWidth = mWidth;
aHeight = mHeight;
return NS_OK;
}
NS_IMETHODIMP nsDeviceContextGTK::GetDeviceContextFor(nsIDeviceContextSpec *aDevice,

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

@ -70,9 +70,14 @@ private:
PRUint32 mDepth;
PRBool mWriteable;
nsPaletteInfo mPaletteInfo;
PRUint32 mNumCells;
PRInt16 mScrollbarHeight;
PRInt16 mScrollbarWidth;
PRUint32 mNumCells;
PRInt16 mScrollbarHeight;
PRInt16 mScrollbarWidth;
float mWidthFloat;
float mHeightFloat;
PRInt32 mWidth;
PRInt32 mHeight;
};
#endif /* nsDeviceContextGTK_h___ */

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

@ -52,6 +52,11 @@ nsDeviceContextXlib::nsDeviceContextXlib()
mScreen = nsnull;
mVisual = nsnull;
mDepth = 0;
mWidthFloat = 0.0f;
mHeightFloat = 0.0f;
mWidth = -1;
mHeight = -1;
}
nsDeviceContextXlib::~nsDeviceContextXlib()
@ -127,6 +132,10 @@ nsDeviceContextXlib::CommonInit(void)
PR_LOG(DeviceContextXlibLM, PR_LOG_DEBUG, ("GFX: dpi=%d t2p=%g p2t=%g\n", dpi, mTwipsToPixels, mPixelsToTwips));
mWidthFloat = (float) WidthOfScreen(mScreen);
mHeightFloat = (float) HeightOfScreen(mScreen);
DeviceContextImpl::CommonInit();
}
@ -344,9 +353,15 @@ NS_IMETHODIMP nsDeviceContextXlib::CheckFontExistence(const nsString& aFontName)
NS_IMETHODIMP nsDeviceContextXlib::GetDeviceSurfaceDimensions(PRInt32 &aWidth, PRInt32 &aHeight)
{
PR_LOG(DeviceContextXlibLM, PR_LOG_DEBUG, ("nsDeviceContextXlib::GetDeviceSurfaceDimensions()\n"));
aWidth = 1;
aHeight = 1;
if (mWidth == -1)
mWidth = NSToIntRound(mWidthFloat * mDevUnitsToAppUnits);
if (mHeight == -1)
mHeight = NSToIntRound(mHeightFloat * mDevUnitsToAppUnits);
aWidth = mWidth;
aHeight = mHeight;
return NS_OK;
}

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

@ -71,6 +71,11 @@ private:
Screen * mScreen;
Visual * mVisual;
int mDepth;
float mWidthFloat;
float mHeightFloat;
PRInt32 mWidth;
PRInt32 mHeight;
};
#endif