+ XSetWindowAttributes attrib;
+ unsigned long mask;
+ const otk::ScreenInfo *info = otk::display->screenInfo(client->screen());
+
+ // create all of the decor windows (except title bar buttons)
+ mask = CWOverrideRedirect | CWEventMask;
+ attrib.event_mask = Frame::event_mask;
+ attrib.override_redirect = true;
+ _frame = createWindow(info, info->rootWindow(), mask, &attrib);
+
+ mask = 0;
+ _plate = createWindow(info, _frame, mask, &attrib);
+ mask = CWEventMask;
+ attrib.event_mask = (ButtonPressMask | ButtonReleaseMask | ButtonMotionMask |
+ ExposureMask);
+ _title = createWindow(info, _frame, mask, &attrib);
+ _label = createWindow(info, _title, mask, &attrib);
+ _handle = createWindow(info, _frame, mask, &attrib);
+ mask |= CWCursor;
+ attrib.cursor = openbox->cursors().ll_angle;
+ _lgrip = createWindow(info, _handle, mask, &attrib);
+ attrib.cursor = openbox->cursors().lr_angle;
+ _rgrip = createWindow(info, _handle, mask, &attrib);
+
+ // the other stuff is shown based on decor settings
+ XMapWindow(**otk::display, _plate);
+ XMapWindow(**otk::display, _lgrip);
+ XMapWindow(**otk::display, _rgrip);
+ XMapWindow(**otk::display, _label);
+
+ applyStyle(*otk::RenderStyle::style(_client->screen()));
+
+ // XXX load buttons
+ _numbuttons = 0;
+ _buttons = new Window[0];
+ _buttons_sur = new otk::Surface*[0];
+ _titleorder = new int[1];
+ _titleorder[0] = -1;
+
+ // register all of the windows with the event dispatcher
+ Window *w = allWindows();
+ for (unsigned int i = 0; w[i]; ++i)
+ openbox->registerHandler(w[i], this);
+ delete [] w;
+}
+
+Frame::~Frame()
+{
+ // unregister all of the windows with the event dispatcher
+ Window *w = allWindows();
+ for (unsigned int i = 0; w[i]; ++i)
+ openbox->clearHandler(w[i]);
+ delete [] w;
+
+ for (int i = 0; i < _numbuttons; ++i) {
+ XDestroyWindow(**otk::display, _buttons[i]);
+ delete _buttons_sur[i];
+ }
+ XDestroyWindow(**otk::display, _rgrip);
+ XDestroyWindow(**otk::display, _lgrip);
+ XDestroyWindow(**otk::display, _handle);
+ XDestroyWindow(**otk::display, _label);
+ XDestroyWindow(**otk::display, _title);
+ XDestroyWindow(**otk::display, _frame);
+
+ if (_frame_sur) delete _frame_sur;
+ if (_title_sur) delete _title_sur;
+ if (_label_sur) delete _label_sur;
+ if (_handle_sur) delete _handle_sur;
+ if (_grip_sur) delete _grip_sur;
+
+ delete [] _buttons;
+ delete [] _titleorder;
+ delete [] _buttons_sur;
+}