a little cleanup

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7744 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca
2004-06-02 20:44:46 +00:00
parent fc5f38fce2
commit 885eed5c44
3 changed files with 94 additions and 80 deletions
+80 -68
View File
@@ -12,15 +12,22 @@
#include "RootLayer.h" #include "RootLayer.h"
#include "DisplayDriver.h" #include "DisplayDriver.h"
#include "LayerData.h" #include "LayerData.h"
#include <stdio.h>
//#define DEBUG_LAYER //#define DEBUG_LAYER
#ifdef DEBUG_LAYER #ifdef DEBUG_LAYER
# include <stdio.h>
# define STRACE(x) printf x # define STRACE(x) printf x
#else #else
# define STRACE(x) ; # define STRACE(x) ;
#endif #endif
//#define DEBUG_LAYER_REBUILD
#ifdef DEBUG_LAYER_REBUILD
# define RBTRACE(x) printf x
#else
# define RBTRACE(x) ;
#endif
BRegion gRedrawReg; BRegion gRedrawReg;
BList gCopyRegList; BList gCopyRegList;
BList gCopyList; BList gCopyList;
@@ -74,7 +81,7 @@ Layer::Layer(BRect frame, const char *name, int32 token, uint32 resize,
clipToPicture = NULL; clipToPicture = NULL;
/* NOW all regions (_visible, _fullVisible, _full) are empty */ /* NOW all regions (_visible, _fullVisible, _full) are empty */
printf("Layer(%s) successfuly created\n", GetName()); STRACE(("Layer(%s) successfuly created\n", GetName()));
} }
//! Destructor frees all allocated heap space //! Destructor frees all allocated heap space
@@ -108,7 +115,7 @@ Layer::~Layer(void)
void Layer::AddChild(Layer *layer, RootLayer *rootLayer) void Layer::AddChild(Layer *layer, RootLayer *rootLayer)
{ {
printf("Layer(%s)::AddChild(%s)\n", GetName(), layer->GetName()); STRACE(("Layer(%s)::AddChild(%s) START\n", GetName(), layer->GetName()));
if( layer->_parent != NULL ) { if( layer->_parent != NULL ) {
printf("ERROR: AddChild(): Layer already has a _parent\n"); printf("ERROR: AddChild(): Layer already has a _parent\n");
return; return;
@@ -171,11 +178,12 @@ printf("Layer(%s)::AddChild(%s)\n", GetName(), layer->GetName());
if ( !(layer->IsHidden()) && layer->fRootLayer && !IsHidden()){ if ( !(layer->IsHidden()) && layer->fRootLayer && !IsHidden()){
FullInvalidate( layer->_full ); FullInvalidate( layer->_full );
} }
printf("Layer(%s)::AddChild(%s) ENDED\n", GetName(), layer->GetName()); STRACE(("Layer(%s)::AddChild(%s) END\n", GetName(), layer->GetName()));
} }
void Layer::RemoveChild(Layer *layer) void Layer::RemoveChild(Layer *layer)
{ {
STRACE(("Layer(%s)::RemoveChild(%s) START\n", GetName(), layer->GetName()));
if( layer->_parent == NULL ){ if( layer->_parent == NULL ){
printf("ERROR: RemoveChild(): Layer doesn't have a _parent\n"); printf("ERROR: RemoveChild(): Layer doesn't have a _parent\n");
return; return;
@@ -248,7 +256,7 @@ void Layer::RemoveChild(Layer *layer)
layer->_full.MakeEmpty(); layer->_full.MakeEmpty();
layer->_fullVisible.MakeEmpty(); layer->_fullVisible.MakeEmpty();
layer->_visible.MakeEmpty(); layer->_visible.MakeEmpty();
STRACE(("Layer(%s)::RemoveChild(%s) END\n", GetName(), layer->GetName()));
} }
void Layer::RemoveSelf() void Layer::RemoveSelf()
@@ -366,9 +374,11 @@ void Layer::FullInvalidate(const BRect &rect)
void Layer::FullInvalidate(const BRegion& region) void Layer::FullInvalidate(const BRegion& region)
{ {
printf("Layer(%s)::FullInvalidate():\n", GetName()); STRACE(("Layer(%s)::FullInvalidate():\n", GetName()));
region.PrintToStream(); #ifdef DEBUG_LAYER
printf("\n"); region.PrintToStream();
printf("\n");
#endif
BPoint pt(0,0); BPoint pt(0,0);
StartRebuildRegions(region, NULL,/* B_LAYER_INVALIDATE, pt); */B_LAYER_NONE, pt); StartRebuildRegions(region, NULL,/* B_LAYER_INVALIDATE, pt); */B_LAYER_NONE, pt);
@@ -380,9 +390,11 @@ printf("\n");
void Layer::Invalidate(const BRegion& region) void Layer::Invalidate(const BRegion& region)
{ {
printf("Layer(%s)::Invalidate():\n", GetName()); STRACE(("Layer(%s)::Invalidate():\n", GetName()));
region.PrintToStream(); #ifdef DEBUG_LAYER
printf("\n"); region.PrintToStream();
printf("\n");
#endif
gRedrawReg = region; gRedrawReg = region;
@@ -393,7 +405,7 @@ printf("\n");
void Layer::Redraw(const BRegion& reg, Layer *startFrom) void Layer::Redraw(const BRegion& reg, Layer *startFrom)
{ {
printf("Layer(%s)::Redraw();\n", GetName()); STRACE(("Layer(%s)::Redraw();\n", GetName()));
BRegion *pReg = const_cast<BRegion*>(&reg); BRegion *pReg = const_cast<BRegion*>(&reg);
if(_serverwin){ if(_serverwin){
@@ -407,11 +419,11 @@ printf("Layer(%s)::Redraw();\n", GetName());
RequestDraw(reg, startFrom); RequestDraw(reg, startFrom);
} }
} }
printf("Layer::Redraw ENDED\n"); STRACE(("Layer::Redraw ENDED\n"));
} }
void Layer::RequestClientUpdate(const BRegion &reg, Layer *startFrom){ void Layer::RequestClientUpdate(const BRegion &reg, Layer *startFrom){
printf("Layer(%s)::RequestClientUpdate();\n", GetName()); STRACE(("Layer(%s)::RequestClientUpdate()\n", GetName()));
if (IsHidden()){ if (IsHidden()){
// this layer has nothing visible on screen, so bail out. // this layer has nothing visible on screen, so bail out.
return; return;
@@ -455,7 +467,7 @@ printf("Layer(%s)::RequestClientUpdate();\n", GetName());
void Layer::RequestDraw(const BRegion &reg, Layer *startFrom, bool redraw) void Layer::RequestDraw(const BRegion &reg, Layer *startFrom, bool redraw)
{ {
printf("Layer(%s)::RequestDraw()\n", GetName()); STRACE(("Layer(%s)::RequestDraw()\n", GetName()));
if (_visible.CountRects() > 0 && !IsHidden()){ if (_visible.CountRects() > 0 && !IsHidden()){
fUpdateReg = _visible; fUpdateReg = _visible;
fUpdateReg.IntersectWith(&reg); fUpdateReg.IntersectWith(&reg);
@@ -488,9 +500,8 @@ printf("Layer(%s)::RequestDraw()\n", GetName());
void Layer::Draw(const BRect &r) void Layer::Draw(const BRect &r)
{ {
// TODO/NOTE: this should be an empty method! the next lines are for testing only // TODO/NOTE: this should be an empty method! the next lines are for testing only
printf("Layer::Draw() Called\n"); STRACE(("Layer::Draw() Called\n"));
// RGBColor col(152,102,51); // RGBColor col(152,102,51);
// DRIVER->FillRect_(r, 1, col, &fUpdateReg); // DRIVER->FillRect_(r, 1, col, &fUpdateReg);
//snooze(1000000); //snooze(1000000);
@@ -502,7 +513,7 @@ printf("Layer::Draw() Called\n");
void Layer::Show(void) void Layer::Show(void)
{ {
printf("Layer(%s)::Show()\n", GetName()); STRACE(("Layer(%s)::Show()\n", GetName()));
if( !IsHidden() ) if( !IsHidden() )
return; return;
@@ -516,7 +527,7 @@ printf("Layer(%s)::Show()\n", GetName());
void Layer::Hide(void) void Layer::Hide(void)
{ {
printf("\n\nLayer(%s)::Hide()\n", GetName()); STRACE(("Layer(%s)::Hide()\n", GetName()));
if ( IsHidden() ) if ( IsHidden() )
return; return;
@@ -590,6 +601,7 @@ uint32 Layer::CountChildren(void) const
} }
void Layer::RebuildFullRegion( ){ void Layer::RebuildFullRegion( ){
STRACE(("Layer(%s)::RebuildFullRegion()\n", GetName()));
if (_parent) if (_parent)
_full.Set( _parent->ConvertToTop( _frame ) ); _full.Set( _parent->ConvertToTop( _frame ) );
else else
@@ -623,6 +635,7 @@ void Layer::RebuildFullRegion( ){
void Layer::RebuildRegions( const BRegion& reg, uint32 action, BPoint pt, BPoint ptOffset) 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. //NOTE: this method must be executed as fast as possible.
// Currently SendView[Moved/Resized]Msg() simply constructs a message and calls // Currently SendView[Moved/Resized]Msg() simply constructs a message and calls
// ServerWindow::SendMessageToClient() // ServerWindow::SendMessageToClient()
@@ -642,12 +655,12 @@ void Layer::RebuildRegions( const BRegion& reg, uint32 action, BPoint pt, BPoint
RRLabel1: RRLabel1:
switch(action){ switch(action){
case B_LAYER_NONE:{ case B_LAYER_NONE:{
printf("1) Action B_LAYER_NONE\n"); RBTRACE(("1) Action B_LAYER_NONE\n"));
oldRegion = _visible; oldRegion = _visible;
break; break;
} }
case B_LAYER_MOVE:{ case B_LAYER_MOVE:{
printf("1) Action B_LAYER_MOVE\n"); RBTRACE(("1) Action B_LAYER_MOVE\n"));
oldRegion = _fullVisible; oldRegion = _fullVisible;
_frame.OffsetBy(pt.x, pt.y); _frame.OffsetBy(pt.x, pt.y);
_full.OffsetBy(pt.x, pt.y); _full.OffsetBy(pt.x, pt.y);
@@ -658,13 +671,13 @@ printf("1) Action B_LAYER_MOVE\n");
break; break;
} }
case B_LAYER_SIMPLE_MOVE:{ case B_LAYER_SIMPLE_MOVE:{
printf("1) Action B_LAYER_SIMPLE_MOVE\n"); RBTRACE(("1) Action B_LAYER_SIMPLE_MOVE\n"));
_full.OffsetBy(pt.x, pt.y); _full.OffsetBy(pt.x, pt.y);
break; break;
} }
case B_LAYER_RESIZE:{ case B_LAYER_RESIZE:{
printf("1) Action B_LAYER_RESIZE\n"); RBTRACE(("1) Action B_LAYER_RESIZE\n"));
oldRegion = _visible; oldRegion = _visible;
_frame.right += pt.x; _frame.right += pt.x;
@@ -677,7 +690,7 @@ printf("1) Action B_LAYER_RESIZE\n");
break; break;
} }
case B_LAYER_MASK_RESIZE:{ case B_LAYER_MASK_RESIZE:{
printf("1) Action B_LAYER_MASK_RESIZE\n"); RBTRACE(("1) Action B_LAYER_MASK_RESIZE\n"));
oldRegion = _visible; oldRegion = _visible;
BPoint offset, rSize; BPoint offset, rSize;
@@ -816,19 +829,22 @@ printf("1) Action B_LAYER_MASK_RESIZE\n");
// _fullVisible.MakeEmpty(); // _fullVisible.MakeEmpty();
// _visible.MakeEmpty(); // _visible.MakeEmpty();
//} //}
printf("\n ======= Layer(%s)::RR finals ======\n", GetName()); #ifdef DEBUG_LAYER_REBUILD
oldRegion.PrintToStream(); printf("\n ======= Layer(%s)::RR finals ======\n", GetName());
_full.PrintToStream(); oldRegion.PrintToStream();
_fullVisible.PrintToStream(); _full.PrintToStream();
_visible.PrintToStream(); _fullVisible.PrintToStream();
printf("==========RedrawReg===========\n"); _visible.PrintToStream();
gRedrawReg.PrintToStream(); printf("==========RedrawReg===========\n");
printf("=====================\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) void Layer::StartRebuildRegions( const BRegion& reg, Layer *target, uint32 action, BPoint& pt)
{ {
printf("Layer(%s)::StartRebuildRegions()\n", GetName()); STRACE(("Layer(%s)::StartRebuildRegions() START\n", GetName()));
if(!_parent) if(!_parent)
_fullVisible = _full; _fullVisible = _full;
@@ -846,36 +862,42 @@ printf("Layer(%s)::StartRebuildRegions()\n", GetName());
lay->RebuildRegions(reg, B_LAYER_NONE, pt, BPoint(0.0f, 0.0f)); lay->RebuildRegions(reg, B_LAYER_NONE, pt, BPoint(0.0f, 0.0f));
} }
} }
#ifdef DEBUG_LAYER_REBUILD
printf("\n ===!=== Layer(%s)::SRR finals ===!===\n", GetName()); printf("\n ===!=== Layer(%s)::SRR finals ===!===\n", GetName());
_full.PrintToStream(); _full.PrintToStream();
_fullVisible.PrintToStream(); _fullVisible.PrintToStream();
_visible.PrintToStream(); _visible.PrintToStream();
oldVisible.PrintToStream(); oldVisible.PrintToStream();
printf("=====================\n"); printf("=====!=====RedrawReg=====!=====\n");
gRedrawReg.PrintToStream(); gRedrawReg.PrintToStream();
printf("=====================\n");
#endif
BRegion redrawReg(_visible); BRegion redrawReg(_visible);
// if this is the first time // if this is the first time
if (oldVisible.CountRects() > 0){ if (oldVisible.CountRects() > 0){
printf("YES, it happens\n");
redrawReg.Exclude(&oldVisible); redrawReg.Exclude(&oldVisible);
} }
gRedrawReg.Include(&redrawReg); 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; k<gCopyRegList.CountItems(); k++){
((BRegion*)(gCopyRegList.ItemAt(k)))->PrintToStream();
((BPoint*)(gCopyList.ItemAt(k)))->PrintToStream();
}
printf("\n");
#endif
printf("Layer(%s)::StartRebuildREgions() ended! Redraw Region:\n", GetName()); STRACE(("Layer(%s)::StartRebuildRegions() END\n", GetName()));
gRedrawReg.PrintToStream();
printf("\n");
printf("Layer(%s)::StartRebuildREgions() ended! Copy Region:\n", GetName());
for(int32 k=0; k<gCopyRegList.CountItems(); k++){
((BRegion*)(gCopyRegList.ItemAt(k)))->PrintToStream();
((BPoint*)(gCopyList.ItemAt(k)))->PrintToStream();
}
printf("\n");
} }
void Layer::MoveBy(float x, float y) void Layer::MoveBy(float x, float y)
{ {
STRACE(("Layer(%s)::MoveBy() START\n", GetName()));
if(!_parent){ if(!_parent){
debugger("ERROR: in Layer::MoveBy()! - No parent!\n"); debugger("ERROR: in Layer::MoveBy()! - No parent!\n");
return; return;
@@ -891,6 +913,7 @@ void Layer::MoveBy(float x, float y)
_parent->Redraw(gRedrawReg, this); _parent->Redraw(gRedrawReg, this);
EmptyGlobals(); EmptyGlobals();
STRACE(("Layer(%s)::MoveBy() END\n", GetName()));
} }
void Layer::EmptyGlobals(){ void Layer::EmptyGlobals(){
@@ -907,7 +930,7 @@ void Layer::EmptyGlobals(){
} }
uint32 Layer::ResizeOthers(float x, float y, BPoint coords[], BPoint *ptOffset){ uint32 Layer::ResizeOthers(float x, float y, BPoint coords[], BPoint *ptOffset){
printf("Layer(%s): x=%f y=%f\n", GetName(), x, y); STRACE(("Layer(%s)::ResizeOthers() START\n", GetName()));
uint32 rmask = _resize_mode; uint32 rmask = _resize_mode;
// offset // offset
coords[0].x = 0.0f; coords[0].x = 0.0f;
@@ -917,55 +940,43 @@ printf("Layer(%s): x=%f y=%f\n", GetName(), x, y);
coords[1].y = 0.0f; coords[1].y = 0.0f;
if ((rmask & 0x00000f00UL)>>8 == _VIEW_LEFT_ if ((rmask & 0x00000f00UL)>>8 == _VIEW_LEFT_
&& (rmask & 0x0000000fUL)>>0 == _VIEW_RIGHT_) && (rmask & 0x0000000fUL)>>0 == _VIEW_RIGHT_){
{
printf("Layer(%s) - step 1\n", GetName());
coords[1].x = x; coords[1].x = x;
} }
else if ((rmask & 0x00000f00UL)>>8 == _VIEW_LEFT_){ else if ((rmask & 0x00000f00UL)>>8 == _VIEW_LEFT_){
printf("Layer(%s) - step 2\n", GetName());
} }
else if ((rmask & 0x0000000fUL)>>0 == _VIEW_RIGHT_){ else if ((rmask & 0x0000000fUL)>>0 == _VIEW_RIGHT_){
printf("Layer(%s) - step 3\n", GetName());
coords[0].x = x; coords[0].x = x;
} }
else if ((rmask & 0x00000f00UL)>>8 == _VIEW_CENTER_){ else if ((rmask & 0x00000f00UL)>>8 == _VIEW_CENTER_){
printf("Layer(%s) - step 4\n", GetName());
coords[0].x = x/2; coords[0].x = x/2;
} }
else { // illegal flag. Do nothing. else { // illegal flag. Do nothing.
printf("Layer(%s) - step 5\n", GetName());
} }
if ((rmask & 0x0000f000UL)>>12 == _VIEW_TOP_ if ((rmask & 0x0000f000UL)>>12 == _VIEW_TOP_
&& (rmask & 0x000000f0UL)>>4 == _VIEW_BOTTOM_) && (rmask & 0x000000f0UL)>>4 == _VIEW_BOTTOM_){
{
coords[1].y = y; coords[1].y = y;
printf("Layer(%s) - sstep 1\n", GetName());
} }
else if ((rmask & 0x0000f000UL)>>12 == _VIEW_TOP_){ else if ((rmask & 0x0000f000UL)>>12 == _VIEW_TOP_){
printf("Layer(%s) - sstep 2\n", GetName());
} }
else if ((rmask & 0x000000f0UL)>>4 == _VIEW_BOTTOM_){ else if ((rmask & 0x000000f0UL)>>4 == _VIEW_BOTTOM_){
printf("Layer(%s) - sstep 3\n", GetName());
coords[0].y = y; coords[0].y = y;
} }
else if ((rmask & 0x0000f000UL)>>12 == _VIEW_CENTER_){ else if ((rmask & 0x0000f000UL)>>12 == _VIEW_CENTER_){
printf("Layer(%s) - sstep 4\n", GetName());
coords[0].y = y/2; coords[0].y = y/2;
} }
else { // illegal flag. Do nothing. else { // illegal flag. Do nothing.
printf("Layer(%s) - sstep 5\n", GetName());
} }
printf("Layer(%s): coord[0].x=%f coord[0].y=%f\n", GetName(), coords[0].x, coords[0].y); STRACE(("Layer(%s)::ResizeOthers() END\n", GetName()));
printf("Layer(%s): coord[1].x=%f coord[1].y=%f\n", GetName(), coords[1].x, coords[1].y);
return 0UL; return 0UL;
} }
void Layer::ResizeBy(float x, float y) void Layer::ResizeBy(float x, float y)
{ {
STRACE(("Layer(%s)::ResizeBy() START\n", GetName()));
if(!_parent){ if(!_parent){
printf("ERROR: in Layer::MoveBy()! - No parent!\n"); printf("ERROR: in Layer::MoveBy()! - No parent!\n");
return; return;
@@ -983,6 +994,7 @@ void Layer::ResizeBy(float x, float y)
_parent->Redraw(gRedrawReg, this); _parent->Redraw(gRedrawReg, this);
EmptyGlobals(); EmptyGlobals();
STRACE(("Layer(%s)::ResizeBy() END\n", GetName()));
} }
void Layer::PrintToStream(void) void Layer::PrintToStream(void)
+4 -7
View File
@@ -49,7 +49,7 @@
#include "CursorManager.h" #include "CursorManager.h"
#include "Workspace.h" #include "Workspace.h"
#define DEBUG_SERVERWINDOW //#define DEBUG_SERVERWINDOW
//#define DEBUG_SERVERWINDOW_MOUSE //#define DEBUG_SERVERWINDOW_MOUSE
//#define DEBUG_SERVERWINDOW_KEYBOARD //#define DEBUG_SERVERWINDOW_KEYBOARD
@@ -916,7 +916,6 @@ void ServerWindow::DispatchMessage(int32 code)
cl->MoveBy(x, y); cl->MoveBy(x, y);
STRACE(("ServerWindow %s: Message AS_LAYER_MOVETO: Layer: %s\n",fTitle.String(), cl->_name->String()));
break; break;
} }
case AS_LAYER_RESIZETO: case AS_LAYER_RESIZETO:
@@ -931,7 +930,6 @@ void ServerWindow::DispatchMessage(int32 code)
cl->ResizeBy(newWidth, newHeight); cl->ResizeBy(newWidth, newHeight);
STRACE(("ServerWindow %s: Message AS_LAYER_RESIZETO: Layer: %s\n",fTitle.String(), cl->_name->String()));
break; break;
} }
case AS_LAYER_GET_COORD: case AS_LAYER_GET_COORD:
@@ -1144,6 +1142,8 @@ void ServerWindow::DispatchMessage(int32 code)
fSession->ReadData(&c, sizeof(rgb_color)); fSession->ReadData(&c, sizeof(rgb_color));
cl->_layerdata->viewcolor.SetColor(c); cl->_layerdata->viewcolor.SetColor(c);
cl->Invalidate(cl->_visible);
STRACE(("ServerWindow %s: Message AS_LAYER_SET_VIEW_COLOR: Layer: %s\n",fTitle.String(), cl->_name->String())); STRACE(("ServerWindow %s: Message AS_LAYER_SET_VIEW_COLOR: Layer: %s\n",fTitle.String(), cl->_name->String()));
break; break;
@@ -1562,9 +1562,7 @@ void ServerWindow::DispatchMessage(int32 code)
fSession->ReadFloat(&yResizeBy); fSession->ReadFloat(&yResizeBy);
fWinBorder->ResizeBy(xResizeBy, yResizeBy); fWinBorder->ResizeBy(xResizeBy, yResizeBy);
printf("===> ddd = %f %f", xResizeBy, yResizeBy);
// TODO: Implement
STRACE(("ServerWindow %s: Message Resize unimplemented\n",fTitle.String()));
break; break;
} }
case B_MINIMIZE: case B_MINIMIZE:
@@ -2184,7 +2182,6 @@ int32 ServerWindow::MonitorWin(void *data)
{ {
STRACE(("ServerWindow %s received Quit request\n",win->Title())); STRACE(("ServerWindow %s received Quit request\n",win->Title()));
quitting = true; quitting = true;
printf("Deleting window...\n");
delete win; delete win;
break; break;
} }
+10 -5
View File
@@ -21,7 +21,7 @@
// //
// File Name: WinBorder.cpp // File Name: WinBorder.cpp
// Author: DarkWyrm <[email protected]> // Author: DarkWyrm <[email protected]>
// Adi Oanca <adioanca@myrealbox.com> // Adi Oanca <adioanca@mymail.ro>
// Description: Layer subclass which handles window management // Description: Layer subclass which handles window management
// //
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@@ -48,8 +48,8 @@
//#define DEBUG_WINBORDER //#define DEBUG_WINBORDER
// toggle // toggle
#define DEBUG_WINBORDER_MOUSE //#define DEBUG_WINBORDER_MOUSE
#define DEBUG_WINBORDER_CLICK //#define DEBUG_WINBORDER_CLICK
#ifdef DEBUG_WINBORDER #ifdef DEBUG_WINBORDER
# include <stdio.h> # include <stdio.h>
@@ -119,7 +119,7 @@ WinBorder::WinBorder(const BRect &r, const char *name, const int32 look, const i
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
WinBorder::~WinBorder(void) WinBorder::~WinBorder(void)
{ {
STRACE(("WinBorder %s:~WinBorder()\n",GetName())); STRACE(("WinBorder(%s):~WinBorder()\n",GetName()));
if (fDecorator) { if (fDecorator) {
delete fDecorator; delete fDecorator;
fDecorator = NULL; fDecorator = NULL;
@@ -130,6 +130,7 @@ STRACE(("WinBorder %s:~WinBorder()\n",GetName()));
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void WinBorder::RebuildFullRegion(void){ void WinBorder::RebuildFullRegion(void){
STRACE(("WinBorder(%s):~RebuildFullRegion()\n",GetName()));
BRegion topLayerFull; BRegion topLayerFull;
Layer *topLayer = _serverwin->fTopLayer; Layer *topLayer = _serverwin->fTopLayer;
topLayerFull.Set( ConvertToTop(*fNewTopLayerFrame) ); topLayerFull.Set( ConvertToTop(*fNewTopLayerFrame) );
@@ -315,7 +316,7 @@ void WinBorder::HighlightDecorator(const bool &active)
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void WinBorder::Draw(const BRect &r) void WinBorder::Draw(const BRect &r)
{ {
printf("WinBorder(%s)::Draw()\n", GetName()); STRACE(("WinBorder(%s)::Draw()\n", GetName()));
if(fDecorator){ if(fDecorator){
// decorator is allowed to draw in its entire visible region, not just in the update one. // decorator is allowed to draw in its entire visible region, not just in the update one.
fUpdateReg = _visible; fUpdateReg = _visible;
@@ -339,6 +340,7 @@ snooze(1000000);
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void WinBorder::MoveBy(float x, float y) void WinBorder::MoveBy(float x, float y)
{ {
STRACE(("WinBorder(%s)::MoveBy()\n", GetName()));
if(fDecorator){ if(fDecorator){
fDecorator->MoveBy(x,y); fDecorator->MoveBy(x,y);
fDecFull->OffsetBy(x,y); fDecFull->OffsetBy(x,y);
@@ -349,6 +351,7 @@ void WinBorder::MoveBy(float x, float y)
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void WinBorder::ResizeBy(float x, float y) void WinBorder::ResizeBy(float x, float y)
{ {
STRACE(("WinBorder(%s)::ResizeBy()\n", GetName()));
if(fDecorator){ if(fDecorator){
fDecorator->ResizeBy(x,y); fDecorator->ResizeBy(x,y);
} }
@@ -413,6 +416,7 @@ void WinBorder::SetLevel(){
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void WinBorder::AddToSubsetOf(WinBorder* main){ void WinBorder::AddToSubsetOf(WinBorder* main){
STRACE(("WinBorder(%s)::AddToSubsetOf()\n", GetName()));
if (!main || (main && !(main->GetRootLayer()))) if (!main || (main && !(main->GetRootLayer())))
return; return;
@@ -466,6 +470,7 @@ void WinBorder::AddToSubsetOf(WinBorder* main){
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void WinBorder::RemoveFromSubsetOf(WinBorder* main){ void WinBorder::RemoveFromSubsetOf(WinBorder* main){
STRACE(("WinBorder(%s)::RemoveFromSubsetOf()\n", GetName()));
RootLayer *rl = main->GetRootLayer(); RootLayer *rl = main->GetRootLayer();
desktop->fGeneralLock.Lock(); desktop->fGeneralLock.Lock();