- if (_decorations & OBClient::Decor_Titlebar) {
- // set the titlebar size
- _titlebar_area.setRect(-_style->getBorderWidth(),
- -_style->getBorderWidth(),
- width,
- (_style->getFont().height() +
- _style->getBevelWidth() * 2));
- _size.top += _titlebar_area.height() + _style->getBorderWidth();
-
- // set the label size
- _label_area.setRect(0, _style->getBevelWidth(),
- width, _style->getFont().height());
- // set the buttons sizes
- if (_decorations & OBClient::Decor_Iconify)
- _button_iconify_area.setRect(0, _style->getBevelWidth() + 1,
- _label_area.height() - 2,
- _label_area.height() - 2);
- if (_decorations & OBClient::Decor_Maximize)
- _button_max_area.setRect(0, _style->getBevelWidth() + 1,
- _label_area.height() - 2,
- _label_area.height() - 2);
- if (_decorations & OBClient::Decor_Sticky)
- _button_stick_area.setRect(0, _style->getBevelWidth() + 1,
- _label_area.height() - 2,
- _label_area.height() - 2);
- if (_decorations & OBClient::Decor_Close)
- _button_close_area.setRect(0, _style->getBevelWidth() + 1,
- _label_area.height() - 2,
- _label_area.height() - 2);
-
- // separation between titlebar elements
- const int sep = _style->getBevelWidth() + 1;
-
- std::string layout = "ILMC"; // XXX: get this from somewhere
- // XXX: it is REQUIRED that by this point, the string only has one of each
- // possible letter, all of the letters are valid, and L exists somewhere in
- // the string!
-
- // the size of the label. this ASSUMES the layout has only buttons other
- // that the ONE LABEL!!
- // adds an extra sep so that there's a space on either side of the
- // titlebar.. note: x = sep, below.
- _label_area.setWidth(_label_area.width() -
- ((_button_iconify_area.width() + sep) *
- (layout.size() - 1) + sep));
-
- int x = sep;
- for (int i = 0, len = layout.size(); i < len; ++i) {
- otk::Rect *area;
- switch (layout[i]) {
- case 'I':
- if (!(_decorations & OBClient::Decor_Iconify))
- continue; // skip it
- area = &_button_iconify_area;
- break;
- case 'L':
- area = &_label_area;
- break;
- case 'M':
- if (!(_decorations & OBClient::Decor_Maximize))
- continue; // skip it
- area = &_button_max_area;
- break;
- case 'S':
- if (!(_decorations & OBClient::Decor_Sticky))
- continue; // skip it
- area = &_button_stick_area;
- break;
- case 'C':
- if (!(_decorations & OBClient::Decor_Close))
- continue; // skip it
- area = &_button_close_area;
- break;
- default:
- assert(false); // the layout string is invalid!
- continue; // just to fuck with g++
- }
- area->setX(x);
- x += sep + area->width();
- }
- }
+static void render(int screen, const otk::Size &size, Window win,
+ otk::Surface **surface,
+ const otk::RenderTexture &texture)
+{
+ otk::Surface *s = new otk::Surface(screen, size);
+ otk::display->renderControl(screen)->drawBackground(*s, texture);
+ XSetWindowBackgroundPixmap(**otk::display, win, s->pixmap());
+ XClearWindow(**otk::display, win);
+ if (*surface) delete *surface;
+ *surface = s;
+}
+
+void Frame::adjustSize()
+{
+ Client::DecorationFlags decorations = _client->decorations();
+ const otk::RenderStyle *style = otk::RenderStyle::style(_client->screen());