diff --git a/src/servers/app/server/Layer.cpp b/src/servers/app/server/Layer.cpp index 2cd434906e..018481eec4 100644 --- a/src/servers/app/server/Layer.cpp +++ b/src/servers/app/server/Layer.cpp @@ -14,7 +14,7 @@ #include "LayerData.h" #include -#define DEBUG_LAYER +//#define DEBUG_LAYER #ifdef DEBUG_LAYER # define STRACE(x) printf x #else @@ -439,7 +439,7 @@ void Layer::RequestDraw(const BRegion ®, Layer *startFrom) Draw(fUpdateReg.Frame()); fDriver->ConstrainClippingRegion(NULL); -// TODO: (WARNING!): For the Update code is MUST not be emptied!!! +// TODO: (WARNING!): For the Update code is MUST NOT be emptied!!! fUpdateReg.MakeEmpty(); } } @@ -677,31 +677,69 @@ void Layer::RebuildRegions( const BRegion& reg, uint32 action, BPoint pt, BPoint { fFullVisible.MakeEmpty(); fVisible = fFull; - if (fParent && fVisible.CountRects() >0){ +#ifdef DEBUG_LAYER_REBUILD + printf("\n ======= Layer(%s):: RR ****** ======\n", GetName()); + fFull.PrintToStream(); + fVisible.PrintToStream(); + printf("\n ======= Layer(%s):: RR ****** END ======\n", GetName()); + + if (!fParent) + printf("\t NO parent\n"); + else + printf("\t VALID Parent: %s.\n", fParent->GetName()); + if (!(fVisible.CountRects() > 0)) + printf("\t NO visible area!\n"); + else + printf("\t VALID visble area\n"); +#endif + + if (fParent && fVisible.CountRects() > 0){ // not the usual case, but support fot this is needed. if (fParent->fAdFlags & B_LAYER_CHILDREN_DEPENDANT){ +#ifdef DEBUG_LAYER_REBUILD + printf("\n ======= Layer(%s)::B_LAYER_CHILDREN_DEPENDANT Parent ======\n", GetName()); + fFull.PrintToStream(); + fVisible.PrintToStream(); +#endif + // because we're skipping one level, we need to do out // parent business as well. // our visible area is relative to our parent's parent. if (fParent->fParent) fVisible.IntersectWith(&(fParent->fParent->fVisible)); - +#ifdef DEBUG_LAYER_REBUILD + fVisible.PrintToStream(); +#endif // exclude parent's visible area which could be composed by // prior siblings' visible areas. if (fVisible.CountRects() > 0) fVisible.Exclude(&(fParent->fVisible)); - +#ifdef DEBUG_LAYER_REBUILD + fVisible.PrintToStream(); +#endif // we have a final visible area. Include it to our parent's one, // exclude from parent's parent. if (fVisible.CountRects() > 0){ fParent->fFullVisible.Include(&fVisible); +#ifdef DEBUG_LAYER_REBUILD + fParent->fFullVisible.PrintToStream(); +#endif if (fParent->fParent) fParent->fParent->fVisible.Exclude(&fVisible); +#ifdef DEBUG_LAYER_REBUILD + fParent->fParent->fVisible.PrintToStream(); +#endif } +#ifdef DEBUG_LAYER_REBUILD + printf("\n ======= Layer(%s)::B_LAYER_CHILDREN_DEPENDANT Parent END ======\n", GetName()); +#endif } // for 95+% of cases else{ +#ifdef DEBUG_LAYER_REBUILD + printf("\n ======= Layer(%s):: (!)B_LAYER_CHILDREN_DEPENDANT Parent ======\n", GetName()); +#endif // the visible area is the one common with parent's one. fVisible.IntersectWith(&(fParent->fVisible)); // exclude from parent's visible area. we're the owners now. diff --git a/src/servers/app/server/Layer.h b/src/servers/app/server/Layer.h index 3ee055ee3a..ca3e22aa2d 100644 --- a/src/servers/app/server/Layer.h +++ b/src/servers/app/server/Layer.h @@ -17,8 +17,11 @@ enum B_LAYER_SIMPLE_MOVE = 0x00004000UL, B_LAYER_RESIZE = 0x00008000UL, B_LAYER_MASK_RESIZE = 0x00010000UL, +}; - B_LAYER_CHILDREN_DEPENDANT = 0x10000000UL, +enum +{ + B_LAYER_CHILDREN_DEPENDANT = 0x1000U, }; class ServerWindow; diff --git a/src/servers/app/server/ServerWindow.cpp b/src/servers/app/server/ServerWindow.cpp index 5eec31ece3..0ef0a4ffc6 100644 --- a/src/servers/app/server/ServerWindow.cpp +++ b/src/servers/app/server/ServerWindow.cpp @@ -49,7 +49,7 @@ #include "CursorManager.h" #include "Workspace.h" -#define DEBUG_SERVERWINDOW +//#define DEBUG_SERVERWINDOW //#define DEBUG_SERVERWINDOW_MOUSE //#define DEBUG_SERVERWINDOW_KEYBOARD @@ -309,6 +309,15 @@ void ServerWindow::Show(void) ws->BringToFrontANormalWindow(fWinBorder); ws->SearchAndSetNewFront(fWinBorder); ws->SetFocusLayer(fWinBorder); +// TODO: this is UGLY. +// Normaly you have to easy pass a "FullInvalidate". But in this case, WinBorder +// is children dependant, so we CANOT rely on ANY region (full, fullVisible, visible) +// You have to figure out a way to do this 'internaly', I mean add support in +// Layer::FullInvalidate or Layer::[Start]RebuildRegions() + +// What we are doinf here is BAD. We pass a rectangle instead of a region. Some areas may +// ger redrawed while there is no need for that!!! + fWinBorder->fParent->FullInvalidate(fWinBorder->fFull.Frame()); } } } @@ -722,7 +731,8 @@ Layer * ServerWindow::CreateLayerTree(Layer *localRoot) delete name; // there is no way of setting this, other than manually :-) - newLayer->fHidden = hidden; +printf("Layer (%s) hidden : %d?\n", fTitle.String(), hidden); + newLayer->fHidden = (hidden == 0)? false: true; int32 dummyMsg; diff --git a/src/servers/app/server/WinBorder.cpp b/src/servers/app/server/WinBorder.cpp index 622125fc73..531fda5186 100644 --- a/src/servers/app/server/WinBorder.cpp +++ b/src/servers/app/server/WinBorder.cpp @@ -46,7 +46,7 @@ // TODO: Document this file completely // Toggle general function call output -#define DEBUG_WINBORDER +//#define DEBUG_WINBORDER // toggle //#define DEBUG_WINBORDER_MOUSE @@ -112,7 +112,7 @@ WinBorder::WinBorder(const BRect &r, const char *name, const int32 look, const i WinBorder::~WinBorder(void) { - STRACE(("WinBorder(%s):~WinBorder()\n",GetName())); + STRACE(("WinBorder(%s)::~WinBorder()\n",GetName())); if (fDecorator) { delete fDecorator; @@ -122,7 +122,7 @@ WinBorder::~WinBorder(void) void WinBorder::RebuildFullRegion(void) { - STRACE(("WinBorder(%s):~RebuildFullRegion()\n",GetName())); + STRACE(("WinBorder(%s)::RebuildFullRegion()\n",GetName())); fFull.MakeEmpty(); diff --git a/src/servers/app/server/Workspace.cpp b/src/servers/app/server/Workspace.cpp index 647f9bb4e1..73d6999d66 100644 --- a/src/servers/app/server/Workspace.cpp +++ b/src/servers/app/server/Workspace.cpp @@ -20,7 +20,7 @@ // DEALINGS IN THE SOFTWARE. // // File Name: Workspace.cpp -// Author: Adi Oanca +// Author: Adi Oanca // Description: Tracks workspaces // //------------------------------------------------------------------------------ @@ -251,17 +251,8 @@ STRACE(("\n@Workspace(%ld)::SetFOCUSLayer( %s )\n", ID(), layer? layer->GetName( if (FocusLayer()){ FocusLayer()->HighlightDecorator(true); } - -// TODO: there had to be a Invalidate() vresion witch takes a BRegion parameter -STRACESTREAM(); - Invalidate(); } - else{ - // Do nothing! - } - STRACE(("\n#Workspace(%ld)::SetFOCUSLayer( %s ) ENDED\n", ID(), layer? layer->GetName(): "NULL")); - return FocusLayer(); } //--------------------------------------------------------------------------- @@ -277,7 +268,7 @@ STRACE(("\n@Workspace(%ld)::SetFrontLayer( %s )\n", ID(), layer? layer->GetName( SearchAndSetNewFront(layer); STRACESTREAM(); -// TODO: there had to be a Invalidate() vresion witch takes a BRegion parameter +// TODO: remove??? Invalidate(); return fFrontItem? fFrontItem->layerPtr: NULL;; @@ -337,7 +328,7 @@ WinBorder* Workspace::SearchWinBorder(BPoint pt){ // For the moment, take windows from front to back and see in witch one 'pt' falls WinBorder *target = NULL; opLock.Lock(); - STRACE(("Searching (%f,%f) in...\n", pt.x, pt.y)); + for( WinBorder *wb = GoToBottomItem(); wb; wb = GoToUpperItem()){ // wb->PrintToStream(); if (!wb->IsHidden() && wb->HasPoint(pt)){