solved some problems with floating subset windows

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6108 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca 2004-01-16 16:09:36 +00:00
parent 7473eb7db8
commit 34168867a4
5 changed files with 36 additions and 13 deletions

View File

@ -456,11 +456,12 @@ void Desktop::PrintToStream(){
}
//---------------------------------------------------------------------------
WinBorder* Desktop::FindWinBorderByServerWindowToken(int32 token){
WinBorder* Desktop::FindWinBorderByServerWindowTokenAndTeamID(int32 token, team_id teamID){
WinBorder* wb;
fLayerLock.Lock();
for (int32 i = 0; (wb = (WinBorder*)fWinBorderList.ItemAt(i)); i++){
if (wb->Window()->ClientToken() == token)
if (wb->Window()->ClientToken() == token
&& wb->Window()->ClientTeamID() == teamID)
break;
}
fLayerLock.Unlock();

View File

@ -74,7 +74,7 @@ public:
// "Private" to app_server :-) - means they should not be used very much
void RemoveSubsetWindow(WinBorder* wb);
WinBorder* FindWinBorderByServerWindowToken(int32 token);
WinBorder* FindWinBorderByServerWindowTokenAndTeamID(int32 token, team_id teamID);
BLocker fGeneralLock;
BLocker fLayerLock;

View File

@ -1390,10 +1390,12 @@ TODO: Figure out what Adi did here and convert to PortMessages
{
WinBorder *wb;
int32 mainToken;
team_id teamID;
ses->ReadInt32(&mainToken);
ses->ReadData(&teamID, sizeof(team_id));
wb = desktop->FindWinBorderByServerWindowToken(mainToken);
wb = desktop->FindWinBorderByServerWindowTokenAndTeamID(mainToken, teamID);
if(wb){
ses->WriteInt32(SERVER_TRUE);
ses->Sync();

View File

@ -91,6 +91,7 @@ WinBorder::WinBorder(const BRect &r, const char *name, const int32 look, const i
fLastMousePosition.Set(-1,-1);
SetLevel();
fMainWinBorder = NULL;
_decorator = NULL;
if (feel == B_NO_BORDER_WINDOW_LOOK){
@ -734,9 +735,9 @@ void WinBorder::AddToSubsetOf(WinBorder* main){
RootLayer *rl = main->GetRootLayer();
desktop->fGeneralLock.Lock();
printf("WinBorder(%s)::AddToSubsetOf() - General lock acquired\n", GetName());
printf("WinBorder(%s)::AddToSubsetOf(%s) - General lock acquired\n", GetName(), main->GetName());
rl->fMainLock.Lock();
printf("WinBorder(%s)::AddToSubsetOf() - Main lock acquired\n", GetName());
printf("WinBorder(%s)::AddToSubsetOf(%s) - Main lock acquired\n", GetName(), main->GetName());
for(int32 i = 0; i < rl->WorkspaceCount(); i++){
Workspace *ws = rl->WorkspaceAt(i+1);
@ -745,9 +746,9 @@ printf("WinBorder(%s)::AddToSubsetOf() - Main lock acquired\n", GetName());
}
rl->fMainLock.Unlock();
printf("WinBorder(%s)::AddToSubsetOf() - Main lock released\n", GetName());
printf("WinBorder(%s)::AddToSubsetOf(%s) - Main lock released\n", GetName(), main->GetName());
desktop->fGeneralLock.Unlock();
printf("WinBorder(%s)::AddToSubsetOf() - General lock released\n", GetName());
printf("WinBorder(%s)::AddToSubsetOf(%s) - General lock released\n", GetName(), main->GetName());
}
}
}

View File

@ -181,13 +181,13 @@ STRACE(("\n@Workspace(%ld)::SetFOCUSLayer( %s )\n", ID(), layer? layer->GetName(
}
// TODO: there had to be a Invalidate() vresion witch takes a BRegion parameter
STRACESTREAM();
Invalidate();
}
else{
// Do nothing!
}
STRACESTREAM();
STRACE(("\n#Workspace(%ld)::SetFOCUSLayer( %s ) ENDED\n", ID(), layer? layer->GetName(): "NULL"));
return FocusLayer();
@ -333,8 +333,10 @@ void Workspace::RemoveItem(ListData* item){
item->upperItem = NULL;
item->lowerItem = NULL;
if (fFocusItem == item)
if (fFocusItem == item){
fFocusItem->layerPtr->SetFocus(false);
fFocusItem = NULL;
}
if (fFrontItem == item)
fFrontItem = NULL;
if (fCurrentItem == item)
@ -517,6 +519,8 @@ STRACE(("#WS(%ld)::SASNF(%s) ENDED 1\n", ID(), preferred? preferred->GetName():
return;
}
// ListData *exFocusItem = fFocusItem;
// properly place this 'preferred' WinBorder.
ListData *lastInserted;
lastInserted = FindPlace(HasItem(preferred));
@ -549,6 +553,18 @@ STRACE((" NORMAL Window '%s' -", preferred? preferred->GetName(): "NULL"));
// if they are in the same team...
if (preferred->Window()->ClientTeamID() == fFrontItem->layerPtr->Window()->ClientTeamID()){
STRACE((" SAME TeamID\n"));
/*
{
int32 exFeel = exFocusItem? exFocusItem->layerPtr->Window()->Feel() : 0;
if (exFocusItem &&
(exFeel == B_FLOATING_SUBSET_WINDOW_FEEL || exFeel == B_MODAL_SUBSET_WINDOW_FEEL)
{
if ( !(fFocusItem->layerPtr->Window()->fWinFMWList.HasItem(exFocusItem->layerPtr)) ){
}
}
}
*/
// collect subset windows that are common to application's windows...
// NOTE: A subset window *can* be added to more than just one window.
FMWList commonFMW;
@ -683,7 +699,7 @@ STRACE((" DIFERRENT TeamID\n"));
// windows to be inserted
fFrontItem = NULL;
goto et1;
} // else - if diferrent ClientTeamID()s.
} // END: else - if diferrent ClientTeamID()s.
} // if (fFrontItem) && NORMAL_WINDOW
else{
STRACE((" NO previous FRONT Item\n"));
@ -913,7 +929,8 @@ STRACE((" MODAL ALL/SYSTEM FIRST Window '%s'\n", preferred? preferred->GetName()
else
STRACE((" The window IS Hidden\n"));
ListData *newFrontItem = NULL;
ListData *exFrontItem = fFrontItem;
ListData *newFrontItem = NULL;
if(preferred){
int32 feel = fBottomItem->layerPtr->Window()->Feel();
@ -921,7 +938,9 @@ STRACE((" MODAL ALL/SYSTEM FIRST Window '%s'\n", preferred? preferred->GetName()
if(preferred->_level == B_FLOATING_SUBSET_FEEL
|| preferred->_level == B_FLOATING_APP_FEEL
|| preferred->_level == B_FLOATING_ALL_FEEL)
{ }
{
newFrontItem = exFrontItem;
}
// if the last in workspace's list is one of these, GIVE focus to it!
else if((feel == B_SYSTEM_FIRST || feel == B_MODAL_ALL_WINDOW_FEEL)
&& !(fBottomItem->layerPtr->IsHidden()) )