mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-14 12:13:22 +00:00
Fix for bug #7797. JS screen property not implemented in gtk widgetry.
This commit is contained in:
parent
09fadcc3a4
commit
961fb5e42c
@ -51,6 +51,11 @@ nsDeviceContextGTK::nsDeviceContextGTK()
|
|||||||
mPaletteInfo.numReserved = 0;
|
mPaletteInfo.numReserved = 0;
|
||||||
mPaletteInfo.palette = NULL;
|
mPaletteInfo.palette = NULL;
|
||||||
mNumCells = 0;
|
mNumCells = 0;
|
||||||
|
|
||||||
|
mWidthFloat = 0.0f;
|
||||||
|
mHeightFloat = 0.0f;
|
||||||
|
mWidth = -1;
|
||||||
|
mHeight = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsDeviceContextGTK::~nsDeviceContextGTK()
|
nsDeviceContextGTK::~nsDeviceContextGTK()
|
||||||
@ -134,6 +139,9 @@ NS_IMETHODIMP nsDeviceContextGTK::Init(nsNativeWidget aNativeWidget)
|
|||||||
gtk_widget_destroy(sb);
|
gtk_widget_destroy(sb);
|
||||||
gtk_widget_unref(sb);
|
gtk_widget_unref(sb);
|
||||||
|
|
||||||
|
mWidthFloat = (float) gdk_screen_width();
|
||||||
|
mHeightFloat = (float) gdk_screen_height();
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
static PRBool once = PR_TRUE;
|
static PRBool once = PR_TRUE;
|
||||||
if (once) {
|
if (once) {
|
||||||
@ -142,6 +150,8 @@ NS_IMETHODIMP nsDeviceContextGTK::Init(nsNativeWidget aNativeWidget)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
DeviceContextImpl::CommonInit();
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,7 +192,7 @@ NS_IMETHODIMP nsDeviceContextGTK::CreateRenderingContext(nsIRenderingContext *&a
|
|||||||
w->allocation.width,
|
w->allocation.width,
|
||||||
w->allocation.height,
|
w->allocation.height,
|
||||||
gdk_rgb_get_visual()->depth);
|
gdk_rgb_get_visual()->depth);
|
||||||
|
|
||||||
GdkGC *gc = gdk_gc_new(win);
|
GdkGC *gc = gdk_gc_new(win);
|
||||||
|
|
||||||
// init the nsDrawingSurfaceGTK
|
// init the nsDrawingSurfaceGTK
|
||||||
@ -368,10 +378,16 @@ NS_IMETHODIMP nsDeviceContextGTK::CheckFontExistence(const nsString& aFontName)
|
|||||||
|
|
||||||
NS_IMETHODIMP nsDeviceContextGTK::GetDeviceSurfaceDimensions(PRInt32 &aWidth, PRInt32 &aHeight)
|
NS_IMETHODIMP nsDeviceContextGTK::GetDeviceSurfaceDimensions(PRInt32 &aWidth, PRInt32 &aHeight)
|
||||||
{
|
{
|
||||||
aWidth = 1;
|
if (mWidth == -1)
|
||||||
aHeight = 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,
|
NS_IMETHODIMP nsDeviceContextGTK::GetDeviceContextFor(nsIDeviceContextSpec *aDevice,
|
||||||
|
@ -70,9 +70,14 @@ private:
|
|||||||
PRUint32 mDepth;
|
PRUint32 mDepth;
|
||||||
PRBool mWriteable;
|
PRBool mWriteable;
|
||||||
nsPaletteInfo mPaletteInfo;
|
nsPaletteInfo mPaletteInfo;
|
||||||
PRUint32 mNumCells;
|
PRUint32 mNumCells;
|
||||||
PRInt16 mScrollbarHeight;
|
PRInt16 mScrollbarHeight;
|
||||||
PRInt16 mScrollbarWidth;
|
PRInt16 mScrollbarWidth;
|
||||||
|
|
||||||
|
float mWidthFloat;
|
||||||
|
float mHeightFloat;
|
||||||
|
PRInt32 mWidth;
|
||||||
|
PRInt32 mHeight;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* nsDeviceContextGTK_h___ */
|
#endif /* nsDeviceContextGTK_h___ */
|
||||||
|
@ -52,6 +52,11 @@ nsDeviceContextXlib::nsDeviceContextXlib()
|
|||||||
mScreen = nsnull;
|
mScreen = nsnull;
|
||||||
mVisual = nsnull;
|
mVisual = nsnull;
|
||||||
mDepth = 0;
|
mDepth = 0;
|
||||||
|
|
||||||
|
mWidthFloat = 0.0f;
|
||||||
|
mHeightFloat = 0.0f;
|
||||||
|
mWidth = -1;
|
||||||
|
mHeight = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsDeviceContextXlib::~nsDeviceContextXlib()
|
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));
|
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();
|
DeviceContextImpl::CommonInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,9 +353,15 @@ NS_IMETHODIMP nsDeviceContextXlib::CheckFontExistence(const nsString& aFontName)
|
|||||||
|
|
||||||
NS_IMETHODIMP nsDeviceContextXlib::GetDeviceSurfaceDimensions(PRInt32 &aWidth, PRInt32 &aHeight)
|
NS_IMETHODIMP nsDeviceContextXlib::GetDeviceSurfaceDimensions(PRInt32 &aWidth, PRInt32 &aHeight)
|
||||||
{
|
{
|
||||||
PR_LOG(DeviceContextXlibLM, PR_LOG_DEBUG, ("nsDeviceContextXlib::GetDeviceSurfaceDimensions()\n"));
|
if (mWidth == -1)
|
||||||
aWidth = 1;
|
mWidth = NSToIntRound(mWidthFloat * mDevUnitsToAppUnits);
|
||||||
aHeight = 1;
|
|
||||||
|
if (mHeight == -1)
|
||||||
|
mHeight = NSToIntRound(mHeightFloat * mDevUnitsToAppUnits);
|
||||||
|
|
||||||
|
aWidth = mWidth;
|
||||||
|
aHeight = mHeight;
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,6 +71,11 @@ private:
|
|||||||
Screen * mScreen;
|
Screen * mScreen;
|
||||||
Visual * mVisual;
|
Visual * mVisual;
|
||||||
int mDepth;
|
int mDepth;
|
||||||
|
|
||||||
|
float mWidthFloat;
|
||||||
|
float mHeightFloat;
|
||||||
|
PRInt32 mWidth;
|
||||||
|
PRInt32 mHeight;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user