void SimplePartWidget::zoomOut() { setZoomFactor(zoomFactor() / zoomConstant); constrainSize(); }
static Bool gridPlaceWindow (Window xid, GridType where) { CompWindow *w; w = findWindowAtDisplay (xid); if (w) { XRectangle workarea; XRectangle desiredSlot; XRectangle desiredRect; XRectangle currentRect; GridProps props = gridProps[where]; XWindowChanges xwc; /* get current available area */ getWorkareaForOutput (w->screen, outputDeviceForWindow(w), &workarea); /* Convention: * xxxSlot include decorations (it's the screen area occupied) * xxxRect are undecorated (it's the constrained position of the contents) */ /* slice and dice to get desired slot - including decorations */ desiredSlot.y = workarea.y + props.gravityDown * (workarea.height / props.numCellsY); desiredSlot.height = workarea.height / props.numCellsY; desiredSlot.x = workarea.x + props.gravityRight * (workarea.width / props.numCellsX); desiredSlot.width = workarea.width / props.numCellsX; /* Adjust for constraints and decorations */ constrainSize (w, &desiredSlot, &desiredRect); /* Get current rect not including decorations */ currentRect.x = w->serverX; currentRect.y = w->serverY; currentRect.width = w->serverWidth; currentRect.height = w->serverHeight; if (desiredRect.y == currentRect.y && desiredRect.height == currentRect.height) { int slotWidth33 = workarea.width / 3; int slotWidth66 = workarea.width - slotWidth33; if (props.numCellsX == 2) /* keys (1, 4, 7, 3, 6, 9) */ { if (currentRect.width == desiredRect.width && currentRect.x == desiredRect.x) { desiredSlot.width = slotWidth66; desiredSlot.x = workarea.x + props.gravityRight * slotWidth33; } else { /* tricky, have to allow for window constraints when * computing what the 33% and 66% offsets would be */ XRectangle rect33, rect66, slot33, slot66; slot33 = desiredSlot; slot33.x = workarea.x + props.gravityRight * slotWidth66; slot33.width = slotWidth33; constrainSize (w, &slot33, &rect33); slot66 = desiredSlot; slot66.x = workarea.x + props.gravityRight * slotWidth33; slot66.width = slotWidth66; constrainSize (w, &slot66, &rect66); if (currentRect.width == rect66.width && currentRect.x == rect66.x) { desiredSlot.width = slotWidth33; desiredSlot.x = workarea.x + props.gravityRight * slotWidth66; } } } else /* keys (2, 5, 8) */ { if (currentRect.width == desiredRect.width && currentRect.x == desiredRect.x) { desiredSlot.width = slotWidth33; desiredSlot.x = workarea.x + slotWidth33; } } constrainSize (w, &desiredSlot, &desiredRect); } xwc.x = desiredRect.x; xwc.y = desiredRect.y; xwc.width = desiredRect.width; xwc.height = desiredRect.height; if (w->mapNum) sendSyncRequest (w); if (w->state & MAXIMIZE_STATE) { /* maximized state interferes with us, clear it */ maximizeWindow (w, 0); } /* TODO: animate move+resize */ configureXWindow (w, CWX | CWY | CWWidth | CWHeight, &xwc); } return TRUE; }