- XFreeFont(getBaseDisplay().getXDisplay(), resource.tstyle.font);
- if (resource.root_command != NULL)
- delete [] resource.root_command;
-
- XFreeGC(getBaseDisplay().getXDisplay(), opGC);
-
- XFreeGC(getBaseDisplay().getXDisplay(),
- resource.wstyle.l_text_focus_gc);
- XFreeGC(getBaseDisplay().getXDisplay(),
- resource.wstyle.l_text_unfocus_gc);
- XFreeGC(getBaseDisplay().getXDisplay(),
- resource.wstyle.b_pic_focus_gc);
- XFreeGC(getBaseDisplay().getXDisplay(),
- resource.wstyle.b_pic_unfocus_gc);
-
- XFreeGC(getBaseDisplay().getXDisplay(),
- resource.mstyle.t_text_gc);
- XFreeGC(getBaseDisplay().getXDisplay(),
- resource.mstyle.f_text_gc);
- XFreeGC(getBaseDisplay().getXDisplay(),
- resource.mstyle.h_text_gc);
- XFreeGC(getBaseDisplay().getXDisplay(),
- resource.mstyle.d_text_gc);
- XFreeGC(getBaseDisplay().getXDisplay(),
- resource.mstyle.hilite_gc);
-
- XFreeGC(getBaseDisplay().getXDisplay(),
- resource.tstyle.l_text_gc);
- XFreeGC(getBaseDisplay().getXDisplay(),
- resource.tstyle.w_text_gc);
- XFreeGC(getBaseDisplay().getXDisplay(),
- resource.tstyle.c_text_gc);
- XFreeGC(getBaseDisplay().getXDisplay(),
- resource.tstyle.b_pic_gc);
-}
-
-
-Rect BScreen::availableArea() const {
- // the following code is temporary and will be taken care of by Screen in the
- // future (with the NETWM 'strut')
- Rect space(0, 0, size().w(), size().h());
- if (!resource.full_max) {
-#ifdef SLIT
- int slit_x = slit->autoHide() ? slit->hiddenOrigin().x() : slit->area().x(),
- slit_y = slit->autoHide() ? slit->hiddenOrigin().y() : slit->area().y();
- int tbarh = resource.hide_toolbar ? 0 :
- toolbar->getExposedHeight() + resource.border_width * 2;
- bool tbartop;
- switch (toolbar->placement()) {
- case Toolbar::TopLeft:
- case Toolbar::TopCenter:
- case Toolbar::TopRight:
- tbartop = true;
- break;
- case Toolbar::BottomLeft:
- case Toolbar::BottomCenter:
- case Toolbar::BottomRight:
- tbartop = false;
- break;
- default:
- ASSERT(false); // unhandled placement
- }
- if ((slit->direction() == Slit::Horizontal &&
- (slit->placement() == Slit::TopLeft ||
- slit->placement() == Slit::TopRight)) ||
- slit->placement() == Slit::TopCenter) {
- // exclude top
- if (tbartop && slit_y + slit->area().h() < tbarh) {
- space.setY(space.y() + tbarh);
- space.setH(space.h() - tbarh);
- } else {
- space.setY(space.y() + (slit_y + slit->area().h() +
- resource.border_width * 2));
- space.setH(space.h() - (slit_y + slit->area().h() +
- resource.border_width * 2));
- if (!tbartop)
- space.setH(space.h() - tbarh);
- }
- } else if ((slit->direction() == Slit::Vertical &&
- (slit->placement() == Slit::TopRight ||
- slit->placement() == Slit::BottomRight)) ||
- slit->placement() == Slit::CenterRight) {
- // exclude right
- space.setW(space.w() - (size().w() - slit_x));
- if (tbartop)
- space.setY(space.y() + tbarh);
- space.setH(space.h() - tbarh);
- } else if ((slit->direction() == Slit::Horizontal &&
- (slit->placement() == Slit::BottomLeft ||
- slit->placement() == Slit::BottomRight)) ||
- slit->placement() == Slit::BottomCenter) {
- // exclude bottom
- if (!tbartop && (size().h() - slit_y) < tbarh) {
- space.setH(space.h() - tbarh);
- } else {
- space.setH(space.h() - (size().h() - slit_y));
- if (tbartop) {
- space.setY(space.y() + tbarh);
- space.setH(space.h() - tbarh);
- }
- }
- } else {// if ((slit->direction() == Slit::Vertical &&
- // (slit->placement() == Slit::TopLeft ||
- // slit->placement() == Slit::BottomLeft)) ||
- // slit->placement() == Slit::CenterLeft)
- // exclude left
- space.setX(slit_x + slit->area().w() +
- resource.border_width * 2);
- space.setW(space.w() - (slit_x + slit->area().w() +
- resource.border_width * 2));
- if (tbartop)
- space.setY(space.y() + tbarh);
- space.setH(space.h() - tbarh);
- }
-#else // !SLIT
- int tbarh = resource.hide_toolbar() ? 0 :
- toolbar->getExposedHeight() + resource.border_width * 2;
- switch (toolbar->placement()) {
- case Toolbar::TopLeft:
- case Toolbar::TopCenter:
- case Toolbar::TopRight:
- space.setY(toolbar->getExposedHeight());
- space.setH(space.h() - toolbar->getExposedHeight());
- break;
- case Toolbar::BottomLeft:
- case Toolbar::BottomCenter:
- case Toolbar::BottomRight:
- space.setH(space.h() - tbarh);
- break;
- default:
- ASSERT(false); // unhandled placement
- }
-#endif // SLIT
- }
- return space;
-}
-
-
-void BScreen::readDatabaseTexture(const char *rname, const char *rclass,
- BTexture *texture,
- unsigned long default_pixel)
-{
- std::string s;
-
- if (resource.styleconfig.getValue(rname, rclass, s))
- image_control->parseTexture(texture, s.c_str());
- else
- texture->setTexture(BImage_Solid | BImage_Flat);
-
- if (texture->getTexture() & BImage_Solid) {
- int clen = strlen(rclass) + 32, nlen = strlen(rname) + 32;
-
- char *colorclass = new char[clen], *colorname = new char[nlen];
-
- sprintf(colorclass, "%s.Color", rclass);
- sprintf(colorname, "%s.color", rname);
-
- readDatabaseColor(colorname, colorclass, texture->getColor(),
- default_pixel);
-
-#ifdef INTERLACE
- sprintf(colorclass, "%s.ColorTo", rclass);
- sprintf(colorname, "%s.colorTo", rname);
-
- readDatabaseColor(colorname, colorclass, texture->getColorTo(),
- default_pixel);
-#endif // INTERLACE
-
- delete [] colorclass;
- delete [] colorname;
-
- if ((! texture->getColor()->isAllocated()) ||
- (texture->getTexture() & BImage_Flat))
- return;
-
- XColor xcol;
-
- xcol.red = (unsigned int) (texture->getColor()->getRed() +
- (texture->getColor()->getRed() >> 1));
- if (xcol.red >= 0xff) xcol.red = 0xffff;
- else xcol.red *= 0xff;
- xcol.green = (unsigned int) (texture->getColor()->getGreen() +
- (texture->getColor()->getGreen() >> 1));
- if (xcol.green >= 0xff) xcol.green = 0xffff;
- else xcol.green *= 0xff;
- xcol.blue = (unsigned int) (texture->getColor()->getBlue() +
- (texture->getColor()->getBlue() >> 1));
- if (xcol.blue >= 0xff) xcol.blue = 0xffff;
- else xcol.blue *= 0xff;
-
- if (! XAllocColor(getBaseDisplay().getXDisplay(),
- getColormap(), &xcol))
- xcol.pixel = 0;
-
- texture->getHiColor()->setPixel(xcol.pixel);
-
- xcol.red =
- (unsigned int) ((texture->getColor()->getRed() >> 2) +
- (texture->getColor()->getRed() >> 1)) * 0xff;
- xcol.green =
- (unsigned int) ((texture->getColor()->getGreen() >> 2) +
- (texture->getColor()->getGreen() >> 1)) * 0xff;
- xcol.blue =
- (unsigned int) ((texture->getColor()->getBlue() >> 2) +
- (texture->getColor()->getBlue() >> 1)) * 0xff;
-
- if (! XAllocColor(getBaseDisplay().getXDisplay(),
- getColormap(), &xcol))
- xcol.pixel = 0;
-
- texture->getLoColor()->setPixel(xcol.pixel);
- } else if (texture->getTexture() & BImage_Gradient) {
- int clen = strlen(rclass) + 10, nlen = strlen(rname) + 10;
-
- char *colorclass = new char[clen], *colorname = new char[nlen],
- *colortoclass = new char[clen], *colortoname = new char[nlen];
-
- sprintf(colorclass, "%s.Color", rclass);
- sprintf(colorname, "%s.color", rname);
-
- sprintf(colortoclass, "%s.ColorTo", rclass);
- sprintf(colortoname, "%s.colorTo", rname);
-
- readDatabaseColor(colorname, colorclass, texture->getColor(),
- default_pixel);
- readDatabaseColor(colortoname, colortoclass, texture->getColorTo(),
- default_pixel);
-
- delete [] colorclass;
- delete [] colorname;
- delete [] colortoclass;
- delete [] colortoname;
- }
-}
-