]> Dogcows Code - chaz/openbox/blobdiff - src/frame.cc
remove the redundant _size property in OBScreen, and set the geometry root property...
[chaz/openbox] / src / frame.cc
index f7103b02fab368b7215e2dabe35f32300d0fe7e7..20e81ebd192d928a034c03aefe81367228ed8fa2 100644 (file)
@@ -18,7 +18,7 @@ extern "C" {
 
 namespace ob {
 
-OBFrame::OBFrame(const OBClient *client, const otk::Style *style)
+OBFrame::OBFrame(OBClient *client, const otk::Style *style)
   : _client(client),
     _screen(otk::OBDisplay::screenInfo(client->screen()))
 {
@@ -114,6 +114,13 @@ void OBFrame::loadStyle(const otk::Style *style)
   XSetWindowBorder(otk::OBDisplay::display, _handle,
                    _style->getBorderColor().pixel());
   
+  // XXX: if (focused)
+    XSetWindowBackground(otk::OBDisplay::display, _window,
+                         _style->getFrameFocus().color().pixel());
+  // XXX: else  
+  // XXX:  XSetWindowBackground(otk::OBDisplay::display, _window,
+  // XXX:                       _style->getFrameUnfocus().color().pixel());
+
   // if !replace, then update() will get called after the client is grabbed!
   if (replace) {
     update();
@@ -144,13 +151,13 @@ void OBFrame::update()
     _titlebar_area.setRect(-_style->getBorderWidth(),
                            -_style->getBorderWidth(),
                            width,
-                           (_style->getFont()->height() +
+                           (_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());
+                        width, _style->getFont().height());
     // set the buttons sizes
     if (_decorations & OBClient::Decor_Iconify)
       _button_iconify_area.setRect(0, _style->getBevelWidth() + 1,
@@ -177,6 +184,14 @@ void OBFrame::update()
     // 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;
@@ -209,15 +224,14 @@ void OBFrame::update()
         continue; // just to fuck with g++
       }
       area->setX(x);
-      if (layout[i] != 'L')
-        _label_area.setWidth(_label_area.width() - area->width());
       x += sep + area->width();
     }
   }
 
   if (_decorations & OBClient::Decor_Handle) {
     _handle_area.setRect(-_style->getBorderWidth(),
-                         _size.top + _client->area().height(),
+                         _size.top + _client->area().height() +
+                         _style->getFrameWidth(),
                          width, _style->getHandleWidth());
     _grip_left_area.setRect(-_style->getBorderWidth(),
                             -_style->getBorderWidth(),
@@ -337,14 +351,14 @@ void OBFrame::updateShape()
   if (!_client->shaped()) {
     // clear the shape on the frame window
     XShapeCombineMask(otk::OBDisplay::display, _window, ShapeBounding,
-                      _size.left - 2,//frame.margin.left - frame.border_w,
-                      _size.top - 2,//frame.margin.top - frame.border_w,
+                      _size.left,
+                      _size.top,
                       None, ShapeSet);
   } else {
     // make the frame's shape match the clients
     XShapeCombineShape(otk::OBDisplay::display, _window, ShapeBounding,
-                       _size.left - 2,
-                       _size.top - 2,
+                       _size.left,
+                       _size.top,
                        _client->window(), ShapeBounding, ShapeSet);
 
   int num = 0;
@@ -378,26 +392,18 @@ void OBFrame::updateShape()
 void OBFrame::grabClient()
 {
   
-  XGrabServer(otk::OBDisplay::display);
-
   // select the event mask on the frame
-  XSelectInput(otk::OBDisplay::display, _window, SubstructureRedirectMask);
+  //XSelectInput(otk::OBDisplay::display, _window, SubstructureRedirectMask);
 
   // reparent the client to the frame
-  XSelectInput(otk::OBDisplay::display, _client->window(),
-               OBClient::event_mask & ~StructureNotifyMask);
-  XReparentWindow(otk::OBDisplay::display, _client->window(), _window,
-                  _size.left, _size.top);
-  XSelectInput(otk::OBDisplay::display, _client->window(),
-               OBClient::event_mask);
+  XReparentWindow(otk::OBDisplay::display, _client->window(), _window, 0, 0);
+  _client->ignore_unmaps++;
 
   // raise the client above the frame
-  XRaiseWindow(otk::OBDisplay::display, _client->window());
+  //XRaiseWindow(otk::OBDisplay::display, _client->window());
   // map the client so it maps when the frame does
   XMapWindow(otk::OBDisplay::display, _client->window());
   
-  XUngrabServer(otk::OBDisplay::display);
-
   update();
 }
 
@@ -441,7 +447,6 @@ Window OBFrame::createChild(Window parent, Cursor cursor)
   Window w = XCreateWindow(otk::OBDisplay::display, parent, 0, 0, 1, 1, 0,
                            _screen->getDepth(), InputOutput,
                            _screen->getVisual(), create_mask, &attrib_create);
-  XRaiseWindow(otk::OBDisplay::display, w); // raise above the parent
   return w;
 }
 
This page took 0.0234 seconds and 4 git commands to generate.