From b356f4a9fdac58189f6eedb40993bc3b28c00a32 Mon Sep 17 00:00:00 2001 From: "ramiro%netscape.com" Date: Tue, 6 Jul 1999 23:28:58 +0000 Subject: [PATCH] Cleanup the widget api some. Move initialization of evil stuff to the gfx end. Dont leak the widget name. Carry around Display* and friends in the appshell. git-svn-id: svn://10.0.0.236/trunk@38469 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp | 92 ++++++++++++++++++-- mozilla/widget/src/xlib/nsAppShell.cpp | 48 +--------- mozilla/widget/src/xlib/nsButton.cpp | 2 +- mozilla/widget/src/xlib/nsScrollBar.cpp | 18 ++-- mozilla/widget/src/xlib/nsTextWidget.cpp | 2 +- mozilla/widget/src/xlib/nsWidget.cpp | 67 ++++++++------ mozilla/widget/src/xlib/nsWidget.h | 52 +++++------ mozilla/widget/src/xlib/nsWindow.cpp | 18 ++-- 8 files changed, 172 insertions(+), 127 deletions(-) diff --git a/mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp b/mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp index d3cca1d170f..5efd1228a34 100644 --- a/mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp +++ b/mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp @@ -34,6 +34,10 @@ static NS_DEFINE_IID(kDeviceContextIID, NS_IDEVICE_CONTEXT_IID); static PRLogModuleInfo *DeviceContextXlibLM = PR_NewLogModule("DeviceContextXlib"); +static PRUint8 _ConvertMaskToCount(unsigned long val); +static PRUint8 _GetShiftForMask(unsigned long val); +static void _EvilInitilizeGlobals(); + nsDeviceContextXlib::nsDeviceContextXlib() : DeviceContextImpl() { @@ -65,6 +69,25 @@ extern Display * gDisplay; extern Screen * gScreen; extern Visual * gVisual; extern int gDepth; +extern XVisualInfo *gVisualInfo; + +extern PRUint32 gRedZeroMask; //red color mask in zero position +extern PRUint32 gGreenZeroMask; //green color mask in zero position +extern PRUint32 gBlueZeroMask; //blue color mask in zero position +extern PRUint32 gAlphaZeroMask; //alpha data mask in zero position +extern PRUint32 gRedMask; //red color mask +extern PRUint32 gGreenMask; //green color mask +extern PRUint32 gBlueMask; //blue color mask +extern PRUint32 gAlphaMask; //alpha data mask +extern PRUint8 gRedCount; //number of red color bits +extern PRUint8 gGreenCount; //number of green color bits +extern PRUint8 gBlueCount; //number of blue color bits +extern PRUint8 gAlphaCount; //number of alpha data bits +extern PRUint8 gRedShift; //number to shift value into red position +extern PRUint8 gGreenShift; //number to shift value into green position +extern PRUint8 gBlueShift; //number to shift value into blue position +extern PRUint8 gAlphaShift; //number to shift value into alpha position + NS_IMETHODIMP nsDeviceContextXlib::Init(nsNativeWidget aNativeWidget) { @@ -78,11 +101,21 @@ NS_IMETHODIMP nsDeviceContextXlib::Init(nsNativeWidget aNativeWidget) mVisual = gVisual; mDepth = gDepth; - printf("nsDeviceContextXlib::Init(dpy=%p screen=%p visual=%p depth=%d)\n", - mDisplay, - mScreen, - mVisual, - mDepth); + static PRBool firstTime = TRUE; + + if (firstTime) + { + firstTime = PR_FALSE; + + _EvilInitilizeGlobals(); + + printf("nsDeviceContextXlib::Init(dpy=%p screen=%p visual=%p depth=%d)\n", + mDisplay, + mScreen, + mVisual, + mDepth); + } + CommonInit(); @@ -397,3 +430,52 @@ NS_IMETHODIMP nsDeviceContextXlib::EndPage(void) PR_LOG(DeviceContextXlibLM, PR_LOG_DEBUG, ("nsDeviceContextXlib::EndPage()\n")); return NS_OK; } + +static void _EvilInitilizeGlobals() +{ + // set up the color info for this display + // set up the masks + gRedMask = gVisualInfo->red_mask; + gGreenMask = gVisualInfo->green_mask; + gBlueMask = gVisualInfo->blue_mask; + gAlphaMask = 0; + // set up the number of bits in each + gRedCount = _ConvertMaskToCount(gVisualInfo->red_mask); + gGreenCount = _ConvertMaskToCount(gVisualInfo->green_mask); + gBlueCount = _ConvertMaskToCount(gVisualInfo->blue_mask); + gAlphaCount = 0; + // set up the number of bits that you need to shift to get to + // a specific mask + gRedShift = _GetShiftForMask(gVisualInfo->red_mask); + gGreenShift = _GetShiftForMask(gVisualInfo->green_mask); + gBlueShift = _GetShiftForMask(gVisualInfo->blue_mask); + gAlphaShift = 0; +} + +static PRUint8 _ConvertMaskToCount(unsigned long val) +{ + PRUint8 retval = 0; + PRUint8 cur_bit = 0; + // walk through the number, incrementing the value if + // the bit in question is set. + while (cur_bit < (sizeof(unsigned long) * 8)) { + if ((val >> cur_bit) & 0x1) { + retval++; + } + cur_bit++; + } + return retval; +} + +static PRUint8 _GetShiftForMask(unsigned long val) +{ + PRUint8 cur_bit = 0; + // walk through the number, looking for the first 1 + while (cur_bit < (sizeof(unsigned long) * 8)) { + if ((val >> cur_bit) & 0x1) { + return cur_bit; + } + cur_bit++; + } + return cur_bit; +} diff --git a/mozilla/widget/src/xlib/nsAppShell.cpp b/mozilla/widget/src/xlib/nsAppShell.cpp index bde9087d951..cffc84979b7 100644 --- a/mozilla/widget/src/xlib/nsAppShell.cpp +++ b/mozilla/widget/src/xlib/nsAppShell.cpp @@ -150,23 +150,7 @@ NS_METHOD nsAppShell::Create(int* argc, char ** argv) } // get the depth for this display gDepth = gVisualInfo->depth; - // set up the color info for this display - // set up the masks - gRedMask = gVisualInfo->red_mask; - gGreenMask = gVisualInfo->green_mask; - gBlueMask = gVisualInfo->blue_mask; - gAlphaMask = 0; - // set up the number of bits in each - gRedCount = convertMaskToCount(gVisualInfo->red_mask); - gGreenCount = convertMaskToCount(gVisualInfo->green_mask); - gBlueCount = convertMaskToCount(gVisualInfo->blue_mask); - gAlphaCount = 0; - // set up the number of bits that you need to shift to get to - // a specific mask - gRedShift = getShiftForMask(gVisualInfo->red_mask); - gGreenShift = getShiftForMask(gVisualInfo->green_mask); - gBlueShift = getShiftForMask(gVisualInfo->blue_mask); - gAlphaShift = 0; + return NS_OK; } @@ -316,7 +300,7 @@ void nsAppShell::DispatchEvent(XEvent *event) { nsWidget *widget; - widget = nsWidget::getWidgetForWindow(event->xany.window); + widget = nsWidget::GetWidgetForWindow(event->xany.window); // switch on the type of event switch (event->type) { case Expose: @@ -448,31 +432,3 @@ nsAppShell::HandleConfigureNotifyEvent(XEvent *event, nsWidget *aWidget) NS_RELEASE(aWidget); delete sevent.windowSize; } - -static PRUint8 convertMaskToCount(unsigned long val) -{ - PRUint8 retval = 0; - PRUint8 cur_bit = 0; - // walk through the number, incrementing the value if - // the bit in question is set. - while (cur_bit < (sizeof(unsigned long) * 8)) { - if ((val >> cur_bit) & 0x1) { - retval++; - } - cur_bit++; - } - return retval; -} - -static PRUint8 getShiftForMask(unsigned long val) -{ - PRUint8 cur_bit = 0; - // walk through the number, looking for the first 1 - while (cur_bit < (sizeof(unsigned long) * 8)) { - if ((val >> cur_bit) & 0x1) { - return cur_bit; - } - cur_bit++; - } - return cur_bit; -} diff --git a/mozilla/widget/src/xlib/nsButton.cpp b/mozilla/widget/src/xlib/nsButton.cpp index a9df9bd1d22..a22554961b6 100644 --- a/mozilla/widget/src/xlib/nsButton.cpp +++ b/mozilla/widget/src/xlib/nsButton.cpp @@ -24,7 +24,7 @@ NS_IMPL_RELEASE(nsButton) nsButton::nsButton() : nsWidget() , nsIButton() { NS_INIT_REFCNT(); - name = "nsButton"; + mName = "nsButton"; } nsButton::~nsButton() diff --git a/mozilla/widget/src/xlib/nsScrollBar.cpp b/mozilla/widget/src/xlib/nsScrollBar.cpp index 3347d200961..71cfdecc452 100644 --- a/mozilla/widget/src/xlib/nsScrollBar.cpp +++ b/mozilla/widget/src/xlib/nsScrollBar.cpp @@ -31,8 +31,8 @@ nsScrollbar::nsScrollbar(PRBool aIsVertical) : nsWidget(), nsIScrollbar() mLineIncrement = 1; mIsVertical = aIsVertical; mBackground = NS_RGB(100,100,100); - bg_pixel = xlib_rgb_xpixel_from_rgb(mBackground); - border_pixel = xlib_rgb_xpixel_from_rgb(mBackground); + mBackgroundPixel = xlib_rgb_xpixel_from_rgb(mBackground); + mBorderPixel = xlib_rgb_xpixel_from_rgb(mBackground); mBar = 0; mBarBounds.x = mBarBounds.y = mBarBounds.width = mBarBounds.height = 0; }; @@ -40,7 +40,7 @@ nsScrollbar::nsScrollbar(PRBool aIsVertical) : nsWidget(), nsIScrollbar() nsScrollbar::~nsScrollbar() { if (mBar) { - XDestroyWindow(gDisplay, mBar); + XDestroyWindow(mDisplay, mBar); DeleteWindowCallback(mBar); } } @@ -213,8 +213,8 @@ void nsScrollbar::CreateNative(Window aParent, nsRect aRect) // make sure that we listen for events attr.event_mask = StructureNotifyMask | ButtonPressMask | ButtonReleaseMask; // set the default background color and border to that awful gray - attr.background_pixel = bg_pixel; - attr.border_pixel = border_pixel; + attr.background_pixel = mBackgroundPixel; + attr.border_pixel = mBorderPixel; // set the colormap attr.colormap = xlib_rgb_get_cmap(); // here's what's in the struct @@ -231,14 +231,14 @@ void nsScrollbar::CreateNative(Window aParent, nsRect aRect) attr.border_pixel = xlib_rgb_xpixel_from_rgb(NS_RGB(100,100,100)); // set up the size CalcBarBounds(); - mBar = XCreateWindow(gDisplay, + mBar = XCreateWindow(mDisplay, mBaseWindow, mBarBounds.x, mBarBounds.y, mBarBounds.width, mBarBounds.height, 2, // border width gDepth, InputOutput, - gVisual, + mVisual, attr_mask, &attr); AddWindowCallback(mBar, this); @@ -248,7 +248,7 @@ NS_IMETHODIMP nsScrollbar::Show(PRBool bState) { nsWidget::Show(bState); if (mBar) { - XMapWindow(gDisplay, mBar); + XMapWindow(mDisplay, mBar); } CalcBarBounds(); LayoutBar(); @@ -376,7 +376,7 @@ void nsScrollbar::CalcBarBounds(void) void nsScrollbar::LayoutBar(void) { - XMoveResizeWindow(gDisplay, mBar, + XMoveResizeWindow(mDisplay, mBar, mBarBounds.x, mBarBounds.y, mBarBounds.width, mBarBounds.height); } diff --git a/mozilla/widget/src/xlib/nsTextWidget.cpp b/mozilla/widget/src/xlib/nsTextWidget.cpp index efd95501107..d13b15aa940 100644 --- a/mozilla/widget/src/xlib/nsTextWidget.cpp +++ b/mozilla/widget/src/xlib/nsTextWidget.cpp @@ -24,7 +24,7 @@ NS_IMPL_RELEASE(nsTextWidget) nsTextWidget::nsTextWidget() : nsTextHelper() { NS_INIT_REFCNT(); - name = "nsTextWidget"; + mName = "nsTextWidget"; } nsTextWidget::~nsTextWidget() diff --git a/mozilla/widget/src/xlib/nsWidget.cpp b/mozilla/widget/src/xlib/nsWidget.cpp index 623193af92e..17d32044b4f 100644 --- a/mozilla/widget/src/xlib/nsWidget.cpp +++ b/mozilla/widget/src/xlib/nsWidget.cpp @@ -51,14 +51,19 @@ nsWidget::nsWidget() : nsBaseWidget() { mPreferredWidth = 0; mPreferredHeight = 0; + + mDisplay = 0; + mScreen = 0; + mVisual = 0; + mBaseWindow = 0; mBackground = NS_RGB(192, 192, 192); - bg_pixel = xlib_rgb_xpixel_from_rgb(mBackground); + mBackgroundPixel = xlib_rgb_xpixel_from_rgb(mBackground); mBackground = NS_RGB(192, 192, 192); - border_pixel = xlib_rgb_xpixel_from_rgb(border_rgb); + mBorderPixel = xlib_rgb_xpixel_from_rgb(mBorderRGB); mGC = 0; - parentWidget = nsnull; - name = "unnamed"; + mParentWidget = nsnull; + mName = "unnamed"; } nsWidget::~nsWidget() @@ -70,9 +75,10 @@ void nsWidget::DestroyNative(void) { if (mGC) - XFreeGC(gDisplay, mGC); + XFreeGC(mDisplay, mGC); + if (mBaseWindow) { - XDestroyWindow(gDisplay, mBaseWindow); + XDestroyWindow(mDisplay, mBaseWindow); DeleteWindowCallback(mBaseWindow); } } @@ -85,7 +91,8 @@ NS_IMETHODIMP nsWidget::Create(nsIWidget *aParent, nsIToolkit *aToolkit, nsWidgetInitData *aInitData) { - parentWidget = aParent; + mParentWidget = aParent; + return(StandardWidgetCreate(aParent, aRect, aHandleEventFunction, aContext, aAppShell, aToolkit, aInitData, nsnull)); @@ -117,6 +124,10 @@ nsWidget::StandardWidgetCreate(nsIWidget *aParent, Window parent; + mDisplay = gDisplay; + mScreen = gScreen; + mVisual = gVisual; + // set up the BaseWidget parts. BaseCreate(aParent, aRect, aHandleEventFunction, aContext, aAppShell, aToolkit, aInitData); @@ -128,13 +139,13 @@ nsWidget::StandardWidgetCreate(nsIWidget *aParent, } // if there's no parent, make the parent the root window. if (parent == 0) { - parent = RootWindow(gDisplay, gScreenNum); + parent = RootWindowOfScreen(mScreen); } // set the bounds mBounds = aRect; // call the native create function CreateNative(parent, mBounds); - XSync(gDisplay, False); + XSync(mDisplay, False); return NS_OK; } @@ -155,7 +166,7 @@ NS_IMETHODIMP nsWidget::Move(PRUint32 aX, PRUint32 aY) aY = 0; } printf("Moving window 0x%lx to %d, %d\n", mBaseWindow, aX, aY); - XMoveWindow(gDisplay, mBaseWindow, aX, aY); + XMoveWindow(mDisplay, mBaseWindow, aX, aY); return NS_OK; } @@ -175,7 +186,7 @@ NS_IMETHODIMP nsWidget::Resize(PRUint32 aWidth, printf("Resizing window 0x%lx to %d, %d\n", mBaseWindow, aWidth, aHeight); mBounds.width = aWidth; mBounds.height = aHeight; - XResizeWindow(gDisplay, mBaseWindow, aWidth, aHeight); + XResizeWindow(mDisplay, mBaseWindow, aWidth, aHeight); return NS_OK; } @@ -206,7 +217,7 @@ NS_IMETHODIMP nsWidget::Resize(PRUint32 aX, printf("Moving window 0x%lx to %d, %d\n", mBaseWindow, aX, aY); mBounds.width = aWidth; mBounds.height = aHeight; - XMoveResizeWindow(gDisplay, mBaseWindow, aX, aY, aWidth, aHeight); + XMoveResizeWindow(mDisplay, mBaseWindow, aX, aY, aWidth, aHeight); return NS_OK; } @@ -265,7 +276,7 @@ void * nsWidget::GetNativeData(PRUint32 aDataType) return (void *)mBaseWindow; break; case NS_NATIVE_DISPLAY: - return (void *)gDisplay; + return (void *)mDisplay; break; case NS_NATIVE_GRAPHIC: // XXX implement this... @@ -323,7 +334,7 @@ NS_IMETHODIMP nsWidget::SetColorMap(nsColorMap *aColorMap) NS_IMETHODIMP nsWidget::Show(PRBool bState) { if (mBaseWindow) { - XMapWindow(gDisplay, mBaseWindow); + XMapWindow(mDisplay, mBaseWindow); } return NS_OK; } @@ -348,9 +359,9 @@ NS_IMETHODIMP nsWidget::SetBackgroundColor(const nscolor &aColor) { printf("nsWidget::SetBackgroundColor()\n"); nsBaseWidget::SetBackgroundColor(aColor); - bg_pixel = xlib_rgb_xpixel_from_rgb(mBackground); + mBackgroundPixel = xlib_rgb_xpixel_from_rgb(mBackground); // set the window attrib - XSetWindowBackground(gDisplay, mBaseWindow, bg_pixel); + XSetWindowBackground(mDisplay, mBaseWindow, mBackgroundPixel); return NS_OK; } @@ -392,8 +403,8 @@ void nsWidget::CreateNative(Window aParent, nsRect aRect) // make sure that we listen for events 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; + attr.background_pixel = mBackgroundPixel; + attr.border_pixel = mBorderPixel; // set the colormap attr.colormap = xlib_rgb_get_cmap(); // here's what's in the struct @@ -414,8 +425,10 @@ void nsWidget::CreateNativeWindow(Window aParent, nsRect aRect, int width; int height; - printf("*** Warning: nsWidget::CreateNative falling back to sane default for widget type \"%s\"\n", name); - if (!strcmp(name, "unnamed")) { + printf("*** Warning: nsWidget::CreateNative falling back to sane default for widget type \"%s\"\n", + (const char *) nsAutoCString(mName)); + + if (mName == "unnamed") { printf("What freaking widget is this, anyway?\n"); } printf("Creating XWindow: x %d y %d w %d h %d\n", @@ -435,18 +448,20 @@ void nsWidget::CreateNativeWindow(Window aParent, nsRect aRect, height = aRect.height; } - mBaseWindow = XCreateWindow(gDisplay, + mBaseWindow = XCreateWindow(mDisplay, aParent, aRect.x, aRect.y, width, height, - 0, // border width + 0, // border width gDepth, - InputOutput, // class - gVisual, // visual + InputOutput, // class + mVisual, // visual aMask, &aAttr); + 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; @@ -456,7 +471,7 @@ void nsWidget::CreateNativeWindow(Window aParent, nsRect aRect, } nsWidget * -nsWidget::getWidgetForWindow(Window aWindow) +nsWidget::GetWidgetForWindow(Window aWindow) { if (window_list == nsnull) { return nsnull; @@ -605,5 +620,5 @@ PRBool nsWidget::ConvertStatus(nsEventStatus aStatus) void nsWidget::CreateGC(void) { - mGC = XCreateGC(gDisplay, mBaseWindow, 0, NULL); + mGC = XCreateGC(mDisplay, mBaseWindow, 0, NULL); } diff --git a/mozilla/widget/src/xlib/nsWidget.h b/mozilla/widget/src/xlib/nsWidget.h index fc1e600ce3f..9d60555ae81 100644 --- a/mozilla/widget/src/xlib/nsWidget.h +++ b/mozilla/widget/src/xlib/nsWidget.h @@ -100,8 +100,15 @@ public: virtual PRBool OnPaint(nsPaintEvent &event); virtual PRBool OnResize(nsSizeEvent &event); virtual PRBool DispatchMouseEvent(nsMouseEvent &aEvent); - static nsWidget *getWidgetForWindow(Window aWindow); + + static nsWidget * GetWidgetForWindow(Window aWindow); + protected: + + // private event functions + PRBool DispatchWindowEvent(nsGUIEvent* event); + PRBool ConvertStatus(nsEventStatus aStatus); + // create the native window for this class virtual void CreateNativeWindow(Window aParent, nsRect aRect, XSetWindowAttributes aAttr, unsigned long aMask); @@ -113,21 +120,23 @@ protected: static void AddWindowCallback (Window aWindow, nsWidget *aWidget); static void DeleteWindowCallback(Window aWindow); static nsHashtable *window_list; - PRUint32 mPreferredWidth; - PRUint32 mPreferredHeight; - nsIWidget *parentWidget; - // private event functions - PRBool nsWidget::DispatchWindowEvent(nsGUIEvent* event); - PRBool nsWidget::ConvertStatus(nsEventStatus aStatus); + PRUint32 mPreferredWidth; + PRUint32 mPreferredHeight; + + nsIWidget * mParentWidget; // All widgets have at least these items. - Window mBaseWindow; - unsigned long bg_pixel; - PRUint32 border_rgb; - unsigned long border_pixel; - GC mGC; // until we get gc pooling working... - const char *name; // name of the type of widget + Display * mDisplay; + Screen * mScreen; + Window mBaseWindow; + Visual * mVisual; + unsigned long mBackgroundPixel; + PRUint32 mBorderRGB; + unsigned long mBorderPixel; + GC mGC; // until we get gc pooling working... + nsString mName; // name of the type of widget + }; extern Display *gDisplay; @@ -137,23 +146,6 @@ extern int gDepth; extern Visual *gVisual; extern XVisualInfo *gVisualInfo; -extern PRUint32 gRedZeroMask; //red color mask in zero position -extern PRUint32 gGreenZeroMask; //green color mask in zero position -extern PRUint32 gBlueZeroMask; //blue color mask in zero position -extern PRUint32 gAlphaZeroMask; //alpha data mask in zero position -extern PRUint32 gRedMask; //red color mask -extern PRUint32 gGreenMask; //green color mask -extern PRUint32 gBlueMask; //blue color mask -extern PRUint32 gAlphaMask; //alpha data mask -extern PRUint8 gRedCount; //number of red color bits -extern PRUint8 gGreenCount; //number of green color bits -extern PRUint8 gBlueCount; //number of blue color bits -extern PRUint8 gAlphaCount; //number of alpha data bits -extern PRUint8 gRedShift; //number to shift value into red position -extern PRUint8 gGreenShift; //number to shift value into green position -extern PRUint8 gBlueShift; //number to shift value into blue position -extern PRUint8 gAlphaShift; //number to shift value into alpha position - // this is from the xlibrgb code. extern "C" diff --git a/mozilla/widget/src/xlib/nsWindow.cpp b/mozilla/widget/src/xlib/nsWindow.cpp index 97aaa3cc43a..eefdab144da 100644 --- a/mozilla/widget/src/xlib/nsWindow.cpp +++ b/mozilla/widget/src/xlib/nsWindow.cpp @@ -23,11 +23,11 @@ nsWindow::nsWindow() : nsWidget() { NS_INIT_REFCNT(); - name = "nsWindow"; + mName = "nsWindow"; mBackground = NS_RGB(255, 255, 255); - bg_pixel = xlib_rgb_xpixel_from_rgb(mBackground); + mBackgroundPixel = xlib_rgb_xpixel_from_rgb(mBackground); mBackground = NS_RGB(255, 255, 255); - border_pixel = xlib_rgb_xpixel_from_rgb(border_rgb); + mBorderPixel = xlib_rgb_xpixel_from_rgb(mBorderRGB); } nsWindow::~nsWindow() @@ -38,9 +38,9 @@ void nsWindow::DestroyNative(void) { if (mGC) - XFreeGC(gDisplay, mGC); + XFreeGC(mDisplay, mGC); if (mBaseWindow) { - XDestroyWindow(gDisplay, mBaseWindow); + XDestroyWindow(mDisplay, mBaseWindow); DeleteWindowCallback(mBaseWindow); } } @@ -56,8 +56,8 @@ void nsWindow::CreateNative(Window aParent, nsRect aRect) // make sure that we listen for events attr.event_mask = StructureNotifyMask | 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; + attr.background_pixel = mBackgroundPixel; + attr.border_pixel = mBorderPixel; // set the colormap attr.colormap = xlib_rgb_get_cmap(); // here's what's in the struct @@ -141,12 +141,12 @@ NS_IMETHODIMP nsWindow::SetTitle(const nsString& aTitle) return NS_ERROR_FAILURE; const char *text = aTitle.ToNewCString(); - XStoreName(gDisplay, mBaseWindow, text); + XStoreName(mDisplay, mBaseWindow, text); delete [] text; return NS_OK; } ChildWindow::ChildWindow(): nsWindow() { - name = "nsChildWindow"; + mName = "nsChildWindow"; }