From c94ea9d669d0787109d1ed000e491fb53fa802d5 Mon Sep 17 00:00:00 2001 From: "blizzard%redhat.com" Date: Wed, 16 Jun 1999 03:07:55 +0000 Subject: [PATCH] xlib renders, baby. git-svn-id: svn://10.0.0.236/trunk@35624 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/widget/src/xlib/nsAppShell.cpp | 10 ++++--- mozilla/widget/src/xlib/nsWidget.cpp | 36 ++++++++++++++++++-------- mozilla/widget/src/xlib/nsWindow.cpp | 12 ++++----- 3 files changed, 37 insertions(+), 21 deletions(-) diff --git a/mozilla/widget/src/xlib/nsAppShell.cpp b/mozilla/widget/src/xlib/nsAppShell.cpp index 1e669870eb1..1af62d4b22e 100644 --- a/mozilla/widget/src/xlib/nsAppShell.cpp +++ b/mozilla/widget/src/xlib/nsAppShell.cpp @@ -322,9 +322,11 @@ nsAppShell::DispatchEvent(XEvent *event) case Expose: HandleExposeEvent(event, widget); break; +#if 0 case ConfigureNotify: HandleConfigureNotifyEvent(event, widget); break; +#endif case ButtonPress: case ButtonRelease: HandleButtonEvent(event, widget); @@ -333,7 +335,7 @@ nsAppShell::DispatchEvent(XEvent *event) HandleMotionNotifyEvent(event, widget); break; default: - printf("Unhandled window event: Window 0x%lxd Got a %s event\n", + printf("Unhandled window event: Window 0x%lx Got a %s event\n", event->xany.window, event_names[event->type]); break; } @@ -359,7 +361,7 @@ nsAppShell::HandleButtonEvent(XEvent *event, nsWidget *aWidget) { nsMouseEvent mevent; PRUint32 eventType = 0; - printf("Button event for window 0x%lxd button %d type %s\n", + printf("Button event for window 0x%lx button %d type %s\n", event->xany.window, event->xbutton.button, (event->type == ButtonPress ? "ButtonPress" : "ButtonRelease")); switch(event->type) { case ButtonPress: @@ -405,7 +407,7 @@ nsAppShell::HandleButtonEvent(XEvent *event, nsWidget *aWidget) void nsAppShell::HandleExposeEvent(XEvent *event, nsWidget *aWidget) { - printf("Expose event for window 0x%lxd %d %d %d %d\n", event->xany.window, + printf("Expose event for window 0x%lx %d %d %d %d\n", event->xany.window, event->xexpose.x, event->xexpose.y, event->xexpose.width, event->xexpose.height); nsPaintEvent pevent; pevent.message = NS_PAINT; @@ -424,7 +426,7 @@ nsAppShell::HandleExposeEvent(XEvent *event, nsWidget *aWidget) void nsAppShell::HandleConfigureNotifyEvent(XEvent *event, nsWidget *aWidget) { - printf("ConfigureNotify event for window 0x%lxd %d %d %d %d\n", + printf("ConfigureNotify event for window 0x%lx %d %d %d %d\n", event->xconfigure.window, event->xconfigure.x, event->xconfigure.y, event->xconfigure.width, event->xconfigure.height); diff --git a/mozilla/widget/src/xlib/nsWidget.cpp b/mozilla/widget/src/xlib/nsWidget.cpp index e5397633c8e..06abdb0cf0a 100644 --- a/mozilla/widget/src/xlib/nsWidget.cpp +++ b/mozilla/widget/src/xlib/nsWidget.cpp @@ -49,12 +49,16 @@ public: nsWidget::nsWidget() : nsBaseWidget() { + int r, g, b; + r =(int)(255.0*rand()/(RAND_MAX+1.0)); + g =(int)(255.0*rand()/(RAND_MAX+1.0)); + b =(int)(255.0*rand()/(RAND_MAX+1.0)); mPreferredWidth = 0; mPreferredHeight = 0; mBaseWindow = 0; - mBackground = NS_RGB(192,192,192); + mBackground = NS_RGB(r, g, b); bg_pixel = xlib_rgb_xpixel_from_rgb(mBackground); - border_rgb = NS_RGB(192,192,192); + mBackground = NS_RGB(r, g, b); border_pixel = xlib_rgb_xpixel_from_rgb(border_rgb); mGC = 0; parentWidget = nsnull; @@ -149,7 +153,7 @@ NS_IMETHODIMP nsWidget::Destroy() NS_IMETHODIMP nsWidget::Move(PRUint32 aX, PRUint32 aY) { - printf("nsWidget::Move\n"); + printf("nsWidget::Move(x, y)\n"); if (aX < 0) { printf("*** x is %d, fixing.\n", aX); aX = 0; @@ -158,6 +162,7 @@ NS_IMETHODIMP nsWidget::Move(PRUint32 aX, PRUint32 aY) printf("*** y is %d, fixing.\n", aY); aY = 0; } + printf("Moving window 0x%lx to %d, %d\n", mBaseWindow, aX, aY); XMoveWindow(gDisplay, mBaseWindow, aX, aY); return NS_OK; } @@ -166,7 +171,7 @@ NS_IMETHODIMP nsWidget::Resize(PRUint32 aWidth, PRUint32 aHeight, PRBool aRepaint) { - printf("nsWidget::Resize\n"); + printf("nsWidget::Resize(width, height)\n"); if (aWidth <= 0) { printf("*** width is %d, fixing.\n", aWidth); aWidth = 1; @@ -175,7 +180,10 @@ NS_IMETHODIMP nsWidget::Resize(PRUint32 aWidth, printf("*** height is %d, fixing.\n", aHeight); aHeight = 1; } - XMoveWindow(gDisplay, mBaseWindow, aWidth, aHeight); + printf("Resizing window 0x%lx to %d, %d\n", mBaseWindow, aWidth, aHeight); + mBounds.width = aWidth; + mBounds.height = aHeight; + XResizeWindow(gDisplay, mBaseWindow, aWidth, aHeight); return NS_OK; } @@ -185,7 +193,7 @@ NS_IMETHODIMP nsWidget::Resize(PRUint32 aX, PRUint32 aHeight, PRBool aRepaint) { - printf("nsWidget::Resize\n"); + printf("nsWidget::Resize(x, y, width, height)\n"); if (aWidth <= 0) { printf("*** width is %d, fixing.\n", aWidth); aWidth = 1; @@ -202,6 +210,8 @@ NS_IMETHODIMP nsWidget::Resize(PRUint32 aX, printf("*** y is %d, fixing.\n", aY); aY = 0; } + printf("Resizing window 0x%lx to %d, %d\n", mBaseWindow, aWidth, aHeight); + printf("Moving window 0x%lx to %d, %d\n", mBaseWindow, aX, aY); XMoveResizeWindow(gDisplay, mBaseWindow, aX, aY, aWidth, aHeight); return NS_OK; } @@ -316,6 +326,9 @@ NS_IMETHODIMP nsWidget::SetColorMap(nsColorMap *aColorMap) NS_IMETHODIMP nsWidget::Show(PRBool bState) { + if (mBaseWindow) { + XMapWindow(gDisplay, mBaseWindow); + } return NS_OK; } @@ -425,13 +438,14 @@ void nsWidget::CreateNative(Window aParent, nsRect aRect) gVisual, // visual attr_mask, &attr); + printf("nsWidget: Created window 0x%lx with parent 0x%lx\n", + mBaseWindow, aParent); + // XXX when we stop getting lame values for this remove it. + // sometimes the dimensions have been corrected by the code above. + mBounds.height = height; + mBounds.width = width; // add the callback for this AddWindowCallback(mBaseWindow, this); - // map this window and flush the connection. we want to see this - // thing now. - XMapWindow(gDisplay, - mBaseWindow); - XSync(gDisplay, False); } nsWidget * diff --git a/mozilla/widget/src/xlib/nsWindow.cpp b/mozilla/widget/src/xlib/nsWindow.cpp index 012128ba7af..3f5e7f3c395 100644 --- a/mozilla/widget/src/xlib/nsWindow.cpp +++ b/mozilla/widget/src/xlib/nsWindow.cpp @@ -92,14 +92,14 @@ nsWindow::CreateNative(Window aParent, nsRect aRect) gVisual, // get the visual from xlibrgb attr_mask, &attr); + printf("nsWindow Created window 0x%lx with parent 0x%lx\n", + mBaseWindow, aParent); + // XXX when we stop getting lame values for this remove it. + // sometimes the dimensions have been corrected by the code above. + mBounds.height = height; + mBounds.width = width; // add the callback for this AddWindowCallback(mBaseWindow, this); - // map this window and flush the connection. we want to see this - // thing now. - XMapWindow(gDisplay, - mBaseWindow); - XSync(gDisplay, False); - } ChildWindow::ChildWindow(): nsWindow()