void ShowIconForMinimizedClient (WmWorkspaceData *pWS, ClientData *pCD) { WmScreenData *pSD = PSD_FOR_CLIENT(pCD); /* * Handle auto-placement for root icons (icons not in an icon * box). */ if (wmGD.iconAutoPlace && !P_ICON_BOX(pCD)) { if ((ICON_PLACE(pCD) == NO_ICON_PLACE) || ((pWS->IPData.placeList[ICON_PLACE(pCD)].pCD) && (pWS->IPData.placeList[ICON_PLACE(pCD)].pCD != pCD))) { /* * Icon place not defined or occupied by another client, * find a free place to put the icon. */ if ((ICON_PLACE(pCD) = GetNextIconPlace (&pWS->IPData)) == NO_ICON_PLACE) { ICON_PLACE(pCD) = CvtIconPositionToPlace (&pWS->IPData, pCD->clientX, pCD->clientY); } CvtIconPlaceToPosition (&pWS->IPData, ICON_PLACE(pCD), &ICON_X(pCD), &ICON_Y(pCD)); #ifndef WSM XMoveWindow (DISPLAY, ICON_FRAME_WIN(pCD), ICON_X(pCD), ICON_Y(pCD)); #endif /* WSM */ } pWS->IPData.placeList[ICON_PLACE(pCD)].pCD = pCD; } #ifdef WSM /* * If icon on root window and this workspace is active, the * make sure it's in the right place. */ if ((pWS == pSD->pActiveWS) && !P_ICON_BOX(pCD)) { XMoveWindow (DISPLAY, ICON_FRAME_WIN(pCD), ICON_X(pCD), ICON_Y(pCD)); } #endif /* WSM */ if (pCD->iconWindow) { XMapWindow (DISPLAY, pCD->iconWindow); } if ((pSD->useIconBox) && P_ICON_BOX(pCD)) { ShowClientIconState (pCD, MINIMIZED_STATE ); } else { XWindowChanges windowChanges; /* * Map the icon on the screen at the appropriate place in the * window stack. */ if (wmGD.lowerOnIconify) { if ((&pCD->iconEntry != pSD->lastClient) && (pSD->lastClient)) { if (pSD->lastClient->type == MINIMIZED_STATE) { windowChanges.sibling = ICON_FRAME_WIN(pSD->lastClient->pCD); } else { windowChanges.sibling = pSD->lastClient->pCD->clientFrameWin; } windowChanges.stack_mode = Below; XConfigureWindow (DISPLAY, ICON_FRAME_WIN(pCD), (CWSibling | CWStackMode), &windowChanges); MoveEntryInList (pWS, &pCD->iconEntry, False /*on bottom*/, NULL); } } else { windowChanges.sibling = pCD->clientFrameWin; windowChanges.stack_mode = Below; XConfigureWindow (DISPLAY, ICON_FRAME_WIN(pCD), (CWSibling | CWStackMode), &windowChanges); MoveEntryInList (pWS, &pCD->iconEntry, False /*below*/, &pCD->clientEntry); } #ifdef WSM if (pWS == pSD->pActiveWS) { XMapWindow (DISPLAY, ICON_FRAME_WIN(pCD)); } #else /* WSM */ XMapWindow (DISPLAY, ICON_FRAME_WIN(pCD)); #endif /* WSM */ } } /* END OF FUNCTION ShowIconForMinimizedClient */
void PackRootIcons (void) { int iOld, iNew; ClientData *pCD; ClientData *pCD_active; int hasActiveText = 1; #ifdef WSM WsClientData *pWsc; #endif /* WSM */ /* * find context of the activeIconTextWin to get pCD and then * if it is the same as this client, hide it. */ if (XFindContext (DISPLAY, ACTIVE_PSD->activeIconTextWin, wmGD.windowContextType, (caddr_t *)&pCD_active)) { hasActiveText = 0; } /* * Traverse the list and pack them together */ if (wmGD.iconAutoPlace) { for (iOld = iNew = 0; iOld < ACTIVE_WS->IPData.totalPlaces; iOld++, iNew++) { if (ACTIVE_WS->IPData.placeList[iOld].pCD == NULL) { /* advance to next non-null entry */ while (++iOld < ACTIVE_WS->IPData.totalPlaces && !ACTIVE_WS->IPData.placeList[iOld].pCD) ; } if (iOld < ACTIVE_WS->IPData.totalPlaces && iOld != iNew) { /* move the icon from its old place to the new place */ MoveIconInfo (&ACTIVE_WS->IPData, iOld, iNew); pCD = ACTIVE_WS->IPData.placeList[iNew].pCD; #ifdef WSM pWsc = GetWsClientData (ACTIVE_WS, pCD); pWsc->iconPlace = iNew; CvtIconPlaceToPosition (&ACTIVE_WS->IPData, pWsc->iconPlace, &pWsc->iconX, &pWsc->iconY); #else /* WSM */ pCD->iconPlace = iNew; CvtIconPlaceToPosition (&ACTIVE_WS->IPData, pCD->iconPlace, &pCD->iconX, &pCD->iconY); #endif /* WSM */ if (hasActiveText && (pCD == pCD_active)) { /* hide activeIconTextWin first */ HideActiveIconText ((WmScreenData *)NULL); #ifdef WSM XMoveWindow (DISPLAY, pWsc->iconFrameWin, pWsc->iconX, pWsc->iconY); #else /* WSM */ XMoveWindow (DISPLAY, ICON_FRAME_WIN(pCD), pCD->iconX, pCD->iconY); #endif /* WSM */ ShowActiveIconText (pCD); } else { #ifdef WSM XMoveWindow (DISPLAY, pWsc->iconFrameWin, pWsc->iconX, pWsc->iconY); #else /* WSM */ XMoveWindow (DISPLAY, ICON_FRAME_WIN(pCD), pCD->iconX, pCD->iconY); #endif /* WSM */ } } } } } /* END OF FUNCTION PackRootIcons */