make sure to set the border pixel for created windows to avoid bad_match errors. patch from Tim Rowley <tor@cs.brown.edu>.

This commit is contained in:
blizzard%redhat.com 1999-05-31 03:46:38 +00:00
parent 334455c2f7
commit 026327ef2b
3 changed files with 10 additions and 4 deletions

View File

@ -54,6 +54,8 @@ nsWidget::nsWidget() : nsBaseWidget()
mBaseWindow = 0;
bg_rgb = NS_RGB(192,192,192);
bg_pixel = xlib_rgb_xpixel_from_rgb(bg_rgb);
border_rgb = NS_RGB(192,192,192);
border_pixel = xlib_rgb_xpixel_from_rgb(border_rgb);
mGC = 0;
parentWidget = nsnull;
name = "unnamed";
@ -339,12 +341,13 @@ void nsWidget::CreateNative(Window aParent, nsRect aRect)
attr.bit_gravity = NorthWestGravity;
// make sure that we listen for events
attr.event_mask = SubstructureNotifyMask | StructureNotifyMask | ExposureMask;
// set the default background color to that awful gray
// set the default background color and border to that awful gray
attr.background_pixel = bg_pixel;
attr.border_pixel = border_pixel;
// set the colormap
attr.colormap = xlib_rgb_get_cmap();
// here's what's in the struct
attr_mask = CWBitGravity | CWEventMask | CWBackPixel;
attr_mask = CWBitGravity | CWEventMask | CWBackPixel | CWBorderPixel;
// check to see if there was actually a colormap.
if (attr.colormap)
attr_mask |= CWColormap;

View File

@ -118,6 +118,8 @@ protected:
Window mBaseWindow;
PRUint32 bg_rgb;
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
};

View File

@ -54,12 +54,13 @@ nsWindow::CreateNative(Window aParent, nsRect aRect)
attr.bit_gravity = NorthWestGravity;
// make sure that we listen for events
attr.event_mask = SubstructureNotifyMask | StructureNotifyMask | ExposureMask;
// set the default background color to that awful gray
// set the default background color and border to that awful gray
attr.background_pixel = bg_pixel;
attr.border_pixel = border_pixel;
// set the colormap
attr.colormap = xlib_rgb_get_cmap();
// here's what's in the struct
attr_mask = CWBitGravity | CWEventMask | CWBackPixel;
attr_mask = CWBitGravity | CWEventMask | CWBackPixel | CWBorderPixel;
// check to see if there was actually a colormap.
if (attr.colormap)
attr_mask |= CWColormap;