/** Startup placement. */ void StartupPlacement(void) { int count; int x; count = settings.desktopCount * GetScreenCount(); cascadeOffsets = Allocate(count * sizeof(int)); for(x = 0; x < count; x++) { cascadeOffsets[x] = settings.borderWidth + settings.titleHeight; } SetWorkarea(); }
/** Snap to the screen. */ void DoSnapScreen(ClientNode *np) { RectangleType client; int screen; const ScreenType *sp; int screenCount; int north, south, east, west; GetClientRectangle(np, &client); GetBorderSize(&np->state, &north, &south, &east, &west); screenCount = GetScreenCount(); for(screen = 0; screen < screenCount; screen++) { sp = GetScreen(screen); if(abs(client.right - sp->width - sp->x) <= settings.snapDistance) { np->x = sp->x + sp->width - west - np->width; } if(abs(client.left - sp->x) <= settings.snapDistance) { np->x = sp->x + east; } if(abs(client.bottom - sp->height - sp->y) <= settings.snapDistance) { np->y = sp->y + sp->height - south; if(!(np->state.status & STAT_SHADED)) { np->y -= np->height; } } if(abs(client.top - sp->y) <= settings.snapDistance) { np->y = north + sp->y; } } }