From c5cff30ac88b70dcc535aad2f2ee399054e28aba Mon Sep 17 00:00:00 2001 From: "blizzard%redhat.com" Date: Sat, 19 Jun 1999 20:24:32 +0000 Subject: [PATCH] implement nsWidget::Invalidate, nsWidget::Update, make resizing go git-svn-id: svn://10.0.0.236/trunk@35901 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/widget/src/xlib/nsAppShell.cpp | 5 ++- mozilla/widget/src/xlib/nsWidget.cpp | 5 ++- mozilla/widget/src/xlib/nsWindow.cpp | 54 ++++++++++++++++++++++++++ mozilla/widget/src/xlib/nsWindow.h | 3 ++ 4 files changed, 64 insertions(+), 3 deletions(-) diff --git a/mozilla/widget/src/xlib/nsAppShell.cpp b/mozilla/widget/src/xlib/nsAppShell.cpp index 1af62d4b22e..bde9087d951 100644 --- a/mozilla/widget/src/xlib/nsAppShell.cpp +++ b/mozilla/widget/src/xlib/nsAppShell.cpp @@ -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); diff --git a/mozilla/widget/src/xlib/nsWidget.cpp b/mozilla/widget/src/xlib/nsWidget.cpp index 06abdb0cf0a..e6d7f692b41 100644 --- a/mozilla/widget/src/xlib/nsWidget.cpp +++ b/mozilla/widget/src/xlib/nsWidget.cpp @@ -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; diff --git a/mozilla/widget/src/xlib/nsWindow.cpp b/mozilla/widget/src/xlib/nsWindow.cpp index 3f5e7f3c395..17856f32cb2 100644 --- a/mozilla/widget/src/xlib/nsWindow.cpp +++ b/mozilla/widget/src/xlib/nsWindow.cpp @@ -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"; diff --git a/mozilla/widget/src/xlib/nsWindow.h b/mozilla/widget/src/xlib/nsWindow.h index 3d5cfe2ec97..d0faf290218 100644 --- a/mozilla/widget/src/xlib/nsWindow.h +++ b/mozilla/widget/src/xlib/nsWindow.h @@ -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);