432 }
433
434 // overriden in XCanvasPeer
435 protected boolean doEraseBackground() {
436 return true;
437 }
438
439 // We need a version of setBackground that does not call repaint !!
440 // and one that does not get overridden. The problem is that in postInit
441 // we call setBackground and we don't have all the stuff initialized to
442 // do a full paint for most peers. So we cannot call setBackground in postInit.
443 public final void xSetBackground(Color c) {
444 XToolkit.awtLock();
445 try {
446 winBackground(c);
447 // fix for 6558510: handle sun.awt.noerasebackground flag,
448 // see doEraseBackground() and preInit() methods in XCanvasPeer
449 if (!doEraseBackground()) {
450 return;
451 }
452 // 6304250: XAWT: Items in choice show a blue border on OpenGL + Solaris10 when background color is set
453 // Note: When OGL is enabled, surfaceData.pixelFor() will not
454 // return a pixel value appropriate for passing to
455 // XSetWindowBackground(). Therefore, we will use the ColorModel
456 // for this component in order to calculate a pixel value from
457 // the given RGB value.
458 ColorModel cm = getColorModel();
459 int pixel = PixelConverter.instance.rgbToPixel(c.getRGB(), cm);
460 XlibWrapper.XSetWindowBackground(XToolkit.getDisplay(), getContentWindow(), pixel);
461 XlibWrapper.XClearWindow(XToolkit.getDisplay(), getContentWindow());
462 }
463 finally {
464 XToolkit.awtUnlock();
465 }
466 }
467
468 public void setBackground(Color c) {
469 xSetBackground(c);
470 }
471
472 Color backgroundColor;
473 void winBackground(Color c) {
474 backgroundColor = c;
475 }
476
477 public Color getWinBackground() {
478 Color c = null;
479
|
432 }
433
434 // overriden in XCanvasPeer
435 protected boolean doEraseBackground() {
436 return true;
437 }
438
439 // We need a version of setBackground that does not call repaint !!
440 // and one that does not get overridden. The problem is that in postInit
441 // we call setBackground and we don't have all the stuff initialized to
442 // do a full paint for most peers. So we cannot call setBackground in postInit.
443 public final void xSetBackground(Color c) {
444 XToolkit.awtLock();
445 try {
446 winBackground(c);
447 // fix for 6558510: handle sun.awt.noerasebackground flag,
448 // see doEraseBackground() and preInit() methods in XCanvasPeer
449 if (!doEraseBackground()) {
450 return;
451 }
452 int pixel = surfaceData.pixelFor(c.getRGB());
453 XlibWrapper.XSetWindowBackground(XToolkit.getDisplay(), getContentWindow(), pixel);
454 XlibWrapper.XClearWindow(XToolkit.getDisplay(), getContentWindow());
455 }
456 finally {
457 XToolkit.awtUnlock();
458 }
459 }
460
461 public void setBackground(Color c) {
462 xSetBackground(c);
463 }
464
465 Color backgroundColor;
466 void winBackground(Color c) {
467 backgroundColor = c;
468 }
469
470 public Color getWinBackground() {
471 Color c = null;
472
|