From 4f4af1fe7944d96add4d0b3c5bc738073b49e4aa Mon Sep 17 00:00:00 2001 From: DarkWyrm Date: Fri, 11 Jun 2004 18:21:57 +0000 Subject: [PATCH] Janitorial work -- mostly moving style closer to OT guidelines git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7912 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/server/Desktop.cpp | 6 +- src/servers/app/server/Layer.cpp | 1441 +++++++++++++---------- src/servers/app/server/Layer.h | 211 ++-- src/servers/app/server/RootLayer.cpp | 52 +- src/servers/app/server/ServerWindow.cpp | 228 ++-- src/servers/app/server/WinBorder.cpp | 66 +- src/servers/app/server/WinBorder.h | 2 +- src/servers/app/server/Workspace.cpp | 90 +- 8 files changed, 1129 insertions(+), 967 deletions(-) diff --git a/src/servers/app/server/Desktop.cpp b/src/servers/app/server/Desktop.cpp index 9444499b46..f468387839 100644 --- a/src/servers/app/server/Desktop.cpp +++ b/src/servers/app/server/Desktop.cpp @@ -255,7 +255,7 @@ void Desktop::AddWinBorder(WinBorder* winBorder) return; // special case for Tracker background window. - if (winBorder->_level == B_SYSTEM_LAST) + if (winBorder->fLevel == B_SYSTEM_LAST) { // it's added in all RottLayers for(int32 i=0; i_level == B_SYSTEM_LAST) + if(winBorder->fLevel == B_SYSTEM_LAST) { for(int32 i=0; iRemoveWinBorder(winBorder); @@ -835,7 +835,7 @@ void Desktop::RemoveSubsetWindow(WinBorder* wb) for(int32 i=0; i < count; i++) { winBorder = static_cast(fWinBorderList.ItemAt(i)); - if (winBorder->_level == B_NORMAL_FEEL) + if (winBorder->fLevel == B_NORMAL_FEEL) winBorder->Window()->fWinFMWList.RemoveItem(wb); } fLayerLock.Unlock(); diff --git a/src/servers/app/server/Layer.cpp b/src/servers/app/server/Layer.cpp index 88b4b8f7f4..11293e5775 100644 --- a/src/servers/app/server/Layer.cpp +++ b/src/servers/app/server/Layer.cpp @@ -28,10 +28,12 @@ # define RBTRACE(x) ; #endif -BRegion gRedrawReg; -BList gCopyRegList; -BList gCopyList; -enum{ +BRegion gRedrawReg; +BList gCopyRegList; +BList gCopyList; + +enum +{ B_LAYER_NONE = 0x00001000UL, B_LAYER_MOVE = 0x00002000UL, B_LAYER_SIMPLE_MOVE = 0x00004000UL, @@ -42,17 +44,17 @@ enum{ Layer::Layer(BRect frame, const char *name, int32 token, uint32 resize, uint32 flags, DisplayDriver *driver) { - // frame is in _parent coordinates + // frame is in fParent coordinates if(frame.IsValid()) - _frame = frame; + fFrame = frame; else // TODO: Decorator class should have a method witch returns the minimum frame width. - _frame.Set(0.0f, 0.0f, 5.0f, 5.0f); + fFrame.Set(0.0f, 0.0f, 5.0f, 5.0f); - _boundsLeftTop.Set( 0.0f, 0.0f ); + fBoundsLeftTop.Set( 0.0f, 0.0f ); - _name = new BString(name); - _layerdata = new LayerData(); + fName = new BString(name); + fLayerData = new LayerData(); // driver init if (!driver) @@ -60,217 +62,260 @@ Layer::Layer(BRect frame, const char *name, int32 token, uint32 resize, fDriver = driver; // Layer does not start out as a part of the tree - _parent = NULL; - _uppersibling = NULL; - _lowersibling = NULL; - _topchild = NULL; - _bottomchild = NULL; + fParent = NULL; + fUpperSibling = NULL; + fLowerSibling = NULL; + fTopChild = NULL; + fBottomChild = NULL; - fCurrent = NULL; - fRootLayer = NULL; + fCurrent = NULL; + fRootLayer = NULL; - _flags = flags; - _resize_mode = resize; - _hidden = false; - _is_updating = false; - fIsTopLayer = false; - _level = 0; - _view_token = token; + fFlags = flags; + fResizeMode = resize; + fHidden = false; - _serverwin = NULL; + fIsUpdating = false; + fIsTopLayer = false; + fLevel = 0; + + fViewToken = token; + fServerWin = NULL; clipToPicture = NULL; - - /* NOW all regions (_visible, _fullVisible, _full) are empty */ + + // NOW all regions (fVisible, fFullVisible, fFull) are empty STRACE(("Layer(%s) successfuly created\n", GetName())); } //! Destructor frees all allocated heap space Layer::~Layer(void) { - if(_layerdata) + if(fLayerData) { - delete _layerdata; - _layerdata = NULL; + delete fLayerData; + fLayerData = NULL; } - - if(_name) + + if(fName) { - delete _name; - _name = NULL; + delete fName; + fName = NULL; } - -// TODO: uncomment! + + // TODO: uncomment! //PruneTree(); - -// _serverwin->RemoveChild(fDriver); + +// fServerWin->RemoveChild(fDriver); // delete fDriver; - + if (clipToPicture) { delete clipToPicture; clipToPicture = NULL; -// TODO: allocate and relase a ServerPicture Object. + + // TODO: allocate and release a ServerPicture Object. } } void Layer::AddChild(Layer *layer, RootLayer *rootLayer) { -STRACE(("Layer(%s)::AddChild(%s) START\n", GetName(), layer->GetName())); - if( layer->_parent != NULL ) { - printf("ERROR: AddChild(): Layer already has a _parent\n"); + STRACE(("Layer(%s)::AddChild(%s) START\n", GetName(), layer->GetName())); + + if( layer->fParent != NULL ) + { + printf("ERROR: AddChild(): Layer already has a parent\n"); return; } - - // attach layer to the tree structure - layer->_parent = this; - if( _bottomchild ){ - layer->_uppersibling = _bottomchild; - _bottomchild->_lowersibling = layer; + + // attach layer to the tree structure + layer->fParent = this; + if( fBottomChild ) + { + layer->fUpperSibling = fBottomChild; + fBottomChild->fLowerSibling = layer; } - else{ - _topchild = layer; + else + { + fTopChild = layer; } - _bottomchild = layer; + fBottomChild = layer; layer->SetRootLayer(fRootLayer); - // higher level objects like RootLayers do not have ServerWindow objects attached - // This is in case o a WinBorder object which already has a valid _serverwin memeber. - if(!(layer->_serverwin)) - layer->SetServerWindow(this->SearchForServerWindow()); - layer->RebuildFullRegion(); - Layer *c = layer->_topchild; //c = short for: current - Layer *stop = layer; + // higher level objects like RootLayers do not have ServerWindow objects attached + // This is in case o a WinBorder object which already has a valid fServerWin member. + if(!(layer->fServerWin)) + layer->SetServerWindow(this->SearchForServerWindow()); + + layer->RebuildFullRegion(); + + //c = short for: current + Layer *c = layer->fTopChild; + Layer *stop = layer; if( c != NULL ) - while( true ){ + { + while( true ) + { // action block { c->SetRootLayer(fRootLayer); c->SetServerWindow(c->SearchForServerWindow()); c->RebuildFullRegion(); } - + // tree parsing algorithm - // go deep - if( c->_topchild ){ - c = c->_topchild; + + // go deep + if( c->fTopChild ) + { + c = c->fTopChild; } - // go right or up else + { + // go right or up + + if( c->fLowerSibling ) + { // go right - if( c->_lowersibling ){ - c = c->_lowersibling; + c = c->fLowerSibling; } + else + { // go up - else{ - while( !c->_parent->_lowersibling && c->_parent != stop ){ - c = c->_parent; - } - // that enough! We've reached this view. - if( c->_parent == stop ) + while( !c->fParent->fLowerSibling && c->fParent != stop ) + c = c->fParent; + + // that enough! We've reached this view. + if( c->fParent == stop ) break; - c = c->_parent->_lowersibling; + c = c->fParent->fLowerSibling; } + } } - - if ( !(layer->IsHidden()) && layer->fRootLayer && !IsHidden()){ - FullInvalidate( layer->_full ); } -STRACE(("Layer(%s)::AddChild(%s) END\n", GetName(), layer->GetName())); + + if ( !(layer->IsHidden()) && layer->fRootLayer && !IsHidden()) + FullInvalidate( layer->fFull ); + + STRACE(("Layer(%s)::AddChild(%s) END\n", GetName(), layer->GetName())); } void Layer::RemoveChild(Layer *layer) { -STRACE(("Layer(%s)::RemoveChild(%s) START\n", GetName(), layer->GetName())); - if( layer->_parent == NULL ){ - printf("ERROR: RemoveChild(): Layer doesn't have a _parent\n"); + STRACE(("Layer(%s)::RemoveChild(%s) START\n", GetName(), layer->GetName())); + + if( layer->fParent == NULL ) + { + printf("ERROR: RemoveChild(): Layer doesn't have a fParent\n"); return; } - if( layer->_parent != this ){ + + if( layer->fParent != this ) + { printf("ERROR: RemoveChild(): Layer is not a child of this layer\n"); return; } - // Take care of _parent - layer->_parent = NULL; - if( _topchild == layer ) - _topchild = layer->_lowersibling; - if( _bottomchild == layer ) - _bottomchild = layer->_uppersibling; + // Take care of fParent + layer->fParent = NULL; + if( fTopChild == layer ) + fTopChild = layer->fLowerSibling; + + if( fBottomChild == layer ) + fBottomChild = layer->fUpperSibling; // Take care of siblings - if( layer->_uppersibling != NULL ) - layer->_uppersibling->_lowersibling = layer->_lowersibling; - if( layer->_lowersibling != NULL ) - layer->_lowersibling->_uppersibling = layer->_uppersibling; - layer->_uppersibling = NULL; - layer->_lowersibling = NULL; - - Layer *c = layer->_topchild; //c = short for: current - Layer *stop = layer; + if( layer->fUpperSibling != NULL ) + layer->fUpperSibling->fLowerSibling = layer->fLowerSibling; + + if( layer->fLowerSibling != NULL ) + layer->fLowerSibling->fUpperSibling = layer->fUpperSibling; + + layer->fUpperSibling = NULL; + layer->fLowerSibling = NULL; + + //c = short for: current + Layer *c = layer->fTopChild; + Layer *stop = layer; if( c != NULL ) - while( true ){ + { + while( true ) + { // action block { c->SetRootLayer(NULL); c->SetServerWindow(NULL); - c->_full.MakeEmpty(); - c->_fullVisible.MakeEmpty(); - c->_visible.MakeEmpty(); + c->fFull.MakeEmpty(); + c->fFullVisible.MakeEmpty(); + c->fVisible.MakeEmpty(); } // tree parsing algorithm + + if( c->fTopChild ) + { // go deep - if( c->_topchild ){ - c = c->_topchild; + c = c->fTopChild; } - // go right or up else + { + // go right or up + + if( c->fLowerSibling ) + { // go right - if( c->_lowersibling ){ - c = c->_lowersibling; + c = c->fLowerSibling; } + else + { // go up - else{ - while( !c->_parent->_lowersibling && c->_parent != stop ){ - c = c->_parent; - } - // that enough! We've reached this view. - if( c->_parent == stop ) + + while( !c->fParent->fLowerSibling && c->fParent != stop ) + c = c->fParent; + + // that's enough! We've reached this view. + if( c->fParent == stop ) break; - - c = c->_parent->_lowersibling; + + c = c->fParent->fLowerSibling; } + } } - - if ( !(layer->IsHidden()) && layer->fRootLayer){ - PrintTree(); - FullInvalidate( layer->_fullVisible ); } - - layer->fRootLayer = NULL; - layer->_serverwin = NULL; - layer->_full.MakeEmpty(); - layer->_fullVisible.MakeEmpty(); - layer->_visible.MakeEmpty(); -STRACE(("Layer(%s)::RemoveChild(%s) END\n", GetName(), layer->GetName())); + + if ( !(layer->IsHidden()) && layer->fRootLayer) + { + PrintTree(); + FullInvalidate( layer->fFullVisible ); + } + + layer->fRootLayer = NULL; + layer->fServerWin = NULL; + layer->fFull.MakeEmpty(); + layer->fFullVisible.MakeEmpty(); + layer->fVisible.MakeEmpty(); + + STRACE(("Layer(%s)::RemoveChild(%s) END\n", GetName(), layer->GetName())); } void Layer::RemoveSelf() { // A Layer removes itself from the tree (duh) - if( _parent == NULL ){ - printf("ERROR: RemoveSelf(): Layer doesn't have a _parent\n"); + if( fParent == NULL ) + { + printf("ERROR: RemoveSelf(): Layer doesn't have a fParent\n"); return; } - _parent->RemoveChild(this); + fParent->RemoveChild(this); } -bool Layer::HasChild(Layer* layer){ - for(Layer *lay = VirtualTopChild(); lay; lay = VirtualLowerSibling()){ +bool Layer::HasChild(Layer* layer) +{ + for(Layer *lay = VirtualTopChild(); lay; lay = VirtualLowerSibling()) + { if(lay == layer) return true; } @@ -279,72 +324,74 @@ bool Layer::HasChild(Layer* layer){ Layer* Layer::LayerAt(const BPoint &pt) { - if (_visible.Contains(pt)){ + if (fVisible.Contains(pt)) return this; - } - - if (_fullVisible.Contains(pt)){ - Layer *lay = NULL; - for ( Layer* child = VirtualBottomChild(); child; child = VirtualUpperSibling() ){ - if ( (lay = child->LayerAt( pt )) ) + + if (fFullVisible.Contains(pt)) + { + Layer *lay = NULL; + for ( Layer* child = VirtualBottomChild(); child; child = VirtualUpperSibling() ) + { + lay = child->LayerAt( pt ); + if (lay) return lay; } } - + return NULL; } BRect Layer::Bounds(void) const { - BRect r(_frame); - r.OffsetTo( _boundsLeftTop ); + BRect r(fFrame); + r.OffsetTo( fBoundsLeftTop ); return r; } BRect Layer::Frame(void) const { - return _frame; + return fFrame; } void Layer::PruneTree(void) { - Layer *lay, - *nextlay; - - lay = _topchild; - _topchild = NULL; + Layer *lay; + Layer *nextlay; + + lay = fTopChild; + fTopChild = NULL; while(lay != NULL) { - if(lay->_topchild != NULL) { + if(lay->fTopChild != NULL) lay->PruneTree(); - } - nextlay = lay->_lowersibling; - lay->_lowersibling = NULL; - + + nextlay = lay->fLowerSibling; + lay->fLowerSibling = NULL; + delete lay; - lay = nextlay; + lay = nextlay; } // Man, this thing is short. Elegant, ain't it? :P } -Layer* Layer::FindLayer(const int32 token) +Layer *Layer::FindLayer(const int32 token) { // recursive search for a layer based on its view token - Layer *lay, - *trylay; - + Layer *lay; + Layer *trylay; + // Search child layers first for(lay = VirtualTopChild(); lay; lay = VirtualLowerSibling()) { - if(lay->_view_token == token) + if(lay->fViewToken == token) return lay; } // Hmmm... not in this layer's children. Try lower descendants for(lay = VirtualTopChild(); lay != NULL; lay = VirtualLowerSibling()) { - trylay = lay->FindLayer(token); + trylay = lay->FindLayer(token); if(trylay) return trylay; } @@ -353,16 +400,18 @@ Layer* Layer::FindLayer(const int32 token) return NULL; } -void Layer::SetServerWindow(ServerWindow *win){ - _serverwin = win; +void Layer::SetServerWindow(ServerWindow *win) +{ + fServerWin = win; } -ServerWindow* Layer::SearchForServerWindow() const { - if (_serverwin) - return _serverwin; +ServerWindow* Layer::SearchForServerWindow() const +{ + if (fServerWin) + return fServerWin; - if(_parent) - return _parent->SearchForServerWindow(); + if(fParent) + return fParent->SearchForServerWindow(); return NULL; } @@ -374,125 +423,142 @@ void Layer::FullInvalidate(const BRect &rect) void Layer::FullInvalidate(const BRegion& region) { -STRACE(("Layer(%s)::FullInvalidate():\n", GetName())); -#ifdef DEBUG_LAYER - region.PrintToStream(); - printf("\n"); -#endif + STRACE(("Layer(%s)::FullInvalidate():\n", GetName())); + #ifdef DEBUG_LAYER + region.PrintToStream(); + printf("\n"); + #endif - BPoint pt(0,0); + BPoint pt(0,0); StartRebuildRegions(region, NULL,/* B_LAYER_INVALIDATE, pt); */B_LAYER_NONE, pt); - + Redraw(gRedrawReg); - + EmptyGlobals(); } void Layer::Invalidate(const BRegion& region) { -STRACE(("Layer(%s)::Invalidate():\n", GetName())); -#ifdef DEBUG_LAYER - region.PrintToStream(); - printf("\n"); -#endif - + STRACE(("Layer(%s)::Invalidate():\n", GetName())); + #ifdef DEBUG_LAYER + region.PrintToStream(); + printf("\n"); + #endif + gRedrawReg = region; - + Redraw(gRedrawReg); - + EmptyGlobals(); } void Layer::Redraw(const BRegion& reg, Layer *startFrom) { -STRACE(("Layer(%s)::Redraw();\n", GetName())); - BRegion *pReg = const_cast(®); + STRACE(("Layer(%s)::Redraw();\n", GetName())); + + BRegion *pReg = const_cast(®); - if(_serverwin){ - if (pReg->CountRects() > 0){ + if(fServerWin) + { + if (pReg->CountRects() > 0) RequestClientUpdate(reg, startFrom); - } + } + else + { // call Draw() for all server layers - else{ - if (pReg->CountRects() > 0){ + if (pReg->CountRects() > 0) RequestDraw(reg, startFrom); - } + } -STRACE(("Layer::Redraw ENDED\n")); + + STRACE(("Layer::Redraw ENDED\n")); } -void Layer::RequestClientUpdate(const BRegion ®, Layer *startFrom){ -STRACE(("Layer(%s)::RequestClientUpdate()\n", GetName())); - if (IsHidden()){ +void Layer::RequestClientUpdate(const BRegion ®, Layer *startFrom) +{ + STRACE(("Layer(%s)::RequestClientUpdate()\n", GetName())); + + if (IsHidden()) + { // this layer has nothing visible on screen, so bail out. return; } -// TODO: remove! - if (_visible.CountRects() > 0){ - fUpdateReg = _visible; + + // TODO: remove + if (fVisible.CountRects() > 0) + { + fUpdateReg = fVisible; fUpdateReg.IntersectWith(®); - - // NOTE: CLEAR to the background color! - - // draw itself. - if (fUpdateReg.CountRects() > 0){ + + // NOTE: CLEAR to the background color! + + // draw itself. + if (fUpdateReg.CountRects() > 0) + { fDriver->ConstrainClippingRegion(&fUpdateReg); Draw(fUpdateReg.Frame()); fDriver->ConstrainClippingRegion(NULL); } - + fUpdateReg.MakeEmpty(); } return; - - -// TODO: use startFrom! - -// TODO: Do that! here? or after a message sent by the client just before calling BView::Draw(r) - // clear the area in the low color - // only the visible area is cleared, because DisplayDriver does the clipping to it. - // draw background, *only IF* our view color is different to B_TRANSPARENT_COLOR! - - BMessage msg; - - msg.what = _UPDATE_; - msg.AddInt32("_token", _view_token); + + + // TODO: use startFrom + + // TODO: Do that! here? or after a message sent by the client just before calling BView::Draw(r) + // clear the area in the low color + // only the visible area is cleared, because DisplayDriver does the clipping to it. + // draw background, *only IF* our view color is different to B_TRANSPARENT_COLOR! + + BMessage msg; + + msg.what = _UPDATE_; + msg.AddInt32("_token", fViewToken); msg.AddRect("_rect", ConvertFromTop(reg.Frame()) ); - // for test purposes only! + + // for test purposes only! msg.AddRect("_rect2", reg.Frame()); - _serverwin->SendMessageToClient( &msg ); + fServerWin->SendMessageToClient( &msg ); } void Layer::RequestDraw(const BRegion ®, Layer *startFrom, bool redraw) { -STRACE(("Layer(%s)::RequestDraw()\n", GetName())); - if (_visible.CountRects() > 0 && !IsHidden()){ - fUpdateReg = _visible; + STRACE(("Layer(%s)::RequestDraw()\n", GetName())); + + if (fVisible.CountRects() > 0 && !IsHidden()) + { + fUpdateReg = fVisible; fUpdateReg.IntersectWith(®); - - // NOTE: do not clear background for internal server layers! - - // draw itself. - if (fUpdateReg.CountRects() > 0){ + + // NOTE: do not clear background for internal server layers! + + // draw itself. + if (fUpdateReg.CountRects() > 0) + { fDriver->ConstrainClippingRegion(&fUpdateReg); Draw(fUpdateReg.Frame()); fDriver->ConstrainClippingRegion(NULL); } - + fUpdateReg.MakeEmpty(); } - // tell children to draw. YES, it's OK - if we're hidden don't tell children to draw + // tell children to draw. YES, it's OK - if we're hidden don't tell children to draw if (!IsHidden()) - for (Layer *lay = VirtualBottomChild(); lay != NULL; lay = VirtualUpperSibling()){ - if (!redraw && startFrom && lay == startFrom) - redraw = true; - - if ((startFrom && redraw) || !startFrom){ - if ( !(lay->IsHidden()) ){ - lay->RequestDraw( reg, startFrom, redraw ); + { + for (Layer *lay = VirtualBottomChild(); lay != NULL; lay = VirtualUpperSibling()) + { + if (!redraw && startFrom && lay == startFrom) + redraw = true; + + if ((startFrom && redraw) || !startFrom) + { + if ( !(lay->IsHidden()) ) + lay->RequestDraw( reg, startFrom, redraw ); } } } @@ -500,585 +566,671 @@ STRACE(("Layer(%s)::RequestDraw()\n", GetName())); void Layer::Draw(const BRect &r) { -// TODO/NOTE: this should be an empty method! the next lines are for testing only -STRACE(("Layer::Draw() Called\n")); -// RGBColor col(152,102,51); -// DRIVER->FillRect_(r, 1, col, &fUpdateReg); -//snooze(1000000); - fDriver->FillRect(r, _layerdata->viewcolor); - + // TODO/NOTE: this should be an empty method! the next lines are for testing only + + STRACE(("Layer::Draw() Called\n")); + + // RGBColor col(152,102,51); + // DRIVER->FillRect_(r, 1, col, &fUpdateReg); + //snooze(1000000); + fDriver->FillRect(r, fLayerData->viewcolor); + // empty HOOK function. } -void Layer::Show(void) +void Layer::Show(bool invalidate) { -STRACE(("Layer(%s)::Show()\n", GetName())); + STRACE(("Layer(%s)::Show()\n", GetName())); if( !IsHidden() ) return; - _hidden = false; - - if(_parent) - _parent->FullInvalidate(_full); - else - FullInvalidate( _full ); + fHidden = false; + + if(invalidate) + { + if(fParent) + fParent->FullInvalidate(fFull); + else + FullInvalidate( fFull ); + } } -void Layer::Hide(void) +void Layer::Hide(bool invalidate) { -STRACE(("Layer(%s)::Hide()\n", GetName())); + STRACE(("Layer(%s)::Hide()\n", GetName())); if ( IsHidden() ) return; - - _hidden = true; - - Layer *c = _topchild; //c = short for: current - Layer *stop = this; + + fHidden = true; + + //c = short for: current + Layer *c = fTopChild; + Layer *stop = this; if( c != NULL ) - while( true ){ + { + while(1) + { // action block { - c->_fullVisible.MakeEmpty(); - c->_visible.MakeEmpty(); + c->fFullVisible.MakeEmpty(); + c->fVisible.MakeEmpty(); } - + // tree parsing algorithm + + if( c->fTopChild ) + { // go deep - if( c->_topchild ){ - c = c->_topchild; + c = c->fTopChild; } - // go right or up else + { + // go right or up + if( c->fLowerSibling ) + { // go right - if( c->_lowersibling ){ - c = c->_lowersibling; + c = c->fLowerSibling; } + else + { // go up - else{ - while( !c->_parent->_lowersibling && c->_parent != stop ){ - c = c->_parent; - } - // that enough! We've reached this view. - if( c->_parent == stop ) + while( !c->fParent->fLowerSibling && c->fParent != stop ) + c = c->fParent; + + // that's enough! We've reached this view. + if( c->fParent == stop ) break; - c = c->_parent->_lowersibling; + c = c->fParent->fLowerSibling; } + } } - - if(_parent) - _parent->FullInvalidate( _fullVisible ); - else - FullInvalidate( _fullVisible ); - - _fullVisible.MakeEmpty(); - _visible.MakeEmpty(); + } + + if(invalidate) + { + if(fParent) + fParent->FullInvalidate( fFullVisible ); + else + FullInvalidate( fFullVisible ); + } + fFullVisible.MakeEmpty(); + fVisible.MakeEmpty(); } bool Layer::IsHidden(void) const { - if (_hidden) + if (fHidden) return true; else - if (_parent) - return _parent->IsHidden(); - + { + if (fParent) + return fParent->IsHidden(); + } + return false; } uint32 Layer::CountChildren(void) const { - uint32 i = 0; - Layer *lay = VirtualTopChild(); + uint32 i = 0; + Layer *lay = VirtualTopChild(); while(lay != NULL) { - lay = VirtualLowerSibling(); + lay = VirtualLowerSibling(); i++; } return i; } -void Layer::RebuildFullRegion( ){ -STRACE(("Layer(%s)::RebuildFullRegion()\n", GetName())); - if (_parent) - _full.Set( _parent->ConvertToTop( _frame ) ); +void Layer::RebuildFullRegion( ) +{ + STRACE(("Layer(%s)::RebuildFullRegion()\n", GetName())); + + if (fParent) + fFull.Set( fParent->ConvertToTop( fFrame ) ); else - _full.Set( _frame ); - -// TODO: Convert to screen coordinates! - LayerData *ld; - ld = _layerdata; - do{ - // clip to user region + fFull.Set( fFrame ); + + // TODO: Convert to screen coordinates! + LayerData *ld; + ld = fLayerData; + do + { + // clip to user region if(ld->clipReg) - _full.IntersectWith( ld->clipReg ); + fFull.IntersectWith( ld->clipReg ); } while( (ld = ld->prevState) ); - - // clip to user picture region + + // clip to user picture region if(clipToPicture) - if(clipToPictureInverse) { - _full.Exclude( clipToPicture ); - } - else{ - _full.IntersectWith( clipToPicture ); - } - - if(IsTopLayer() && _serverwin){ - if (_serverwin->fWinBorder->fDecorator){ - // decorator overlaping topLayer? make decorator be in front. - _full.Exclude( _serverwin->fWinBorder->fDecFull ); + { + if(clipToPictureInverse) + fFull.Exclude( clipToPicture ); + else + fFull.IntersectWith( clipToPicture ); + } + + if(IsTopLayer() && fServerWin) + { + if (fServerWin->fWinBorder->fDecorator) + { + // decorator overlapping topLayer? put decorator in front. + fFull.Exclude( fServerWin->fWinBorder->fDecFull ); } } } void Layer::RebuildRegions( const BRegion& reg, uint32 action, BPoint pt, BPoint ptOffset) { -STRACE(("Layer(%s)::RebuildRegions() START\n", GetName())); -//NOTE: this method must be executed as fast as possible. - // Currently SendView[Moved/Resized]Msg() simply constructs a message and calls - // ServerWindow::SendMessageToClient() - // this involves the alternative use of kernel and this code in the CPU, so, a lot - // of context switches. This is NOT good at all! - // One alternative would be the use of a BMessageQueue per ServerWindows OR only - // one for app_server which will be emptied as soon as this critical operation ended. - // Talk to DW, Gabe. - - BRegion oldRegion; - uint32 newAction = action; - BPoint newPt = pt; - BPoint newOffset = ptOffset; // used for resizing only + STRACE(("Layer(%s)::RebuildRegions() START\n", GetName())); - BPoint dummyNewLocation; + //NOTE: this method must be executed as quickly as possible. + + + // Currently SendView[Moved/Resized]Msg() simply constructs a message and calls + // ServerWindow::SendMessageToClient(). This involves the alternative use of + // kernel and this code in the CPU, so there are a lot of context switches. + // This is NOT good at all! + + // One alternative would be the use of a BMessageQueue per ServerWindows OR only + // one for app_server which will be emptied as soon as this critical operation ended. + // Talk to DW, Gabe. + + BRegion oldRegion; + uint32 newAction = action; + BPoint newPt = pt; + BPoint newOffset = ptOffset; // used for resizing only + + BPoint dummyNewLocation; RRLabel1: - switch(action){ - case B_LAYER_NONE:{ -RBTRACE(("1) Action B_LAYER_NONE\n")); - oldRegion = _visible; + switch(action) + { + case B_LAYER_NONE: + { + RBTRACE(("1) Action B_LAYER_NONE\n")); + oldRegion = fVisible; break; } - case B_LAYER_MOVE:{ -RBTRACE(("1) Action B_LAYER_MOVE\n")); - oldRegion = _fullVisible; - _frame.OffsetBy(pt.x, pt.y); - _full.OffsetBy(pt.x, pt.y); -// TODO: uncomment later when you'll implement a queue in ServerWindow::SendMessgeToClient() + case B_LAYER_MOVE: + { + RBTRACE(("1) Action B_LAYER_MOVE\n")); + oldRegion = fFullVisible; + fFrame.OffsetBy(pt.x, pt.y); + fFull.OffsetBy(pt.x, pt.y); + + // TODO: uncomment later when you'll implement a queue in ServerWindow::SendMessgeToClient() //SendViewMovedMsg(); newAction = B_LAYER_SIMPLE_MOVE; break; } - case B_LAYER_SIMPLE_MOVE:{ -RBTRACE(("1) Action B_LAYER_SIMPLE_MOVE\n")); - _full.OffsetBy(pt.x, pt.y); - + case B_LAYER_SIMPLE_MOVE: + { + RBTRACE(("1) Action B_LAYER_SIMPLE_MOVE\n")); + fFull.OffsetBy(pt.x, pt.y); + break; } - case B_LAYER_RESIZE:{ -RBTRACE(("1) Action B_LAYER_RESIZE\n")); - oldRegion = _visible; - - _frame.right += pt.x; - _frame.bottom += pt.y; + case B_LAYER_RESIZE: + { + RBTRACE(("1) Action B_LAYER_RESIZE\n")); + oldRegion = fVisible; + + fFrame.right += pt.x; + fFrame.bottom += pt.y; RebuildFullRegion(); -// TODO: uncomment later when you'll implement a queue in ServerWindow::SendMessgeToClient() + + // TODO: uncomment later when you'll implement a queue in ServerWindow::SendMessgeToClient() //SendViewResizedMsg(); - - newAction = B_LAYER_MASK_RESIZE; + + newAction = B_LAYER_MASK_RESIZE; break; } - case B_LAYER_MASK_RESIZE:{ -RBTRACE(("1) Action B_LAYER_MASK_RESIZE\n")); - oldRegion = _visible; - - BPoint offset, rSize; - BPoint coords[2]; - + case B_LAYER_MASK_RESIZE: + { + RBTRACE(("1) Action B_LAYER_MASK_RESIZE\n")); + oldRegion = fVisible; + + BPoint offset, rSize; + BPoint coords[2]; + ResizeOthers(pt.x, pt.y, coords, NULL); - offset = coords[0]; - rSize = coords[1]; - newOffset = offset + ptOffset; - - if(!(rSize.x == 0.0f && rSize.y == 0.0f)){ - _frame.OffsetBy(offset); - _frame.right += rSize.x; - _frame.bottom += rSize.y; + offset = coords[0]; + rSize = coords[1]; + newOffset = offset + ptOffset; + + if(!(rSize.x == 0.0f && rSize.y == 0.0f)) + { + fFrame.OffsetBy(offset); + fFrame.right += rSize.x; + fFrame.bottom += rSize.y; RebuildFullRegion(); -// TODO: uncomment later when you'll implement a queue in ServerWindow::SendMessgeToClient() + + // TODO: uncomment later when you'll implement a queue in ServerWindow::SendMessgeToClient() //SendViewResizedMsg(); - newAction = B_LAYER_MASK_RESIZE; - newPt = rSize; + newAction = B_LAYER_MASK_RESIZE; + newPt = rSize; dummyNewLocation = newOffset; } - else if (!(offset.x == 0.0f && offset.y == 0.0f)){ - pt = newOffset; - action = B_LAYER_MOVE; - newPt = pt; - goto RRLabel1; - } - else{ - pt = ptOffset; - action = B_LAYER_MOVE; - newPt = pt; - goto RRLabel1; + else + { + if (!(offset.x == 0.0f && offset.y == 0.0f)) + { + pt = newOffset; + action = B_LAYER_MOVE; + newPt = pt; + goto RRLabel1; + } + else + { + pt = ptOffset; + action = B_LAYER_MOVE; + newPt = pt; + goto RRLabel1; + } } break; } } - if (!IsHidden()){ - _visible = _full; - if (_parent){ - _visible.IntersectWith( &(_parent->_visible) ); - // exclude from parent's visible area. - if ( !IsHidden() && _visible.CountRects() > 0) - _parent->_visible.Exclude( &(_visible) ); - } - _fullVisible = _visible; - } - - // Rebuild regions for children... - for(Layer *lay = VirtualBottomChild(); lay != NULL; lay = VirtualUpperSibling()) + if (!IsHidden()) { - lay->RebuildRegions(reg, newAction, newPt, newOffset); - } - - if(!IsHidden()) - switch(action){ - case B_LAYER_NONE:{ - BRegion r(_visible); - if (oldRegion.CountRects() > 0) - r.Exclude(&oldRegion); - - if(r.CountRects() > 0){ - gRedrawReg.Include(&r); - } - break; - } - case B_LAYER_MOVE:{ - BRegion redrawReg; - BRegion *copyReg = new BRegion(); - BRegion screenReg(fRootLayer->Bounds()); - - oldRegion.OffsetBy(pt.x, pt.y); - oldRegion.IntersectWith(&_fullVisible); - - *copyReg = oldRegion; - copyReg->IntersectWith(&screenReg); - if(copyReg->CountRects() > 0 && !(pt.x == 0.0f && pt.y == 0.0f) ){ - copyReg->OffsetBy(-pt.x, -pt.y); - BPoint *point = new BPoint(pt); - gCopyRegList.AddItem(copyReg); - gCopyList.AddItem(point); - } - else{ - delete copyReg; - } - - redrawReg = _fullVisible; - redrawReg.Exclude(&oldRegion); - if(redrawReg.CountRects() > 0 && !(pt.x == 0.0f && pt.y == 0.0f) ){ - gRedrawReg.Include(&redrawReg); - } - - break; - } - case B_LAYER_RESIZE:{ - BRegion redrawReg; + fVisible = fFull; + if (fParent) + { + fVisible.IntersectWith( &(fParent->fVisible) ); - redrawReg = _visible; - redrawReg.Exclude(&oldRegion); - if(redrawReg.CountRects() > 0){ - gRedrawReg.Include(&redrawReg); - } - - break; + // exclude from parent's visible area. + if ( !IsHidden() && fVisible.CountRects() > 0) + fParent->fVisible.Exclude( &(fVisible) ); } - case B_LAYER_MASK_RESIZE:{ - BRegion redrawReg; - BRegion *copyReg = new BRegion(); - - oldRegion.OffsetBy(dummyNewLocation.x, dummyNewLocation.y); - - redrawReg = _visible; - redrawReg.Exclude(&oldRegion); - if(redrawReg.CountRects() > 0) + fFullVisible = fVisible; + } + + // Rebuild regions for children... + for(Layer *lay = VirtualBottomChild(); lay != NULL; lay = VirtualUpperSibling()) + lay->RebuildRegions(reg, newAction, newPt, newOffset); + + if(!IsHidden()) + { + switch(action) + { + case B_LAYER_NONE: { - gRedrawReg.Include(&redrawReg); + BRegion r(fVisible); + if (oldRegion.CountRects() > 0) + r.Exclude(&oldRegion); + + if(r.CountRects() > 0) + gRedrawReg.Include(&r); + break; } - - *copyReg = _visible; - copyReg->IntersectWith(&oldRegion); - copyReg->OffsetBy(-dummyNewLocation.x, -dummyNewLocation.y); - if(copyReg->CountRects() > 0 - && !(dummyNewLocation.x == 0.0f && dummyNewLocation.y == 0.0f)) + case B_LAYER_MOVE: { - gCopyRegList.AddItem(copyReg); - gCopyList.AddItem(new BPoint(dummyNewLocation)); + BRegion redrawReg; + BRegion *copyReg = new BRegion(); + BRegion screenReg(fRootLayer->Bounds()); + + oldRegion.OffsetBy(pt.x, pt.y); + oldRegion.IntersectWith(&fFullVisible); + + *copyReg = oldRegion; + copyReg->IntersectWith(&screenReg); + if(copyReg->CountRects() > 0 && !(pt.x == 0.0f && pt.y == 0.0f) ) + { + copyReg->OffsetBy(-pt.x, -pt.y); + BPoint *point = new BPoint(pt); + gCopyRegList.AddItem(copyReg); + gCopyList.AddItem(point); + } + else + { + delete copyReg; + } + + redrawReg = fFullVisible; + redrawReg.Exclude(&oldRegion); + if(redrawReg.CountRects() > 0 && !(pt.x == 0.0f && pt.y == 0.0f) ) + { + gRedrawReg.Include(&redrawReg); + } + + break; + } + case B_LAYER_RESIZE: + { + BRegion redrawReg; + + redrawReg = fVisible; + redrawReg.Exclude(&oldRegion); + if(redrawReg.CountRects() > 0) + gRedrawReg.Include(&redrawReg); + + break; + } + case B_LAYER_MASK_RESIZE: + { + BRegion redrawReg; + BRegion *copyReg = new BRegion(); + + oldRegion.OffsetBy(dummyNewLocation.x, dummyNewLocation.y); + + redrawReg = fVisible; + redrawReg.Exclude(&oldRegion); + if(redrawReg.CountRects() > 0) + { + gRedrawReg.Include(&redrawReg); + } + + *copyReg = fVisible; + copyReg->IntersectWith(&oldRegion); + copyReg->OffsetBy(-dummyNewLocation.x, -dummyNewLocation.y); + if(copyReg->CountRects() > 0 + && !(dummyNewLocation.x == 0.0f && dummyNewLocation.y == 0.0f)) + { + gCopyRegList.AddItem(copyReg); + gCopyList.AddItem(new BPoint(dummyNewLocation)); + } + + break; + } + default: + { + break; } - - break; - } - default:{ } } -//if (IsHidden()){ -// _fullVisible.MakeEmpty(); -// _visible.MakeEmpty(); -//} -#ifdef DEBUG_LAYER_REBUILD - printf("\n ======= Layer(%s)::RR finals ======\n", GetName()); - oldRegion.PrintToStream(); - _full.PrintToStream(); - _fullVisible.PrintToStream(); - _visible.PrintToStream(); - printf("==========RedrawReg===========\n"); - gRedrawReg.PrintToStream(); - printf("=====================\n"); -#endif -STRACE(("Layer(%s)::RebuildRegions() END\n", GetName())); +/* if (IsHidden()) + { + fFullVisible.MakeEmpty(); + fVisible.MakeEmpty(); + } +*/ + + #ifdef DEBUG_LAYER_REBUILD + printf("\n ======= Layer(%s)::RR finals ======\n", GetName()); + oldRegion.PrintToStream(); + fFull.PrintToStream(); + fFullVisible.PrintToStream(); + fVisible.PrintToStream(); + printf("==========RedrawReg===========\n"); + gRedrawReg.PrintToStream(); + printf("=====================\n"); + #endif + + STRACE(("Layer(%s)::RebuildRegions() END\n", GetName())); } void Layer::StartRebuildRegions( const BRegion& reg, Layer *target, uint32 action, BPoint& pt) { -STRACE(("Layer(%s)::StartRebuildRegions() START\n", GetName())); - if(!_parent) - _fullVisible = _full; - - BRegion oldVisible = _visible; - - _visible = _fullVisible; - - // Rebuild regions for children... + STRACE(("Layer(%s)::StartRebuildRegions() START\n", GetName())); + if(!fParent) + fFullVisible = fFull; + + BRegion oldVisible = fVisible; + + fVisible = fFullVisible; + + // Rebuild regions for children... for(Layer *lay = VirtualBottomChild(); lay != NULL; lay = VirtualUpperSibling()) { - if (lay == target){ + if (lay == target) lay->RebuildRegions(reg, action, pt, BPoint(0.0f, 0.0f)); - } - else{ + else lay->RebuildRegions(reg, B_LAYER_NONE, pt, BPoint(0.0f, 0.0f)); - } } -#ifdef DEBUG_LAYER_REBUILD - printf("\n ===!=== Layer(%s)::SRR finals ===!===\n", GetName()); - _full.PrintToStream(); - _fullVisible.PrintToStream(); - _visible.PrintToStream(); - oldVisible.PrintToStream(); - printf("=====!=====RedrawReg=====!=====\n"); - gRedrawReg.PrintToStream(); - printf("=====================\n"); -#endif - - BRegion redrawReg(_visible); - // if this is the first time - if (oldVisible.CountRects() > 0){ + + #ifdef DEBUG_LAYER_REBUILD + printf("\n ===!=== Layer(%s)::SRR finals ===!===\n", GetName()); + fFull.PrintToStream(); + fFullVisible.PrintToStream(); + fVisible.PrintToStream(); + oldVisible.PrintToStream(); + printf("=====!=====RedrawReg=====!=====\n"); + gRedrawReg.PrintToStream(); + printf("=====================\n"); + #endif + + BRegion redrawReg(fVisible); + + // if this is the first time + if (oldVisible.CountRects() > 0) redrawReg.Exclude(&oldVisible); - } + gRedrawReg.Include(&redrawReg); -#ifdef DEBUG_LAYER_REBUILD - printf("Layer(%s)::StartRebuildREgions() ended! Redraw Region:\n", GetName()); - gRedrawReg.PrintToStream(); - printf("\n"); - printf("Layer(%s)::StartRebuildREgions() ended! Copy Region:\n", GetName()); - for(int32 k=0; kPrintToStream(); - ((BPoint*)(gCopyList.ItemAt(k)))->PrintToStream(); - } - printf("\n"); -#endif + #ifdef DEBUG_LAYER_REBUILD + printf("Layer(%s)::StartRebuildREgions() ended! Redraw Region:\n", GetName()); + gRedrawReg.PrintToStream(); + printf("\n"); + printf("Layer(%s)::StartRebuildREgions() ended! Copy Region:\n", GetName()); + for(int32 k=0; kPrintToStream(); + ((BPoint*)(gCopyList.ItemAt(k)))->PrintToStream(); + } + printf("\n"); + #endif -STRACE(("Layer(%s)::StartRebuildRegions() END\n", GetName())); + STRACE(("Layer(%s)::StartRebuildRegions() END\n", GetName())); } void Layer::MoveBy(float x, float y) { -STRACE(("Layer(%s)::MoveBy() START\n", GetName())); - if(!_parent){ + STRACE(("Layer(%s)::MoveBy() START\n", GetName())); + if(!fParent) + { debugger("ERROR: in Layer::MoveBy()! - No parent!\n"); return; } - - BPoint pt(x,y); - BRect rect(_full.Frame().OffsetByCopy(pt)); - - _parent->StartRebuildRegions(BRegion(rect), this, B_LAYER_MOVE, pt); - fDriver->CopyRegionList(&gCopyRegList, &gCopyList, gCopyRegList.CountItems(), &_fullVisible); - - _parent->Redraw(gRedrawReg, this); - + BPoint pt(x,y); + BRect rect(fFull.Frame().OffsetByCopy(pt)); + + fParent->StartRebuildRegions(BRegion(rect), this, B_LAYER_MOVE, pt); + + fDriver->CopyRegionList(&gCopyRegList, &gCopyList, gCopyRegList.CountItems(), &fFullVisible); + fParent->Redraw(gRedrawReg, this); + EmptyGlobals(); -STRACE(("Layer(%s)::MoveBy() END\n", GetName())); + + STRACE(("Layer(%s)::MoveBy() END\n", GetName())); } -void Layer::EmptyGlobals(){ - void *item; - +void Layer::EmptyGlobals() +{ + void *item; + gRedrawReg.MakeEmpty(); - while((item = gCopyRegList.RemoveItem((int32)0))){ + + while((item = gCopyRegList.RemoveItem((int32)0))) delete (BRegion*)item; - } - - while((item = gCopyList.RemoveItem((int32)0))){ + + while((item = gCopyList.RemoveItem((int32)0))) delete (BPoint*)item; - } } -uint32 Layer::ResizeOthers(float x, float y, BPoint coords[], BPoint *ptOffset){ -STRACE(("Layer(%s)::ResizeOthers() START\n", GetName())); - uint32 rmask = _resize_mode; - // offset - coords[0].x = 0.0f; - coords[0].y = 0.0f; - // resize by width/height - coords[1].x = 0.0f; - coords[1].y = 0.0f; +uint32 Layer::ResizeOthers(float x, float y, BPoint coords[], BPoint *ptOffset) +{ + STRACE(("Layer(%s)::ResizeOthers() START\n", GetName())); + uint32 rmask = fResizeMode; + + // offset + coords[0].x = 0.0f; + coords[0].y = 0.0f; + + // resize by width/height + coords[1].x = 0.0f; + coords[1].y = 0.0f; if ((rmask & 0x00000f00UL)>>8 == _VIEW_LEFT_ - && (rmask & 0x0000000fUL)>>0 == _VIEW_RIGHT_){ + && (rmask & 0x0000000fUL)>>0 == _VIEW_RIGHT_) + { coords[1].x = x; } - else if ((rmask & 0x00000f00UL)>>8 == _VIEW_LEFT_){ + else + if ((rmask & 0x00000f00UL)>>8 == _VIEW_LEFT_) + { } - else if ((rmask & 0x0000000fUL)>>0 == _VIEW_RIGHT_){ + else + if ((rmask & 0x0000000fUL)>>0 == _VIEW_RIGHT_) + { coords[0].x = x; } - else if ((rmask & 0x00000f00UL)>>8 == _VIEW_CENTER_){ + else + if ((rmask & 0x00000f00UL)>>8 == _VIEW_CENTER_) + { coords[0].x = x/2; } - else { // illegal flag. Do nothing. + else + { + // illegal flag. Do nothing. } if ((rmask & 0x0000f000UL)>>12 == _VIEW_TOP_ - && (rmask & 0x000000f0UL)>>4 == _VIEW_BOTTOM_){ + && (rmask & 0x000000f0UL)>>4 == _VIEW_BOTTOM_) + { coords[1].y = y; } - else if ((rmask & 0x0000f000UL)>>12 == _VIEW_TOP_){ + else + if ((rmask & 0x0000f000UL)>>12 == _VIEW_TOP_) + { } - else if ((rmask & 0x000000f0UL)>>4 == _VIEW_BOTTOM_){ + else + if ((rmask & 0x000000f0UL)>>4 == _VIEW_BOTTOM_) + { coords[0].y = y; } - else if ((rmask & 0x0000f000UL)>>12 == _VIEW_CENTER_){ + else + if ((rmask & 0x0000f000UL)>>12 == _VIEW_CENTER_) + { coords[0].y = y/2; } - else { // illegal flag. Do nothing. + else + { + // illegal flag. Do nothing. } -STRACE(("Layer(%s)::ResizeOthers() END\n", GetName())); + STRACE(("Layer(%s)::ResizeOthers() END\n", GetName())); return 0UL; } void Layer::ResizeBy(float x, float y) { -STRACE(("Layer(%s)::ResizeBy() START\n", GetName())); - if(!_parent){ + STRACE(("Layer(%s)::ResizeBy() START\n", GetName())); + + if(!fParent) + { printf("ERROR: in Layer::MoveBy()! - No parent!\n"); return; } - - BPoint pt(x,y); - BRect rect(_full.Frame()); - rect.right += x; - rect.bottom += y; - - _parent->StartRebuildRegions(BRegion(rect), this, B_LAYER_RESIZE, pt); - fDriver->CopyRegionList(&gCopyRegList, &gCopyList, gCopyRegList.CountItems(), &_fullVisible); - - _parent->Redraw(gRedrawReg, this); - + BPoint pt(x,y); + BRect rect(fFull.Frame()); + rect.right += x; + rect.bottom += y; + + fParent->StartRebuildRegions(BRegion(rect), this, B_LAYER_RESIZE, pt); + + fDriver->CopyRegionList(&gCopyRegList, &gCopyList, gCopyRegList.CountItems(), &fFullVisible); + fParent->Redraw(gRedrawReg, this); + EmptyGlobals(); -STRACE(("Layer(%s)::ResizeBy() END\n", GetName())); + + STRACE(("Layer(%s)::ResizeBy() END\n", GetName())); } void Layer::PrintToStream(void) { - printf("\n----------- Layer %s -----------\n",_name->String()); - printf("\t Parent: %s\n", _parent? _parent->_name->String():"NULL"); + printf("\n----------- Layer %s -----------\n",fName->String()); + printf("\t Parent: %s\n", fParent? fParent->GetName():"NULL"); printf("\t us: %s\t ls: %s\n", - _uppersibling? _uppersibling->_name->String():"NULL", - _lowersibling? _lowersibling->_name->String():"NULL"); + fUpperSibling? fUpperSibling->GetName():"NULL", + fLowerSibling? fLowerSibling->GetName():"NULL"); printf("\t topChild: %s\t bottomChild: %s\n", - _topchild? _topchild->_name->String():"NULL", - _bottomchild? _bottomchild->_name->String():"NULL"); - - printf("Frame: (%f, %f, %f, %f)", _frame.left, _frame.top, _frame.right, _frame.bottom); - printf("Token: %ld\n",_view_token); - printf("Hidden - direct: %s\n", _hidden?"true":"false"); + fTopChild? fTopChild->GetName():"NULL", + fBottomChild? fBottomChild->GetName():"NULL"); + + printf("Frame: (%f, %f, %f, %f)", fFrame.left, fFrame.top, fFrame.right, fFrame.bottom); + printf("Token: %ld\n",fViewToken); + printf("Hidden - direct: %s\n", fHidden?"true":"false"); printf("Hidden - indirect: %s\n", IsHidden()?"true":"false"); - printf("ResizingMode: %lx\n", _resize_mode); - printf("Flags: %lx\n", _flags); - - if (_layerdata) - _layerdata->PrintToStream(); + printf("ResizingMode: %lx\n", fResizeMode); + printf("Flags: %lx\n", fFlags); + + if (fLayerData) + fLayerData->PrintToStream(); else printf(" NO LayerData valid pointer\n"); } void Layer::PrintNode(void) { - printf("-----------\nLayer %s\n",_name->String()); - if(_parent) - printf("Parent: %s (%p)\n",_parent->_name->String(), _parent); + printf("-----------\nLayer %s\n",fName->String()); + if(fParent) + printf("Parent: %s (%p)\n",fParent->GetName(), fParent); else printf("Parent: NULL\n"); - if(_uppersibling) - printf("Upper sibling: %s (%p)\n",_uppersibling->_name->String(), _uppersibling); + if(fUpperSibling) + printf("Upper sibling: %s (%p)\n",fUpperSibling->GetName(), fUpperSibling); else printf("Upper sibling: NULL\n"); - if(_lowersibling) - printf("Lower sibling: %s (%p)\n",_lowersibling->_name->String(), _lowersibling); + if(fLowerSibling) + printf("Lower sibling: %s (%p)\n",fLowerSibling->GetName(), fLowerSibling); else printf("Lower sibling: NULL\n"); - if(_topchild) - printf("Top child: %s (%p)\n",_topchild->_name->String(), _topchild); + if(fTopChild) + printf("Top child: %s (%p)\n",fTopChild->GetName(), fTopChild); else printf("Top child: NULL\n"); - if(_bottomchild) - printf("Bottom child: %s (%p)\n",_bottomchild->_name->String(), _bottomchild); + if(fBottomChild) + printf("Bottom child: %s (%p)\n",fBottomChild->GetName(), fBottomChild); else printf("Bottom child: NULL\n"); - printf("Visible Areas: "); _visible.PrintToStream(); + printf("Visible Areas: "); fVisible.PrintToStream(); } -void Layer::PrintTree(){ +void Layer::PrintTree() +{ printf("\n Tree structure:\n"); printf("\t%s\t%s\n", GetName(), IsHidden()? "Hidden": "NOT hidden"); for(Layer *lay = VirtualBottomChild(); lay != NULL; lay = VirtualUpperSibling()) - { printf("\t%s\t%s\n", lay->GetName(), lay->IsHidden()? "Hidden": "NOT hidden"); - } } BRect Layer::ConvertToParent(BRect rect) { - return (rect.OffsetByCopy(_frame.LeftTop())); + return (rect.OffsetByCopy(fFrame.LeftTop())); } BRegion Layer::ConvertToParent(BRegion *reg) { BRegion newreg; + for(int32 i=0; iCountRects(); i++) - newreg.Include( (reg->RectAt(i)).OffsetByCopy(_frame.LeftTop()) ); + newreg.Include( (reg->RectAt(i)).OffsetByCopy(fFrame.LeftTop()) ); + return newreg; } BRect Layer::ConvertFromParent(BRect rect) { - return (rect.OffsetByCopy(_frame.left*-1,_frame.top*-1)); + return (rect.OffsetByCopy(fFrame.left*-1,fFrame.top*-1)); } BRegion Layer::ConvertFromParent(BRegion *reg) { BRegion newreg; + for(int32 i=0; iCountRects();i++) - newreg.Include((reg->RectAt(i)).OffsetByCopy(_frame.left*-1,_frame.top*-1)); + newreg.Include((reg->RectAt(i)).OffsetByCopy(fFrame.left*-1,fFrame.top*-1)); + return newreg; } @@ -1092,8 +1244,8 @@ BRegion Layer::ConvertToTop(BRegion *reg) BRect Layer::ConvertToTop(BRect rect) { - if (_parent!=NULL) - return(_parent->ConvertToTop(rect.OffsetByCopy(_frame.LeftTop())) ); + if (fParent!=NULL) + return(fParent->ConvertToTop(rect.OffsetByCopy(fFrame.LeftTop())) ); else return(rect); } @@ -1101,65 +1253,74 @@ BRect Layer::ConvertToTop(BRect rect) BRegion Layer::ConvertFromTop(BRegion *reg) { BRegion newreg; + for(int32 i=0; iCountRects();i++) newreg.Include(ConvertFromTop(reg->RectAt(i))); + return newreg; } BRect Layer::ConvertFromTop(BRect rect) { - if (_parent!=NULL) - return(_parent->ConvertFromTop(rect.OffsetByCopy(_frame.LeftTop().x*-1, - _frame.LeftTop().y*-1)) ); + if (fParent!=NULL) + return(fParent->ConvertFromTop(rect.OffsetByCopy(fFrame.LeftTop().x*-1, + fFrame.LeftTop().y*-1)) ); else return(rect); } -void Layer::SendViewResizedMsg(){ - if( _serverwin && _flags & B_FRAME_EVENTS ) +void Layer::SendViewResizedMsg() +{ + if( fServerWin && fFlags & B_FRAME_EVENTS ) { - BMessage msg; - msg.what = B_VIEW_RESIZED; + BMessage msg; + msg.what = B_VIEW_RESIZED; msg.AddInt64( "when", real_time_clock_usecs() ); - msg.AddInt32( "_token", _view_token ); - msg.AddFloat( "width", _frame.Width() ); - msg.AddFloat( "height", _frame.Height() ); - // no need for that... it's here because of backward compatibility - msg.AddPoint( "where", _frame.LeftTop() ); + msg.AddInt32( "_token", fViewToken ); + msg.AddFloat( "width", fFrame.Width() ); + msg.AddFloat( "height", fFrame.Height() ); - _serverwin->SendMessageToClient( &msg ); + // no need for that... it's here because of backward compatibility + msg.AddPoint( "where", fFrame.LeftTop() ); + + fServerWin->SendMessageToClient( &msg ); } } -void Layer::SendViewMovedMsg(){ - if( _serverwin && _flags & B_FRAME_EVENTS ) +void Layer::SendViewMovedMsg() +{ + if( fServerWin && fFlags & B_FRAME_EVENTS ) { - BMessage msg; - msg.what = B_VIEW_MOVED; + BMessage msg; + msg.what = B_VIEW_MOVED; msg.AddInt64( "when", real_time_clock_usecs() ); - msg.AddInt32( "_token", _view_token ); - msg.AddPoint( "where", _frame.LeftTop() ); - - _serverwin->SendMessageToClient( &msg ); + msg.AddInt32( "_token", fViewToken ); + msg.AddPoint( "where", fFrame.LeftTop() ); + + fServerWin->SendMessageToClient( &msg ); } } -Layer* Layer::VirtualTopChild() const{ - fCurrent = _topchild; +Layer *Layer::VirtualTopChild() const +{ + fCurrent = fTopChild; return fCurrent; } -Layer* Layer::VirtualLowerSibling() const{ - fCurrent = fCurrent->_lowersibling; +Layer *Layer::VirtualLowerSibling() const +{ + fCurrent = fCurrent->fLowerSibling; return fCurrent; } -Layer* Layer::VirtualUpperSibling() const{ - fCurrent = fCurrent->_uppersibling; +Layer *Layer::VirtualUpperSibling() const +{ + fCurrent = fCurrent->fUpperSibling; return fCurrent; } -Layer* Layer::VirtualBottomChild() const{ - fCurrent = _bottomchild; +Layer* Layer::VirtualBottomChild() const +{ + fCurrent = fBottomChild; return fCurrent; } diff --git a/src/servers/app/server/Layer.h b/src/servers/app/server/Layer.h index bf92e7c525..665db3621e 100644 --- a/src/servers/app/server/Layer.h +++ b/src/servers/app/server/Layer.h @@ -12,89 +12,84 @@ class ServerWindow; class RootLayer; -//class MyDriver; class DisplayDriver; class LayerData; class Layer { public: - Layer(BRect frame, const char *name, int32 token, uint32 resize, - uint32 flags, DisplayDriver *driver); - virtual ~Layer(void); + Layer(BRect frame, const char *name, int32 token, uint32 resize, + uint32 flags, DisplayDriver *driver); + virtual ~Layer(void); - void AddChild(Layer *child, RootLayer *rootLayer = NULL); - void RemoveChild(Layer *child); - void RemoveSelf(); - bool HasChild(Layer* layer); - RootLayer* GetRootLayer() const { return fRootLayer; } - - uint32 CountChildren(void) const; - Layer* FindLayer(const int32 token); - Layer* LayerAt(const BPoint &pt); - bool IsTopLayer() { return fIsTopLayer; } - - virtual Layer* VirtualTopChild() const; - virtual Layer* VirtualLowerSibling() const; - virtual Layer* VirtualUpperSibling() const; - virtual Layer* VirtualBottomChild() const; - - const char* GetName(void) const { return (_name)?_name->String():NULL; } + void AddChild(Layer *child, RootLayer *rootLayer = NULL); + void RemoveChild(Layer *child); + void RemoveSelf(void); + bool HasChild(Layer *layer); + RootLayer *GetRootLayer(void) const { return fRootLayer; } + + uint32 CountChildren(void) const; + Layer *FindLayer(const int32 token); + Layer *LayerAt(const BPoint &pt); + bool IsTopLayer(void) { return fIsTopLayer; } + + virtual Layer *VirtualTopChild(void) const; + virtual Layer *VirtualLowerSibling(void) const; + virtual Layer *VirtualUpperSibling(void) const; + virtual Layer *VirtualBottomChild(void) const; + + const char *GetName(void) const { return (fName)?fName->String():NULL; } + + void FullInvalidate(const BRect &rect); + void FullInvalidate(const BRegion ®ion); + void Invalidate(const BRegion ®ion); + + virtual void RebuildFullRegion(void); + void StartRebuildRegions( const BRegion& reg, Layer *target, uint32 action, BPoint& pt); + void RebuildRegions( const BRegion& reg, uint32 action, BPoint pt, BPoint ptOffset); + uint32 ResizeOthers(float x, float y, BPoint coords[], BPoint *ptOffset); + + void Redraw(const BRegion& reg, Layer *startFrom=NULL); + + void EmptyGlobals(void); + + virtual void Draw(const BRect &r); + + void SendViewMovedMsg(void); + void SendViewResizedMsg(void); + + virtual void Show(bool invalidate=true); + virtual void Hide(bool invalidate=true); + bool IsHidden(void) const; + + BRect Bounds(void) const; + BRect Frame(void) const; + + virtual void MoveBy(float x, float y); + virtual void ResizeBy(float x, float y); + + BRect ConvertToParent(BRect rect); + BRegion ConvertToParent(BRegion *reg); + BRect ConvertFromParent(BRect rect); + BRegion ConvertFromParent(BRegion *reg); + BRegion ConvertToTop(BRegion *reg); + BRect ConvertToTop(BRect rect); + BRegion ConvertFromTop(BRegion *reg); + BRect ConvertFromTop(BRect rect); + + DisplayDriver *GetDisplayDriver(void) const { return fDriver; } + + void PruneTree(void); + + void PrintToStream(void); + void PrintNode(void); + void PrintTree(void); - void FullInvalidate(const BRect &rect); - void FullInvalidate(const BRegion ®ion); - void Invalidate(const BRegion ®ion); - - virtual void RebuildFullRegion(void); - void StartRebuildRegions( const BRegion& reg, Layer *target, uint32 action, BPoint& pt); - void RebuildRegions( const BRegion& reg, uint32 action, BPoint pt, BPoint ptOffset); - uint32 ResizeOthers(float x, float y, BPoint coords[], BPoint *ptOffset); - - void Redraw(const BRegion& reg, Layer *startFrom=NULL); - - void EmptyGlobals(); - - virtual void Draw(const BRect &r); - - void SendViewMovedMsg(); - void SendViewResizedMsg(); - - virtual void Show(void); - virtual void Hide(void); - bool IsHidden(void) const; - - BRect Bounds(void) const; - BRect Frame(void) const; - - virtual void MoveBy(float x, float y); - virtual void ResizeBy(float x, float y); - - BRect ConvertToParent(BRect rect); - BRegion ConvertToParent(BRegion *reg); - BRect ConvertFromParent(BRect rect); - BRegion ConvertFromParent(BRegion *reg); - BRegion ConvertToTop(BRegion *reg); - BRect ConvertToTop(BRect rect); - BRegion ConvertFromTop(BRegion *reg); - BRect ConvertFromTop(BRect rect); - - DisplayDriver* GetDisplayDriver() const { return fDriver; } - - void PruneTree(void); - - void PrintToStream(void); - void PrintNode(void); - void PrintTree(); - // server "private" - should not be used - void SetRootLayer(RootLayer* rl){ fRootLayer = rl; } - void SetServerWindow(ServerWindow *win); - void SetAsTopLayer(bool option) { fIsTopLayer = option; } - -private: - void RequestClientUpdate(const BRegion ®, Layer *startFrom); - void RequestDraw(const BRegion ®, Layer *startFrom, bool redraw=false); - ServerWindow* SearchForServerWindow() const; + void SetRootLayer(RootLayer *rl){ fRootLayer = rl; } + void SetServerWindow(ServerWindow *win); + void SetAsTopLayer(bool option) { fIsTopLayer = option; } + protected: friend class RootLayer; @@ -104,39 +99,45 @@ protected: friend class Desktop; friend class Workspace; - BRect _frame; - BPoint _boundsLeftTop; - Layer *_parent, - *_uppersibling, - *_lowersibling, - *_topchild, - *_bottomchild; + BRect fFrame; + BPoint fBoundsLeftTop; + Layer *fParent; + Layer *fUpperSibling; + Layer *fLowerSibling; + Layer *fTopChild; + Layer *fBottomChild; + + mutable Layer *fCurrent; + + BRegion fVisible; + BRegion fFullVisible; + BRegion fFull; + BRegion fUpdateReg; + + BRegion *clipToPicture; + bool clipToPictureInverse; + + ServerWindow *fServerWin; + BString *fName; + int32 fViewToken; + int32 fLevel; + uint32 fFlags; + uint32 fResizeMode; + bool fHidden; + bool fIsUpdating; + bool fIsTopLayer; + + DisplayDriver *fDriver; + LayerData *fLayerData; + //RGBColor fBackColor; + + RootLayer *fRootLayer; - mutable Layer *fCurrent; +private: + void RequestClientUpdate(const BRegion ®, Layer *startFrom); + void RequestDraw(const BRegion ®, Layer *startFrom, bool redraw=false); + ServerWindow *SearchForServerWindow(void) const; - BRegion _visible, - _fullVisible, - _full, - fUpdateReg; - - BRegion *clipToPicture; - bool clipToPictureInverse; - - ServerWindow *_serverwin; - BString *_name; - int32 _view_token; - int32 _level; - uint32 _flags; - uint32 _resize_mode; - bool _hidden; - bool _is_updating; - bool fIsTopLayer; - - DisplayDriver *fDriver; - LayerData *_layerdata; -// RGBColor fBackColor; - - RootLayer* fRootLayer; }; #endif diff --git a/src/servers/app/server/RootLayer.cpp b/src/servers/app/server/RootLayer.cpp index 73b8ad051d..36dd06ada8 100644 --- a/src/servers/app/server/RootLayer.cpp +++ b/src/servers/app/server/RootLayer.cpp @@ -71,8 +71,8 @@ RootLayer::RootLayer(const char *name, int32 workspaceCount, fScreenYResolution = 0; fColorSpace = B_RGB32; - _view_token = 0; // is this used for WinBorders? - _hidden = false; + fViewToken = 0; // is this used for WinBorders? + fHidden = false; SetWorkspaceCount(workspaceCount); } @@ -133,28 +133,28 @@ void RootLayer::Draw(const BRect &r) polygon[5].x = 200; polygon[5].y = 200; - _layerdata->highcolor.SetColor(255,0,0,255); - _layerdata->lowcolor.SetColor(255,255,255,255); - _driver->FillRect(r1,_layerdata,pattern); + fLayerData->highcolor.SetColor(255,0,0,255); + fLayerData->lowcolor.SetColor(255,255,255,255); + _driver->FillRect(r1,fLayerData,pattern); - _layerdata->highcolor.SetColor(255,255,0,255); - _driver->StrokeLine(BPoint(100,100),BPoint(1500,1100),_layerdata,pattern); + fLayerData->highcolor.SetColor(255,255,0,255); + _driver->StrokeLine(BPoint(100,100),BPoint(1500,1100),fLayerData,pattern); - _layerdata->highcolor.SetColor(0,0,255,255); - _driver->StrokeBezier(pts,_layerdata,pattern); - _driver->StrokeArc(BRect(200,300,400,600),30,270,_layerdata,pattern); - _driver->StrokeEllipse(BRect(200,700,400,900),_layerdata,pattern); - _driver->StrokeRect(BRect(650,1000,750,1090),_layerdata,pattern); - _driver->StrokeRoundRect(BRect(200,1000,600,1090),30,40,_layerdata,pattern); -// _driver->StrokePolygon(polygon,6,polygonRect,_layerdata,pattern); -// _driver->StrokeTriangle(triangle,triangleRect,_layerdata,pattern); - _layerdata->highcolor.SetColor(255,0,255,255); - _driver->FillArc(BRect(1250,300,1450,600),30,270,_layerdata,pattern); -// _driver->FillBezier(pts,_layerdata,pattern); - _driver->FillEllipse(BRect(800,300,1200,600),_layerdata,pattern); - _driver->FillRoundRect(BRect(800,1000,1200,1090),30,40,_layerdata,pattern2); - _driver->FillPolygon(polygon,6,polygonRect,_layerdata,pattern); -// _driver->FillTriangle(triangle,triangleRect,_layerdata,pattern); + fLayerData->highcolor.SetColor(0,0,255,255); + _driver->StrokeBezier(pts,fLayerData,pattern); + _driver->StrokeArc(BRect(200,300,400,600),30,270,fLayerData,pattern); + _driver->StrokeEllipse(BRect(200,700,400,900),fLayerData,pattern); + _driver->StrokeRect(BRect(650,1000,750,1090),fLayerData,pattern); + _driver->StrokeRoundRect(BRect(200,1000,600,1090),30,40,fLayerData,pattern); +// _driver->StrokePolygon(polygon,6,polygonRect,fLayerData,pattern); +// _driver->StrokeTriangle(triangle,triangleRect,fLayerData,pattern); + fLayerData->highcolor.SetColor(255,0,255,255); + _driver->FillArc(BRect(1250,300,1450,600),30,270,fLayerData,pattern); +// _driver->FillBezier(pts,fLayerData,pattern); + _driver->FillEllipse(BRect(800,300,1200,600),fLayerData,pattern); + _driver->FillRoundRect(BRect(800,1000,1200,1090),30,40,fLayerData,pattern2); + _driver->FillPolygon(polygon,6,polygonRect,fLayerData,pattern); +// _driver->FillTriangle(triangle,triangleRect,fLayerData,pattern); #endif // end DISPLAYDRIVER_TEST_HACK @@ -389,7 +389,7 @@ void RootLayer::RemoveWinBorder(WinBorder* winBorder) void RootLayer::ChangeWorkspacesFor(WinBorder* winBorder, uint32 newWorkspaces) { // only normal windows are affected by this change - if(!winBorder->_level != B_NORMAL_FEEL) + if(!winBorder->fLevel != B_NORMAL_FEEL) return; uint32 oldWorkspaces = winBorder->Window()->Workspaces(); @@ -489,7 +489,7 @@ void RootLayer::SetScreens(Screen *screen[], int32 rows, int32 columns) newFrame.right -= 1; newFrame.bottom -= 1; - _frame = newFrame; + fFrame = newFrame; fRows = rows; fColumns = columns; fScreenXResolution = (int32)(screen[0]->Resolution().x); @@ -645,14 +645,14 @@ void RootLayer::SetBGColor(const RGBColor &col) { ActiveWorkspace()->SetBGColor(col); - _layerdata->viewcolor = col; + fLayerData->viewcolor = col; // Invalidate(Frame()); } RGBColor RootLayer::BGColor(void) const { - return _layerdata->viewcolor; + return fLayerData->viewcolor; } void RootLayer::RemoveAppWindow(WinBorder *wb) diff --git a/src/servers/app/server/ServerWindow.cpp b/src/servers/app/server/ServerWindow.cpp index 3086658a15..eb2b3da0fd 100644 --- a/src/servers/app/server/ServerWindow.cpp +++ b/src/servers/app/server/ServerWindow.cpp @@ -287,8 +287,8 @@ void ServerWindow::Show(void) rl->fMainLock.Lock(); STRACE(("ServerWindow(%s)::Show() - Main lock acquired\n", fWinBorder->GetName())); - // manually set fWinBorder->_hidden to false because Layer's version also calls FullInvalidate. - fWinBorder->_hidden=false; + // manually set fWinBorder->fHidden to false because Layer's version also calls FullInvalidate. + fWinBorder->fHidden=false; if ( (fFeel == B_FLOATING_SUBSET_WINDOW_FEEL || fFeel == B_MODAL_SUBSET_WINDOW_FEEL) && fWinBorder->MainWinBorder() == NULL) @@ -578,56 +578,56 @@ void ServerWindow::SetLayerFontState(Layer *layer) // TODO: implement later. Currently there is no SetFamAndStyle(uint32) // in ServerFont class. DW, could you add one? - //layer->_layerdata->font-> + //layer->fLayerData->font-> } if (mask & B_FONT_SIZE) { float size; fSession->ReadFloat(&size); - layer->_layerdata->font.SetSize(size); + layer->fLayerData->font.SetSize(size); } if (mask & B_FONT_SHEAR) { float shear; fSession->ReadFloat(&shear); - layer->_layerdata->font.SetShear(shear); + layer->fLayerData->font.SetShear(shear); } if (mask & B_FONT_ROTATION) { float rotation; fSession->ReadFloat(&rotation); - layer->_layerdata->font.SetRotation(rotation); + layer->fLayerData->font.SetRotation(rotation); } if (mask & B_FONT_SPACING) { uint8 spacing; fSession->ReadUInt8(&spacing); - layer->_layerdata->font.SetSpacing(spacing); + layer->fLayerData->font.SetSpacing(spacing); } if (mask & B_FONT_ENCODING) { uint8 encoding; fSession->ReadUInt8((uint8*)&encoding); - layer->_layerdata->font.SetEncoding(encoding); + layer->fLayerData->font.SetEncoding(encoding); } if (mask & B_FONT_FACE) { uint16 face; fSession->ReadUInt16(&face); - layer->_layerdata->font.SetFace(face); + layer->fLayerData->font.SetFace(face); } if (mask & B_FONT_FLAGS) { uint32 flags; fSession->ReadUInt32(&flags); - layer->_layerdata->font.SetFlags(flags); + layer->fLayerData->font.SetFlags(flags); } STRACE(("DONE: ServerWindow %s: Message AS_LAYER_SET_FONT_STATE: Layer: %s\n", fTitle.String(), layer->_name->String())); @@ -639,49 +639,49 @@ void ServerWindow::SetLayerState(Layer *layer) pattern patt; int32 clipRegRects; - fSession->ReadPoint( &(layer->_layerdata->penlocation)); - fSession->ReadFloat( &(layer->_layerdata->pensize)); + fSession->ReadPoint( &(layer->fLayerData->penlocation)); + fSession->ReadFloat( &(layer->fLayerData->pensize)); fSession->ReadData( &highColor, sizeof(rgb_color)); fSession->ReadData( &lowColor, sizeof(rgb_color)); fSession->ReadData( &viewColor, sizeof(rgb_color)); fSession->ReadData( &patt, sizeof(pattern)); - fSession->ReadInt8((int8*) &(layer->_layerdata->draw_mode)); - fSession->ReadPoint( &(layer->_layerdata->coordOrigin)); - fSession->ReadInt8((int8*) &(layer->_layerdata->lineJoin)); - fSession->ReadInt8((int8*) &(layer->_layerdata->lineCap)); - fSession->ReadFloat( &(layer->_layerdata->miterLimit)); - fSession->ReadInt8((int8*) &(layer->_layerdata->alphaSrcMode)); - fSession->ReadInt8((int8*) &(layer->_layerdata->alphaFncMode)); - fSession->ReadFloat( &(layer->_layerdata->scale)); - fSession->ReadBool( &(layer->_layerdata->fontAliasing)); + fSession->ReadInt8((int8*) &(layer->fLayerData->draw_mode)); + fSession->ReadPoint( &(layer->fLayerData->coordOrigin)); + fSession->ReadInt8((int8*) &(layer->fLayerData->lineJoin)); + fSession->ReadInt8((int8*) &(layer->fLayerData->lineCap)); + fSession->ReadFloat( &(layer->fLayerData->miterLimit)); + fSession->ReadInt8((int8*) &(layer->fLayerData->alphaSrcMode)); + fSession->ReadInt8((int8*) &(layer->fLayerData->alphaFncMode)); + fSession->ReadFloat( &(layer->fLayerData->scale)); + fSession->ReadBool( &(layer->fLayerData->fontAliasing)); fSession->ReadInt32( &clipRegRects); - layer->_layerdata->patt.Set(*((uint64*)&patt)); - layer->_layerdata->highcolor.SetColor(highColor); - layer->_layerdata->lowcolor.SetColor(lowColor); - layer->_layerdata->viewcolor.SetColor(viewColor); + layer->fLayerData->patt.Set(*((uint64*)&patt)); + layer->fLayerData->highcolor.SetColor(highColor); + layer->fLayerData->lowcolor.SetColor(lowColor); + layer->fLayerData->viewcolor.SetColor(viewColor); if(clipRegRects != 0) { - if(layer->_layerdata->clipReg == NULL) - layer->_layerdata->clipReg = new BRegion(); + if(layer->fLayerData->clipReg == NULL) + layer->fLayerData->clipReg = new BRegion(); else - layer->_layerdata->clipReg->MakeEmpty(); + layer->fLayerData->clipReg->MakeEmpty(); BRect rect; for(int32 i = 0; i < clipRegRects; i++) { fSession->ReadRect(&rect); - layer->_layerdata->clipReg->Include(rect); + layer->fLayerData->clipReg->Include(rect); } } else { - if (layer->_layerdata->clipReg) + if (layer->fLayerData->clipReg) { - delete layer->_layerdata->clipReg; - layer->_layerdata->clipReg = NULL; + delete layer->fLayerData->clipReg; + layer->fLayerData->clipReg = NULL; } } STRACE(("DONE: ServerWindow %s: Message AS_LAYER_SET_STATE: Layer: %s\n",fTitle.String(), @@ -714,7 +714,7 @@ Layer * ServerWindow::CreateLayerTree(Layer *localRoot) delete name; // there is no way of setting this, other than manually :-) - newLayer->_hidden = hidden; + newLayer->fHidden = hidden; int32 dummyMsg; @@ -771,11 +771,11 @@ void ServerWindow::DispatchMessage(int32 code) BRegion region; src = sbmp->Bounds(); - dst = cl->_parent->ConvertFromParent(cl->_full.Frame()); - region = cl->_parent->ConvertFromParent(&(cl->_full)); + dst = cl->fParent->ConvertFromParent(cl->fFull.Frame()); + region = cl->fParent->ConvertFromParent(&(cl->fFull)); dst.OffsetBy(point); - cl->fDriver->DrawBitmap(®ion, sbmp, src, dst, cl->_layerdata); + cl->fDriver->DrawBitmap(®ion, sbmp, src, dst, cl->fLayerData); } // TODO: Adi -- shouldn't this sync with the client? @@ -796,11 +796,11 @@ void ServerWindow::DispatchMessage(int32 code) BRegion region; src = sbmp->Bounds(); - dst = cl->_parent->ConvertFromParent(cl->_full.Frame()); - region = cl->_parent->ConvertFromParent(&(cl->_full)); + dst = cl->fParent->ConvertFromParent(cl->fFull.Frame()); + region = cl->fParent->ConvertFromParent(&(cl->fFull)); dst.OffsetBy(point); - cl->fDriver->DrawBitmap(®ion, sbmp, src, dst, cl->_layerdata); + cl->fDriver->DrawBitmap(®ion, sbmp, src, dst, cl->fLayerData); } break; } @@ -818,11 +818,11 @@ void ServerWindow::DispatchMessage(int32 code) { BRegion region; BRect dst; - region = cl->_parent->ConvertFromParent(&(cl->_full)); - dst = cl->_parent->ConvertFromParent(cl->_full.Frame()); + region = cl->fParent->ConvertFromParent(&(cl->fFull)); + dst = cl->fParent->ConvertFromParent(cl->fFull.Frame()); dstRect.OffsetBy(dst.left, dst.top); - cl->fDriver->DrawBitmap(®ion, sbmp, srcRect, dstRect, cl->_layerdata); + cl->fDriver->DrawBitmap(®ion, sbmp, srcRect, dstRect, cl->fLayerData); } // TODO: Adi -- shouldn't this sync with the client? @@ -842,11 +842,11 @@ void ServerWindow::DispatchMessage(int32 code) { BRegion region; BRect dst; - region = cl->_parent->ConvertFromParent(&(cl->_full)); - dst = cl->_parent->ConvertFromParent(cl->_full.Frame()); + region = cl->fParent->ConvertFromParent(&(cl->fFull)); + dst = cl->fParent->ConvertFromParent(cl->fFull.Frame()); dstRect.OffsetBy(dst.left, dst.top); - cl->fDriver->DrawBitmap(®ion, sbmp, srcRect, dstRect, cl->_layerdata); + cl->fDriver->DrawBitmap(®ion, sbmp, srcRect, dstRect, cl->fLayerData); } break; } @@ -880,7 +880,7 @@ void ServerWindow::DispatchMessage(int32 code) STRACE(("ServerWindow %s: AS_LAYER_DELETE(self)...\n", fTitle.String())); Layer *parent; - parent = cl->_parent; + parent = cl->fParent; // here we remove current layer from list. cl->RemoveSelf(); @@ -917,7 +917,7 @@ void ServerWindow::DispatchMessage(int32 code) rgb_color hc, lc, vc; // high, low and view colors uint64 patt; // current pattern as a uint64 - ld = cl->_layerdata; // now we write fewer characters. :-) + ld = cl->fLayerData; // now we write fewer characters. :-) hc = ld->highcolor.GetColor32(); lc = ld->lowcolor.GetColor32(); vc = ld->viewcolor.GetColor32(); @@ -959,9 +959,9 @@ void ServerWindow::DispatchMessage(int32 code) for(int i = 0; i < noOfRects; i++) fSession->WriteRect(ld->clipReg->RectAt(i)); - fSession->WriteFloat(cl->_frame.left); - fSession->WriteFloat(cl->_frame.top); - fSession->WriteRect(cl->_frame.OffsetToCopy(cl->_boundsLeftTop)); + fSession->WriteFloat(cl->fFrame.left); + fSession->WriteFloat(cl->fFrame.top); + fSession->WriteRect(cl->fFrame.OffsetToCopy(cl->fBoundsLeftTop)); fSession->Sync(); STRACE(("ServerWindow %s: Message AS_LAYER_GET_STATE: Layer: %s\n",fTitle.String(), cl->_name->String())); @@ -994,9 +994,9 @@ void ServerWindow::DispatchMessage(int32 code) } case AS_LAYER_GET_COORD: { - fSession->WriteFloat(cl->_frame.left); - fSession->WriteFloat(cl->_frame.top); - fSession->WriteRect(cl->_frame.OffsetToCopy(cl->_boundsLeftTop)); + fSession->WriteFloat(cl->fFrame.left); + fSession->WriteFloat(cl->fFrame.top); + fSession->WriteRect(cl->fFrame.OffsetToCopy(cl->fBoundsLeftTop)); fSession->Sync(); STRACE(("ServerWindow %s: Message AS_LAYER_GET_COORD: Layer: %s\n",fTitle.String(), cl->_name->String())); @@ -1009,14 +1009,14 @@ void ServerWindow::DispatchMessage(int32 code) fSession->ReadFloat(&x); fSession->ReadFloat(&y); - cl->_layerdata->coordOrigin.Set(x, y); + cl->fLayerData->coordOrigin.Set(x, y); STRACE(("ServerWindow %s: Message AS_LAYER_SET_ORIGIN: Layer: %s\n",fTitle.String(), cl->_name->String())); break; } case AS_LAYER_GET_ORIGIN: { - fSession->WritePoint(cl->_layerdata->coordOrigin); + fSession->WritePoint(cl->fLayerData->coordOrigin); fSession->Sync(); STRACE(("ServerWindow %s: Message AS_LAYER_GET_ORIGIN: Layer: %s\n",fTitle.String(), cl->_name->String())); @@ -1024,7 +1024,7 @@ void ServerWindow::DispatchMessage(int32 code) } case AS_LAYER_RESIZE_MODE: { - fSession->ReadUInt32(&(cl->_resize_mode)); + fSession->ReadUInt32(&(cl->fResizeMode)); STRACE(("ServerWindow %s: Message AS_LAYER_RESIZE_MODE: Layer: %s\n",fTitle.String(), cl->_name->String())); break; @@ -1042,7 +1042,7 @@ void ServerWindow::DispatchMessage(int32 code) } case AS_LAYER_SET_FLAGS: { - fSession->ReadUInt32(&(cl->_flags)); + fSession->ReadUInt32(&(cl->fFlags)); STRACE(("ServerWindow %s: Message AS_LAYER_SET_FLAGS: Layer: %s\n",fTitle.String(), cl->_name->String())); break; @@ -1072,19 +1072,19 @@ void ServerWindow::DispatchMessage(int32 code) fSession->ReadInt8(&lineCap); fSession->ReadInt8(&lineJoin); - fSession->ReadFloat(&(cl->_layerdata->miterLimit)); + fSession->ReadFloat(&(cl->fLayerData->miterLimit)); - cl->_layerdata->lineCap = (cap_mode)lineCap; - cl->_layerdata->lineJoin = (join_mode)lineJoin; + cl->fLayerData->lineCap = (cap_mode)lineCap; + cl->fLayerData->lineJoin = (join_mode)lineJoin; STRACE(("ServerWindow %s: Message AS_LAYER_SET_LINE_MODE: Layer: %s\n",fTitle.String(), cl->_name->String())); break; } case AS_LAYER_GET_LINE_MODE: { - fSession->WriteInt8((int8)(cl->_layerdata->lineCap)); - fSession->WriteInt8((int8)(cl->_layerdata->lineJoin)); - fSession->WriteFloat(cl->_layerdata->miterLimit); + fSession->WriteInt8((int8)(cl->fLayerData->lineCap)); + fSession->WriteInt8((int8)(cl->fLayerData->lineJoin)); + fSession->WriteFloat(cl->fLayerData->miterLimit); fSession->Sync(); STRACE(("ServerWindow %s: Message AS_LAYER_GET_LINE_MODE: Layer: %s\n",fTitle.String(), cl->_name->String())); @@ -1093,8 +1093,8 @@ void ServerWindow::DispatchMessage(int32 code) case AS_LAYER_PUSH_STATE: { LayerData *ld = new LayerData(); - ld->prevState = cl->_layerdata; - cl->_layerdata = ld; + ld->prevState = cl->fLayerData; + cl->fLayerData = ld; cl->RebuildFullRegion(); @@ -1103,14 +1103,14 @@ void ServerWindow::DispatchMessage(int32 code) } case AS_LAYER_POP_STATE: { - if (!(cl->_layerdata->prevState)) + if (!(cl->fLayerData->prevState)) { STRACE(("WARNING: SW(%s): User called BView(%s)::PopState(), but there is NO state on stack!\n", fTitle.String(), cl->_name->String())); break; } - LayerData *ld = cl->_layerdata; - cl->_layerdata = cl->_layerdata->prevState; + LayerData *ld = cl->fLayerData; + cl->fLayerData = cl->fLayerData->prevState; delete ld; cl->RebuildFullRegion(); @@ -1120,14 +1120,14 @@ void ServerWindow::DispatchMessage(int32 code) } case AS_LAYER_SET_SCALE: { - fSession->ReadFloat(&(cl->_layerdata->scale)); + fSession->ReadFloat(&(cl->fLayerData->scale)); STRACE(("ServerWindow %s: Message AS_LAYER_SET_SCALE: Layer: %s\n",fTitle.String(), cl->_name->String())); break; } case AS_LAYER_GET_SCALE: { - LayerData *ld = cl->_layerdata; + LayerData *ld = cl->fLayerData; float scale = ld->scale; while((ld = ld->prevState)) @@ -1146,14 +1146,14 @@ void ServerWindow::DispatchMessage(int32 code) fSession->ReadFloat(&x); fSession->ReadFloat(&y); - cl->_layerdata->penlocation.Set(x, y); + cl->fLayerData->penlocation.Set(x, y); STRACE(("ServerWindow %s: Message AS_LAYER_SET_PEN_LOC: Layer: %s\n",fTitle.String(), cl->_name->String())); break; } case AS_LAYER_GET_PEN_LOC: { - fSession->WritePoint(cl->_layerdata->penlocation); + fSession->WritePoint(cl->fLayerData->penlocation); fSession->Sync(); STRACE(("ServerWindow %s: Message AS_LAYER_GET_PEN_LOC: Layer: %s\n",fTitle.String(), cl->_name->String())); @@ -1161,14 +1161,14 @@ void ServerWindow::DispatchMessage(int32 code) } case AS_LAYER_SET_PEN_SIZE: { - fSession->ReadFloat(&(cl->_layerdata->pensize)); + fSession->ReadFloat(&(cl->fLayerData->pensize)); STRACE(("ServerWindow %s: Message AS_LAYER_SET_PEN_SIZE: Layer: %s\n",fTitle.String(), cl->_name->String())); break; } case AS_LAYER_GET_PEN_SIZE: { - fSession->WriteFloat(cl->_layerdata->pensize); + fSession->WriteFloat(cl->fLayerData->pensize); fSession->Sync(); STRACE(("ServerWindow %s: Message AS_LAYER_GET_PEN_SIZE: Layer: %s\n",fTitle.String(), cl->_name->String())); @@ -1180,7 +1180,7 @@ void ServerWindow::DispatchMessage(int32 code) fSession->ReadData(&c, sizeof(rgb_color)); - cl->_layerdata->highcolor.SetColor(c); + cl->fLayerData->highcolor.SetColor(c); STRACE(("ServerWindow %s: Message AS_LAYER_SET_HIGH_COLOR: Layer: %s\n",fTitle.String(), cl->_name->String())); break; @@ -1191,7 +1191,7 @@ void ServerWindow::DispatchMessage(int32 code) fSession->ReadData(&c, sizeof(rgb_color)); - cl->_layerdata->lowcolor.SetColor(c); + cl->fLayerData->lowcolor.SetColor(c); STRACE(("ServerWindow %s: Message AS_LAYER_SET_LOW_COLOR: Layer: %s\n",fTitle.String(), cl->_name->String())); break; @@ -1202,9 +1202,9 @@ void ServerWindow::DispatchMessage(int32 code) fSession->ReadData(&c, sizeof(rgb_color)); - cl->_layerdata->viewcolor.SetColor(c); + cl->fLayerData->viewcolor.SetColor(c); - cl->Invalidate(cl->_visible); + cl->Invalidate(cl->fVisible); STRACE(("ServerWindow %s: Message AS_LAYER_SET_VIEW_COLOR: Layer: %s\n",fTitle.String(), cl->_name->String())); break; @@ -1213,9 +1213,9 @@ void ServerWindow::DispatchMessage(int32 code) { rgb_color highColor, lowColor, viewColor; - highColor = cl->_layerdata->highcolor.GetColor32(); - lowColor = cl->_layerdata->lowcolor.GetColor32(); - viewColor = cl->_layerdata->viewcolor.GetColor32(); + highColor = cl->fLayerData->highcolor.GetColor32(); + lowColor = cl->fLayerData->lowcolor.GetColor32(); + viewColor = cl->fLayerData->viewcolor.GetColor32(); fSession->WriteData(&highColor, sizeof(rgb_color)); fSession->WriteData(&lowColor, sizeof(rgb_color)); @@ -1232,16 +1232,16 @@ void ServerWindow::DispatchMessage(int32 code) fSession->ReadInt8(&srcAlpha); fSession->ReadInt8(&alphaFunc); - cl->_layerdata->alphaSrcMode = (source_alpha)srcAlpha; - cl->_layerdata->alphaFncMode = (alpha_function)alphaFunc; + cl->fLayerData->alphaSrcMode = (source_alpha)srcAlpha; + cl->fLayerData->alphaFncMode = (alpha_function)alphaFunc; STRACE(("ServerWindow %s: Message AS_LAYER_SET_BLEND_MODE: Layer: %s\n",fTitle.String(), cl->_name->String())); break; } case AS_LAYER_GET_BLEND_MODE: { - fSession->WriteInt8((int8)(cl->_layerdata->alphaSrcMode)); - fSession->WriteInt8((int8)(cl->_layerdata->alphaFncMode)); + fSession->WriteInt8((int8)(cl->fLayerData->alphaSrcMode)); + fSession->WriteInt8((int8)(cl->fLayerData->alphaFncMode)); fSession->Sync(); STRACE(("ServerWindow %s: Message AS_LAYER_GET_BLEND_MODE: Layer: %s\n",fTitle.String(), cl->_name->String())); @@ -1253,14 +1253,14 @@ void ServerWindow::DispatchMessage(int32 code) fSession->ReadInt8(&drawingMode); - cl->_layerdata->draw_mode = (drawing_mode)drawingMode; + cl->fLayerData->draw_mode = (drawing_mode)drawingMode; STRACE(("ServerWindow %s: Message AS_LAYER_SET_DRAW_MODE: Layer: %s\n",fTitle.String(), cl->_name->String())); break; } case AS_LAYER_GET_DRAW_MODE: { - fSession->WriteInt8((int8)(cl->_layerdata->draw_mode)); + fSession->WriteInt8((int8)(cl->fLayerData->draw_mode)); fSession->Sync(); STRACE(("ServerWindow %s: Message AS_LAYER_GET_DRAW_MODE: Layer: %s\n",fTitle.String(), cl->_name->String())); @@ -1268,7 +1268,7 @@ void ServerWindow::DispatchMessage(int32 code) } case AS_LAYER_PRINT_ALIASING: { - fSession->ReadBool(&(cl->_layerdata->fontAliasing)); + fSession->ReadBool(&(cl->fLayerData->fontAliasing)); STRACE(("ServerWindow %s: Message AS_LAYER_PRINT_ALIASING: Layer: %s\n",fTitle.String(), cl->_name->String())); break; @@ -1288,9 +1288,9 @@ void ServerWindow::DispatchMessage(int32 code) // if we had a picture to clip to, include the FULL visible region(if any) in the area to be redrawn // in other words: invalidate what ever is visible for this layer and his children. - if (cl->clipToPicture && cl->_fullVisible.CountRects() > 0) + if (cl->clipToPicture && cl->fFullVisible.CountRects() > 0) { - reg.Include(&cl->_fullVisible); + reg.Include(&cl->fFullVisible); redraw = true; } @@ -1299,7 +1299,7 @@ void ServerWindow::DispatchMessage(int32 code) int32 i = 0; while(1) { - sp=static_cast(cl->_serverwin->fServerApp->fPictureList->ItemAt(i++)); + sp=static_cast(cl->fServerWin->fServerApp->fPictureList->ItemAt(i++)); if (!sp) break; @@ -1323,20 +1323,20 @@ void ServerWindow::DispatchMessage(int32 code) } // we need to rebuild the visible region, we may have a valid one. - if (cl->_parent && !(cl->_hidden)) + if (cl->fParent && !(cl->fHidden)) { - //cl->_parent->RebuildChildRegions(cl->_full.Frame(), cl); + //cl->fParent->RebuildChildRegions(cl->fFull.Frame(), cl); } else { // will this happen? Maybe... - //cl->RebuildRegions(cl->_full.Frame()); + //cl->RebuildRegions(cl->fFull.Frame()); } // include our full visible region in the region to be redrawn - if (!(cl->_hidden) && (cl->_fullVisible.CountRects() > 0)) + if (!(cl->fHidden) && (cl->fFullVisible.CountRects() > 0)) { - reg.Include(&(cl->_fullVisible)); + reg.Include(&(cl->fFullVisible)); redraw = true; } @@ -1361,7 +1361,7 @@ void ServerWindow::DispatchMessage(int32 code) while(1) { - sp= static_cast(cl->_serverwin->fServerApp->fPictureList->ItemAt(i++)); + sp= static_cast(cl->fServerWin->fServerApp->fPictureList->ItemAt(i++)); if (!sp) break; @@ -1395,8 +1395,8 @@ void ServerWindow::DispatchMessage(int32 code) LayerData *ld; int32 noOfRects; - ld = cl->_layerdata; - reg = cl->ConvertFromParent(&(cl->_visible)); + ld = cl->fLayerData; + reg = cl->ConvertFromParent(&(cl->fVisible)); if(ld->clipReg) reg.IntersectWith(ld->clipReg); @@ -1424,17 +1424,17 @@ void ServerWindow::DispatchMessage(int32 code) int32 noOfRects; BRect r; - if(cl->_layerdata->clipReg) - cl->_layerdata->clipReg->MakeEmpty(); + if(cl->fLayerData->clipReg) + cl->fLayerData->clipReg->MakeEmpty(); else - cl->_layerdata->clipReg = new BRegion(); + cl->fLayerData->clipReg = new BRegion(); fSession->ReadInt32(&noOfRects); for(int i = 0; i < noOfRects; i++) { fSession->ReadRect(&r); - cl->_layerdata->clipReg->Include(r); + cl->fLayerData->clipReg->Include(r); } cl->RebuildFullRegion(); @@ -2306,43 +2306,43 @@ Layer* ServerWindow::FindLayer(const Layer* start, int32 token) const return NULL; // see if we're looking for 'start' - if(start->_view_token == token) + if(start->fViewToken == token) return const_cast(start); - Layer *c = start->_topchild; //c = short for: current + Layer *c = start->fTopChild; //c = short for: current if(c != NULL) while(true) { // action block { - if(c->_view_token == token) + if(c->fViewToken == token) return c; } // go deep - if( c->_topchild) + if( c->fTopChild) { - c = c->_topchild; + c = c->fTopChild; } // go right or up else // go right - if(c->_lowersibling) + if(c->fLowerSibling) { - c = c->_lowersibling; + c = c->fLowerSibling; } // go up else { - while(!c->_parent->_lowersibling && c->_parent != start) + while(!c->fParent->fLowerSibling && c->fParent != start) { - c = c->_parent; + c = c->fParent; } // that enough! We've reached the start layer. - if(c->_parent == start) + if(c->fParent == start) break; - c = c->_parent->_lowersibling; + c = c->fParent->fLowerSibling; } } diff --git a/src/servers/app/server/WinBorder.cpp b/src/servers/app/server/WinBorder.cpp index 90dd3d1ba5..a34f60accc 100644 --- a/src/servers/app/server/WinBorder.cpp +++ b/src/servers/app/server/WinBorder.cpp @@ -84,8 +84,8 @@ WinBorder::WinBorder(const BRect &r, const char *name, const int32 look, const i : Layer(r, name, B_NULL_TOKEN, B_FOLLOW_NONE, flags, driver) { // unlike BViews, windows start off as hidden - _hidden = true; - _serverwin = win; + fHidden = true; + fServerWin = win; fMouseButtons = 0; fKeyModifiers = 0; @@ -101,7 +101,7 @@ WinBorder::WinBorder(const BRect &r, const char *name, const int32 look, const i fLastMousePosition.Set(-1,-1); SetLevel(); - fNewTopLayerFrame = &(win->fTopLayer->_frame); + fNewTopLayerFrame = &(win->fTopLayer->fFrame); if (feel!= B_NO_BORDER_WINDOW_LOOK) { @@ -110,7 +110,7 @@ WinBorder::WinBorder(const BRect &r, const char *name, const int32 look, const i fDecorator->GetFootprint(fDecFull); } - _full.MakeEmpty(); + fFull.MakeEmpty(); STRACE(("WinBorder %s:\n",GetName())); STRACE(("\tFrame: (%.1f,%.1f,%.1f,%.1f)\n",r.left,r.top,r.right,r.bottom)); @@ -134,13 +134,13 @@ void WinBorder::RebuildFullRegion(void) { STRACE(("WinBorder(%s):~RebuildFullRegion()\n",GetName())); BRegion topLayerFull; - Layer *topLayer = _serverwin->fTopLayer; + Layer *topLayer = fServerWin->fTopLayer; topLayerFull.Set( ConvertToTop(*fNewTopLayerFrame) ); - fNewTopLayerFrame = &(_serverwin->fTopLayer->_frame); + fNewTopLayerFrame = &(fServerWin->fTopLayer->fFrame); // TODO: Convert to screen coordinates LayerData *ld; - ld = topLayer->_layerdata; + ld = topLayer->fLayerData; do { // clip to user region @@ -158,14 +158,14 @@ void WinBorder::RebuildFullRegion(void) topLayerFull.IntersectWith( topLayer->clipToPicture ); } - _full.MakeEmpty(); - _full = topLayerFull; + fFull.MakeEmpty(); + fFull = topLayerFull; if (fDecorator) { fDecFull->MakeEmpty(); fDecorator->GetFootprint(fDecFull); - _full.Include(fDecFull); + fFull.Include(fDecFull); } } @@ -371,7 +371,7 @@ void WinBorder::Draw(const BRect &r) if(fDecorator) { // decorator is allowed to draw in its entire visible region, not just in the update one. - fUpdateReg = _visible; + fUpdateReg = fVisible; fUpdateReg.IntersectWith(fDecFull); // restrict Decorator drawing to the update region only. fDriver->ConstrainClippingRegion(&fUpdateReg); @@ -410,7 +410,7 @@ void WinBorder::ResizeBy(float x, float y) if(fDecorator) fDecorator->ResizeBy(x,y); - BRect *localRect = new BRect(_serverwin->fTopLayer->_frame); + BRect *localRect = new BRect(fServerWin->fTopLayer->fFrame); fNewTopLayerFrame = localRect; // force topLayer's frame to resize @@ -423,7 +423,7 @@ void WinBorder::ResizeBy(float x, float y) bool WinBorder::HasPoint(BPoint& pt) const { - return _fullVisible.Contains(pt); + return fFullVisible.Contains(pt); } void WinBorder::SetMainWinBorder(WinBorder *newMain) @@ -437,28 +437,28 @@ WinBorder* WinBorder::MainWinBorder() const{ void WinBorder::SetLevel() { - switch(_serverwin->Feel()) + switch(fServerWin->Feel()) { case B_NORMAL_WINDOW_FEEL: - _level = B_NORMAL_FEEL; + fLevel = B_NORMAL_FEEL; break; case B_FLOATING_SUBSET_WINDOW_FEEL: - _level = B_FLOATING_SUBSET_FEEL; + fLevel = B_FLOATING_SUBSET_FEEL; break; case B_FLOATING_APP_WINDOW_FEEL: - _level = B_FLOATING_APP_FEEL; + fLevel = B_FLOATING_APP_FEEL; break; case B_FLOATING_ALL_WINDOW_FEEL: - _level = B_FLOATING_ALL_FEEL; + fLevel = B_FLOATING_ALL_FEEL; break; case B_MODAL_SUBSET_WINDOW_FEEL: - _level = B_MODAL_SUBSET_FEEL; + fLevel = B_MODAL_SUBSET_FEEL; break; case B_MODAL_APP_WINDOW_FEEL: - _level = B_MODAL_APP_FEEL; + fLevel = B_MODAL_APP_FEEL; break; case B_MODAL_ALL_WINDOW_FEEL: - _level = B_MODAL_ALL_FEEL; + fLevel = B_MODAL_ALL_FEEL; break; case B_SYSTEM_LAST: case B_SYSTEM_FIRST: @@ -467,11 +467,11 @@ void WinBorder::SetLevel() // if(_win->ServerTeamID() != _win->ClientTeamID()) // _win->QuietlySetFeel(B_NORMAL_WINDOW_FEEL); // else - _level = _serverwin->Feel(); + fLevel = fServerWin->Feel(); break; default: - _serverwin->QuietlySetFeel(B_NORMAL_WINDOW_FEEL); - _level = B_NORMAL_FEEL; + fServerWin->QuietlySetFeel(B_NORMAL_WINDOW_FEEL); + fLevel = B_NORMAL_FEEL; break; } } @@ -490,7 +490,7 @@ void WinBorder::AddToSubsetOf(WinBorder* main) { // if the main window is hidden also hide this one. if(main->IsHidden()) - _hidden = true; + fHidden = true; // add to main window's subset main->Window()->fWinFMWList.AddItem(this); @@ -577,28 +577,28 @@ void WinBorder::PrintToStream() { printf("\t%s", GetName()); - if (_level == B_FLOATING_SUBSET_FEEL) + if (fLevel == B_FLOATING_SUBSET_FEEL) printf("\t%s", "B_FLOATING_SUBSET_WINDOW_FEEL"); - if (_level == B_FLOATING_APP_FEEL) + if (fLevel == B_FLOATING_APP_FEEL) printf("\t%s", "B_FLOATING_APP_WINDOW_FEEL"); - if (_level == B_FLOATING_ALL_FEEL) + if (fLevel == B_FLOATING_ALL_FEEL) printf("\t%s", "B_FLOATING_ALL_WINDOW_FEEL"); - if (_level == B_MODAL_SUBSET_FEEL) + if (fLevel == B_MODAL_SUBSET_FEEL) printf("\t%s", "B_MODAL_SUBSET_WINDOW_FEEL"); - if (_level == B_MODAL_APP_FEEL) + if (fLevel == B_MODAL_APP_FEEL) printf("\t%s", "B_MODAL_APP_WINDOW_FEEL"); - if (_level == B_MODAL_ALL_FEEL) + if (fLevel == B_MODAL_ALL_FEEL) printf("\t%s", "B_MODAL_ALL_WINDOW_FEEL"); - if (_level == B_NORMAL_FEEL) + if (fLevel == B_NORMAL_FEEL) printf("\t%s", "B_NORMAL_WINDOW_FEEL"); - printf("\t%s\n", _hidden?"hidden" : "not hidden"); + printf("\t%s\n", fHidden?"hidden" : "not hidden"); } void WinBorder::UpdateColors(void) diff --git a/src/servers/app/server/WinBorder.h b/src/servers/app/server/WinBorder.h index 45da38312a..68dfad00b7 100644 --- a/src/servers/app/server/WinBorder.h +++ b/src/servers/app/server/WinBorder.h @@ -60,7 +60,7 @@ public: void UpdateFont(void); void UpdateScreen(void); - ServerWindow *Window(void) const { return _serverwin; } + ServerWindow *Window(void) const { return fServerWin; } Decorator *GetDecorator(void) const { return fDecorator; } WinBorder *MainWinBorder() const; diff --git a/src/servers/app/server/Workspace.cpp b/src/servers/app/server/Workspace.cpp index 8fceefd168..647f9bb4e1 100644 --- a/src/servers/app/server/Workspace.cpp +++ b/src/servers/app/server/Workspace.cpp @@ -150,12 +150,12 @@ STRACESTREAM(); SearchAndSetNewFront(nextItem? nextItem->layerPtr: NULL); // remove some windows. - if (item && item->layerPtr->_level == B_NORMAL_FEEL) + if (item && item->layerPtr->fLevel == B_NORMAL_FEEL) { ListData *listItem = item->lowerItem; - while(listItem && (listItem->layerPtr->_level == B_FLOATING_SUBSET_FEEL - || listItem->layerPtr->_level == B_FLOATING_APP_FEEL - || listItem->layerPtr->_level == B_MODAL_SUBSET_FEEL)) + while(listItem && (listItem->layerPtr->fLevel == B_FLOATING_SUBSET_FEEL + || listItem->layerPtr->fLevel == B_FLOATING_APP_FEEL + || listItem->layerPtr->fLevel == B_MODAL_SUBSET_FEEL)) { // *carefuly* remove the item from the list ListData *itemX = listItem; @@ -209,12 +209,12 @@ bool Workspace::HideSubsetWindows(WinBorder* layer){ //SearchAndSetNewFocus(nextItem? nextItem->layerPtr: NULL); // remove some windows. - if (item && item->layerPtr->_level == B_NORMAL_FEEL) + if (item && item->layerPtr->fLevel == B_NORMAL_FEEL) { ListData *listItem = item->lowerItem; - while(listItem && (listItem->layerPtr->_level == B_FLOATING_SUBSET_FEEL - || listItem->layerPtr->_level == B_FLOATING_APP_FEEL - || listItem->layerPtr->_level == B_MODAL_SUBSET_FEEL)) + while(listItem && (listItem->layerPtr->fLevel == B_FLOATING_SUBSET_FEEL + || listItem->layerPtr->fLevel == B_FLOATING_APP_FEEL + || listItem->layerPtr->fLevel == B_MODAL_SUBSET_FEEL)) { // *carefuly* remove the item from the list ListData *itemX = listItem; @@ -493,7 +493,7 @@ ListData* Workspace::FindPlace(ListData* pref){ switch(feel){ case B_NORMAL_WINDOW_FEEL:{ - while(cursor && cursor->layerPtr->_level > B_MODAL_APP_FEEL){ + while(cursor && cursor->layerPtr->fLevel > B_MODAL_APP_FEEL){ cursor = cursor->upperItem; } InsertItem(pref, cursor? cursor->lowerItem: NULL); @@ -501,7 +501,7 @@ ListData* Workspace::FindPlace(ListData* pref){ } case B_SYSTEM_LAST:{ - while(cursor && cursor->layerPtr->_level > pref->layerPtr->_level){ + while(cursor && cursor->layerPtr->fLevel > pref->layerPtr->fLevel){ cursor = cursor->upperItem; } InsertItem(pref, cursor? cursor->lowerItem: fTopItem); @@ -512,7 +512,7 @@ ListData* Workspace::FindPlace(ListData* pref){ case B_FLOATING_ALL_WINDOW_FEEL: case B_MODAL_ALL_WINDOW_FEEL: case B_MODAL_APP_WINDOW_FEEL:{ - while(cursor && cursor->layerPtr->_level > pref->layerPtr->_level){ + while(cursor && cursor->layerPtr->fLevel > pref->layerPtr->fLevel){ cursor = cursor->upperItem; } InsertItem(pref, cursor? cursor->lowerItem: NULL); @@ -524,13 +524,13 @@ ListData* Workspace::FindPlace(ListData* pref){ // NOTE that this happens only if its main window is the front most one. case B_FLOATING_SUBSET_WINDOW_FEEL:{ for(cursor = fBottomItem; cursor; cursor = cursor->upperItem){ - if (cursor->layerPtr->_level <= pref->layerPtr->_level + if (cursor->layerPtr->fLevel <= pref->layerPtr->fLevel && (cursor->layerPtr == pref->layerPtr->MainWinBorder() || cursor->layerPtr->MainWinBorder() == pref->layerPtr->MainWinBorder()) ) { break; } - else if(pref->layerPtr->_level == B_FLOATING_SUBSET_FEEL - && cursor->layerPtr->_level == B_FLOATING_APP_FEEL) + else if(pref->layerPtr->fLevel == B_FLOATING_SUBSET_FEEL + && cursor->layerPtr->fLevel == B_FLOATING_APP_FEEL) { break; } } if (cursor) @@ -543,10 +543,10 @@ ListData* Workspace::FindPlace(ListData* pref){ // it belongs to another application case B_MODAL_SUBSET_WINDOW_FEEL:{ for(cursor = fBottomItem; cursor; cursor = cursor->upperItem){ - if (cursor->layerPtr->_level <= pref->layerPtr->_level) + if (cursor->layerPtr->fLevel <= pref->layerPtr->fLevel) break; - else if(pref->layerPtr->_level == B_MODAL_SUBSET_FEEL - && cursor->layerPtr->_level == B_MODAL_APP_FEEL + else if(pref->layerPtr->fLevel == B_MODAL_SUBSET_FEEL + && cursor->layerPtr->fLevel == B_MODAL_APP_FEEL && pref->layerPtr->Window()->ClientTeamID() != cursor->layerPtr->Window()->ClientTeamID()) break; @@ -560,7 +560,7 @@ ListData* Workspace::FindPlace(ListData* pref){ // NOTE that this happens only if its main window is the front most one. case B_FLOATING_APP_WINDOW_FEEL:{ for(cursor = fBottomItem; cursor; cursor = cursor->upperItem){ - if (cursor->layerPtr->_level <= pref->layerPtr->_level + if (cursor->layerPtr->fLevel <= pref->layerPtr->fLevel && pref->layerPtr->Window()->ClientTeamID() == cursor->layerPtr->Window()->ClientTeamID()) { break; } @@ -752,8 +752,8 @@ STRACE((" SAME TeamID\n")); STRACE((" DIFERRENT TeamID\n")); // remove front window's floating(_SUBSET_/_APP_) windows, if any. ListData *listItem = fFrontItem->lowerItem; - while(listItem && (listItem->layerPtr->_level == B_FLOATING_SUBSET_FEEL - || listItem->layerPtr->_level == B_FLOATING_APP_FEEL)) + while(listItem && (listItem->layerPtr->fLevel == B_FLOATING_SUBSET_FEEL + || listItem->layerPtr->fLevel == B_FLOATING_APP_FEEL)) { // *carefully* remove the item from the list ListData *item = listItem; listItem = listItem->lowerItem; @@ -866,12 +866,12 @@ STRACE((" MODAL_APP/SUBSET Window '%s'\n", preferred? preferred->GetName(): "NUL int32 count = 0, i; int32 prefIndex = -1; - if (fFrontItem && fFrontItem->layerPtr->_level == B_NORMAL_FEEL) + if (fFrontItem && fFrontItem->layerPtr->fLevel == B_NORMAL_FEEL) { // remove front window's floating(_SUBSET_/_APP_) windows, if any. ListData *listItem = fFrontItem->lowerItem; - while(listItem && (listItem->layerPtr->_level == B_FLOATING_SUBSET_FEEL - || listItem->layerPtr->_level == B_FLOATING_APP_FEEL)) + while(listItem && (listItem->layerPtr->fLevel == B_FLOATING_SUBSET_FEEL + || listItem->layerPtr->fLevel == B_FLOATING_APP_FEEL)) { // *carefully* remove the item from the list ListData *item = listItem; listItem = listItem->lowerItem; @@ -968,12 +968,12 @@ STRACE((" MODAL_APP/SUBSET Window '%s'\n", preferred? preferred->GetName(): "NUL { STRACE((" MODAL ALL/SYSTEM FIRST Window '%s'\n", preferred? preferred->GetName(): "NULL")); // remove all application's floating windows. - if (fFrontItem && fFrontItem->layerPtr->_level == B_NORMAL_FEEL) + if (fFrontItem && fFrontItem->layerPtr->fLevel == B_NORMAL_FEEL) { ListData *listItem = fFrontItem->lowerItem; while(listItem && - (listItem->layerPtr->_level == B_FLOATING_SUBSET_FEEL - || listItem->layerPtr->_level == B_FLOATING_APP_FEEL)) + (listItem->layerPtr->fLevel == B_FLOATING_SUBSET_FEEL + || listItem->layerPtr->fLevel == B_FLOATING_APP_FEEL)) { // *carefully* remove the item from the list ListData *item = listItem; @@ -999,9 +999,9 @@ STRACE((" MODAL ALL/SYSTEM FIRST Window '%s'\n", preferred? preferred->GetName() int32 feel = fBottomItem->layerPtr->Window()->Feel(); // if preferred is one of these *don't* give front state to it! - if(preferred->_level == B_FLOATING_SUBSET_FEEL - || preferred->_level == B_FLOATING_APP_FEEL - || preferred->_level == B_FLOATING_ALL_FEEL) + if(preferred->fLevel == B_FLOATING_SUBSET_FEEL + || preferred->fLevel == B_FLOATING_APP_FEEL + || preferred->fLevel == B_FLOATING_ALL_FEEL) { newFrontItem = exFrontItem; } @@ -1013,7 +1013,7 @@ STRACE((" MODAL ALL/SYSTEM FIRST Window '%s'\n", preferred? preferred->GetName() } // the SYSTEM_LAST will get the front status, only if it's the only // WinBorder in this workspace. - else if (preferred->_level == B_SYSTEM_LAST + else if (preferred->fLevel == B_SYSTEM_LAST && !(preferred->IsHidden()) ) { if(fBottomItem->layerPtr == preferred) @@ -1068,25 +1068,25 @@ STRACE(("*WS(%ld)::SASNFocus(%s)\n", ID(), preferred? preferred->GetName(): "NUL } } - if (item->layerPtr->_level == B_SYSTEM_FIRST || item->layerPtr->_level == B_MODAL_ALL_FEEL) + if (item->layerPtr->fLevel == B_SYSTEM_FIRST || item->layerPtr->fLevel == B_MODAL_ALL_FEEL) { break; } - if (item->layerPtr->_level == B_MODAL_APP_FEEL + if (item->layerPtr->fLevel == B_MODAL_APP_FEEL && (preferred && preferred->Window()->ClientTeamID() == item->layerPtr->Window()->ClientTeamID())) { break; } - if (item->layerPtr->_level == B_MODAL_SUBSET_FEEL + if (item->layerPtr->fLevel == B_MODAL_SUBSET_FEEL && (preferred && item->layerPtr->MainWinBorder() == preferred)) { break; } // select one window, other than a system_last one! - if (selectOthers && item->layerPtr->_level != B_SYSTEM_LAST){ + if (selectOthers && item->layerPtr->fLevel != B_SYSTEM_LAST){ break; } } @@ -1156,12 +1156,12 @@ STRACE(("\n!MoveToBack(%s) -", newLast? newLast->GetName(): "NULL")); if(item){ ListData *listItem = NULL; - switch(item->layerPtr->_level){ + switch(item->layerPtr->fLevel){ case B_FLOATING_ALL_FEEL:{ STRACE((" B_FLOATING_ALL_FEEL window\n")); // search the place where we should insert it later listItem = item->upperItem; - while(listItem && (listItem->layerPtr->_level == item->layerPtr->_level)) + while(listItem && (listItem->layerPtr->fLevel == item->layerPtr->fLevel)) listItem = listItem->upperItem; break; @@ -1176,8 +1176,8 @@ STRACE((" B_FLOATING_SUBSET_FEEL/B_FLOATING_APP_FEEL window\n")); // search the place where we should insert it later listItem = item->upperItem; while(listItem && - (listItem->layerPtr->_level == B_FLOATING_SUBSET_FEEL - || listItem->layerPtr->_level == B_FLOATING_APP_FEEL)) + (listItem->layerPtr->fLevel == B_FLOATING_SUBSET_FEEL + || listItem->layerPtr->fLevel == B_FLOATING_APP_FEEL)) listItem = listItem->upperItem; break; @@ -1190,9 +1190,9 @@ STRACE((" B_MODAL_SUBSET_FEEL/B_MODAL_APP_FEEL window\n")); // search the place where we should insert it later listItem = item->upperItem; while(listItem && - (listItem->layerPtr->_level == B_MODAL_SUBSET_FEEL - || listItem->layerPtr->_level == B_MODAL_APP_FEEL - || listItem->layerPtr->_level == B_NORMAL_FEEL)) + (listItem->layerPtr->fLevel == B_MODAL_SUBSET_FEEL + || listItem->layerPtr->fLevel == B_MODAL_APP_FEEL + || listItem->layerPtr->fLevel == B_NORMAL_FEEL)) listItem = listItem->upperItem; break; @@ -1202,7 +1202,7 @@ STRACE((" B_MODAL_SUBSET_FEEL/B_MODAL_APP_FEEL window\n")); case B_NORMAL_FEEL:{ STRACE((" B_NORMAL_FEEL window\n")); listItem = item->upperItem; - while(listItem && (listItem->layerPtr->_level >= item->layerPtr->_level)){ + while(listItem && (listItem->layerPtr->fLevel >= item->layerPtr->fLevel)){ listItem = listItem->upperItem; } @@ -1218,11 +1218,11 @@ STRACE((" B_NORMAL_FEEL window\n")); else{ // if it's a normal window, first remove any floating windows, // it or its application has - if(newLast->_level == B_NORMAL_FEEL && fFrontItem->layerPtr == newLast){ + if(newLast->fLevel == B_NORMAL_FEEL && fFrontItem->layerPtr == newLast){ ListData *iter = item->lowerItem; while(iter && - (iter->layerPtr->_level == B_FLOATING_SUBSET_FEEL - || iter->layerPtr->_level == B_FLOATING_APP_FEEL)) + (iter->layerPtr->fLevel == B_FLOATING_SUBSET_FEEL + || iter->layerPtr->fLevel == B_FLOATING_APP_FEEL)) { // *carefully* remove the item from the list ListData *itemX = iter;