diff --git a/src/servers/app/RootLayer.cpp b/src/servers/app/RootLayer.cpp index 8faf731844..6dc97d6195 100644 --- a/src/servers/app/RootLayer.cpp +++ b/src/servers/app/RootLayer.cpp @@ -425,7 +425,6 @@ void RootLayer::AddWinBorder(WinBorder* winBorder) if (feel != B_FLOATING_SUBSET_WINDOW_FEEL && feel != B_MODAL_SUBSET_WINDOW_FEEL) { uint32 wks = winBorder->Workspaces(); - // add to current workspace if (wks == 0) { @@ -1777,7 +1776,7 @@ void RootLayer::show_winBorder(WinBorder *winBorder) // subset modals are a bit like floating windows, they are being added // and removed from workspace when there's at least a normal window // that uses them. - winBorder->Level() == B_MODAL_APP || + winBorder->Feel() == B_MODAL_SUBSET_WINDOW_FEEL || // floating windows are inserted/removed on-the-fly so this window, // although needed may not be in workspace's list. winBorder->Level() == B_FLOATING_APP)) diff --git a/src/servers/app/WinBorder.cpp b/src/servers/app/WinBorder.cpp index bec78c6022..bdf5679c5e 100644 --- a/src/servers/app/WinBorder.cpp +++ b/src/servers/app/WinBorder.cpp @@ -425,6 +425,7 @@ void WinBorder::QuietlySetFeel(int32 feel) switch (fFeel) { case B_MODAL_APP_WINDOW_FEEL: + break; case B_MODAL_SUBSET_WINDOW_FEEL: case B_FLOATING_APP_WINDOW_FEEL: case B_FLOATING_SUBSET_WINDOW_FEEL: @@ -437,7 +438,6 @@ void WinBorder::QuietlySetFeel(int32 feel) fWorkspaces = 0xffffffffUL; break; case B_NORMAL_WINDOW_FEEL: - if (fWorkspaces == 0x0UL) - ; + break; } } diff --git a/src/servers/app/Workspace.cpp b/src/servers/app/Workspace.cpp index 4de8fcf4bb..9526e45493 100644 --- a/src/servers/app/Workspace.cpp +++ b/src/servers/app/Workspace.cpp @@ -21,7 +21,7 @@ // // File Name: Workspace.cpp // Author: Adi Oanca -// Description: Tracks workspaces +// Description: Tracks windows inside one workspace // // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // Notes: IMPORTANT WARNING @@ -542,18 +542,36 @@ STRACE(("W(%ld)::HideWinBorder(%s) \n", fID, winBorder? winBorder->GetName(): "N { // if this modal subset is in our list ONLY (not in other visible normal window's one), // then remove from Workspace's list. - if (item->layerPtr->Level() == B_MODAL_APP - && winBorder->fFMWList.HasItem(item->layerPtr) - && !searchFirstMainWindow(item->layerPtr)) + if (item->layerPtr->Level() == B_MODAL_APP) { - // if this modal subset has front state, make sure another window will get that status. - if (fFrontItem == item) - changeFront = true; + if(winBorder->fFMWList.HasItem(item->layerPtr)) + { + if(!searchFirstMainWindow(item->layerPtr)) + { + // if this modal subset has front state, make sure another window will get that status. + if (fFrontItem == item) + changeFront = true; - toast = item; - item = item->lowerItem; - RemoveItem(toast); - fPool.ReleaseMemory(toast); + toast = item; + item = item->lowerItem; + RemoveItem(toast); + fPool.ReleaseMemory(toast); + } + } + else if (!searchANormalWindow(item->layerPtr) + && !(item->layerPtr->Workspaces() & (0x00000001 << fID))) + { + // if this modal subset has front state, make sure another window will get that status. + if (fFrontItem == item) + changeFront = true; + + toast = item; + item = item->lowerItem; + RemoveItem(toast); + fPool.ReleaseMemory(toast); + } + else + item = item->lowerItem; } else item = item->lowerItem; @@ -1362,6 +1380,22 @@ bool Workspace::removeAndPlaceBefore(const WinBorder *wb, ListData *beforeItem) return removeAndPlaceBefore(HasItem(wb), beforeItem); } +inline +WinBorder* Workspace::searchANormalWindow(WinBorder *wb) const +{ + ListData *listItem = fBottomItem; + while (listItem) + { + if (listItem->layerPtr->Level() == B_NORMAL && !listItem->layerPtr->IsHidden() + && listItem->layerPtr->App()->ClientTeamID() == wb->App()->ClientTeamID()) + return listItem->layerPtr; + + listItem = listItem->upperItem; + } + return NULL; +} + + inline WinBorder* Workspace::searchFirstMainWindow(WinBorder *wb) const { diff --git a/src/servers/app/Workspace.h b/src/servers/app/Workspace.h index d40298bb25..270b66bbef 100644 --- a/src/servers/app/Workspace.h +++ b/src/servers/app/Workspace.h @@ -102,6 +102,7 @@ private: bool removeAndPlaceBefore(ListData *item, ListData *beforeItem); WinBorder* searchFirstMainWindow(WinBorder *wb) const; + WinBorder* searchANormalWindow(WinBorder *wb) const; bool windowHasVisibleModals(const WinBorder *winBorder) const; ListData* putModalsInFront(ListData *item);