- // position/size all the windows
-
- XResizeWindow(otk::OBDisplay::display, _window,
- _size.left + _size.right + _client->area().width(),
- _size.top + _size.bottom + _client->area().height());
-
- XMoveWindow(otk::OBDisplay::display, _client->window(),
- _size.left, _size.top);
-
- if (_decorations & OBClient::Decor_Titlebar) {
- XMoveResizeWindow(otk::OBDisplay::display, _titlebar,
- _titlebar_area.x(), _titlebar_area.y(),
- _titlebar_area.width(), _titlebar_area.height());
- XMoveResizeWindow(otk::OBDisplay::display, _label,
- _label_area.x(), _label_area.y(),
- _label_area.width(), _label_area.height());
- if (_decorations & OBClient::Decor_Iconify)
- XMoveResizeWindow(otk::OBDisplay::display, _button_iconify,
- _button_iconify_area.x(), _button_iconify_area.y(),
- _button_iconify_area.width(),
- _button_iconify_area.height());
- if (_decorations & OBClient::Decor_Maximize)
- XMoveResizeWindow(otk::OBDisplay::display, _button_max,
- _button_max_area.x(), _button_max_area.y(),
- _button_max_area.width(),
- _button_max_area.height());
- if (_decorations & OBClient::Decor_Sticky)
- XMoveResizeWindow(otk::OBDisplay::display, _button_stick,
- _button_stick_area.x(), _button_stick_area.y(),
- _button_stick_area.width(),
- _button_stick_area.height());
- if (_decorations & OBClient::Decor_Close)
- XMoveResizeWindow(otk::OBDisplay::display, _button_close,
- _button_close_area.x(), _button_close_area.y(),
- _button_close_area.width(),
- _button_close_area.height());
- }
-
- if (_decorations & OBClient::Decor_Handle) {
- XMoveResizeWindow(otk::OBDisplay::display, _handle,
- _handle_area.x(), _handle_area.y(),
- _handle_area.width(), _handle_area.height());
- XMoveResizeWindow(otk::OBDisplay::display, _grip_left,
- _grip_left_area.x(), _grip_left_area.y(),
- _grip_left_area.width(), _grip_left_area.height());
- XMoveResizeWindow(otk::OBDisplay::display, _grip_right,
- _grip_right_area.x(), _grip_right_area.y(),
- _grip_right_area.width(), _grip_right_area.height());
- }
-
- // map/unmap all the windows
- if (_decorations & OBClient::Decor_Titlebar) {
- XMapWindow(otk::OBDisplay::display, _label);
- if (_decorations & OBClient::Decor_Iconify)
- XMapWindow(otk::OBDisplay::display, _button_iconify);
- else
- XUnmapWindow(otk::OBDisplay::display, _button_iconify);
- if (_decorations & OBClient::Decor_Maximize)
- XMapWindow(otk::OBDisplay::display, _button_max);
- else
- XUnmapWindow(otk::OBDisplay::display, _button_max);
- if (_decorations & OBClient::Decor_Sticky)
- XMapWindow(otk::OBDisplay::display, _button_stick);
- else
- XUnmapWindow(otk::OBDisplay::display, _button_stick);
- if (_decorations & OBClient::Decor_Close)
- XMapWindow(otk::OBDisplay::display, _button_close);
- else
- XUnmapWindow(otk::OBDisplay::display, _button_close);
- XMapWindow(otk::OBDisplay::display, _titlebar);
- } else {
- XUnmapWindow(otk::OBDisplay::display, _titlebar);
- XUnmapWindow(otk::OBDisplay::display, _label);
- XUnmapWindow(otk::OBDisplay::display, _button_iconify);
- XUnmapWindow(otk::OBDisplay::display, _button_max);
- XUnmapWindow(otk::OBDisplay::display, _button_stick);
- XUnmapWindow(otk::OBDisplay::display, _button_close);
- }
-
- if (_decorations & OBClient::Decor_Handle) {
- XMapWindow(otk::OBDisplay::display, _grip_left);
- XMapWindow(otk::OBDisplay::display, _grip_right);
- XMapWindow(otk::OBDisplay::display, _handle);
- } else {
- XUnmapWindow(otk::OBDisplay::display, _handle);
- XUnmapWindow(otk::OBDisplay::display, _grip_left);
- XUnmapWindow(otk::OBDisplay::display, _grip_right);
+void Frame::renderMax()
+{
+ if (!(_decorations & Client::Decor_Maximize)) return;
+ bool press = _max_press || _client->maxVert() || _client->maxHorz();
+ renderButton(_client->screen(), _client->focused(), press, _max,
+ &_max_sur, geom.button_size,
+ otk::RenderStyle::style(_client->screen())->maximizeMask(),
+ geom.max_x, (geom.bevel + 1), _title_sur);
+}
+
+void Frame::renderDesk()
+{
+ if (!(_decorations & Client::Decor_AllDesktops)) return;
+ bool press = _desk_press || _client->desktop() == 0xffffffff;
+ renderButton(_client->screen(), _client->focused(), press, _desk,
+ &_desk_sur, geom.button_size,
+ otk::RenderStyle::style(_client->screen())->alldesktopsMask(),
+ geom.desktop_x, (geom.bevel + 1), _title_sur);
+}
+
+void Frame::renderIconify()
+{
+ if (!(_decorations & Client::Decor_Iconify)) return;
+ renderButton(_client->screen(), _client->focused(), _iconify_press, _iconify,
+ &_iconify_sur, geom.button_size,
+ otk::RenderStyle::style(_client->screen())->iconifyMask(),
+ geom.iconify_x, (geom.bevel + 1), _title_sur);
+}
+
+void Frame::renderClose()
+{
+ if (!(_decorations & Client::Decor_Close)) return;
+ renderButton(_client->screen(), _client->focused(), _close_press, _close,
+ &_close_sur, geom.button_size,
+ otk::RenderStyle::style(_client->screen())->closeMask(),
+ geom.close_x, (geom.bevel + 1), _title_sur);
+}
+
+void Frame::renderIcon()
+{
+ if (!(_decorations & Client::Decor_Icon)) return;
+ const int screen = _client->screen();
+ const otk::RenderControl *control = otk::display->renderControl(screen);
+
+ otk::Surface *s = new otk::Surface(screen, otk::Size(geom.button_size,
+ geom.button_size));
+ otk::pixel32 *dest = s->pixelData(), *src;
+ int w = _title_sur->size().width();
+
+ src = _title_sur->pixelData() + w * (geom.bevel + 1) + geom.icon_x;
+
+ // get the background under the icon button
+ for (int y = 0; y < geom.button_size; ++y, src += w - geom.button_size)
+ for (int x = 0; x < geom.button_size; ++x, ++dest, ++src)
+ *dest = *src;
+ // draw the icon over it
+ const Icon *icon = _client->icon(otk::Size(geom.button_size,
+ geom.button_size));
+ control->drawImage(*s, icon->w, icon->h, icon->data);
+ if (!icon->data) {
+ Pixmap p = _client->pixmapIcon(), m = _client->pixmapIconMask();
+ if (p != None)
+ control->drawImage(*s, p, m);