зеркало из https://github.com/mozilla/gecko-dev.git
Clamp window width to twice the X screen width (ditto for height). b=409006 r+sr=roc
This commit is contained in:
Родитель
45e2122519
Коммит
fab38680f3
|
@ -204,8 +204,7 @@ nsCommonWidget::Show(PRBool aState)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsCommonWidget::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)
|
nsCommonWidget::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)
|
||||||
{
|
{
|
||||||
mBounds.width = aWidth;
|
mBounds.SizeTo(GetSafeWindowSize(nsSize(aWidth, aHeight)));
|
||||||
mBounds.height = aHeight;
|
|
||||||
|
|
||||||
if (!mCreated)
|
if (!mCreated)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -278,8 +277,7 @@ nsCommonWidget::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight,
|
||||||
{
|
{
|
||||||
mBounds.x = aX;
|
mBounds.x = aX;
|
||||||
mBounds.y = aY;
|
mBounds.y = aY;
|
||||||
mBounds.width = aWidth;
|
mBounds.SizeTo(GetSafeWindowSize(nsSize(aWidth, aHeight)));
|
||||||
mBounds.height = aHeight;
|
|
||||||
|
|
||||||
mPlaced = PR_TRUE;
|
mPlaced = PR_TRUE;
|
||||||
|
|
||||||
|
|
|
@ -102,6 +102,8 @@ public:
|
||||||
|
|
||||||
virtual void NativeShow (PRBool aAction) = 0;
|
virtual void NativeShow (PRBool aAction) = 0;
|
||||||
|
|
||||||
|
virtual nsSize GetSafeWindowSize(nsSize aSize) = 0;
|
||||||
|
|
||||||
// Some of the nsIWidget methods
|
// Some of the nsIWidget methods
|
||||||
NS_IMETHOD Show (PRBool aState);
|
NS_IMETHOD Show (PRBool aState);
|
||||||
NS_IMETHOD Resize (PRInt32 aWidth,
|
NS_IMETHOD Resize (PRInt32 aWidth,
|
||||||
|
|
|
@ -3572,6 +3572,32 @@ nsWindow::NativeShow (PRBool aAction)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsSize
|
||||||
|
nsWindow::GetSafeWindowSize(nsSize aSize)
|
||||||
|
{
|
||||||
|
GdkScreen* screen = NULL;
|
||||||
|
if (mContainer) {
|
||||||
|
screen = gdk_drawable_get_screen(GTK_WIDGET(mContainer)->window);
|
||||||
|
}
|
||||||
|
else if (mDrawingarea) {
|
||||||
|
screen = gdk_drawable_get_screen(mDrawingarea->inner_window);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!screen)
|
||||||
|
return aSize;
|
||||||
|
|
||||||
|
nsSize result = aSize;
|
||||||
|
if (aSize.width > 2 * gdk_screen_get_width(screen)) {
|
||||||
|
NS_WARNING("Clamping huge window width");
|
||||||
|
result.width = 2 * gdk_screen_get_width(screen);
|
||||||
|
}
|
||||||
|
if (aSize.height > 2 * gdk_screen_get_height(screen)) {
|
||||||
|
NS_WARNING("Clamping huge window height");
|
||||||
|
result.height = 2 * gdk_screen_get_height(screen);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsWindow::EnsureGrabs(void)
|
nsWindow::EnsureGrabs(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -246,6 +246,7 @@ public:
|
||||||
PRBool aRepaint);
|
PRBool aRepaint);
|
||||||
|
|
||||||
void NativeShow (PRBool aAction);
|
void NativeShow (PRBool aAction);
|
||||||
|
virtual nsSize GetSafeWindowSize(nsSize aSize);
|
||||||
|
|
||||||
void EnsureGrabs (void);
|
void EnsureGrabs (void);
|
||||||
void GrabPointer (void);
|
void GrabPointer (void);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче