MCPcopy Create free account
hub / github.com/SimHacker/micropolis / ArrangePacking

Function ArrangePacking

micropolis-activity/src/tk/tkpack.c:346–650  ·  view source on GitHub ↗
(clientData)

Source from the content-addressed store, hash-verified

344 * moved.
345 *
346 *--------------------------------------------------------------
347 */
348
349static void
350ArrangePacking(clientData)
351 ClientData clientData; /* Structure describing parent
352 * whose children are to be
353 * re-layed out. */
354{
355 register Packer *parentPtr = (Packer *) clientData;
356 register Packer *childPtr;
357 int numExpX, numExpY; /* # of windows that are expandable in
358 * each direction. */
359 int spareX, spareY; /* Amount of extra space to give to each
360 * expandable window. */
361 int leftOverX, leftOverY; /* Extra chunk of space to give to last
362 * expandable window. */
363 int cavityX, cavityY, cavityWidth, cavityHeight;
364 /* These variables keep track of the
365 * as-yet-unallocated space remaining in
366 * the middle of the parent window. */
367 int frameX, frameY, frameWidth, frameHeight;
368 /* These variables keep track of the frame
369 * allocated to the current window. */
370 int x, y, width, height; /* These variables are used to hold the
371 * actual geometry of the current window. */
372 int intBWidth; /* Width of internal border in parent window,
373 * if any. */
374 int abort; /* May get set to non-zero to abort this
375 * repacking operation. */
376 int maxWidth, maxHeight, tmp;
377
378 parentPtr->flags &= ~REQUESTED_REPACK;
379
380 /*
381 * If the parent has no children anymore, then don't do anything
382 * at all: just leave the parent's size as-is.
383 */
384
385 if (parentPtr->childPtr == NULL) {
386 return;
387 }
388
389 /*
390 * Abort any nested call to ArrangePacking for this window, since
391 * we'll do everything necessary here, and set up so this call
392 * can be aborted if necessary.
393 */
394
395 if (parentPtr->abortPtr != NULL) {
396 *parentPtr->abortPtr = 1;
397 }
398 parentPtr->abortPtr = &abort;
399 abort = 0;
400 Tk_Preserve((ClientData) parentPtr);
401
402 /*
403 * Pass #1: scan all the children to figure out the total amount

Callers

nothing calls this directly

Calls 8

Tk_PreserveFunction · 0.85
Tk_GeometryRequestFunction · 0.85
panicFunction · 0.85
Tk_UnmapWindowFunction · 0.85
Tk_MoveResizeWindowFunction · 0.85
Tk_MapWindowFunction · 0.85
Tk_ReleaseFunction · 0.85
Tk_DoWhenIdleFunction · 0.70

Tested by

no test coverage detected