зеркало из https://github.com/mozilla/gecko-dev.git
implement nsWidget::Invalidate, nsWidget::Update, make resizing go
This commit is contained in:
Родитель
f36b444774
Коммит
68925a2575
|
@ -322,11 +322,12 @@ nsAppShell::DispatchEvent(XEvent *event)
|
|||
case Expose:
|
||||
HandleExposeEvent(event, widget);
|
||||
break;
|
||||
#if 0
|
||||
case ConfigureNotify:
|
||||
// we need to make sure that this is the LAST of the
|
||||
// config events.
|
||||
while (XCheckWindowEvent(gDisplay, event->xany.window, StructureNotifyMask, event) == True);
|
||||
HandleConfigureNotifyEvent(event, widget);
|
||||
break;
|
||||
#endif
|
||||
case ButtonPress:
|
||||
case ButtonRelease:
|
||||
HandleButtonEvent(event, widget);
|
||||
|
|
|
@ -228,11 +228,13 @@ NS_IMETHODIMP nsWidget::SetFocus(void)
|
|||
|
||||
NS_IMETHODIMP nsWidget::Invalidate(PRBool aIsSynchronous)
|
||||
{
|
||||
printf("nsWidget::Invalidate(sync)\n");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::Invalidate(const nsRect & aRect, PRBool aIsSynchronous)
|
||||
{
|
||||
printf("nsWidget::Invalidate(rect, sync)\n");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -344,6 +346,7 @@ NS_IMETHODIMP nsWidget::SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight)
|
|||
|
||||
NS_IMETHODIMP nsWidget::Update()
|
||||
{
|
||||
printf("nsWidget::Update()\n");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -399,7 +402,7 @@ void nsWidget::CreateNative(Window aParent, nsRect aRect)
|
|||
// be discarded...
|
||||
attr.bit_gravity = NorthWestGravity;
|
||||
// make sure that we listen for events
|
||||
attr.event_mask = StructureNotifyMask | ExposureMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask;
|
||||
attr.event_mask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask;
|
||||
// set the default background color and border to that awful gray
|
||||
attr.background_pixel = bg_pixel;
|
||||
attr.border_pixel = border_pixel;
|
||||
|
|
|
@ -102,6 +102,60 @@ nsWindow::CreateNative(Window aParent, nsRect aRect)
|
|||
AddWindowCallback(mBaseWindow, this);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWindow::Invalidate(PRBool aIsSynchronous)
|
||||
{
|
||||
printf("nsWindow::Invalidate(sync)\n");
|
||||
nsPaintEvent pevent;
|
||||
pevent.message = NS_PAINT;
|
||||
pevent.widget = this;
|
||||
pevent.eventStructType = NS_PAINT_EVENT;
|
||||
pevent.rect = new nsRect (mBounds.x, mBounds.y,
|
||||
mBounds.height, mBounds.width);
|
||||
// XXX fix this
|
||||
pevent.time = 0;
|
||||
AddRef();
|
||||
OnPaint(pevent);
|
||||
Release();
|
||||
delete pevent.rect;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWindow::Invalidate(const nsRect & aRect, PRBool aIsSynchronous)
|
||||
{
|
||||
printf("nsWindow::Invalidate(rect, sync)\n");
|
||||
nsPaintEvent pevent;
|
||||
pevent.message = NS_PAINT;
|
||||
pevent.widget = this;
|
||||
pevent.eventStructType = NS_PAINT_EVENT;
|
||||
pevent.rect = new nsRect(aRect);
|
||||
// XXX fix this
|
||||
pevent.time = 0;
|
||||
AddRef();
|
||||
OnPaint(pevent);
|
||||
Release();
|
||||
// XXX will this leak?
|
||||
//delete pevent.rect;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWindow::Update()
|
||||
{
|
||||
printf("nsWindow::Update()\n");
|
||||
nsPaintEvent pevent;
|
||||
pevent.message = NS_PAINT;
|
||||
pevent.widget = this;
|
||||
pevent.eventStructType = NS_PAINT_EVENT;
|
||||
pevent.rect = new nsRect (mBounds.x, mBounds.y,
|
||||
mBounds.height, mBounds.width);
|
||||
// XXX fix this
|
||||
pevent.time = 0;
|
||||
AddRef();
|
||||
OnPaint(pevent);
|
||||
Release();
|
||||
delete pevent.rect;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
ChildWindow::ChildWindow(): nsWindow()
|
||||
{
|
||||
name = "nsChildWindow";
|
||||
|
|
|
@ -26,6 +26,9 @@ class nsWindow : public nsWidget
|
|||
public:
|
||||
nsWindow();
|
||||
~nsWindow();
|
||||
NS_IMETHOD Invalidate(PRBool aIsSynchronous);
|
||||
NS_IMETHOD Invalidate(const nsRect & aRect, PRBool aIsSynchronous);
|
||||
NS_IMETHOD Update();
|
||||
protected:
|
||||
void CreateNative(Window aParent, nsRect aRect);
|
||||
void DestroyNative(void);
|
||||
|
|
Загрузка…
Ссылка в новой задаче