- // the following code is temporary and will be taken care of by Screen in the
- // future (with the NETWM 'strut')
- Rect space(0, 0, screen->size().w(), screen->size().h());
- if (! screen->fullMax()) {
-#ifdef SLIT
- Slit *slit = screen->getSlit();
- Toolbar *toolbar = screen->getToolbar();
- int tbarh = screen->hideToolbar() ? 0 :
- toolbar->getExposedHeight() + screen->getBorderWidth() * 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) {
- space.setY(slit->area().y());
- space.setH(space.h() - space.y());
- } else
- space.setH(space.h() - tbarh);
- space.setY(space.y() + slit->area().h() + screen->getBorderWidth() * 2);
- space.setH(space.h() - (slit->area().h() + screen->getBorderWidth() * 2));
- } else if ((slit->direction() == Slit::Vertical &&
- (slit->placement() == Slit::TopRight ||
- slit->placement() == Slit::BottomRight)) ||
- slit->placement() == Slit::CenterRight) {
- // exclude right
- space.setW(space.w() - (slit->area().w() + screen->getBorderWidth() * 2));
- 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
- space.setH(space.h() - (screen->size().h() - slit->area().y()));
- } else {// if ((slit->direction() == Slit::Vertical &&
- // (slit->placement() == Slit::TopLeft ||
- // slit->placement() == Slit::BottomLeft)) ||
- // slit->placement() == Slit::CenterLeft)
- // exclude left
- space.setX(slit->area().w() + screen->getBorderWidth() * 2);
- space.setW(space.w() - (slit->area().w() + screen->getBorderWidth() * 2));
- if (tbartop)
- space.setY(space.y() + tbarh);
- space.setH(space.h() - tbarh);
- }
-#else // !SLIT
- Toolbar *toolbar = screen->getToolbar();
- int tbarh = screen->hideToolbar() ? 0 :
- toolbar->getExposedHeight() + screen->getBorderWidth() * 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
- }
-
- openbox_attrib.premax_x = frame.x;
- openbox_attrib.premax_y = frame.y;
- openbox_attrib.premax_w = frame.width;
- openbox_attrib.premax_h = frame.height;
-
- unsigned int dw = space.w(),
- dh = space.h();
- dw -= frame.border_w * 2;
- dw -= frame.mwm_border_w * 2;
- dw -= client.base_width;
-
- dh -= frame.border_w * 2;
- dh -= frame.mwm_border_w * 2;
- dh -= ((frame.handle_h + frame.border_w) * decorations.handle);
- dh -= client.base_height;
- dh -= frame.y_border;
-
- if (dw < client.min_width) dw = client.min_width;
- if (dh < client.min_height) dh = client.min_height;
- if (dw > client.max_width) dw = client.max_width;
- if (dh > client.max_height) dh = client.max_height;
-
- dw -= (dw % client.width_inc);
- dw += client.base_width;
- dw += frame.mwm_border_w * 2;
-
- dh -= (dh % client.height_inc);
- dh += client.base_height;
- dh += frame.y_border;
- dh += ((frame.handle_h + frame.border_w) * decorations.handle);
- dh += frame.mwm_border_w * 2;
-
- int dx = space.x() + ((space.w() - dw) / 2) - frame.border_w,
- dy = space.y() + ((space.h() - dh) / 2) - frame.border_w;
+ blackbox_attrib.premax_x = frame.rect.x();
+ blackbox_attrib.premax_y = frame.rect.y();
+ blackbox_attrib.premax_w = frame.rect.width();
+ // use client.rect so that clients can be restored even if shaded
+ blackbox_attrib.premax_h =
+ client.rect.height() + frame.margin.top + frame.margin.bottom;
+
+#ifdef XINERAMA
+ if (screen->isXineramaActive() && blackbox->doXineramaMaximizing()) {
+ // find the area to use
+ RectList availableAreas = screen->allAvailableAreas();
+ RectList::iterator it, end = availableAreas.end();
+
+ for (it = availableAreas.begin(); it != end; ++it)
+ if (it->intersects(frame.rect)) break;
+ if (it == end) // the window isn't inside an area
+ it = availableAreas.begin(); // so just default to the first one
+
+ frame.changing = *it;
+ } else
+#endif // XINERAMA
+ frame.changing = screen->availableArea();