void SetClientStateWithEventMask (ClientData *pCD, int newState, Time setTime, unsigned int event_mask) { ClientData *pcdLeader; int currentState; WmScreenData *pSD = PSD_FOR_CLIENT(pCD); #ifdef WSM Boolean notShowing = (newState & UNSEEN_STATE); #endif /* WSM */ currentState = pCD->clientState; if (currentState == newState) { /* no change in state */ return; } /* * Undo the old state and setup the new state. If this is a transient * window then insure that it is put in a state that is compatible * with its transient leader (e.g., it cannot be minimized separately). */ pcdLeader = (pCD->transientLeader) ? FindTransientTreeLeader (pCD) : pCD; #ifdef WSM SetClientWsIndex (pCD); #endif /* WSM */ if (pCD->transientLeader) { if ((pcdLeader->clientState == MINIMIZED_STATE) && (newState != WITHDRAWN_STATE)) { newState = MINIMIZED_STATE; #ifdef WSM if (notShowing) { newState |= UNSEEN_STATE; } #endif /* WSM */ } else if ((newState == MINIMIZED_STATE) && (pcdLeader->clientState != MINIMIZED_STATE)) { if (currentState == WITHDRAWN_STATE) { newState = NORMAL_STATE; #ifdef WSM if (notShowing) { newState |= UNSEEN_STATE; } #endif /* WSM */ } else { newState = currentState; #ifdef WSM if (notShowing) { newState |= UNSEEN_STATE; } #endif /* WSM */ } } if (newState == currentState) { return; } } switch (newState) { #ifdef WSM case UNSEEN_STATE | WITHDRAWN_STATE: #else case WITHDRAWN_STATE: #endif /* WSM */ { /* * Free window manager resources (frame and icon). The * WM_STATE property is set in WithdrawWindow. */ UnManageWindow (pCD); break; } case NORMAL_STATE: case MAXIMIZED_STATE: { SetupWindowStateWithEventMask (pCD, newState, setTime, event_mask); #ifdef WSM XMapWindow (DISPLAY, pCD->client); XMapWindow (DISPLAY, pCD->clientFrameWin); #if defined(PANELIST) WmStopWaiting(); /* in WmIPC.c */ #endif /* PANELIST */ #endif /* WSM */ break; } case MINIMIZED_STATE: { Boolean clientHasFocus; /* * Transient windows are minimized with the rest of the transient * tree, including the transient leader. */ if ((pCD->clientState == NORMAL_STATE) || (pCD->clientState == MAXIMIZED_STATE)) { if ((wmGD.keyboardFocus == pCD) || (pCD->transientChildren && wmGD.keyboardFocus && (pCD == FindTransientTreeLeader (wmGD.keyboardFocus)))) { clientHasFocus = True; } else { clientHasFocus = False; } if (clientHasFocus || ((wmGD.nextKeyboardFocus == pCD) || (pCD->transientChildren && wmGD.keyboardFocus && (pCD == FindTransientTreeLeader (wmGD.nextKeyboardFocus))))) { /* * Give up the keyboard focus when minimized (including * the case in which an associated transient window has * the focus). Immediately remove the focus indication * from the window being minimized. */ if (wmGD.autoKeyFocus && (wmGD.keyboardFocusPolicy == KEYBOARD_FOCUS_EXPLICIT)) { AutoResetKeyFocus (pcdLeader, setTime); } else { Do_Focus_Key (NULL, setTime, ALWAYS_SET_FOCUS | WORKSPACE_IF_NULL); } if (clientHasFocus) { SetKeyboardFocus (NULL, 0); } } /* unmap main client and all transients */ UnmapClients (pCD, event_mask); } /* * Display the icon for the minimized client. */ if (ICON_FRAME_WIN(pCD)) { #ifdef WSM if (pCD->clientState & UNSEEN_STATE) { if (pCD->iconWindow) { XMapWindow (DISPLAY, pCD->iconWindow); } XMapWindow (DISPLAY, ICON_FRAME_WIN(pCD)); } ShowAllIconsForMinimizedClient (pCD); #else /* WSM */ ShowIconForMinimizedClient (pSD->pActiveWS, pCD); #endif /* WSM */ } SetClientWMState (pCD, IconicState, MINIMIZED_STATE); if ((pSD->useIconBox) && P_ICON_BOX(pCD)) { if ((pCD->clientFlags & ICON_BOX) && ACTIVE_ICON_TEXT_WIN) { /* * Hide active icon text window and reparent it to * root */ HideActiveIconText((WmScreenData *)NULL); pSD->activeLabelParent = ACTIVE_ROOT; XReparentWindow(DISPLAY, ACTIVE_ICON_TEXT_WIN , ACTIVE_ROOT, 0, 0 ); } if (ICON_FRAME_WIN(pCD)) { /* * force icon appearance in icon box to change */ IconExposureProc (pCD, True); } } break; } #ifdef WSM case UNSEEN_STATE | NORMAL_STATE: case UNSEEN_STATE | MAXIMIZED_STATE: case UNSEEN_STATE | MINIMIZED_STATE: { if (wmGD.keyboardFocus == pCD) { /* * Give up the keyboard focus */ Do_Focus_Key ((ClientData *)NULL, CurrentTime, ALWAYS_SET_FOCUS); SetKeyboardFocus (NULL, 0); } if (!(pCD->clientState & UNSEEN_STATE) && (((pCD->clientState & ~UNSEEN_STATE) == NORMAL_STATE) || ((pCD->clientState & ~UNSEEN_STATE) == MAXIMIZED_STATE))) { /* unmap main client and all transients */ UnmapClients (pcdLeader, event_mask); } if (pCD->clientFrameWin) { if (!P_ICON_BOX(pCD)) { if (ICON_FRAME_WIN(pCD)) { XUnmapWindow (DISPLAY, ICON_FRAME_WIN(pCD)); } if (pCD->iconWindow) XUnmapWindow (DISPLAY, pCD->iconWindow); } } switch (newState & ~UNSEEN_STATE) { case MINIMIZED_STATE: SetClientWMState (pCD, IconicState, newState); break; case NORMAL_STATE: case MAXIMIZED_STATE: default: SetClientWMState (pCD, NormalState, newState); break; } } break; #endif /* WSM */ } } /* END OF FUNCTION SetClientStateWithEventMask */
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 */