Fix some code... its late isn't it? no more random looping due to resizing

code.
This commit is contained in:
pavlov%pavlov.net 1998-12-05 03:54:30 +00:00
Родитель c8661b26e2
Коммит 582b673aa6
3 изменённых файлов: 8 добавлений и 73 удалений

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

@ -616,7 +616,7 @@ gint nsGtkWidget_Resize_EventHandler(GtkWidget *w, GtkAllocation *allocation, gp
{ {
nsWindow *win = (nsWindow*)data; nsWindow *win = (nsWindow*)data;
nsRect winBounds, sizeBounds; nsRect winBounds;
win->GetBounds(winBounds); win->GetBounds(winBounds);
g_print("resize event handler:\n\tallocation->w=%d allocation->h=%d window.w=%d window.h=%d\n", g_print("resize event handler:\n\tallocation->w=%d allocation->h=%d window.w=%d window.h=%d\n",
allocation->width, allocation->height, winBounds.width, winBounds.height); allocation->width, allocation->height, winBounds.width, winBounds.height);
@ -624,35 +624,15 @@ gint nsGtkWidget_Resize_EventHandler(GtkWidget *w, GtkAllocation *allocation, gp
winBounds.height != allocation->height) { winBounds.height != allocation->height) {
g_print("\tAllocation != current window bounds. Resize.\n"); g_print("\tAllocation != current window bounds. Resize.\n");
nsSizeEvent sizeEvent; winBounds.width = allocation->width;
sizeEvent.eventStructType = NS_SIZE_EVENT; winBounds.height = allocation->height;
sizeEvent.message = NS_SIZE;
sizeEvent.point.x = winBounds.x;
sizeEvent.point.y = winBounds.y;
sizeEvent.time = PR_IntervalNow();
// nsGUIEvent
sizeEvent.widget = win;
sizeEvent.nativeMsg = nsnull;
winBounds.width = sizeBounds.width = allocation->width;
winBounds.height = sizeBounds.height = allocation->height;
sizeBounds.x = 0;
sizeBounds.y = 0;
// nsSizeEvent
sizeEvent.windowSize = &sizeBounds;
sizeEvent.mWinWidth = winBounds.width;
sizeEvent.mWinHeight = winBounds.height;
win->OnResize(sizeEvent);
// win->SetBounds(winBounds); // win->SetBounds(winBounds);
nsPaintEvent pevent; nsPaintEvent pevent;
pevent.message = NS_PAINT; pevent.message = NS_PAINT;
pevent.widget = win; pevent.widget = win;
pevent.time = PR_IntervalNow(); pevent.time = PR_IntervalNow();
pevent.rect = (nsRect *)&sizeBounds; pevent.rect = (nsRect *)&winBounds;
win->OnPaint(pevent); win->OnPaint(pevent);
} }
return FALSE; return FALSE;

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

@ -146,9 +146,9 @@ NS_METHOD nsWidget::Move(PRUint32 aX, PRUint32 aY)
NS_METHOD nsWidget::Resize(PRUint32 aWidth, PRUint32 aHeight, PRBool aRepaint) NS_METHOD nsWidget::Resize(PRUint32 aWidth, PRUint32 aHeight, PRBool aRepaint)
{ {
#ifdef DBG //#ifdef DBG
g_print("nsWidget::Resize(%3d,%3d) - %s %p %s\n", aWidth, aHeight, mWidget->name, this, aRepaint ? "paint" : "no paint"); g_print("nsWidget::Resize(%3d,%3d) - %s %p %s\n", aWidth, aHeight, mWidget->name, this, aRepaint ? "paint" : "no paint");
#endif //#endif
mBounds.width = aWidth; mBounds.width = aWidth;
mBounds.height = aHeight; mBounds.height = aHeight;
gtk_widget_set_usize(mWidget, aWidth, aHeight); gtk_widget_set_usize(mWidget, aWidth, aHeight);

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

@ -637,11 +637,13 @@ void nsWindow::OnDestroy()
PRBool nsWindow::OnResize(nsSizeEvent &aEvent) PRBool nsWindow::OnResize(nsSizeEvent &aEvent)
{ {
/*
nsRect* size = aEvent.windowSize; nsRect* size = aEvent.windowSize;
if (mEventCallback && !mIgnoreResize) { if (mEventCallback && !mIgnoreResize) {
return DispatchWindowEvent(&aEvent); return DispatchWindowEvent(&aEvent);
} }
*/
return FALSE; return FALSE;
} }
@ -763,53 +765,6 @@ PRUint32 nsWindow::GetYCoord(PRUint32 aNewY)
return(aNewY); return(aNewY);
} }
static gint DoResize(GtkWidget *w, GtkAllocation *allocation, gpointer data)
{
nsWindow *win = (nsWindow*)data;
nsRect bounds;
win->GetBounds(bounds);
g_print("DoResized called a->w %d a->h %d b.w %d b.h %d\n",
allocation->width, allocation->height, bounds.width, bounds.height);
if (bounds.width != allocation->width ||
bounds.height != allocation->height) {
g_print("RESIZE!\n");
nsSizeEvent sizeEvent;
sizeEvent.eventStructType = NS_SIZE_EVENT;
sizeEvent.message = NS_SIZE;
sizeEvent.point.x = bounds.x;
sizeEvent.point.y = bounds.y;
sizeEvent.time = PR_IntervalNow();
// nsGUIEvent
sizeEvent.widget = win;
sizeEvent.nativeMsg = nsnull;
bounds.width = allocation->width;
bounds.height = allocation->height;
bounds.x = 0;
bounds.y = 0;
// nsSizeEvent
sizeEvent.windowSize = &bounds;
sizeEvent.mWinWidth = bounds.width;
sizeEvent.mWinHeight = bounds.height;
win->OnResize(sizeEvent);
win->SetBounds(bounds);
nsPaintEvent pevent;
pevent.message = NS_PAINT;
pevent.widget = win;
pevent.time = PR_IntervalNow();
pevent.rect = (nsRect *)&bounds;
win->OnPaint(pevent);
}
return TRUE; /* Stop the handling of this signal */
}
NS_METHOD nsWindow::SetMenuBar(nsIMenuBar * aMenuBar) NS_METHOD nsWindow::SetMenuBar(nsIMenuBar * aMenuBar)
{ {
GtkWidget *menubar; GtkWidget *menubar;