From 31b34533a7984ff541a2ed1c8095429aa4c718e0 Mon Sep 17 00:00:00 2001 From: DarkWyrm Date: Wed, 21 Jan 2004 02:58:39 +0000 Subject: [PATCH] Converted numerous printf() calls to STRACE(()) calls Added some mouse click handling code to WinBorder Made WinBorder mouse hooks simpler Added some mouse handling code to ServerWindow git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6207 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/server/Desktop.cpp | 31 ++- src/servers/app/server/Layer.cpp | 6 +- src/servers/app/server/ServerApp.cpp | 4 +- src/servers/app/server/ServerWindow.cpp | 2 +- src/servers/app/server/WinBorder.cpp | 266 ++++++++++++++---------- src/servers/app/server/WinBorder.h | 118 +++++------ src/servers/app/server/Workspace.cpp | 22 +- 7 files changed, 259 insertions(+), 190 deletions(-) diff --git a/src/servers/app/server/Desktop.cpp b/src/servers/app/server/Desktop.cpp index ad1396a34a..8ce3d61e94 100644 --- a/src/servers/app/server/Desktop.cpp +++ b/src/servers/app/server/Desktop.cpp @@ -322,9 +322,14 @@ void Desktop::MouseEventHandler(PortMessage *msg){ BPoint pt; int64 dummy; + int32 mod; + int32 buttons; + msg->Read(&dummy); msg->Read(&pt.x); msg->Read(&pt.y); + msg->Read(&mod); + msg->Read(&buttons); // printf("MOUSE DOWN: at (%f, %f)\n", pt.x, pt.y); @@ -340,7 +345,9 @@ void Desktop::MouseEventHandler(PortMessage *msg){ ws->SearchAndSetNewFront(target); ws->SetFocusLayer(target); - + + target->MouseDown(pt,buttons,mod); + rl->fMainLock.Unlock(); fGeneralLock.Unlock(); } @@ -353,12 +360,19 @@ void Desktop::MouseEventHandler(PortMessage *msg){ // 3) float - y coordinate of mouse click // 4) int32 - modifier keys down - BPoint pt; - int64 dummy; + BPoint pt; + int64 dummy; + int32 mod; + msg->Read(&dummy); msg->Read(&pt.x); msg->Read(&pt.y); - + msg->Read(&mod); + + WinBorder *target=ActiveRootLayer()->ActiveWorkspace()->SearchLayerUnderPoint(pt); + if(target) + target->MouseUp(pt,mod); + // printf("MOUSE UP: at (%f, %f)\n", pt.x, pt.y); break; @@ -371,16 +385,25 @@ void Desktop::MouseEventHandler(PortMessage *msg){ // 4) int32 - buttons down int64 dummy; float x,y; + int32 buttons; + msg->Read(&dummy); msg->Read(&x); msg->Read(&y); + msg->Read(&buttons); // We need this so that we can see the cursor on the screen if(fActiveScreen) fActiveScreen->DDriver()->MoveCursorTo(x,y); + + BPoint pt; + WinBorder *target=ActiveRootLayer()->ActiveWorkspace()->SearchLayerUnderPoint(pt); + if(target) + target->MouseMoved(pt,buttons); break; } case B_MOUSE_WHEEL_CHANGED:{ + // TODO: Later on, this will need to be passed onto the client ServerWindow break; } default:{ diff --git a/src/servers/app/server/Layer.cpp b/src/servers/app/server/Layer.cpp index 7164c0b6c3..4ba319e921 100644 --- a/src/servers/app/server/Layer.cpp +++ b/src/servers/app/server/Layer.cpp @@ -394,7 +394,7 @@ void Layer::MouseTransit(uint32 transit) void Layer::DoInvalidate(const BRegion ®, Layer *start){ //TODO: REMOVE this! For Test purposes only! -printf("**********Layer::DoInvalidate()\n"); + STRACE(("**********Layer::DoInvalidate()\n")); if (GetRootLayer()) GetRootLayer()->Draw(GetRootLayer()->Bounds()); else{ @@ -568,7 +568,7 @@ void Layer::Show(void) _hidden = false; //TODO: *****!*!*!*!*!*!*!**!***REMOVE this! For Test purposes only! -printf("**********Layer::Show()\n"); +STRACE(("**********Layer::Show()\n")); DoInvalidate(BRegion(Bounds()), NULL); return; //---------------- @@ -596,7 +596,7 @@ void Layer::Hide(void) _hidden = true; //TODO: *****!*!*!*!*!*!*!**!***REMOVE this! For Test purposes only! -printf("**********Layer::Hide()\n"); +STRACE(("**********Layer::Hide()\n")); DoInvalidate(BRegion(Bounds()), NULL); return; //---------------- diff --git a/src/servers/app/server/ServerApp.cpp b/src/servers/app/server/ServerApp.cpp index fe2012b577..94ce80eda2 100644 --- a/src/servers/app/server/ServerApp.cpp +++ b/src/servers/app/server/ServerApp.cpp @@ -57,7 +57,7 @@ #include "LayerData.h" #include "Utils.h" -#define DEBUG_SERVERAPP +//#define DEBUG_SERVERAPP #ifdef DEBUG_SERVERAPP # include @@ -517,7 +517,7 @@ void ServerApp::_DispatchMessage(PortMessage *msg) msg->Read(&looperPort); msg->ReadString(&title); msg->Read(&replyport); - + STRACE(("ServerApp %s: Got 'New Window' message, trying to do smething...\n",fSignature.String())); // ServerWindow constructor will reply with port_id of a newly created port diff --git a/src/servers/app/server/ServerWindow.cpp b/src/servers/app/server/ServerWindow.cpp index b7e1a53f12..876d871b21 100644 --- a/src/servers/app/server/ServerWindow.cpp +++ b/src/servers/app/server/ServerWindow.cpp @@ -48,7 +48,7 @@ #include "CursorManager.h" #include "Workspace.h" -#define DEBUG_SERVERWINDOW +//#define DEBUG_SERVERWINDOW //#define DEBUG_SERVERWINDOW_MOUSE //#define DEBUG_SERVERWINDOW_KEYBOARD diff --git a/src/servers/app/server/WinBorder.cpp b/src/servers/app/server/WinBorder.cpp index a020754660..f4e6be1e5f 100644 --- a/src/servers/app/server/WinBorder.cpp +++ b/src/servers/app/server/WinBorder.cpp @@ -49,7 +49,7 @@ // toggle //#define DEBUG_WINBORDER_MOUSE -//#define DEBUG_WINBORDER_CLICK +#define DEBUG_WINBORDER_CLICK #ifdef DEBUG_WINBORDER # include @@ -95,31 +95,33 @@ WinBorder::WinBorder(const BRect &r, const char *name, const int32 look, const i fMainWinBorder = NULL; _decorator = NULL; - if (feel == B_NO_BORDER_WINDOW_LOOK){ + if (feel == B_NO_BORDER_WINDOW_LOOK) + { _full = _win->fTopLayer->_full; fDecFull = NULL; fDecFullVisible = NULL; fDecVisible = NULL; } - else{ + else + { _decorator = new_decorator(r, name, look, feel, flags, fDriver); fDecFull = new BRegion(); fDecVisible = new BRegion(); fDecFullVisible = fDecVisible; _decorator->GetFootprint( fDecFull ); - - // our full region is the union between decorator's region and fTopLayer's region + + // our full region is the union between decorator's region and fTopLayer's region _full = _win->fTopLayer->_full; _full.Include( fDecFull ); } - // get a token - _view_token = border_token_handler.GetToken(); + // get a token + _view_token = border_token_handler.GetToken(); -STRACE(("WinBorder %s:\n",GetName())); -STRACE(("\tFrame: (%.1f,%.1f,%.1f,%.1f)\n",r.left,r.top,r.right,r.bottom)); -STRACE(("\tWindow %s\n",win?win->Title():"NULL")); + STRACE(("WinBorder %s:\n",GetName())); + STRACE(("\tFrame: (%.1f,%.1f,%.1f,%.1f)\n",r.left,r.top,r.right,r.bottom)); + STRACE(("\tWindow %s\n",win?win->Title():"NULL")); } WinBorder::~WinBorder(void) @@ -138,30 +140,37 @@ STRACE(("WinBorder %s:~WinBorder()\n",GetName())); } } -void WinBorder::MouseDown(int8 *buffer) +void WinBorder::MouseDown(const BPoint &pt, const int32 &buttons, const int32 &modifiers) { - // Buffer data: - // 1) int64 - time of mouse click - // 2) float - x coordinate of mouse click - // 3) float - y coordinate of mouse click - // 4) int32 - modifier keys down - // 5) int32 - buttons down - // 6) int32 - clicks - int8 *index = buffer; index+=sizeof(int64); - float x = *((float*)index); index+=sizeof(float); - float y = *((float*)index); index+=sizeof(float); - int32 modifiers = *((int32*)index); index+=sizeof(int32); - int32 buttons = *((int32*)index); - - BPoint pt(x,y); - - // user clicked on decorator - if (fDecFullVisible->Contains(pt)){ + // user clicked on decorator + if (fDecFullVisible->Contains(pt)) + { click_type click; -// TODO: modify this!!! _decorator->MouseDown(...); - click = _decorator->Clicked(pt, buttons, modifiers); + click = _decorator->Clicked(pt, buttons, modifiers); - switch(click){ + switch(click) + { + case DEC_CLOSE: + { + STRACE_CLICK(("WinBorder: Push Close Button\n")); + _decorator->SetClose(true); + _decorator->DrawClose(); + break; + } + case DEC_ZOOM: + { + STRACE_CLICK(("WinBorder: Push Zoom Button\n")); + _decorator->SetZoom(true); + _decorator->DrawZoom(); + break; + } + case DEC_MINIMIZE: + { + STRACE_CLICK(("WinBorder: Push Close Button\n")); + _decorator->SetMinimize(true); + _decorator->DrawMinimize(); + break; + } case DEC_MOVETOBACK: { STRACE_CLICK(("WinBorder: MoveToBack\n")); @@ -175,53 +184,75 @@ void WinBorder::MouseDown(int8 *buffer) } } } - // user clicked in window's area - else{ + // user clicked in window's area + else + { STRACE_CLICK(("WinBorder: MoveToFront 2\n")); bool sendMessage = true; - if (1 /* TODO: uncomment: ActiveLayer() != this*/){ + if (1 /* TODO: uncomment: ActiveLayer() != this*/) + { MoveToFront(); if (0 /* B_FIRST_CLICK? what's the name of that flaaaag ??? */){ sendMessage = false; } } - if (sendMessage){ - BMessage msg; - // a tweak for converting a point into local coords. :-) - BRect helpRect(pt.x, pt.y, pt.x+1, pt.y+1); - msg.what = B_MOUSE_DOWN; - msg.AddInt64("when", real_time_clock_usecs()); - msg.AddPoint("where", (_win->fTopLayer->LayerAt(pt)->ConvertFromTop(helpRect)).LeftTop() ); - msg.AddInt32("modifiers", modifiers); - msg.AddInt32("buttons", buttons); - msg.AddInt32("clicks", 1); - - _win->SendMessageToClient( &msg ); + if (sendMessage) + { + Layer *targetLayer=_win->fTopLayer->LayerAt(pt); + if(targetLayer) + { + BMessage msg; + + // a tweak for converting a point into local coords. :-) + BRect helpRect(pt.x, pt.y, pt.x+1, pt.y+1); + msg.what = B_MOUSE_DOWN; + msg.AddInt64("when", real_time_clock_usecs()); + msg.AddPoint("where", (targetLayer->ConvertFromTop(helpRect)).LeftTop() ); + msg.AddInt32("modifiers", modifiers); + msg.AddInt32("buttons", buttons); + msg.AddInt32("clicks", 1); + + _win->SendMessageToClient( &msg ); + } } } // this is important to determine how much we should resize or move the Layer(WinBorder)(window) fLastMousePosition = pt; } -void WinBorder::MouseMoved(int8 *buffer) +void WinBorder::MouseMoved(const BPoint &pt, const int32 &buttons) { // Buffer data: // 1) int64 - time of mouse click // 2) float - x coordinate of mouse click // 3) float - y coordinate of mouse click // 4) int32 - buttons down - int8 *index = buffer; index+=sizeof(int64); - float x = *((float*)index); index+=sizeof(float); - float y = *((float*)index); index+=sizeof(float); - int32 buttons = *((int32*)index); - - BPoint pt(x,y); -// TODO: modify this!!! _decorator->MouseMoved(...); - click_type action = _decorator->Clicked(pt, _mbuttons, _kmodifiers); - - switch (action){ + + click_type action = _decorator->Clicked(pt, _mbuttons, _kmodifiers); + + + // If the user clicked a button and then moused away without lifting the button, + // we don't want to trigger the button. Instead, we reset it to its original up state + if(_decorator->GetClose() && action!=DEC_CLOSE) + { + _decorator->SetClose(false); + _decorator->DrawClose(); + } + if(_decorator->GetZoom() && action!=DEC_ZOOM) + { + _decorator->SetZoom(false); + _decorator->DrawZoom(); + } + if(_decorator->GetMinimize() && action!=DEC_MINIMIZE) + { + _decorator->SetMinimize(false); + _decorator->DrawMinimize(); + } + + switch (action) + { case DEC_DRAG: { STRACE_CLICK(("WinBorder: Drag\n")); @@ -240,11 +271,13 @@ void WinBorder::MouseMoved(int8 *buffer) ResizeBy( difference.x, difference.y ); break; } - default:{ - BMessage msg; - // a tweak for converting a point into local coords. :-) - BRect helpRect(pt.x, pt.y, pt.x+1, pt.y+1); - msg.what = B_MOUSE_MOVED; + default: + { + BMessage msg; + + // a tweak for converting a point into local coords. :-) + BRect helpRect(pt.x, pt.y, pt.x+1, pt.y+1); + msg.what = B_MOUSE_MOVED; msg.AddInt64("when", real_time_clock_usecs()); msg.AddPoint("where", (_win->fTopLayer->ConvertFromTop(helpRect)).LeftTop() ); msg.AddInt32("buttons", buttons); @@ -252,69 +285,82 @@ void WinBorder::MouseMoved(int8 *buffer) _win->SendMessageToClient( &msg ); } } - // this is important to determine how much we should resize or move the Layer(WinBorder)(window) + // this is important to determine how much we should resize or move the + // Layer(WinBorder)(window) fLastMousePosition = pt; } -void WinBorder::MouseUp(int8 *buffer) +void WinBorder::MouseUp(const BPoint &pt, const int32 &modifiers) { -STRACE_MOUSE(("WinBorder %s: MouseUp() \n",GetName())); + STRACE_MOUSE(("WinBorder %s: MouseUp() \n",GetName())); + // buffer data: // 1) int64 - time of mouse click // 2) float - x coordinate of mouse click // 3) float - y coordinate of mouse click // 4) int32 - modifier keys down - int8 *index = buffer; index+=sizeof(int64); - float x = *((float*)index); index+=sizeof(float); - float y = *((float*)index); index+=sizeof(float); - int32 modifiers = *((int32*)index); - - BPoint pt(x,y); -// TODO: modify this!!! _decorator->MouseUp(...); + click_type action =_decorator->Clicked(pt, _mbuttons, _kmodifiers); - switch (action){ + switch (action) + { case DEC_CLOSE: { STRACE_CLICK(("WinBorder: Close\n")); - /* NOTE: I think you better put this code in... ServerWindow::Close() - * and call that here!!! - * SW::Close() must send B_QUIT_REQUESTED and wait for an answer first. - */ - - RemoveSelf(); - delete this; + + if(_decorator->GetClose()) + { + _decorator->SetClose(false); + _decorator->DrawClose(); + + BMessage msg(B_QUIT_REQUESTED); + _win->SendMessageToClient(&msg); + } break; } case DEC_ZOOM: { STRACE_CLICK(("WinBorder: Zoom\n")); - /* NOTE: I think you better put this code in... ServerWindow::Zoom() - * and call that here!!! - */ - // TODO: implement - // if (actual_coods != max_zoom_coords) - // MoveBy(X, Y); - // ResizeBy(X, Y); - // TODO: send B_ZOOM to client; + + if(_decorator->GetZoom()) + { + _decorator->SetZoom(false); + _decorator->DrawZoom(); + + BMessage msg(B_ZOOM); + _win->SendMessageToClient(&msg); + } break; } case DEC_MINIMIZE: { STRACE_CLICK(("WinBoder: Minimize\n")); - _win->Minimize(true); + if(_decorator->GetMinimize()) + { + _decorator->SetMinimize(false); + _decorator->DrawMinimize(); + + BMessage msg(B_MINIMIZE); + _win->SendMessageToClient(&msg); + } break; } - default:{ - BMessage msg; - // a tweak for converting a point into local coords. :-) - BRect helpRect(pt.x, pt.y, pt.x+1, pt.y+1); - msg.what = B_MOUSE_UP; - msg.AddInt64("when", real_time_clock_usecs()); - msg.AddPoint("where", (_win->fTopLayer->LayerAt(pt)->ConvertFromTop(helpRect)).LeftTop() ); - msg.AddInt32("modifiers", modifiers); - - _win->SendMessageToClient( &msg ); + default: + { + Layer *targetLayer=_win->fTopLayer->LayerAt(pt); + if(targetLayer) + { + BMessage msg; + + // a tweak for converting a point into local coords. :-) + BRect helpRect(pt.x, pt.y, pt.x+1, pt.y+1); + msg.what = B_MOUSE_UP; + msg.AddInt64("when", real_time_clock_usecs()); + msg.AddPoint("where", (targetLayer->ConvertFromTop(helpRect)).LeftTop() ); + msg.AddInt32("modifiers", modifiers); + + _win->SendMessageToClient( &msg ); + } } } } @@ -414,9 +460,9 @@ void WinBorder::RebuildRegions( const BRect& r ){ void WinBorder::Draw(const BRect &r) { //TODO: REMOVE this! For Test purposes only! -printf("*WinBorder(%s)::Draw()\n", GetName()); - _decorator->Draw(); -printf("#WinBorder(%s)::Draw() ENDED\n", GetName()); + STRACE(("*WinBorder(%s)::Draw()\n", GetName())); + _decorator->Draw(); + STRACE(("#WinBorder(%s)::Draw() ENDED\n", GetName())); return; //---------------- @@ -736,9 +782,9 @@ void WinBorder::AddToSubsetOf(WinBorder* main){ RootLayer *rl = main->GetRootLayer(); desktop->fGeneralLock.Lock(); -printf("WinBorder(%s)::AddToSubsetOf(%s) - General lock acquired\n", GetName(), main->GetName()); + STRACE(("WinBorder(%s)::AddToSubsetOf(%s) - General lock acquired\n", GetName(), main->GetName())); rl->fMainLock.Lock(); -printf("WinBorder(%s)::AddToSubsetOf(%s) - Main lock acquired\n", GetName(), main->GetName()); + STRACE(("WinBorder(%s)::AddToSubsetOf(%s) - Main lock acquired\n", GetName(), main->GetName())); for(int32 i = 0; i < rl->WorkspaceCount(); i++){ Workspace *ws = rl->WorkspaceAt(i+1); @@ -747,9 +793,9 @@ printf("WinBorder(%s)::AddToSubsetOf(%s) - Main lock acquired\n", GetName(), mai } rl->fMainLock.Unlock(); -printf("WinBorder(%s)::AddToSubsetOf(%s) - Main lock released\n", GetName(), main->GetName()); + STRACE(("WinBorder(%s)::AddToSubsetOf(%s) - Main lock released\n", GetName(), main->GetName())); desktop->fGeneralLock.Unlock(); -printf("WinBorder(%s)::AddToSubsetOf(%s) - General lock released\n", GetName(), main->GetName()); + STRACE(("WinBorder(%s)::AddToSubsetOf(%s) - General lock released\n", GetName(), main->GetName())); } } } @@ -758,9 +804,9 @@ void WinBorder::RemoveFromSubsetOf(WinBorder* main){ RootLayer *rl = main->GetRootLayer(); desktop->fGeneralLock.Lock(); -printf("WinBorder(%s)::RemoveFromSubsetOf(%s) - General lock acquired\n", GetName(), main->GetName()); + STRACE(("WinBorder(%s)::RemoveFromSubsetOf(%s) - General lock acquired\n", GetName(), main->GetName())); rl->fMainLock.Lock(); -printf("WinBorder(%s)::RemoveFromSubsetOf(%s) - Main lock acquired\n", GetName(), main->GetName()); + STRACE(("WinBorder(%s)::RemoveFromSubsetOf(%s) - Main lock acquired\n", GetName(), main->GetName())); // remove from main window's subset list. if(main->Window()->fWinFMWList.RemoveItem(this)){ int32 count = main->GetRootLayer()->WorkspaceCount(); @@ -776,9 +822,9 @@ printf("WinBorder(%s)::RemoveFromSubsetOf(%s) - Main lock acquired\n", GetName() fMainWinBorder = NULL; rl->fMainLock.Unlock(); -printf("WinBorder(%s)::RemoveFromSubsetOf(%s) - Main lock released\n", GetName(), main->GetName()); + STRACE(("WinBorder(%s)::RemoveFromSubsetOf(%s) - Main lock released\n", GetName(), main->GetName())); desktop->fGeneralLock.Unlock(); -printf("WinBorder(%s)::RemoveFromSubsetOf(%s) - General lock released\n", GetName(), main->GetName()); + STRACE(("WinBorder(%s)::RemoveFromSubsetOf(%s) - General lock released\n", GetName(), main->GetName())); } //--------------------------------------------------------------------------- void WinBorder::PrintToStream(){ diff --git a/src/servers/app/server/WinBorder.h b/src/servers/app/server/WinBorder.h index 3840633c6d..bdff000c96 100644 --- a/src/servers/app/server/WinBorder.h +++ b/src/servers/app/server/WinBorder.h @@ -38,69 +38,69 @@ class DisplayDriver; class WinBorder : public Layer { public: - WinBorder(const BRect &r, const char *name, const int32 look, - const int32 feel, const int32 flags, ServerWindow *win); - virtual ~WinBorder(void); - - virtual void RebuildRegions( const BRect& r ); - virtual void Draw(const BRect &r); - - virtual void MoveBy(float x, float y); - virtual void ResizeBy(float x, float y); - bool HasPoint(BPoint pt) const; + WinBorder(const BRect &r, const char *name, const int32 look, + const int32 feel, const int32 flags, ServerWindow *win); + virtual ~WinBorder(void); + + virtual void RebuildRegions( const BRect& r ); + virtual void Draw(const BRect &r); + + virtual void MoveBy(float x, float y); + virtual void ResizeBy(float x, float y); + bool HasPoint(BPoint pt) const; + + void MoveToBack(); + void MoveToFront(); + + void MouseDown(const BPoint &pt, const int32 &buttons, const int32 &modifiers); + void MouseMoved(const BPoint &pt, const int32 &buttons); + void MouseUp(const BPoint &pt, const int32 &modifiers); + + virtual void Hide(); + virtual void Show(); + + void UpdateColors(void); + void UpdateDecorator(void); + void UpdateFont(void); + void UpdateScreen(void); + + void SetFocus(const bool &active); + ServerWindow* Window(void) const { return _win; } + Decorator* GetDecorator(void) const { return _decorator; } + + WinBorder* MainWinBorder() const; + void SetLevel(); + + void AddToSubsetOf(WinBorder* main); + void RemoveFromSubsetOf(WinBorder* main); + + void PrintToStream(); + + // Server "private" :-) - should not be used + void SetMainWinBorder(WinBorder *newMain); - void MoveToBack(); - void MoveToFront(); - - void MouseDown(int8 *buffer); - void MouseMoved(int8 *buffer); - void MouseUp(int8 *buffer); - - virtual void Hide(); - virtual void Show(); - - void UpdateColors(void); - void UpdateDecorator(void); - void UpdateFont(void); - void UpdateScreen(void); - - void SetFocus(const bool &active); - ServerWindow* Window(void) const { return _win; } - Decorator* GetDecorator(void) const { return _decorator; } - - WinBorder* MainWinBorder() const; - void SetLevel(); - - void AddToSubsetOf(WinBorder* main); - void RemoveFromSubsetOf(WinBorder* main); - - void PrintToStream(); - -// Server "private" :-) - should not be used - void SetMainWinBorder(WinBorder *newMain); - protected: - ServerWindow *_win; - //BString *_title; - Decorator *_decorator; - int32 _flags; - BRect _clientframe; - int32 _mbuttons, - _kmodifiers; - BPoint fLastMousePosition; - bool _update; - bool _hresizewin,_vresizewin; + ServerWindow *_win; + //BString *_title; + Decorator *_decorator; + int32 _flags; + BRect _clientframe; + int32 _mbuttons, + _kmodifiers; + BPoint fLastMousePosition; + bool _update; + bool _hresizewin,_vresizewin; - BRegion *fDecFull, - *fDecFullVisible, - *fDecVisible; + BRegion *fDecFull, + *fDecFullVisible, + *fDecVisible; - WinBorder* fMainWinBorder; -/* bool fIsMoving; - bool fIsResizing; - bool fIsClosing; - bool fIsMinimizing; - bool fIsZooming + WinBorder *fMainWinBorder; +/* bool fIsMoving; + bool fIsResizing; + bool fIsClosing; + bool fIsMinimizing; + bool fIsZooming */ }; diff --git a/src/servers/app/server/Workspace.cpp b/src/servers/app/server/Workspace.cpp index 0249b60bb5..f8f27b436d 100644 --- a/src/servers/app/server/Workspace.cpp +++ b/src/servers/app/server/Workspace.cpp @@ -38,7 +38,7 @@ #include "RootLayer.h" #include "Desktop.h" -#define DEBUG_WORKSPACE +//#define DEBUG_WORKSPACE #ifdef DEBUG_WORKSPACE # include @@ -167,14 +167,14 @@ STRACESTREAM(); RemoveItem(item); delete item; -STRACESTREAM(); + STRACESTREAM(); opLock.Unlock(); // reset some internal variables layer->SetMainWinBorder(NULL); // its RootLayer is set to NULL by Layer::RemoveChild(layer); -printf("Layer %s found and removed from Workspace No %ld\n", layer->GetName(), ID()); + STRACE(("Layer %s found and removed from Workspace No %ld\n", layer->GetName(), ID())); if (wasFocus) SetFocusLayer(nextItem? nextItem->layerPtr: NULL); @@ -184,7 +184,7 @@ printf("Layer %s found and removed from Workspace No %ld\n", layer->GetName(), I return true; } else{ -printf("Layer %s NOT found in Workspace No %ld\n", layer->GetName(), ID()); + STRACE(("Layer %s NOT found in Workspace No %ld\n", layer->GetName(), ID())); opLock.Unlock(); return false; } @@ -337,11 +337,11 @@ WinBorder* Workspace::SearchLayerUnderPoint(BPoint pt){ // For the moment, take windows from front to back and see in witch one 'pt' falls WinBorder *target = NULL; opLock.Lock(); -printf("Searching (%f,%f) in...\n", pt.x, pt.y); + STRACE(("Searching (%f,%f) in...\n", pt.x, pt.y)); for( WinBorder *wb = GoToBottomItem(); wb; wb = GoToUpperItem()){ -wb->PrintToStream(); +// wb->PrintToStream(); if (!wb->IsHidden() && wb->HasPoint(pt)){ -printf("%s - SELECTED!\n", wb->GetName()); + STRACE(("%s - SELECTED!\n", wb->GetName())); target = wb; break; } @@ -461,7 +461,7 @@ ListData* Workspace::FindPlace(ListData* pref){ while(pref && item->lowerItem != pref && (pref->upperItem || pref->lowerItem)){ if ( !(item->layerPtr->Window()->Flags() & B_AVOID_FRONT) && !(item->layerPtr->IsHidden()) ) break; -printf("item: %s - pref: %s\n", item->layerPtr->GetName(), pref->layerPtr->GetName()); + STRACE(("item: %s - pref: %s\n", item->layerPtr->GetName(), pref->layerPtr->GetName())); if (item == fTopItem) item = fBottomItem; else @@ -612,10 +612,10 @@ STRACE(("#WS(%ld)::SASNF(%s) ENDED 2\n", ID(), preferred? preferred->GetName(): } if(!lastInserted){ - printf("PAAAAANIC: Workspace::SASNF(): 'lastInserted' IS NULL\n"); + STRACE(("PAAAAANIC: Workspace::SASNF(): 'lastInserted' IS NULL\n")); } else{ - printf("\n&&&&Processing for: %s\n", lastInserted->layerPtr->GetName()); + STRACE(("\n&&&&Processing for: %s\n", lastInserted->layerPtr->GetName())); } if (lastInserted && !(lastInserted->layerPtr->IsHidden())){ @@ -987,7 +987,7 @@ STRACE((" MODAL ALL/SYSTEM FIRST Window '%s'\n", preferred? preferred->GetName() } else{ // We ***should NOT*** reach this point! - printf("SERVER: PANIC: \"%s\": What kind of window is this???\n", preferred? preferred->GetName(): "NULL"); + STRACE(("SERVER: PANIC: \"%s\": What kind of window is this???\n", preferred? preferred->GetName(): "NULL")); } } else