Fixed a bug where a modal app window appeared in current workspace although its workspace mask did not include it

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12462 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca 2005-04-23 10:05:33 +00:00
parent 70208b9153
commit 51a73c1e2b
4 changed files with 49 additions and 15 deletions

View File

@ -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))

View File

@ -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;
}
}

View File

@ -21,7 +21,7 @@
//
// File Name: Workspace.cpp
// Author: Adi Oanca <adioanca@cotty.iren.ro>
// 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
{

View File

@ -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);