Bug #209342. Browser will come up at position 0,0.
git-svn-id: svn://10.0.0.236/trunk@157029 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -49,6 +49,7 @@ nsCommonWidget::nsCommonWidget()
|
||||
mNeedsShow = PR_FALSE;
|
||||
mEnabled = PR_TRUE;
|
||||
mCreated = PR_FALSE;
|
||||
mPlaced = PR_FALSE;
|
||||
|
||||
mPreferredWidth = 0;
|
||||
mPreferredHeight = 0;
|
||||
@@ -330,6 +331,8 @@ nsCommonWidget::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight,
|
||||
mBounds.width = aWidth;
|
||||
mBounds.height = aHeight;
|
||||
|
||||
mPlaced = PR_TRUE;
|
||||
|
||||
if (!mCreated)
|
||||
return NS_OK;
|
||||
|
||||
|
||||
@@ -137,6 +137,9 @@ protected:
|
||||
PRBool mEnabled;
|
||||
// has the native window for this been created yet?
|
||||
PRBool mCreated;
|
||||
// Has anyone set an x/y location for this widget yet? Toplevels
|
||||
// shouldn't be automatically set to 0,0 for first show.
|
||||
PRBool mPlaced;
|
||||
|
||||
// Preferred sizes
|
||||
PRUint32 mPreferredWidth;
|
||||
|
||||
@@ -465,6 +465,8 @@ nsWindow::Move(PRInt32 aX, PRInt32 aY)
|
||||
LOG(("nsWindow::Move [%p] %d %d\n", (void *)this,
|
||||
aX, aY));
|
||||
|
||||
mPlaced = PR_TRUE;
|
||||
|
||||
// Since a popup window's x/y coordinates are in relation to to
|
||||
// the parent, the parent might have moved so we always move a
|
||||
// popup window.
|
||||
@@ -487,7 +489,12 @@ nsWindow::Move(PRInt32 aX, PRInt32 aY)
|
||||
gtk_window_move(GTK_WINDOW(mShell), newrect.x, newrect.y);
|
||||
}
|
||||
else {
|
||||
gtk_window_move(GTK_WINDOW(mShell), aX, aY);
|
||||
// We only move the toplevel window if someone has
|
||||
// actually placed the window somewhere. If no placement
|
||||
// has taken place, we just let the window manager Do The
|
||||
// Right Thing.
|
||||
if (mPlaced)
|
||||
gtk_window_move(GTK_WINDOW(mShell), aX, aY);
|
||||
}
|
||||
}
|
||||
else if (mDrawingarea) {
|
||||
@@ -1189,6 +1196,18 @@ nsWindow::OnConfigureEvent(GtkWidget *aWidget, GdkEventConfigure *aEvent)
|
||||
mBounds.y == aEvent->y)
|
||||
return FALSE;
|
||||
|
||||
// Toplevel windows need to have their bounds set so that we can
|
||||
// keep track of our location. It's not often that the x,y is set
|
||||
// by the layout engine. Width and height are set elsewhere.
|
||||
if (mIsTopLevel) {
|
||||
mPlaced = PR_TRUE;
|
||||
// Need to translate this into the right coordinates
|
||||
nsRect oldrect, newrect;
|
||||
WidgetToScreen(oldrect, newrect);
|
||||
mBounds.x = newrect.x;
|
||||
mBounds.y = newrect.y;
|
||||
}
|
||||
|
||||
nsGUIEvent event(NS_MOVE, this);
|
||||
|
||||
event.point.x = aEvent->x;
|
||||
@@ -2336,7 +2355,13 @@ nsWindow::NativeResize(PRInt32 aX, PRInt32 aY,
|
||||
gtk_window_resize(GTK_WINDOW(mShell), aWidth, aHeight);
|
||||
}
|
||||
else {
|
||||
gtk_window_move(GTK_WINDOW(mShell), aX, aY);
|
||||
// We only move the toplevel window if someone has
|
||||
// actually placed the window somewhere. If no placement
|
||||
// has taken place, we just let the window manager Do The
|
||||
// Right Thing.
|
||||
if (mPlaced)
|
||||
gtk_window_move(GTK_WINDOW(mShell), aX, aY);
|
||||
|
||||
gtk_window_resize(GTK_WINDOW(mShell), aWidth, aHeight);
|
||||
moz_drawingarea_resize(mDrawingarea, aWidth, aHeight);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user