diff --git a/src/servers/app/server/AppServer.cpp b/src/servers/app/server/AppServer.cpp index 733bebb255..78f8b026e0 100644 --- a/src/servers/app/server/AppServer.cpp +++ b/src/servers/app/server/AppServer.cpp @@ -789,6 +789,7 @@ int main( int argc, char** argv ) if(find_port(SERVER_PORT_NAME)!=B_NAME_NOT_FOUND) return -1; + srand(real_time_clock_usecs()); AppServer app_server; app_server.Run(); return 0; diff --git a/src/servers/app/server/Layer.cpp b/src/servers/app/server/Layer.cpp index ebed73d120..1d8df389b0 100644 --- a/src/servers/app/server/Layer.cpp +++ b/src/servers/app/server/Layer.cpp @@ -121,7 +121,7 @@ Layer::~Layer(void) delete fLayerData; fLayerData = NULL; } - + if(fName) { delete fName; @@ -375,7 +375,7 @@ Layer* Layer::LayerAt(const BPoint &pt) { if (fVisible.Contains(pt)) return this; - + if (fFullVisible.Contains(pt)) { Layer *lay = NULL; @@ -645,10 +645,9 @@ void Layer::Draw(const BRect &r) r.PrintToStream(); #endif -// fDriver->FillRect(r, fLayerData->viewcolor); - srand(123); - RGBColor c(rand()%255,rand()%255,rand()%255); - fDriver->FillRect(r, c); + fDriver->FillRect(r, fLayerData->viewcolor); +// RGBColor c(rand()%255,rand()%255,rand()%255); +// fDriver->FillRect(r, c); // empty HOOK function. } @@ -879,7 +878,6 @@ void Layer::RebuildRegions( const BRegion& reg, uint32 action, BPoint pt, BPoint { fFullVisible.MakeEmpty(); fVisible = fFull; - #ifdef DEBUG_LAYER_REBUILD printf("\n ======= Layer(%s):: RR ****** ======\n", GetName()); fFull.PrintToStream(); diff --git a/src/servers/app/server/RootLayer.cpp b/src/servers/app/server/RootLayer.cpp index 132b4fe71b..27cfaf63a1 100644 --- a/src/servers/app/server/RootLayer.cpp +++ b/src/servers/app/server/RootLayer.cpp @@ -326,7 +326,13 @@ Layer* RootLayer::VirtualTopChild() const fWinBorderIndex = fWinBorderCount-1; if (fWinBorderIndex < fWinBorderCount && fWinBorderIndex >= 0) - return fWinBorderList[fWinBorderIndex--]; +{ + WinBorder *wb = fWinBorderList[fWinBorderIndex]; + fWinBorderIndex--; +//printf("Adi: VTC: %p.\n", wb); +// return fWinBorderList[fWinBorderIndex--]; + return wb; +} return NULL; } @@ -334,7 +340,13 @@ Layer* RootLayer::VirtualTopChild() const Layer* RootLayer::VirtualLowerSibling() const { if (fWinBorderIndex < fWinBorderCount && fWinBorderIndex > 0) - return fWinBorderList[fWinBorderIndex--]; +{ + WinBorder *wb = fWinBorderList[fWinBorderIndex]; + fWinBorderIndex--; +//printf("Adi: VLS: %p.\n", wb); + return wb; +// return fWinBorderList[fWinBorderIndex--]; +} return NULL; } @@ -342,7 +354,13 @@ Layer* RootLayer::VirtualLowerSibling() const Layer* RootLayer::VirtualUpperSibling() const { if (fWinBorderIndex < fWinBorderCount && fWinBorderIndex > 0) - return fWinBorderList[fWinBorderIndex++]; +{ + WinBorder *wb = fWinBorderList[fWinBorderIndex]; + fWinBorderIndex++; +//printf("Adi: VUS: %p.\n", wb); + return wb; +// return fWinBorderList[fWinBorderIndex++]; +} return NULL; } @@ -352,7 +370,13 @@ Layer* RootLayer::VirtualBottomChild() const fWinBorderIndex = 0; if (fWinBorderIndex < fWinBorderCount && fWinBorderIndex >= 0) - return fWinBorderList[fWinBorderIndex++]; +{ + WinBorder *wb = fWinBorderList[fWinBorderIndex]; + fWinBorderIndex++; +//printf("Adi: VBC: %p.\n", wb); + return wb; +// return fWinBorderList[fWinBorderIndex++]; +} return NULL; } @@ -365,7 +389,7 @@ void RootLayer::AddWinBorder(WinBorder* winBorder) debugger("RootLayer::RemoveWinBorder - winBorder must be hidden\n"); return; } - +//printf("Adi: AddWinBorder(%p)\n", winBorder); uint32 wks = winBorder->Window()->Workspaces(); // add to current workspace @@ -885,28 +909,30 @@ void RootLayer::MouseEventHandler(int32 code, BPortLink& msg) if (invalidate) { - WinBorder *focus = FocusWinBorder(); + get_workspace_windows(); + + // TODO: should it be improved by calling with region of hidden windows + // plus the full regions of new windows??? + invalidate_layer(this, fFull); + } + + WinBorder *focus = FocusWinBorder(); + if (exFocus || focus) + { if (exFocus && exFocus != focus && exFocus->fDecorator) exFocus->fDecorator->SetFocus(false); if (focus && exFocus != focus && focus->fDecorator) focus->fDecorator->SetFocus(true); - get_workspace_windows(); - - BRegion reg(target->fFull); - reg.Include(&target->fTopLayer->fFull); - invalidate_layer(this, reg); - if (exFocus && FocusWinBorder() != exFocus) + if (exFocus && focus != exFocus) { - reg.MakeEmpty(); - reg.Include(&exFocus->fVisible); // TODO: this line is a hack, decorator is drawn twice. - reg.Include(&focus->fVisible); + BRegion reg(exFocus->fVisible); + if (focus) + reg.Include(&focus->fVisible); + redraw_layer(this, reg); } - - if (!(target->Window()->Flags() & B_WILL_ACCEPT_FIRST_CLICK)) - sendMessage = false; } if (action == DEC_DRAG) @@ -919,6 +945,9 @@ void RootLayer::MouseEventHandler(int32 code, BPortLink& msg) } else { + if (!(target->Window()->Flags() & B_WILL_ACCEPT_FIRST_CLICK)) + sendMessage = false; + target->Window()->Lock(); target->MouseDown(evt, sendMessage); target->Window()->Unlock(); @@ -1533,21 +1562,25 @@ void RootLayer::show_winBorder(WinBorder *winBorder) { invalid = false; - if (fWorkspace[i] && fWorkspace[i]->HasWinBorder(winBorder)) + if (fWorkspace[i] && + (fWorkspace[i]->HasWinBorder(winBorder) || + // 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)) + { invalid = fWorkspace[i]->ShowWinBorder(winBorder); + } if (fActiveWksIndex == i) invalidate = invalid; } get_workspace_windows(); - if (invalidate) { - BRegion reg(winBorder->fFull); - reg.Include(&winBorder->fTopLayer->fFull); - invalidate_layer(this, reg); -// invalidate_layer(this, winBorder->fFull); + // TODO: should it be improved by calling with region of hidden windows + // plus the full regions of new windows??? + invalidate_layer(this, fFull); } } @@ -1573,7 +1606,9 @@ void RootLayer::hide_winBorder(WinBorder *winBorder) if (invalidate) { - invalidate_layer(this, winBorder->fFullVisible); + // TODO: should it be improved by calling with region of hidden windows + // plus the full regions of new windows??? + invalidate_layer(this, fFull); } } @@ -1594,4 +1629,10 @@ void RootLayer::get_workspace_windows() fWinBorderCount = bufferSize; fWinBorderIndex = 0; -} \ No newline at end of file +//for (int32 i = 0; i < fWinBorderCount; i++) +//{ +// printf("Adi: %ld get_workspace_windows(%p)\n", i, fWinBorderList[i]); +//} +//printf("Adi: get_workspace_windows DONE\n"); +} + diff --git a/src/servers/app/server/RootLayer.h b/src/servers/app/server/RootLayer.h index f7275e440b..1a76e736d4 100644 --- a/src/servers/app/server/RootLayer.h +++ b/src/servers/app/server/RootLayer.h @@ -164,9 +164,9 @@ friend class Desktop; int32 fActiveWksIndex; int32 fWsCount; Workspace* fWorkspace[32]; - mutable WinBorder** fWinBorderList2; - mutable WinBorder** fWinBorderList; - mutable int32 fWinBorderCount; + WinBorder** fWinBorderList2; + WinBorder** fWinBorderList; + int32 fWinBorderCount; mutable int32 fWinBorderIndex; int32 fWinBorderListLength; diff --git a/src/servers/app/server/Workspace.cpp b/src/servers/app/server/Workspace.cpp index ee55a1e233..08aba02ddc 100644 --- a/src/servers/app/server/Workspace.cpp +++ b/src/servers/app/server/Workspace.cpp @@ -800,7 +800,7 @@ STRACE(("W(%ld)::ShowWinBorder(%s) \n", fID, winBorder? winBorder->GetName(): "N } else { - // none of the unhiden normal windows have this window as part of their subset. + // none of the unhiden normal windows havs this window as part of its subset. // as a result this window won't be added to Workspace's list for it to be shown. return false; }