mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-25 03:49:42 +00:00
Fix some code... its late isn't it? no more random looping due to resizing
code.
This commit is contained in:
parent
c8661b26e2
commit
582b673aa6
@ -616,7 +616,7 @@ gint nsGtkWidget_Resize_EventHandler(GtkWidget *w, GtkAllocation *allocation, gp
|
||||
{
|
||||
nsWindow *win = (nsWindow*)data;
|
||||
|
||||
nsRect winBounds, sizeBounds;
|
||||
nsRect winBounds;
|
||||
win->GetBounds(winBounds);
|
||||
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);
|
||||
@ -624,35 +624,15 @@ gint nsGtkWidget_Resize_EventHandler(GtkWidget *w, GtkAllocation *allocation, gp
|
||||
winBounds.height != allocation->height) {
|
||||
g_print("\tAllocation != current window bounds. Resize.\n");
|
||||
|
||||
nsSizeEvent sizeEvent;
|
||||
sizeEvent.eventStructType = NS_SIZE_EVENT;
|
||||
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);
|
||||
winBounds.width = allocation->width;
|
||||
winBounds.height = allocation->height;
|
||||
// win->SetBounds(winBounds);
|
||||
|
||||
nsPaintEvent pevent;
|
||||
pevent.message = NS_PAINT;
|
||||
pevent.widget = win;
|
||||
pevent.time = PR_IntervalNow();
|
||||
pevent.rect = (nsRect *)&sizeBounds;
|
||||
pevent.rect = (nsRect *)&winBounds;
|
||||
win->OnPaint(pevent);
|
||||
}
|
||||
return FALSE;
|
||||
|
@ -146,9 +146,9 @@ NS_METHOD nsWidget::Move(PRUint32 aX, PRUint32 aY)
|
||||
|
||||
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");
|
||||
#endif
|
||||
//#endif
|
||||
mBounds.width = aWidth;
|
||||
mBounds.height = aHeight;
|
||||
gtk_widget_set_usize(mWidget, aWidth, aHeight);
|
||||
|
@ -637,11 +637,13 @@ void nsWindow::OnDestroy()
|
||||
|
||||
PRBool nsWindow::OnResize(nsSizeEvent &aEvent)
|
||||
{
|
||||
/*
|
||||
nsRect* size = aEvent.windowSize;
|
||||
|
||||
if (mEventCallback && !mIgnoreResize) {
|
||||
return DispatchWindowEvent(&aEvent);
|
||||
}
|
||||
*/
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -763,53 +765,6 @@ PRUint32 nsWindow::GetYCoord(PRUint32 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)
|
||||
{
|
||||
GtkWidget *menubar;
|
||||
|
Loading…
x
Reference in New Issue
Block a user