--- compiz-0.9.7.6.orig/src/event.cpp +++ compiz-0.9.7.6/src/event.cpp @@ -1251,7 +1251,7 @@ CompScreenImpl::_handleEvent (XEvent *ev } /* been shaded */ - if (w->priv->height == 0) + if (w->shaded ()) { if (w->id () == priv->activeWindow) w->moveInputFocusTo (); --- compiz-0.9.7.6.orig/src/screen.cpp +++ compiz-0.9.7.6/src/screen.cpp @@ -4060,8 +4060,8 @@ CompScreenImpl::viewportForGeometry (con CompRect rect (gm); int offset; - rect.setWidth (rect.width () + (gm.border () * 2)); - rect.setHeight (rect.height () + (gm.border () * 2)); + rect.setWidth (gm.widthIncBorders ()); + rect.setHeight (gm.heightIncBorders ()); offset = rect.centerX () < 0 ? -1 : 0; viewport.setX (priv->vp.x () + ((rect.centerX () / width ()) + offset) % @@ -4657,6 +4657,8 @@ PrivateScreen::initDisplay (const char * return false; } + /* Use synchronous behaviour when running with --sync, useful + * for getting stacktraces when X Errors occurr */ XSynchronize (dpy, synchronousX ? True : False); snprintf (displayString, 255, "DISPLAY=%s", --- compiz-0.9.7.6.orig/src/windowgeometry.cpp +++ compiz-0.9.7.6/src/windowgeometry.cpp @@ -61,22 +61,19 @@ CompWindow::pos () const int CompWindow::width () const { - return priv->width + - priv->geometry.border () * 2; + return priv->geometry.widthIncBorders (); } int CompWindow::height () const { - return priv->height + - priv->geometry.border () * 2;; + return priv->geometry.heightIncBorders (); } CompSize CompWindow::size () const { - return CompSize (priv->width + priv->geometry.border () * 2, - priv->height + priv->geometry.border () * 2); + return CompSize (width (), height ()); } int @@ -102,88 +99,84 @@ CompWindow::serverPos () const int CompWindow::serverWidth () const { - return priv->serverGeometry.width () + - 2 * priv->serverGeometry.border (); + return priv->serverGeometry.widthIncBorders (); } int CompWindow::serverHeight () const { - return priv->serverGeometry.height () + - 2 * priv->serverGeometry.border (); + return priv->serverGeometry.heightIncBorders (); } const CompSize CompWindow::serverSize () const { - return CompSize (priv->serverGeometry.width () + - 2 * priv->serverGeometry.border (), - priv->serverGeometry.height () + - 2 * priv->serverGeometry.border ()); + return CompSize (priv->serverGeometry.widthIncBorders (), + priv->serverGeometry.heightIncBorders ()); } CompRect CompWindow::borderRect () const { - return CompRect (priv->geometry.x () - priv->geometry.border () - priv->border.left, - priv->geometry.y () - priv->geometry.border () - priv->border.top, - priv->geometry.width () + priv->geometry.border () * 2 + + return CompRect (priv->geometry.xMinusBorder () - priv->border.left, + priv->geometry.yMinusBorder () - priv->border.top, + priv->geometry.widthIncBorders () + priv->border.left + priv->border.right, - priv->geometry.height () + priv->geometry.border () * 2 + + priv->geometry.heightIncBorders () + priv->border.top + priv->border.bottom); } CompRect CompWindow::serverBorderRect () const { - return CompRect (priv->serverGeometry.x () - priv->geometry.border () - priv->border.left, - priv->serverGeometry.y () - priv->geometry.border () - priv->border.top, - priv->serverGeometry.width () + priv->geometry.border () * 2 + + return CompRect (priv->serverGeometry.xMinusBorder () - priv->border.left, + priv->serverGeometry.yMinusBorder () - priv->border.top, + priv->serverGeometry.widthIncBorders () + priv->border.left + priv->border.right, - priv->serverGeometry.height () + priv->geometry.border () * 2 + + priv->serverGeometry.heightIncBorders() + priv->border.top + priv->border.bottom); } CompRect CompWindow::inputRect () const { - return CompRect (priv->geometry.x () - priv->geometry.border () - priv->serverInput.left, - priv->geometry.y () - priv->geometry.border () - priv->serverInput.top, - priv->geometry.width () + priv->geometry.border () * 2 + + return CompRect (priv->geometry.xMinusBorder () - priv->serverInput.left, + priv->geometry.yMinusBorder () - priv->serverInput.top, + priv->geometry.widthIncBorders () + priv->serverInput.left + priv->serverInput.right, - priv->geometry.height () +priv->geometry.border () * 2 + + priv->geometry.heightIncBorders () + priv->serverInput.top + priv->serverInput.bottom); } CompRect CompWindow::serverInputRect () const { - return CompRect (priv->serverGeometry.x () - priv->serverGeometry.border () - priv->serverInput.left, - priv->serverGeometry.y () - priv->serverGeometry.border () - priv->serverInput.top, - priv->serverGeometry.width () + priv->serverGeometry.border () * 2 + + return CompRect (priv->serverGeometry.xMinusBorder () - priv->serverInput.left, + priv->serverGeometry.yMinusBorder () - priv->serverInput.top, + priv->serverGeometry.widthIncBorders () + priv->serverInput.left + priv->serverInput.right, - priv->serverGeometry.height () + priv->serverGeometry.border () * 2 + + priv->serverGeometry.heightIncBorders () + priv->serverInput.top + priv->serverInput.bottom); } CompRect CompWindow::outputRect () const { - return CompRect (priv->geometry.x () - priv->serverGeometry.border ()- priv->output.left, - priv->geometry.y () - priv->serverGeometry.border () - priv->output.top, - priv->geometry.width () + priv->serverGeometry.border () * 2 + + return CompRect (priv->geometry.xMinusBorder ()- priv->output.left, + priv->geometry.yMinusBorder () - priv->output.top, + priv->geometry.widthIncBorders () + priv->output.left + priv->output.right, - priv->geometry.height () + priv->serverGeometry.border () * 2 + + priv->geometry.heightIncBorders () + priv->output.top + priv->output.bottom); } CompRect CompWindow::serverOutputRect () const { - return CompRect (priv->serverGeometry.x () - priv->serverGeometry.border () - priv->output.left, - priv->serverGeometry.y () - priv->serverGeometry.border () - priv->output.top, - priv->serverGeometry.width () + priv->serverGeometry.border () * 2 + + return CompRect (priv->serverGeometry.xMinusBorder () - priv->output.left, + priv->serverGeometry.yMinusBorder () - priv->output.top, + priv->serverGeometry.widthIncBorders () + priv->output.left + priv->output.right, - priv->serverGeometry.height () + priv->serverGeometry.border () * 2 + + priv->serverGeometry.heightIncBorders () + priv->output.top + priv->output.bottom); } --- compiz-0.9.7.6.orig/src/window.cpp +++ compiz-0.9.7.6/src/window.cpp @@ -77,8 +77,8 @@ inline bool PrivateWindow::isInvisible() const { return attrib.map_state != IsViewable || - attrib.x + width + output.right <= 0 || - attrib.y + height + output.bottom <= 0 || + attrib.x + geometry.width () + output.right <= 0 || + attrib.y + geometry.height () + output.bottom <= 0 || attrib.x - output.left >= (int) screen->width () || attrib.y - output.top >= (int) screen->height (); } @@ -810,292 +810,14 @@ PrivateWindow::updateFrameWindow () if (!serverFrame) return; + xwc.x = serverGeometry.x (); + xwc.y = serverGeometry.y (); + xwc.width = serverGeometry.width (); + xwc.height = serverGeometry.height (); + xwc.border_width = serverGeometry.border (); - gettimeofday (&lastConfigureRequest, NULL); - /* Flush any changes made to serverFrameGeometry or serverGeometry to the server - * since there is a race condition where geometries will go out-of-sync with - * window movement */ - - window->syncPosition (); - - if (serverInput.left || serverInput.right || serverInput.top || serverInput.bottom) - { - int bw = serverGeometry.border () * 2; - - xwc.x = serverGeometry.x () - serverInput.left; - xwc.y = serverGeometry.y () - serverInput.top; - xwc.width = serverGeometry.width () + serverInput.left + serverInput.right + bw; - if (shaded) - xwc.height = serverInput.top + serverInput.bottom + bw; - else - xwc.height = serverGeometry.height () + serverInput.top + serverInput.bottom + bw; - - if (shaded) - height = serverInput.top + serverInput.bottom; - - if (serverFrameGeometry.x () == xwc.x) - valueMask &= ~(CWX); - else - serverFrameGeometry.setX (xwc.x); - - if (serverFrameGeometry.y () == xwc.y) - valueMask &= ~(CWY); - else - serverFrameGeometry.setY (xwc.y); - - if (serverFrameGeometry.width () == xwc.width) - valueMask &= ~(CWWidth); - else - serverFrameGeometry.setWidth (xwc.width); - - if (serverFrameGeometry.height () == xwc.height) - valueMask &= ~(CWHeight); - else - serverFrameGeometry.setHeight (xwc.height); - - /* Geometry is the same, so we're not going to get a ConfigureNotify - * event when the window is configured, which means that other plugins - * won't know that the client, frame and wrapper windows got shifted - * around (and might result in display corruption, eg in OpenGL */ - if (valueMask == 0) - { - XConfigureEvent xev; - XWindowAttributes attrib; - unsigned int nchildren = 0; - Window rootRet = 0, parentRet = 0; - Window *children = NULL; - - xev.type = ConfigureNotify; - xev.event = screen->root (); - xev.window = priv->serverFrame; - - XGrabServer (screen->dpy ()); - - if (XGetWindowAttributes (screen->dpy (), priv->serverFrame, &attrib)) - { - xev.x = attrib.x; - xev.y = attrib.y; - xev.width = attrib.width; - xev.height = attrib.height; - xev.border_width = attrib.border_width; - xev.above = None; - - /* We need to ensure that the stacking order is - * based on the current server stacking order so - * find the sibling to this window's frame in the - * server side stack and stack above that */ - XQueryTree (screen->dpy (), screen->root (), &rootRet, &parentRet, &children, &nchildren); - - if (nchildren) - { - for (unsigned int i = 0; i < nchildren; i++) - { - if (i + 1 == nchildren || - children[i + 1] == ROOTPARENT (window)) - { - xev.above = children[i]; - break; - } - } - } - - if (children) - XFree (children); - - if (!xev.above) - xev.above = (window->serverPrev) ? ROOTPARENT (window->serverPrev) : None; - - xev.override_redirect = priv->attrib.override_redirect; - - } - - compiz::X11::PendingEvent::Ptr pc = - boost::shared_static_cast (compiz::X11::PendingConfigureEvent::Ptr ( - new compiz::X11::PendingConfigureEvent ( - screen->dpy (), serverFrame, valueMask, &xwc))); - - pendingConfigures.add (pc); - if (priv->mClearCheckTimeout.active ()) - priv->mClearCheckTimeout.stop (); - priv->mClearCheckTimeout.start (boost::bind (&PrivateWindow::checkClear, priv), - 2000, 2500); - - XSendEvent (screen->dpy (), screen->root (), false, - SubstructureNotifyMask, (XEvent *) &xev); - - XUngrabServer (screen->dpy ()); - XSync (screen->dpy (), false); - } - else - { - compiz::X11::PendingEvent::Ptr pc = - boost::shared_static_cast (compiz::X11::PendingConfigureEvent::Ptr ( - new compiz::X11::PendingConfigureEvent ( - screen->dpy (), serverFrame, valueMask, &xwc))); - - pendingConfigures.add (pc); - if (priv->mClearCheckTimeout.active ()) - priv->mClearCheckTimeout.stop (); - priv->mClearCheckTimeout.start (boost::bind (&PrivateWindow::checkClear, priv), - 2000, 2500); - XConfigureWindow (screen->dpy (), serverFrame, valueMask, &xwc); - } - - if (shaded) - { - XUnmapWindow (screen->dpy (), wrapper); - } - else - { - XMapWindow (screen->dpy (), wrapper); - XMoveResizeWindow (screen->dpy (), wrapper, serverInput.left, serverInput.top, - serverGeometry.width (), serverGeometry.height ()); - } - XMoveResizeWindow (screen->dpy (), id, 0, 0, - serverGeometry.width (), serverGeometry.height ()); - window->sendConfigureNotify (); - window->windowNotify (CompWindowNotifyFrameUpdate); - } - else - { - int bw = serverGeometry.border () * 2; - - xwc.x = serverGeometry.x (); - xwc.y = serverGeometry.y (); - xwc.width = serverGeometry.width () + bw; - - /* FIXME: It doesn't make much sense to allow undecorated windows to be - * shaded */ - if (shaded) - xwc.height = bw; - else - xwc.height = serverGeometry.height () + bw; - - if (serverFrameGeometry.x () == xwc.x) - valueMask &= ~(CWX); - else - serverFrameGeometry.setX (xwc.x); - - if (serverFrameGeometry.y () == xwc.y) - valueMask &= ~(CWY); - else - serverFrameGeometry.setY (xwc.y); - - if (serverFrameGeometry.width () == xwc.width) - valueMask &= ~(CWWidth); - else - serverFrameGeometry.setWidth (xwc.width); - - if (serverFrameGeometry.height () == xwc.height) - valueMask &= ~(CWHeight); - else - serverFrameGeometry.setHeight (xwc.height); - - /* Geometry is the same, so we're not going to get a ConfigureNotify - * event when the window is configured, which means that other plugins - * won't know that the client, frame and wrapper windows got shifted - * around (and might result in display corruption, eg in OpenGL */ - if (valueMask == 0) - { - XConfigureEvent xev; - XWindowAttributes attrib; - unsigned int nchildren = 0; - Window rootRet = 0, parentRet = 0; - Window *children = NULL; - - xev.type = ConfigureNotify; - xev.event = screen->root (); - xev.window = priv->serverFrame; - - XGrabServer (screen->dpy ()); - - if (XGetWindowAttributes (screen->dpy (), priv->serverFrame, &attrib)) - { - xev.x = attrib.x; - xev.y = attrib.y; - xev.width = attrib.width; - xev.height = attrib.height; - xev.border_width = attrib.border_width; - xev.above = None; - - /* We need to ensure that the stacking order is - * based on the current server stacking order so - * find the sibling to this window's frame in the - * server side stack and stack above that */ - XQueryTree (screen->dpy (), screen->root (), &rootRet, &parentRet, &children, &nchildren); - - if (nchildren) - { - for (unsigned int i = 0; i < nchildren; i++) - { - if (i + 1 == nchildren || - children[i + 1] == ROOTPARENT (window)) - { - xev.above = children[i]; - break; - } - } - } - - if (children) - XFree (children); - - if (!xev.above) - xev.above = (window->serverPrev) ? ROOTPARENT (window->serverPrev) : None; - - xev.override_redirect = priv->attrib.override_redirect; - - } - - compiz::X11::PendingEvent::Ptr pc = - boost::shared_static_cast (compiz::X11::PendingConfigureEvent::Ptr ( - new compiz::X11::PendingConfigureEvent ( - screen->dpy (), serverFrame, valueMask, &xwc))); - - pendingConfigures.add (pc); - if (priv->mClearCheckTimeout.active ()) - priv->mClearCheckTimeout.stop (); - priv->mClearCheckTimeout.start (boost::bind (&PrivateWindow::checkClear, priv), - 2000, 2500); - - XSendEvent (screen->dpy (), screen->root (), false, - SubstructureNotifyMask, (XEvent *) &xev); - - XUngrabServer (screen->dpy ()); - XSync (screen->dpy (), false); - } - else - { - compiz::X11::PendingEvent::Ptr pc = - boost::shared_static_cast (compiz::X11::PendingConfigureEvent::Ptr ( - new compiz::X11::PendingConfigureEvent ( - screen->dpy (), serverFrame, valueMask, &xwc))); - - pendingConfigures.add (pc); - if (priv->mClearCheckTimeout.active ()) - priv->mClearCheckTimeout.stop (); - priv->mClearCheckTimeout.start (boost::bind (&PrivateWindow::checkClear, priv), - 2000, 2500); - - XConfigureWindow (screen->dpy (), serverFrame, valueMask, &xwc); - } - - if (shaded) - { - XUnmapWindow (screen->dpy (), wrapper); - } - else - { - XMapWindow (screen->dpy (), wrapper); - XMoveResizeWindow (screen->dpy (), wrapper, 0, 0, - serverGeometry.width (), serverGeometry.height ()); - } - - XMoveResizeWindow (screen->dpy (), id, 0, 0, - serverGeometry.width (), serverGeometry.height ()); - window->sendConfigureNotify (); - window->windowNotify (CompWindowNotifyFrameUpdate); - } + window->configureXWindow (valueMask, &xwc); + window->windowNotify (CompWindowNotifyFrameUpdate); window->recalcActions (); } @@ -1138,8 +860,8 @@ PrivateWindow::rectsToRegion (unsigned i for (unsigned int i = 0; i < n; i++) { - x1 = rects[i].x + priv->geometry.border (); - y1 = rects[i].y + priv->geometry.border (); + x1 = rects[i].x + priv->serverGeometry.border (); + y1 = rects[i].y + priv->serverGeometry.border (); x2 = x1 + rects[i].width; y2 = y1 + rects[i].height; @@ -1147,17 +869,17 @@ PrivateWindow::rectsToRegion (unsigned i x1 = 0; if (y1 < 0) y1 = 0; - if (x2 > priv->width) - x2 = priv->width; - if (y2 > priv->height) - y2 = priv->height; + if (x2 > priv->serverGeometry.width ()) + x2 = priv->serverGeometry.width (); + if (y2 > priv->serverGeometry.height ()) + y2 = priv->serverGeometry.height (); if (y1 < y2 && x1 < x2) { - x1 += priv->geometry.x (); - y1 += priv->geometry.y (); - x2 += priv->geometry.x (); - y2 += priv->geometry.y (); + x1 += priv->serverGeometry.x (); + y1 += priv->serverGeometry.y (); + x2 += priv->serverGeometry.x (); + y2 += priv->serverGeometry.y (); ret += CompRect (x1, y1, x2 - x1, y2 - y1); } @@ -1178,24 +900,26 @@ PrivateWindow::updateRegion () XRectangle *inputShapeRects = NULL; int nBounding = 0, nInput = 0; - priv->region = CompRegion (); - priv->inputRegion = CompRegion (); + priv->region -= infiniteRegion; + priv->inputRegion -= infiniteRegion; if (screen->XShape ()) { int order; + /* We should update the server here */ + XSync (screen->dpy (), false); + boundingShapeRects = XShapeGetRectangles (screen->dpy (), priv->id, ShapeBounding, &nBounding, &order); inputShapeRects = XShapeGetRectangles (screen->dpy (), priv->id, ShapeInput, &nInput, &order); - } - r.x = -priv->geometry.border (); - r.y = -priv->geometry.border (); - r.width = priv->width + priv->geometry.border (); - r.height = priv->height + priv->geometry.border (); + r.x = -priv->serverGeometry.border (); + r.y = -priv->serverGeometry.border (); + r.width = priv->serverGeometry.widthIncBorders (); + r.height = priv->serverGeometry.heightIncBorders (); if (nBounding < 1) { @@ -1729,7 +1453,7 @@ CompWindow::unmap () priv->attrib.map_state = IsUnmapped; priv->invisible = true; - if (priv->shaded && priv->height) + if (priv->shaded) { priv->updateFrameWindow (); } @@ -1814,7 +1538,7 @@ CompWindow::resize (int x, } bool -CompWindow::resize (CompWindow::Geometry gm) +PrivateWindow::resize (const CompWindow::Geometry &gm) { /* Input extents are now the last thing sent * from the server. This might not work in some @@ -1831,12 +1555,8 @@ CompWindow::resize (CompWindow::Geometry priv->geometry.height () != gm.height () || priv->geometry.border () != gm.border ()) { - int pw, ph; int dx, dy, dwidth, dheight; - pw = gm.width () + gm.border () * 2; - ph = gm.height () + gm.border () * 2; - dx = gm.x () - priv->geometry.x (); dy = gm.y () - priv->geometry.y (); dwidth = gm.width () - priv->geometry.width (); @@ -1846,37 +1566,58 @@ CompWindow::resize (CompWindow::Geometry gm.width (), gm.height (), gm.border ()); - priv->width = pw; - priv->height = ph; + if (priv->attrib.override_redirect) + { + priv->serverGeometry = priv->geometry; + priv->serverFrameGeometry = priv->frameGeometry; + } - if (priv->mapNum) + if (priv->mapNum && attrib.override_redirect) priv->updateRegion (); - resizeNotify (dx, dy, dwidth, dheight); + window->resizeNotify (dx, dy, dwidth, dheight); priv->invisible = priv->isInvisible (); } else if (priv->geometry.x () != gm.x () || priv->geometry.y () != gm.y ()) { - int dx, dy; + move (gm.x () - priv->geometry.x (), + gm.y () - priv->geometry.y (), true); + } - dx = gm.x () - priv->geometry.x (); - dy = gm.y () - priv->geometry.y (); + return true; +} - priv->geometry.setX (gm.x ()); - priv->geometry.setY (gm.y ()); +bool +PrivateWindow::resize (const XWindowAttributes &attr) +{ + return resize (CompWindow::Geometry (attr.x, attr.y, attr.width, attr.height, + attr.border_width)); +} - priv->region.translate (dx, dy); - priv->inputRegion.translate (dx, dy); - if (!priv->frameRegion.isEmpty ()) - priv->frameRegion.translate (dx, dy); +bool +PrivateWindow::resize (int x, + int y, + int width, + int height, + int border) +{ + return resize (CompWindow::Geometry (x, y, width, height, border)); +} - priv->invisible = priv->isInvisible (); +bool +CompWindow::resize (CompWindow::Geometry gm) +{ + XWindowChanges xwc = XWINDOWCHANGES_INIT; + unsigned int valueMask = CWX | CWY | CWWidth | CWHeight | CWBorderWidth; - moveNotify (dx, dy, true); - } + xwc.x = gm.x (); + xwc.y = gm.y (); + xwc.width = gm.width (); + xwc.height = gm.height (); + xwc.border_width = gm.border (); - updateFrameRegion (); + configureXWindow (valueMask, &xwc); return true; } @@ -2044,13 +1785,7 @@ PrivateWindow::configure (XConfigureEven ce->border_width); else { - if (ce->override_redirect) - { - priv->serverGeometry.set (ce->x, ce->y, ce->width, ce->height, - ce->border_width); - } - - window->resize (ce->x, ce->y, ce->width, ce->height, ce->border_width); + resize (ce->x, ce->y, ce->width, ce->height, ce->border_width); } if (ce->event == screen->root ()) @@ -2120,9 +1855,9 @@ PrivateWindow::configureFrame (XConfigur * windows since we didn't resize them * on configureXWindow */ if (priv->shaded) - height = priv->serverGeometry.height () - priv->serverGeometry.border () * 2 - priv->serverInput.top - priv->serverInput.bottom; + height = priv->serverGeometry.heightIncBorders () - priv->serverInput.top - priv->serverInput.bottom; else - height = ce->height - priv->serverGeometry.border () * 2 - priv->serverInput.top - priv->serverInput.bottom; + height = ce->height + priv->serverGeometry.border () * 2 - priv->serverInput.top - priv->serverInput.bottom; /* set the frame geometry */ priv->frameGeometry.set (ce->x, ce->y, ce->width, ce->height, ce->border_width); @@ -2131,7 +1866,7 @@ PrivateWindow::configureFrame (XConfigur if (priv->syncWait) priv->syncGeometry.set (x, y, width, height, ce->border_width); else - window->resize (x, y, width, height, ce->border_width); + resize (x, y, width, height, ce->border_width); if (priv->restack (ce->above)) priv->updatePassiveButtonGrabs (); @@ -2140,27 +1875,6 @@ PrivateWindow::configureFrame (XConfigur if (above) above->priv->updatePassiveButtonGrabs (); - - if (!pendingConfigures.pending ()) - { - /* Tell plugins its ok to start doing stupid things again but - * obviously FIXME */ - CompOption::Vector options; - CompOption::Value v; - - options.push_back (CompOption ("window", CompOption::TypeInt)); - v.set ((int) id); - options.back ().set (v); - options.push_back (CompOption ("active", CompOption::TypeInt)); - v.set ((int) 0); - options.back ().set (v); - - /* Notify other plugins that it is unsafe to change geometry or serverGeometry - * FIXME: That API should not be accessible to plugins, this is a hack to avoid - * breaking ABI */ - - screen->handleCompizEvent ("core", "lock_position", options); - } } void @@ -2183,23 +1897,34 @@ CompWindow::move (int dx, { if (dx || dy) { - gettimeofday (&priv->lastGeometryUpdate, NULL); + XWindowChanges xwc = XWINDOWCHANGES_INIT; + unsigned int valueMask = CWX | CWY; + + xwc.x = priv->serverGeometry.x () + dx; + xwc.y = priv->serverGeometry.y () + dy; + + priv->nextMoveImmediate = immediate; - /* Don't allow window movement to overwrite working geometries - * last received from the server if we know there are pending - * ConfigureNotify events on this window. That's a clunky workaround - * and a FIXME in any case, however, until we can break the API - * and remove CompWindow::move, this will need to be the case */ - - if (!priv->pendingConfigures.pending ()) - { - priv->geometry.setX (priv->geometry.x () + dx); - priv->geometry.setY (priv->geometry.y () + dy); - priv->frameGeometry.setX (priv->frameGeometry.x () + dx); - priv->frameGeometry.setY (priv->frameGeometry.y () + dy); + configureXWindow (valueMask, &xwc); + } +} - priv->pendingPositionUpdates = true; +void +PrivateWindow::move (int dx, + int dy, + bool immediate) +{ + if (dx || dy) + { + priv->geometry.setX (priv->geometry.x () + dx); + priv->geometry.setY (priv->geometry.y () + dy); + priv->frameGeometry.setX (priv->frameGeometry.x () + dx); + priv->frameGeometry.setY (priv->frameGeometry.y () + dy); + if (priv->attrib.override_redirect) + { + priv->serverGeometry = priv->geometry; + priv->serverFrameGeometry = priv->frameGeometry; priv->region.translate (dx, dy); priv->inputRegion.translate (dx, dy); if (!priv->frameRegion.isEmpty ()) @@ -2207,19 +1932,7 @@ CompWindow::move (int dx, priv->invisible = priv->isInvisible (); - moveNotify (dx, dy, immediate); - } - else - { - XWindowChanges xwc = XWINDOWCHANGES_INIT; - unsigned int valueMask = CWX | CWY; - compLogMessage ("core", CompLogLevelDebug, "pending configure notifies on 0x%x, "\ - "moving window asyncrhonously!", (unsigned int) priv->serverId); - - xwc.x = priv->serverGeometry.x () + dx; - xwc.y = priv->serverGeometry.y () + dy; - - configureXWindow (valueMask, &xwc); + window->moveNotify (dx, dy, true); } } } @@ -2230,22 +1943,6 @@ compiz::X11::PendingEventQueue::pending return !mEvents.empty (); } -bool -PrivateWindow::checkClear () -{ - if (pendingConfigures.pending ()) - { - /* FIXME: This is a hack to avoid performance regressions - * and must be removed in 0.9.6 */ - compLogMessage ("core", CompLogLevelWarn, "failed to receive ConfigureNotify event on 0x%x\n", - id); - pendingConfigures.dump (); - pendingConfigures.clear (); - } - - return false; -} - void compiz::X11::PendingEventQueue::add (PendingEvent::Ptr p) { @@ -2467,21 +2164,6 @@ compiz::X11::PendingConfigureEvent::Pend mValueMask (valueMask), mXwc (*xwc) { - CompOption::Vector options; - CompOption::Value v; - - options.push_back (CompOption ("window", CompOption::TypeInt)); - v.set ((int) w); - options.back ().set (v); - options.push_back (CompOption ("active", CompOption::TypeInt)); - v.set ((int) 1); - options.back ().set (v); - - /* Notify other plugins that it is unsafe to change geometry or serverGeometry - * FIXME: That API should not be accessible to plugins, this is a hack to avoid - * breaking ABI */ - - screen->handleCompizEvent ("core", "lock_position", options); } compiz::X11::PendingConfigureEvent::~PendingConfigureEvent () @@ -2491,57 +2173,6 @@ compiz::X11::PendingConfigureEvent::~Pen void CompWindow::syncPosition () { - gettimeofday (&priv->lastConfigureRequest, NULL); - - unsigned int valueMask = CWX | CWY; - XWindowChanges xwc = XWINDOWCHANGES_INIT; - - if (priv->pendingPositionUpdates && !priv->pendingConfigures.pending ()) - { - if (priv->serverFrameGeometry.x () == priv->frameGeometry.x ()) - valueMask &= ~(CWX); - if (priv->serverFrameGeometry.y () == priv->frameGeometry.y ()) - valueMask &= ~(CWY); - - /* Because CompWindow::move can update the geometry last - * received from the server, we must indicate that no values - * changed, because when the ConfigureNotify comes around - * the values are going to be the same. That's obviously - * broken behaviour and worthy of a FIXME, but requires - * larger changes to the window movement system. */ - if (valueMask) - { - priv->serverGeometry.setX (priv->geometry.x ()); - priv->serverGeometry.setY (priv->geometry.y ()); - priv->serverFrameGeometry.setX (priv->frameGeometry.x ()); - priv->serverFrameGeometry.setY (priv->frameGeometry.y ()); - - xwc.x = priv->serverFrameGeometry.x (); - xwc.y = priv->serverFrameGeometry.y (); - - compiz::X11::PendingEvent::Ptr pc = - boost::shared_static_cast (compiz::X11::PendingConfigureEvent::Ptr ( - new compiz::X11::PendingConfigureEvent ( - screen->dpy (), priv->serverFrame, 0, &xwc))); - - priv->pendingConfigures.add (pc); - - /* Got 3 seconds to get its stuff together */ - if (priv->mClearCheckTimeout.active ()) - priv->mClearCheckTimeout.stop (); - priv->mClearCheckTimeout.start (boost::bind (&PrivateWindow::checkClear, priv), - 2000, 2500); - XConfigureWindow (screen->dpy (), ROOTPARENT (this), valueMask, &xwc); - - if (priv->serverFrame) - { - XMoveWindow (screen->dpy (), priv->wrapper, - priv->serverInput.left, priv->serverInput.top); - sendConfigureNotify (); - } - } - priv->pendingPositionUpdates = false; - } } bool @@ -3340,16 +2971,28 @@ void PrivateWindow::reconfigureXWindow (unsigned int valueMask, XWindowChanges *xwc) { - unsigned int frameValueMask = 0; + int dx = valueMask & CWX ? xwc->x - serverGeometry.x () : 0; + int dy = valueMask & CWY ? xwc->y - serverGeometry.y () : 0; - /* Immediately sync window position - * if plugins were updating w->geometry () directly - * in order to avoid a race condition */ + unsigned int frameValueMask = 0; - window->syncPosition (); + if (id == screen->root ()) + { + compLogMessage ("core", CompLogLevelWarn, "attempted to reconfigure root window"); + return; + } /* Remove redundant bits */ + xwc->x = valueMask & CWX ? xwc->x : serverGeometry.x (); + xwc->y = valueMask & CWY ? xwc->y : serverGeometry.y (); + xwc->width = valueMask & CWWidth ? xwc->width : serverGeometry.width (); + xwc->height = valueMask & CWHeight ? xwc->height : serverGeometry.height (); + xwc->border_width = valueMask & CWBorderWidth ? xwc->border_width : serverGeometry.border (); + + /* FIXME: This is a total fallacy for the reparenting case + * at least since the client doesn't actually move here, it only + * moves within the frame */ if (valueMask & CWX && serverGeometry.x () == xwc->x) valueMask &= ~(CWX); @@ -3416,18 +3059,15 @@ PrivateWindow::reconfigureXWindow (unsig compLogMessage ("core", CompLogLevelWarn, "restack_mode not Above"); } - frameValueMask = valueMask; + frameValueMask = CWX | CWY | CWWidth | CWHeight | (valueMask & (CWStackMode | CWSibling)); - if (frameValueMask & CWX && - serverFrameGeometry.x () == xwc->x - serverGeometry.border () - serverInput.left) + if (serverFrameGeometry.x () == xwc->x - serverGeometry.border () - serverInput.left) frameValueMask &= ~(CWX); - if (frameValueMask & CWY && - serverFrameGeometry.y () == xwc->y - serverGeometry.border () - serverInput.top) + if (serverFrameGeometry.y () == xwc->y - serverGeometry.border () - serverInput.top) frameValueMask &= ~(CWY); - if (frameValueMask & CWWidth && - serverFrameGeometry.width () == xwc->width + serverGeometry.border () * 2 + if (serverFrameGeometry.width () == xwc->width + serverGeometry.border () * 2 + serverInput.left + serverInput.right) frameValueMask &= ~(CWWidth); @@ -3437,19 +3077,76 @@ PrivateWindow::reconfigureXWindow (unsig if (shaded) { - if (frameValueMask & CWHeight && - serverFrameGeometry.height () == serverGeometry.border () * 2 + if (serverFrameGeometry.height () == serverGeometry.border () * 2 + serverInput.top + serverInput.bottom) frameValueMask &= ~(CWHeight); } else { - if (frameValueMask & CWHeight && - serverFrameGeometry.height () == xwc->height + serverGeometry.border () * 2 + if (serverFrameGeometry.height () == xwc->height + serverGeometry.border () * 2 + serverInput.top + serverInput.bottom) frameValueMask &= ~(CWHeight); } + /* Don't allow anything that might generate a BadValue */ + if (valueMask & CWWidth && !xwc->width) + { + compLogMessage ("core", CompLogLevelWarn, "Attempted to set < 1 width on a window"); + xwc->width = 1; + } + + if (valueMask & CWHeight && !xwc->height) + { + compLogMessage ("core", CompLogLevelWarn, "Attempted to set < 1 height on a window"); + xwc->height = 1; + } + + if (valueMask & CWStackMode && + ((xwc->stack_mode != TopIf) && (xwc->stack_mode != BottomIf) && (xwc->stack_mode != Opposite) && + (xwc->stack_mode != Above) && (xwc->stack_mode != Below))) + { + compLogMessage ("core", CompLogLevelWarn, "Invalid stack mode %i", xwc->stack_mode); + valueMask &= ~(CWStackMode | CWSibling); + } + + /* Don't allow anything that might cause a BadMatch error */ + + if (valueMask & CWSibling && !(valueMask & CWStackMode)) + { + compLogMessage ("core", CompLogLevelWarn, "Didn't specify a CWStackMode for CWSibling"); + valueMask &= ~CWSibling; + } + + if (valueMask & CWSibling && xwc->sibling == (serverFrame ? serverFrame : id)) + { + compLogMessage ("core", CompLogLevelWarn, "Can't restack a window relative to itself"); + valueMask &= ~CWSibling; + } + + if (valueMask & CWBorderWidth && attrib.c_class == InputOnly) + { + compLogMessage ("core", CompLogLevelWarn, "Cannot set border_width of an input_only window"); + valueMask &= ~CWBorderWidth; + } + + if (valueMask & CWSibling) + { + CompWindow *sibling = screen->findTopLevelWindow (xwc->sibling); + + if (!sibling) + { + compLogMessage ("core", CompLogLevelWarn, "Attempted to restack relative to 0x%x which is "\ + "not a child of the root window or a window compiz owns", static_cast (xwc->sibling)); + valueMask &= ~(CWSibling | CWStackMode); + } + else if (sibling->frame () && xwc->sibling != sibling->frame ()) + { + compLogMessage ("core", CompLogLevelWarn, "Attempted to restack relative to 0x%x which is "\ + "not a child of the root window", static_cast (xwc->sibling)); + valueMask &= ~(CWSibling | CWStackMode); + } + } + /* Can't set the border width of frame windows */ frameValueMask &= ~(CWBorderWidth); @@ -3476,11 +3173,8 @@ PrivateWindow::reconfigureXWindow (unsig + serverInput.top + serverInput.bottom); } - if (serverFrame) { - gettimeofday (&lastConfigureRequest, NULL); - if (frameValueMask) { XWindowChanges wc = *xwc; @@ -3496,13 +3190,10 @@ PrivateWindow::reconfigureXWindow (unsig screen->dpy (), priv->serverFrame, frameValueMask, &wc))); pendingConfigures.add (pc); - if (priv->mClearCheckTimeout.active ()) - priv->mClearCheckTimeout.stop (); - priv->mClearCheckTimeout.start (boost::bind (&PrivateWindow::checkClear, priv), - 2000, 2500); XConfigureWindow (screen->dpy (), serverFrame, frameValueMask, &wc); } + valueMask &= ~(CWSibling | CWStackMode); /* If the frame has changed position (eg, serverInput.top @@ -3528,6 +3219,27 @@ PrivateWindow::reconfigureXWindow (unsig if (valueMask) XConfigureWindow (screen->dpy (), id, valueMask, xwc); + + if (!attrib.override_redirect) + { + if (valueMask & (CWWidth | CWHeight)) + { + updateRegion (); + } + else if (valueMask & (CWX | CWY)) + { + region.translate (dx, dy); + inputRegion.translate (dx, dy); + if (!frameRegion.isEmpty ()) + frameRegion.translate (dx, dy); + } + + if (dx || dy) + { + window->moveNotify (dx, dy, priv->nextMoveImmediate); + priv->nextMoveImmediate = true; + } + } } bool @@ -4305,10 +4017,6 @@ PrivateWindow::addWindowStackChanges (XW screen->dpy (), serverFrame, valueMask, &lxwc))); pendingConfigures.add (pc); - if (priv->mClearCheckTimeout.active ()) - priv->mClearCheckTimeout.stop (); - priv->mClearCheckTimeout.start (boost::bind (&PrivateWindow::checkClear, priv), - 2000, 2500); } /* Below with no sibling puts the window at the bottom @@ -4612,8 +4320,8 @@ void PrivateWindow::ensureWindowVisibility () { int x1, y1, x2, y2; - int width = serverGeometry.width () + serverGeometry.border () * 2; - int height = serverGeometry.height () + serverGeometry.border () * 2; + int width = serverGeometry.widthIncBorders (); + int height = serverGeometry.heightIncBorders (); int dx = 0; int dy = 0; @@ -5473,10 +5181,10 @@ CompWindow::getMovementForOffset (CompPo } else { - m = priv->geometry.x () + offX; - if (m - priv->input.left < (int) s->width () - vWidth) + m = priv->serverGeometry.x () + offX; + if (m - priv->serverInput.left < (int) s->width () - vWidth) rv.setX (offX + vWidth); - else if (m + priv->width + priv->input.right > vWidth) + else if (m + priv->serverGeometry.width () + priv->serverInput.right > vWidth) rv.setX (offX - vWidth); else rv.setX (offX); @@ -5488,10 +5196,10 @@ CompWindow::getMovementForOffset (CompPo } else { - m = priv->geometry.y () + offY; - if (m - priv->input.top < (int) s->height () - vHeight) + m = priv->serverGeometry.y () + offY; + if (m - priv->serverInput.top < (int) s->height () - vHeight) rv.setY (offY + vHeight); - else if (m + priv->height + priv->input.bottom > vHeight) + else if (m + priv->serverGeometry.height () + priv->serverInput.bottom > vHeight) rv.setY (offY - vHeight); else rv.setY (offY); @@ -6014,8 +5722,8 @@ CompWindow::moveToViewportPosition (int y -= screen->vp ().y () * screen->height (); } - tx = x - priv->geometry.x (); - ty = y - priv->geometry.y (); + tx = x - priv->serverGeometry.x (); + ty = y - priv->serverGeometry.y (); if (tx || ty) { @@ -6037,21 +5745,21 @@ CompWindow::moveToViewportPosition (int if (screen->vpSize ().width ()!= 1) { - m = priv->geometry.x () + tx; + m = priv->serverGeometry.x () + tx; if (m - priv->output.left < (int) screen->width () - vWidth) wx = tx + vWidth; - else if (m + priv->width + priv->output.right > vWidth) + else if (m + priv->serverGeometry.width () + priv->output.right > vWidth) wx = tx - vWidth; } if (screen->vpSize ().height () != 1) { - m = priv->geometry.y () + ty; + m = priv->serverGeometry.y () + ty; if (m - priv->output.top < (int) screen->height () - vHeight) wy = ty + vHeight; - else if (m + priv->height + priv->output.bottom > vHeight) + else if (m + priv->serverGeometry.height () + priv->output.bottom > vHeight) wy = ty - vHeight; } @@ -6206,8 +5914,8 @@ PrivateWindow::updateStartupId () svp = screen->vp (); size = *screen; - x = window->geometry ().x () + (svp.x () - vp.x ()) * size.width (); - y = window->geometry ().y () + (svp.y () - vp.y ()) * size.height (); + x = window->serverGeometry ().x () + (svp.x () - vp.x ()) * size.width (); + y = window->serverGeometry ().y () + (svp.y () - vp.y ()) * size.height (); window->moveToViewportPosition (x, y, true); if (allowWindowFocus (0, timestamp)) @@ -6276,9 +5984,6 @@ CompWindow::CompWindow (Window aboveId, priv->serverFrameGeometry = priv->frameGeometry = priv->syncGeometry = priv->geometry = priv->serverGeometry; - priv->width = priv->attrib.width + priv->attrib.border_width * 2; - priv->height = priv->attrib.height + priv->attrib.border_width * 2; - priv->sizeHints.flags = 0; priv->recalcNormalHints (); @@ -6300,8 +6005,7 @@ CompWindow::CompWindow (Window aboveId, if (priv->attrib.c_class != InputOnly) { - priv->region = CompRegion (priv->attrib.x, priv->attrib.y, - priv->width, priv->height); + priv->region = CompRegion (priv->serverGeometry); priv->inputRegion = priv->region; /* need to check for DisplayModal state on all windows */ @@ -6531,8 +6235,6 @@ PrivateWindow::PrivateWindow () : hints (NULL), inputHint (true), alpha (false), - width (0), - height (0), region (), wmType (0), type (CompWindowTypeUnknownMask), @@ -6567,7 +6269,6 @@ PrivateWindow::PrivateWindow () : pendingUnmaps (0), pendingMaps (0), pendingConfigures (screen->dpy ()), - pendingPositionUpdates (false), startupId (0), resName (0), @@ -6745,14 +6446,12 @@ CompWindow::mwmFunc () void CompWindow::updateFrameRegion () { - if (priv->serverFrame && - priv->serverGeometry.width () == priv->geometry.width () && - priv->serverGeometry.height () == priv->geometry.height ()) + if (priv->serverFrame) { CompRect r; int x, y; - priv->frameRegion = CompRegion (); + priv->frameRegion -= infiniteRegion; updateFrameRegion (priv->frameRegion); @@ -6761,16 +6460,16 @@ CompWindow::updateFrameRegion () r = priv->region.boundingRect (); priv->frameRegion -= r; - r.setGeometry (r.x1 () - priv->input.left, - r.y1 () - priv->input.top, - r.width () + priv->input.right + priv->input.left, - r.height () + priv->input.bottom + priv->input.top); + r.setGeometry (r.x1 () - priv->serverInput.left, + r.y1 () - priv->serverInput.top, + r.width () + priv->serverInput.right + priv->serverInput.left, + r.height () + priv->serverInput.bottom + priv->serverInput.top); priv->frameRegion &= CompRegion (r); } - x = priv->geometry.x () - priv->input.left; - y = priv->geometry.y () - priv->input.top; + x = priv->serverGeometry.x () - priv->serverInput.left; + y = priv->serverGeometry.y () - priv->serverInput.top; XShapeCombineRegion (screen->dpy (), priv->serverFrame, ShapeBounding, -x, -y, @@ -6811,6 +6510,11 @@ CompWindow::setWindowFrameExtents (CompW priv->updateSize (); priv->updateFrameWindow (); + + /* Always send a moveNotify + * whenever the frame extents update + * so that plugins can re-position appropriately */ + moveNotify (0, 0, true); } /* Use b for _NET_WM_FRAME_EXTENTS here because @@ -7094,10 +6798,10 @@ PrivateWindow::unreparent () /* Wait for the reparent to finish */ XSync (dpy, false); - xwc.x = serverGeometry.x () - serverGeometry.border (); - xwc.y = serverGeometry.y () - serverGeometry.border (); - xwc.width = serverGeometry.width () + serverGeometry.border () * 2; - xwc.height = serverGeometry.height () + serverGeometry.border () * 2; + xwc.x = serverGeometry.xMinusBorder (); + xwc.y = serverGeometry.yMinusBorder (); + xwc.width = serverGeometry.widthIncBorders (); + xwc.height = serverGeometry.heightIncBorders (); XConfigureWindow (dpy, serverFrame, CWX | CWY | CWWidth | CWHeight, &xwc); --- compiz-0.9.7.6.orig/src/actions.cpp +++ compiz-0.9.7.6/src/actions.cpp @@ -201,9 +201,9 @@ CompScreenImpl::windowMenu (CompAction time = CompOption::getIntOptionNamed (options, "time", CurrentTime); button = CompOption::getIntOptionNamed (options, "button", 0); x = CompOption::getIntOptionNamed (options, "x", - w->geometry ().x ()); + w->serverGeometry ().x ()); y = CompOption::getIntOptionNamed (options, "y", - w->geometry ().y ()); + w->serverGeometry ().y ()); screen->toolkitAction (Atoms::toolkitActionWindowMenu, time, w->id (), button, x, y); --- compiz-0.9.7.6.orig/src/privatewindow.h +++ compiz-0.9.7.6/src/privatewindow.h @@ -34,7 +34,6 @@ #include #include "privatescreen.h" - typedef CompWindowExtents CompFullscreenMonitorSet; class PrivateWindow { @@ -167,6 +166,11 @@ class PrivateWindow { bool handleSyncAlarm (); + void move (int dx, int dy, bool sync); + bool resize (int dx, int dy, int dwidth, int dheight, int dborder); + bool resize (const CompWindow::Geometry &g); + bool resize (const XWindowAttributes &attrib); + void configure (XConfigureEvent *ce); void configureFrame (XConfigureEvent *ce); @@ -241,13 +245,8 @@ class PrivateWindow { XSizeHints sizeHints; XWMHints *hints; - struct timeval lastGeometryUpdate; - struct timeval lastConfigureRequest; - bool inputHint; bool alpha; - int width; - int height; CompRegion region; CompRegion inputRegion; CompRegion frameRegion; @@ -290,8 +289,6 @@ class PrivateWindow { typedef std::pair XWCValueMask; compiz::X11::PendingEventQueue pendingConfigures; - CompTimer mClearCheckTimeout; - bool pendingPositionUpdates; char *startupId; char *resName; @@ -327,6 +324,8 @@ class PrivateWindow { bool closeRequests; Time lastCloseRequestTime; + + bool nextMoveImmediate; }; #endif --- compiz-0.9.7.6.orig/src/window/geometry/tests/window-geometry/src/test-window-geometry.cpp +++ compiz-0.9.7.6/src/window/geometry/tests/window-geometry/src/test-window-geometry.cpp @@ -87,3 +87,13 @@ TEST_F(CompWindowGeometryTestGeometry, T EXPECT_EQ (rg, compiz::window::Geometry (49, 99, 199, 299, 5)); EXPECT_EQ (mask, CHANGE_X | CHANGE_Y | CHANGE_WIDTH | CHANGE_HEIGHT); } + +TEST_F(CompWindowGeometryTestGeometry, TestBorders) +{ + compiz::window::Geometry g (1, 1, 1, 1, 1); + + EXPECT_EQ (g.xMinusBorder (), 0); + EXPECT_EQ (g.yMinusBorder (), 0); + EXPECT_EQ (g.widthIncBorders (), 3); + EXPECT_EQ (g.heightIncBorders (), 3); +} --- compiz-0.9.7.6.orig/src/window/geometry/include/core/windowgeometry.h +++ compiz-0.9.7.6/src/window/geometry/include/core/windowgeometry.h @@ -64,6 +64,12 @@ public: compiz::window::Geometry change (const compiz::window::Geometry &g, unsigned int mask) const; void applyChange (const compiz::window::Geometry &g, unsigned int mask); + int xMinusBorder () const { return x () - mBorder; } + int yMinusBorder () const { return y () - mBorder; } + + unsigned int widthIncBorders () const { return width () + mBorder * 2; } + unsigned int heightIncBorders () const { return height () + mBorder * 2; } + private: int mBorder; }; --- compiz-0.9.7.6.orig/plugins/wobbly/src/wobbly.cpp +++ compiz-0.9.7.6/plugins/wobbly/src/wobbly.cpp @@ -1251,7 +1251,7 @@ WobblyWindow::ensureModel () if (!model) { unsigned int edgeMask = 0; - CompRect outRect (window->outputRect ()); + CompRect outRect (window->serverOutputRect ()); if (window->type () & CompWindowTypeNormalMask) edgeMask = WestEdgeMask | EastEdgeMask | NorthEdgeMask | @@ -1448,9 +1448,9 @@ WobblyScreen::preparePaint (int msSinceL else cw->addDamage (); - int wx = w->geometry ().x (); - int wy = w->geometry ().y (); - int borderWidth = w->geometry ().border (); + int wx = w->serverGeometry ().x (); + int wy = w->serverGeometry ().y (); + int borderWidth = w->serverGeometry ().border (); // Damage a box that's 1-pixel larger on each side // to prevent artifacts @@ -1578,7 +1578,7 @@ WobblyWindow::glAddGeometry (const GLTex } } - CompRect outRect (window->outputRect ()); + CompRect outRect (window->serverOutputRect ()); wx = outRect.x (); wy = outRect.y (); width = outRect.width (); @@ -1772,7 +1772,7 @@ WobblyScreen::shiver (CompOption::Vector if (ww->isWobblyWin () && ww->ensureModel ()) { - CompRect outRect (w->outputRect ()); + CompRect outRect (w->serverOutputRect ()); ww->model->setMiddleAnchor (outRect.x (), outRect.y (), outRect.width (), outRect.height ()); @@ -1901,7 +1901,7 @@ WobblyScreen::handleEvent (XEvent *event switch (focusEffect) { case WobblyOptions::FocusEffectShiver: { - CompRect outRect (w->outputRect ()); + CompRect outRect (w->serverOutputRect ()); ww->model->adjustObjectsForShiver (outRect.x (), outRect.y (), @@ -1977,7 +1977,7 @@ WobblyWindow::initiateMapEffect () wScreen->optionGetMapWindowMatch ().evaluate (window) && ensureModel ()) { - CompRect outRect (window->outputRect ()); + CompRect outRect (window->serverOutputRect ()); model->initObjects (outRect.x (), outRect.y (), outRect.width (), outRect.height ()); @@ -2006,7 +2006,7 @@ WobblyWindow::resizeNotify (int dx, int dwidth, int dheight) { - CompRect outRect (window->outputRect ()); + CompRect outRect (window->serverOutputRect ()); if (wScreen->optionGetMaximizeEffect () && isWobblyWin () && @@ -2144,7 +2144,7 @@ WobblyWindow::grabNotify (int x if (wScreen->optionGetMaximizeEffect ()) { - CompRect outRect (window->outputRect ()); + CompRect outRect (window->serverOutputRect ()); if (window->state () & MAXIMIZE_STATE) { @@ -2192,7 +2192,7 @@ WobblyWindow::grabNotify (int x if (wScreen->yConstrained) { int output = - ::screen->outputDeviceForGeometry (window->geometry ()); + ::screen->outputDeviceForGeometry (window->serverGeometry ()); wScreen->constraintBox = &::screen->outputDevs ()[output].workArea (); } @@ -2252,7 +2252,7 @@ WobblyWindow::ungrabNotify () if (wScreen->optionGetMaximizeEffect () && (state & MAXIMIZE_STATE)) { - CompRect outRect (window->outputRect ()); + CompRect outRect (window->serverOutputRect ()); model->addEdgeAnchors (outRect.x (), outRect.y (), outRect.width (), outRect.height ()); --- compiz-0.9.7.6.orig/plugins/composite/src/window.cpp +++ compiz-0.9.7.6/plugins/composite/src/window.cpp @@ -250,7 +250,7 @@ CompositeWindow::damageTransformedRect ( if (x2 > x1 && y2 > y1) { - CompWindow::Geometry geom = priv->window->geometry (); + const CompWindow::Geometry &geom = priv->window->serverGeometry (); x1 += geom.x () + geom.border (); y1 += geom.y () + geom.border (); @@ -272,20 +272,20 @@ CompositeWindow::damageOutputExtents () { int x1, x2, y1, y2; - CompWindow::Geometry geom = priv->window->geometry (); - CompWindowExtents output = priv->window->output (); + const CompWindow::Geometry &geom = priv->window->serverGeometry (); + const CompWindowExtents &output = priv->window->output (); /* top */ x1 = -output.left - geom.border (); y1 = -output.top - geom.border (); - x2 = priv->window->size ().width () + output.right - geom.border (); + x2 = geom.width () + geom.border () + output.right; y2 = -geom.border (); if (x1 < x2 && y1 < y2) addDamageRect (CompRect (x1, y1, x2 - x1, y2 - y1)); /* bottom */ - y1 = priv->window->size ().height () - geom.border (); + y1 = geom.height () + geom.border (); y2 = y1 + output.bottom - geom.border (); if (x1 < x2 && y1 < y2) @@ -295,13 +295,13 @@ CompositeWindow::damageOutputExtents () x1 = -output.left - geom.border (); y1 = -geom.border (); x2 = -geom.border (); - y2 = priv->window->size ().height () - geom.border (); + y2 = geom.height () - geom.border (); if (x1 < x2 && y1 < y2) addDamageRect (CompRect (x1, y1, x2 - x1, y2 - y1)); /* right */ - x1 = priv->window->size ().width () - geom.border (); + x1 = geom.width () - geom.border (); x2 = x1 + output.right - geom.border (); if (x1 < x2 && y1 < y2) @@ -322,7 +322,7 @@ CompositeWindow::addDamageRect (const Co x = rect.x (); y = rect.y (); - CompWindow::Geometry geom = priv->window->geometry (); + const CompWindow::Geometry &geom = priv->window->serverGeometry (); x += geom.x () + geom.border (); y += geom.y () + geom.border (); @@ -341,16 +341,16 @@ CompositeWindow::addDamage (bool force) if (priv->window->shaded () || force || (priv->window->isViewable ())) { - int border = priv->window->geometry ().border (); + int border = priv->window->serverGeometry ().border (); int x1 = -MAX (priv->window->output ().left, priv->window->input ().left) - border; int y1 = -MAX (priv->window->output ().top, priv->window->input ().top) - border; - int x2 = priv->window->size ().width () + + int x2 = priv->window->serverGeometry ().width () + MAX (priv->window->output ().right, priv->window->input ().right) ; - int y2 = priv->window->size ().height () + + int y2 = priv->window->serverGeometry ().height () + MAX (priv->window->output ().bottom, priv->window->input ().bottom) ; CompRect r (x1, y1, x2 - x1, y2 - y1); @@ -410,7 +410,7 @@ PrivateCompositeWindow::handleDamageRect if (!w->damageRect (initial, CompRect (x, y, width, height))) { - CompWindow::Geometry geom = w->priv->window->geometry (); + CompWindow::Geometry geom = w->priv->window->serverGeometry (); x += geom.x () + geom.border (); y += geom.y () + geom.border (); @@ -622,14 +622,14 @@ PrivateCompositeWindow::moveNotify (int { int x, y, x1, x2, y1, y2; - x = window->geometry ().x (); - y = window->geometry ().y (); + x = window->serverGeometry ().x (); + y = window->serverGeometry ().y (); x1 = x - window->output ().left - dx; y1 = y - window->output ().top - dy; - x2 = x + window->size ().width () + + x2 = x + window->serverGeometry ().width () + window->output ().right - dx; - y2 = y + window->size ().height () + + y2 = y + window->serverGeometry ().height () + window->output ().bottom - dy; cScreen->damageRegion (CompRegion (CompRect (x1, y1, x2 - x1, y2 - y1))); --- compiz-0.9.7.6.orig/plugins/decor/src/decor.cpp +++ compiz-0.9.7.6/plugins/decor/src/decor.cpp @@ -1040,8 +1040,8 @@ DecorWindow::updateDecorationScale () for (i = 0; i < wd->nQuad; i++) { int x, y; - unsigned int width = window->size ().width (); - unsigned int height = window->size ().height (); + unsigned int width = window->geometry ().width (); + unsigned int height = window->geometry ().height (); if (window->shaded ()) height = 0; @@ -1050,8 +1050,8 @@ DecorWindow::updateDecorationScale () &x1, &y1, &x2, &y2, &sx, &sy); /* Translate by x and y points of this window */ - x = window->geometry ().x (); - y = window->geometry ().y (); + x = window->serverGeometry ().x (); + y = window->serverGeometry ().y (); wd->quad[i].box.x1 = x1 + x; wd->quad[i].box.y1 = y1 + y; @@ -1079,8 +1079,8 @@ DecorWindow::updateDecorationScale () bool DecorWindow::checkSize (const Decoration::Ptr &decoration) { - return (decoration->minWidth <= (int) window->size ().width () && - decoration->minHeight <= (int) window->size ().height ()); + return (decoration->minWidth <= (int) window->geometry ().width () && + decoration->minHeight <= (int) window->geometry ().height ()); } /* @@ -1684,7 +1684,6 @@ DecorWindow::updateInputFrame () XRectangle rects[4]; int x, y, width, height; CompWindow::Geometry server = window->serverGeometry (); - int bw = server.border () * 2; CompWindowExtents input; CompWindowExtents border; Window parent; @@ -1711,8 +1710,8 @@ DecorWindow::updateInputFrame () x = window->border ().left - border.left; y = window->border ().top - border.top; - width = server.width () + input.left + input.right + bw; - height = server.height ()+ input.top + input.bottom + bw; + width = server.widthIncBorders () + input.left + input.right; + height = server.heightIncBorders ()+ input.top + input.bottom ; /* Non switcher windows are rooted relative to the frame window of the client * and switchers need to be offset by the window geometry of the client */ @@ -1851,7 +1850,6 @@ DecorWindow::updateOutputFrame () XRectangle rects[4]; int x, y, width, height; CompWindow::Geometry server = window->serverGeometry (); - int bw = server.border () * 2; CompWindowExtents input; /* Determine frame extents */ @@ -1862,8 +1860,8 @@ DecorWindow::updateOutputFrame () x = window->input ().left - input.left; y = window->input ().top - input.top; - width = server.width () + input.left + input.right + bw; - height = server.height ()+ input.top + input.bottom + bw; + width = server.widthIncBorders () + input.left + input.right; + height = server.heightIncBorders ()+ input.top + input.bottom; if (window->shaded ()) height = input.top + input.bottom; @@ -2094,8 +2092,8 @@ DecorWindow::updateFrameRegion (CompRegi { int x, y; - x = window->geometry (). x (); - y = window->geometry (). y (); + x = window->serverGeometry (). x (); + y = window->serverGeometry (). y (); region += frameRegion.translated (x - wd->decor->input.left, y - wd->decor->input.top); @@ -2116,7 +2114,7 @@ DecorWindow::updateFrameRegion (CompRegi void DecorWindow::updateWindowRegions () { - const CompRect &input (window->inputRect ()); + const CompRect &input (window->serverInputRect ()); if (regions.size () != gWindow->textures ().size ()) regions.resize (gWindow->textures ().size ()); --- compiz-0.9.7.6.orig/plugins/opengl/src/window.cpp +++ compiz-0.9.7.6/plugins/opengl/src/window.cpp @@ -76,7 +76,7 @@ PrivateGLWindow::~PrivateGLWindow () void PrivateGLWindow::setWindowMatrix () { - CompRect input (window->inputRect ()); + CompRect input (window->serverInputRect ()); if (textures.size () != matrices.size ()) matrices.resize (textures.size ()); @@ -344,7 +344,7 @@ PrivateGLWindow::updateFrameRegion (Comp void PrivateGLWindow::updateWindowRegions () { - CompRect input (window->inputRect ()); + CompRect input (window->serverInputRect ()); if (regions.size () != textures.size ()) regions.resize (textures.size ()); --- compiz-0.9.7.6.orig/plugins/resize/src/resize.cpp +++ compiz-0.9.7.6/plugins/resize/src/resize.cpp @@ -56,7 +56,7 @@ ResizeScreen::getPaintRectangle (BoxPtr void ResizeWindow::getStretchScale (BoxPtr pBox, float *xScale, float *yScale) { - CompRect rect (window->borderRect ()); + CompRect rect (window->serverBorderRect ()); *xScale = (rect.width ()) ? (pBox->x2 - pBox->x1) / (float) rect.width () : 1.0f; @@ -1467,10 +1467,10 @@ ResizeScreen::handleEvent (XEvent *event getPaintRectangle (&box); damageRectangle (&box); - box.x1 = w->outputRect ().x (); - box.y1 = w->outputRect ().y (); - box.x2 = box.x1 + w->outputRect ().width (); - box.y2 = box.y1 + w->outputRect ().height (); + box.x1 = w->serverOutputRect ().x (); + box.y1 = w->serverOutputRect ().y (); + box.x2 = box.x1 + w->serverOutputRect ().width (); + box.y2 = box.y1 + w->serverOutputRect ().height (); damageRectangle (&box); } --- compiz-0.9.7.6.orig/plugins/move/src/move.cpp +++ compiz-0.9.7.6/plugins/move/src/move.cpp @@ -138,8 +138,8 @@ moveInitiate (CompAction *action, { int xRoot, yRoot; - xRoot = w->geometry ().x () + (w->size ().width () / 2); - yRoot = w->geometry ().y () + (w->size ().height () / 2); + xRoot = w->serverGeometry ().x () + (w->size ().width () / 2); + yRoot = w->serverGeometry ().y () + (w->size ().height () / 2); s->warpPointer (xRoot - pointerX, yRoot - pointerY); } @@ -169,8 +169,8 @@ moveTerminate (CompAction *action, if (ms->w) { if (state & CompAction::StateCancel) - ms->w->move (ms->savedX - ms->w->geometry ().x (), - ms->savedY - ms->w->geometry ().y (), false); + ms->w->move (ms->savedX - ms->w->serverGeometry ().x (), + ms->savedY - ms->w->serverGeometry ().y (), false); ms->w->syncPosition (); @@ -314,12 +314,10 @@ moveHandleMotionEvent (CompScreen *s, w = ms->w; - wX = w->geometry ().x (); - wY = w->geometry ().y (); - wWidth = w->geometry ().width () + - w->geometry ().border () * 2; - wHeight = w->geometry ().height () + - w->geometry ().border () * 2; + wX = w->serverGeometry ().x (); + wY = w->serverGeometry ().y (); + wWidth = w->serverGeometry ().widthIncBorders (); + wHeight = w->serverGeometry ().heightIncBorders (); ms->x += xRoot - lastPointerX; ms->y += yRoot - lastPointerY; @@ -484,8 +482,8 @@ moveHandleMotionEvent (CompScreen *s, if (dx || dy) { - w->move (wX + dx - w->geometry ().x (), - wY + dy - w->geometry ().y (), false); + w->move (wX + dx - w->serverGeometry ().x (), + wY + dy - w->serverGeometry ().y (), false); if (!ms->optionGetLazyPositioning ()) w->syncPosition (); --- compiz-0.9.7.6.orig/plugins/place/src/place.cpp +++ compiz-0.9.7.6/plugins/place/src/place.cpp @@ -343,37 +343,36 @@ PlaceWindow::doValidateResizeRequest (un CompWindow::Geometry geom; int output; + geom.set (xwc->x, xwc->y, xwc->width, xwc->height, + window->serverGeometry ().border ()); + if (clampToViewport) { /* left, right, top, bottom target coordinates, clamed to viewport * sizes as we don't need to validate movements to other viewports; * we are only interested in inner-viewport movements */ - x = xwc->x % screen->width (); - if ((x + xwc->width) < 0) + x = geom.x () % screen->width (); + if ((geom.x2 ()) < 0) x += screen->width (); - y = xwc->y % screen->height (); - if ((y + xwc->height) < 0) + y = geom.y () % screen->height (); + if ((geom.y2 ()) < 0) y += screen->height (); } else { - x = xwc->x; - y = xwc->y; + x = geom.x (); + y = geom.y (); } left = x - window->border ().left; - right = left + xwc->width + (window->border ().left + - window->border ().right + - 2 * window->serverGeometry ().border ()); + right = left + geom.widthIncBorders () + (window->border ().left + + window->border ().right); top = y - window->border ().top; - bottom = top + xwc->height + (window->border ().top + - window->border ().bottom + - 2 * window->serverGeometry ().border ()); + bottom = top + geom.heightIncBorders () + (window->border ().top + + window->border ().bottom); - geom.set (xwc->x, xwc->y, xwc->width, xwc->height, - window->serverGeometry ().border ()); output = screen->outputDeviceForGeometry (geom); workArea = screen->getWorkareaForOutput (output); @@ -746,10 +745,8 @@ PlaceWindow::placePointer (const CompRec { if (PlaceScreen::get (screen)->getPointerPosition (pos)) { - unsigned int dx = (window->serverGeometry ().width () / 2) - - window->serverGeometry ().border (); - unsigned int dy = (window->serverGeometry ().height () / 2) - - window->serverGeometry ().border (); + unsigned int dx = (window->serverGeometry ().widthIncBorders () / 2); + unsigned int dy = (window->serverGeometry ().heightIncBorders () / 2); pos -= CompPoint (dx, dy); } else @@ -1200,14 +1197,12 @@ PlaceWindow::constrainToWorkarea (const extents.left = pos.x () - window->border ().left; extents.top = pos.y () - window->border ().top; - extents.right = extents.left + window->serverWidth () + + extents.right = extents.left + window->serverGeometry ().heightIncBorders () + (window->border ().left + - window->border ().right + - 2 * window->serverGeometry ().border ()); - extents.bottom = extents.top + window->serverHeight () + + window->border ().right); + extents.bottom = extents.top + window->serverGeometry ().widthIncBorders () + (window->border ().top + - window->border ().bottom + - 2 * window->serverGeometry ().border ()); + window->border ().bottom); delta = workArea.right () - extents.right; if (delta < 0) --- compiz-0.9.7.6.orig/plugins/place/src/constrain-to-workarea/src/constrain-to-workarea.cpp +++ compiz-0.9.7.6/plugins/place/src/constrain-to-workarea/src/constrain-to-workarea.cpp @@ -61,13 +61,11 @@ compiz::place::clampGeometryToWorkArea ( } left = x - border.left; - right = left + g.width () + (border.left + - border.right + - 2 * g.border ()); + right = left + g.widthIncBorders () + (border.left + + border.right); top = y - border.top; - bottom = top + g.height () + (border.top + - border.bottom + - 2 * g.border ()); + bottom = top + g.heightIncBorders () + (border.top + + border.bottom); if ((right - left) > workArea.width ()) {