This is a better fix for 42345. It should fix some of the "window opening

offscreen" problems people have been seeing.  r=blizzard.
This commit is contained in:
bryner%uiuc.edu 2000-08-26 04:37:47 +00:00
Родитель d5890a8161
Коммит dd1a838423
3 изменённых файлов: 26 добавлений и 15 удалений

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

@ -1015,9 +1015,7 @@ handle_superwin_flush(gpointer aData)
gboolean
handle_configure_event(GtkWidget *w, GdkEventConfigure *conf, gpointer p)
{
// This event handler is only installed on toplevel windows, because:
// a) gdk_window_get_root_origin gives bad results for inner windows, and
// b) we don't really need to worry about move events on inner windows
// This event handler is only installed on toplevel windows
nsWindow *widget = (nsWindow *)p;
@ -1025,21 +1023,24 @@ handle_configure_event(GtkWidget *w, GdkEventConfigure *conf, gpointer p)
nsRect oldBounds;
widget->GetBounds(oldBounds);
// this is really supposed to be get_origin, not get_root_origin
// - bryner
nscoord x,y;
gdk_window_get_root_origin(w->window, &x, &y);
gdk_window_get_origin(w->window, &x, &y);
if ((oldBounds.x == x) && (oldBounds.y == y))
if ((oldBounds.x == x) && (oldBounds.y == y)) {
#ifdef DEBUG_MOVE
printf("Window: No position change\n");
#endif
return PR_FALSE;
}
#ifdef DEBUG_MOVE
printf("Window: Move from (%d,%d) to (%d,%d)\n", oldBounds.x, oldBounds.y,
x, y);
printf("Window: Move from (%d,%d) to (%d,%d)\n", oldBounds.x,
oldBounds.y, x, y);
#endif
nscoord relX, relY;
gdk_window_get_origin(w->window, &relX, &relY);
widget->OnMove(relX, relY);
widget->OnMove(x, y);
return PR_FALSE;
}

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

@ -655,12 +655,15 @@ PRBool nsWidget::OnResize(nsRect &aRect)
//------
PRBool nsWidget::OnMove(PRInt32 aX, PRInt32 aY)
{
nsGUIEvent event;
#if 0
printf("nsWidget::OnMove %s (%p)\n",
printf("nsWidget::OnMove %s (%p) (%d,%d) -> (%d,%d)\n",
(const char *) debug_GetName(mWidget),
this);
this, mBounds.x, mBounds.y, aX, aY);
#endif
mBounds.x = aX;
mBounds.y = aY;
nsGUIEvent event;
InitEvent(event, NS_MOVE);
event.point.x = aX;
event.point.y = aY;

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

@ -227,8 +227,14 @@ NS_IMETHODIMP nsWindow::WidgetToScreen(const nsRect& aOldRect, nsRect& aNewRect)
return NS_ERROR_FAILURE;
}
gdk_window_get_root_origin(mMozArea->window, &x, &y);
#ifdef DEBUG_MOVE
printf("Got root origin = (%d,%d)\n", x, y);
#endif
aNewRect.x = x + aOldRect.x;
aNewRect.y = y + aOldRect.y;
#ifdef DEBUG_MOVE
printf("result = (%d,%d)\n", aNewRect.x, aNewRect.y);
#endif
}
else
return NS_ERROR_FAILURE;
@ -2527,7 +2533,8 @@ NS_IMETHODIMP nsWindow::EndResizingChildren(void)
NS_IMETHODIMP nsWindow::GetScreenBounds(nsRect &aRect)
{
WidgetToScreen(mBounds, aRect);
nsRect origin(0,0,mBounds.width,mBounds.height);
WidgetToScreen(origin, aRect);
return NS_OK;
}