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
+3 -2
View File
@@ -456,11 +456,12 @@ void Desktop::PrintToStream(){
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
WinBorder* Desktop::FindWinBorderByServerWindowToken(int32 token){ WinBorder* Desktop::FindWinBorderByServerWindowTokenAndTeamID(int32 token, team_id teamID){
WinBorder* wb; WinBorder* wb;
fLayerLock.Lock(); fLayerLock.Lock();
for (int32 i = 0; (wb = (WinBorder*)fWinBorderList.ItemAt(i)); i++){ 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; break;
} }
fLayerLock.Unlock(); fLayerLock.Unlock();
+1 -1
View File
@@ -74,7 +74,7 @@ public:
// "Private" to app_server :-) - means they should not be used very much // "Private" to app_server :-) - means they should not be used very much
void RemoveSubsetWindow(WinBorder* wb); void RemoveSubsetWindow(WinBorder* wb);
WinBorder* FindWinBorderByServerWindowToken(int32 token); WinBorder* FindWinBorderByServerWindowTokenAndTeamID(int32 token, team_id teamID);
BLocker fGeneralLock; BLocker fGeneralLock;
BLocker fLayerLock; BLocker fLayerLock;
+3 -1
View File
@@ -1390,10 +1390,12 @@ TODO: Figure out what Adi did here and convert to PortMessages
{ {
WinBorder *wb; WinBorder *wb;
int32 mainToken; int32 mainToken;
team_id teamID;
ses->ReadInt32(&mainToken); ses->ReadInt32(&mainToken);
ses->ReadData(&teamID, sizeof(team_id));
wb = desktop->FindWinBorderByServerWindowToken(mainToken); wb = desktop->FindWinBorderByServerWindowTokenAndTeamID(mainToken, teamID);
if(wb){ if(wb){
ses->WriteInt32(SERVER_TRUE); ses->WriteInt32(SERVER_TRUE);
ses->Sync(); ses->Sync();
+5 -4
View File
@@ -91,6 +91,7 @@ WinBorder::WinBorder(const BRect &r, const char *name, const int32 look, const i
fLastMousePosition.Set(-1,-1); fLastMousePosition.Set(-1,-1);
SetLevel(); SetLevel();
fMainWinBorder = NULL;
_decorator = NULL; _decorator = NULL;
if (feel == B_NO_BORDER_WINDOW_LOOK){ if (feel == B_NO_BORDER_WINDOW_LOOK){
@@ -734,9 +735,9 @@ void WinBorder::AddToSubsetOf(WinBorder* main){
RootLayer *rl = main->GetRootLayer(); RootLayer *rl = main->GetRootLayer();
desktop->fGeneralLock.Lock(); 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(); 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++){ for(int32 i = 0; i < rl->WorkspaceCount(); i++){
Workspace *ws = rl->WorkspaceAt(i+1); Workspace *ws = rl->WorkspaceAt(i+1);
@@ -745,9 +746,9 @@ printf("WinBorder(%s)::AddToSubsetOf() - Main lock acquired\n", GetName());
} }
rl->fMainLock.Unlock(); 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(); desktop->fGeneralLock.Unlock();
printf("WinBorder(%s)::AddToSubsetOf() - General lock released\n", GetName()); printf("WinBorder(%s)::AddToSubsetOf(%s) - General lock released\n", GetName(), main->GetName());
} }
} }
} }
+24 -5
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 // TODO: there had to be a Invalidate() vresion witch takes a BRegion parameter
STRACESTREAM();
Invalidate(); Invalidate();
} }
else{ else{
// Do nothing! // Do nothing!
} }
STRACESTREAM();
STRACE(("\n#Workspace(%ld)::SetFOCUSLayer( %s ) ENDED\n", ID(), layer? layer->GetName(): "NULL")); STRACE(("\n#Workspace(%ld)::SetFOCUSLayer( %s ) ENDED\n", ID(), layer? layer->GetName(): "NULL"));
return FocusLayer(); return FocusLayer();
@@ -333,8 +333,10 @@ void Workspace::RemoveItem(ListData* item){
item->upperItem = NULL; item->upperItem = NULL;
item->lowerItem = NULL; item->lowerItem = NULL;
if (fFocusItem == item) if (fFocusItem == item){
fFocusItem->layerPtr->SetFocus(false);
fFocusItem = NULL; fFocusItem = NULL;
}
if (fFrontItem == item) if (fFrontItem == item)
fFrontItem = NULL; fFrontItem = NULL;
if (fCurrentItem == item) if (fCurrentItem == item)
@@ -517,6 +519,8 @@ STRACE(("#WS(%ld)::SASNF(%s) ENDED 1\n", ID(), preferred? preferred->GetName():
return; return;
} }
// ListData *exFocusItem = fFocusItem;
// properly place this 'preferred' WinBorder. // properly place this 'preferred' WinBorder.
ListData *lastInserted; ListData *lastInserted;
lastInserted = FindPlace(HasItem(preferred)); lastInserted = FindPlace(HasItem(preferred));
@@ -549,6 +553,18 @@ STRACE((" NORMAL Window '%s' -", preferred? preferred->GetName(): "NULL"));
// if they are in the same team... // if they are in the same team...
if (preferred->Window()->ClientTeamID() == fFrontItem->layerPtr->Window()->ClientTeamID()){ if (preferred->Window()->ClientTeamID() == fFrontItem->layerPtr->Window()->ClientTeamID()){
STRACE((" SAME TeamID\n")); 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... // collect subset windows that are common to application's windows...
// NOTE: A subset window *can* be added to more than just one window. // NOTE: A subset window *can* be added to more than just one window.
FMWList commonFMW; FMWList commonFMW;
@@ -683,7 +699,7 @@ STRACE((" DIFERRENT TeamID\n"));
// windows to be inserted // windows to be inserted
fFrontItem = NULL; fFrontItem = NULL;
goto et1; goto et1;
} // else - if diferrent ClientTeamID()s. } // END: else - if diferrent ClientTeamID()s.
} // if (fFrontItem) && NORMAL_WINDOW } // if (fFrontItem) && NORMAL_WINDOW
else{ else{
STRACE((" NO previous FRONT Item\n")); STRACE((" NO previous FRONT Item\n"));
@@ -913,7 +929,8 @@ STRACE((" MODAL ALL/SYSTEM FIRST Window '%s'\n", preferred? preferred->GetName()
else else
STRACE((" The window IS Hidden\n")); STRACE((" The window IS Hidden\n"));
ListData *newFrontItem = NULL; ListData *exFrontItem = fFrontItem;
ListData *newFrontItem = NULL;
if(preferred){ if(preferred){
int32 feel = fBottomItem->layerPtr->Window()->Feel(); 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 if(preferred->_level == B_FLOATING_SUBSET_FEEL
|| preferred->_level == B_FLOATING_APP_FEEL || preferred->_level == B_FLOATING_APP_FEEL
|| preferred->_level == B_FLOATING_ALL_FEEL) || preferred->_level == B_FLOATING_ALL_FEEL)
{ } {
newFrontItem = exFrontItem;
}
// if the last in workspace's list is one of these, GIVE focus to it! // 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) else if((feel == B_SYSTEM_FIRST || feel == B_MODAL_ALL_WINDOW_FEEL)
&& !(fBottomItem->layerPtr->IsHidden()) ) && !(fBottomItem->layerPtr->IsHidden()) )