From a596e677c71887d4fbd5e6b55773b206d44edb81 Mon Sep 17 00:00:00 2001 From: DarkWyrm Date: Sat, 26 Jun 2004 02:15:48 +0000 Subject: [PATCH] AppServer.cpp: removed a memory leak from new_decorator decorators now set appropriate fonts for their context WinBorder: tweaked some debug output settings Layer: tweaked some debug output settings PicturePlayer: added some tentative code and notes for escapements in DrawString case for player CursorManager: update to resemble OT style RootLayer: removed testing-purposes-only Draw() function Implemented methods to read in workspace data Workspace: Janitorial work Added methods for packing and unpacking settings Added some members for holding basic settings Desktop: Moved workspace data functions to RootLayer Other files: Janitorial work git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8172 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/server/AppServer.cpp | 2 - src/servers/app/server/CursorManager.cpp | 240 +-- src/servers/app/server/CursorManager.h | 26 +- src/servers/app/server/Decorator.cpp | 22 +- src/servers/app/server/DefaultDecorator.cpp | 14 +- src/servers/app/server/Desktop.cpp | 21 +- src/servers/app/server/Desktop.h | 47 +- src/servers/app/server/Layer.cpp | 21 +- src/servers/app/server/PicturePlayer.cpp | 11 +- src/servers/app/server/RootLayer.cpp | 199 +-- src/servers/app/server/RootLayer.h | 6 +- src/servers/app/server/ServerBitmap.cpp | 5 +- src/servers/app/server/ServerWindow.cpp | 9 +- src/servers/app/server/WinBorder.cpp | 15 +- src/servers/app/server/Workspace.cpp | 1499 +++++++++++-------- src/servers/app/server/Workspace.h | 162 +- 16 files changed, 1301 insertions(+), 998 deletions(-) diff --git a/src/servers/app/server/AppServer.cpp b/src/servers/app/server/AppServer.cpp index 7586aad30f..e27ea64ae8 100644 --- a/src/servers/app/server/AppServer.cpp +++ b/src/servers/app/server/AppServer.cpp @@ -821,7 +821,6 @@ Decorator *new_decorator(BRect rect, const char *title, int32 wlook, int32 wfeel { Decorator *dec=NULL; - dec=new DefaultDecorator(rect,wlook,wfeel,wflags); if(!app_server->make_decorator) dec=new DefaultDecorator(rect,wlook,wfeel,wflags); else @@ -830,7 +829,6 @@ Decorator *new_decorator(BRect rect, const char *title, int32 wlook, int32 wfeel gui_colorset.Lock(); dec->SetDriver(ddriver); dec->SetColors(gui_colorset); - dec->SetFont(fontserver->GetSystemPlain()); dec->SetTitle(title); gui_colorset.Unlock(); diff --git a/src/servers/app/server/CursorManager.cpp b/src/servers/app/server/CursorManager.cpp index 1d6a80c998..0b24329af1 100644 --- a/src/servers/app/server/CursorManager.cpp +++ b/src/servers/app/server/CursorManager.cpp @@ -42,47 +42,47 @@ CursorManager *cursormanager; //! Initializes the CursorManager CursorManager::CursorManager(void) { - _cursorlist=new BList(0); + fCursorList=new BList(0); // Error code for AddCursor - _tokenizer.ExcludeValue(B_ERROR); + fTokenizer.ExcludeValue(B_ERROR); // Set system cursors to "unassigned" ServerCursor *cdefault=new ServerCursor(default_cursor_data); AddCursor(cdefault); - _defaultcsr=cdefault; + fDefaultCursor=cdefault; ServerCursor *ctext=new ServerCursor(default_text_data); AddCursor(ctext); - _textcsr=ctext; + fTextCursor=ctext; ServerCursor *cmove=new ServerCursor(default_move_data); AddCursor(cmove); - _movecsr=cmove; + fMoveCursor=cmove; ServerCursor *cdrag=new ServerCursor(default_drag_data); AddCursor(cdrag); - _dragcsr=cdrag; + fDragCursor=cdrag; ServerCursor *cresize=new ServerCursor(default_resize_data); AddCursor(cresize); - _resizecsr=cresize; + fResizeCursor=cresize; ServerCursor *cresizenwse=new ServerCursor(default_resize_nwse_data); AddCursor(cresizenwse); - _resize_nwse_csr=cresizenwse; + fNWSECursor=cresizenwse; ServerCursor *cresizenesw=new ServerCursor(default_resize_nesw_data); AddCursor(cresizenesw); - _resize_nesw_csr=cresizenesw; + fNESWCursor=cresizenesw; ServerCursor *cresizens=new ServerCursor(default_resize_ns_data); AddCursor(cresizens); - _resize_ns_csr=cresizens; + fNSCursor=cresizens; ServerCursor *cresizeew=new ServerCursor(default_resize_ew_data); AddCursor(cresizeew); - _resize_ew_csr=cresizeew; + fEWCursor=cresizeew; } @@ -90,14 +90,14 @@ CursorManager::CursorManager(void) CursorManager::~CursorManager(void) { ServerCursor *temp; - for(int32 i=0; i<_cursorlist->CountItems();i++) + for(int32 i=0; iCountItems();i++) { - temp=(ServerCursor*)_cursorlist->ItemAt(i); + temp=(ServerCursor*)fCursorList->ItemAt(i); if(temp) delete temp; } - _cursorlist->MakeEmpty(); - delete _cursorlist; + fCursorList->MakeEmpty(); + delete fCursorList; // Note that it is not necessary to remove and delete the system // cursors. These cursors are kept in the list with a NULL application @@ -117,8 +117,8 @@ int32 CursorManager::AddCursor(ServerCursor *sc) return B_ERROR; Lock(); - _cursorlist->AddItem(sc); - int32 value=_tokenizer.GetToken(); + fCursorList->AddItem(sc); + int32 value=fTokenizer.GetToken(); sc->_token=value; Unlock(); @@ -136,12 +136,12 @@ void CursorManager::DeleteCursor(int32 token) Lock(); ServerCursor *temp; - for(int32 i=0; i<_cursorlist->CountItems();i++) + for(int32 i=0; iCountItems();i++) { - temp=(ServerCursor*)_cursorlist->ItemAt(i); + temp=(ServerCursor*)fCursorList->ItemAt(i); if(temp && temp->_token==token) { - _cursorlist->RemoveItem(i); + fCursorList->RemoveItem(i); delete temp; break; } @@ -161,13 +161,13 @@ void CursorManager::RemoveAppCursors(const char *signature) Lock(); ServerCursor *temp; - for(int32 i=0; i<_cursorlist->CountItems();i++) + for(int32 i=0; iCountItems();i++) { - temp=(ServerCursor*)_cursorlist->ItemAt(i); + temp=(ServerCursor*)fCursorList->ItemAt(i); if(temp && temp->GetAppSignature() && strcmp(signature, temp->GetAppSignature())==0) { - _cursorlist->RemoveItem(i); + fCursorList->RemoveItem(i); delete temp; break; } @@ -212,12 +212,12 @@ void CursorManager::ObscureCursor(void) void CursorManager::SetCursor(int32 token) { Lock(); - ServerCursor *c=_FindCursor(token); + ServerCursor *c=FindCursor(token); if(c) { DisplayDriver *driver = desktop->ActiveScreen()->DDriver(); driver->SetCursor(c); - _current_which=B_CURSOR_OTHER; + fCurrentWhich=B_CURSOR_OTHER; } Unlock(); } @@ -231,56 +231,56 @@ void CursorManager::SetCursor(cursor_which which) { case B_CURSOR_DEFAULT: { - driver->SetCursor(_defaultcsr); - _current_which=which; + driver->SetCursor(fDefaultCursor); + fCurrentWhich=which; break; } case B_CURSOR_TEXT: { - driver->SetCursor(_textcsr); - _current_which=which; + driver->SetCursor(fTextCursor); + fCurrentWhich=which; break; } case B_CURSOR_MOVE: { - driver->SetCursor(_movecsr); - _current_which=which; + driver->SetCursor(fMoveCursor); + fCurrentWhich=which; break; } case B_CURSOR_DRAG: { - driver->SetCursor(_dragcsr); - _current_which=which; + driver->SetCursor(fDragCursor); + fCurrentWhich=which; break; } case B_CURSOR_RESIZE: { - driver->SetCursor(_resizecsr); - _current_which=which; + driver->SetCursor(fResizeCursor); + fCurrentWhich=which; break; } case B_CURSOR_RESIZE_NWSE: { - driver->SetCursor(_resize_nwse_csr); - _current_which=which; + driver->SetCursor(fNWSECursor); + fCurrentWhich=which; break; } case B_CURSOR_RESIZE_NESW: { - driver->SetCursor(_resize_nesw_csr); - _current_which=which; + driver->SetCursor(fNESWCursor); + fCurrentWhich=which; break; } case B_CURSOR_RESIZE_NS: { - driver->SetCursor(_resize_ns_csr); - _current_which=which; + driver->SetCursor(fNSCursor); + fCurrentWhich=which; break; } case B_CURSOR_RESIZE_EW: { - driver->SetCursor(_resize_ew_csr); - _current_which=which; + driver->SetCursor(fEWCursor); + fCurrentWhich=which; break; } default: @@ -309,65 +309,65 @@ void CursorManager::SetCursorSet(const char *path) if(cs.FindCursor(B_CURSOR_DEFAULT,&csr)==B_OK) { - if(_defaultcsr) - delete _defaultcsr; - _defaultcsr=csr; + if(fDefaultCursor) + delete fDefaultCursor; + fDefaultCursor=csr; } if(cs.FindCursor(B_CURSOR_TEXT,&csr)==B_OK) { - if(_textcsr) - delete _textcsr; - _textcsr=csr; + if(fTextCursor) + delete fTextCursor; + fTextCursor=csr; } if(cs.FindCursor(B_CURSOR_MOVE,&csr)==B_OK) { - if(_movecsr) - delete _movecsr; - _movecsr=csr; + if(fMoveCursor) + delete fMoveCursor; + fMoveCursor=csr; } if(cs.FindCursor(B_CURSOR_DRAG,&csr)==B_OK) { - if(_dragcsr) - delete _dragcsr; - _dragcsr=csr; + if(fDragCursor) + delete fDragCursor; + fDragCursor=csr; } if(cs.FindCursor(B_CURSOR_RESIZE,&csr)==B_OK) { - if(_resizecsr) - delete _resizecsr; - _resizecsr=csr; + if(fResizeCursor) + delete fResizeCursor; + fResizeCursor=csr; } if(cs.FindCursor(B_CURSOR_RESIZE_NWSE,&csr)==B_OK) { - if(_resize_nwse_csr) - delete _resize_nwse_csr; - _resize_nwse_csr=csr; + if(fNWSECursor) + delete fNWSECursor; + fNWSECursor=csr; } if(cs.FindCursor(B_CURSOR_RESIZE_NESW,&csr)==B_OK) { - if(_resize_nesw_csr) - delete _resize_nesw_csr; - _resize_nesw_csr=csr; + if(fNESWCursor) + delete fNESWCursor; + fNESWCursor=csr; } if(cs.FindCursor(B_CURSOR_RESIZE_NS,&csr)==B_OK) { - if(_resize_ns_csr) - delete _resize_ns_csr; - _resize_ns_csr=csr; + if(fNSCursor) + delete fNSCursor; + fNSCursor=csr; } if(cs.FindCursor(B_CURSOR_RESIZE_EW,&csr)==B_OK) { - if(_resize_ew_csr) - delete _resize_ew_csr; - _resize_ew_csr=csr; + if(fEWCursor) + delete fEWCursor; + fEWCursor=csr; } Unlock(); @@ -389,47 +389,47 @@ ServerCursor *CursorManager::GetCursor(cursor_which which) { case B_CURSOR_DEFAULT: { - temp=_defaultcsr; + temp=fDefaultCursor; break; } case B_CURSOR_TEXT: { - temp=_textcsr; + temp=fTextCursor; break; } case B_CURSOR_MOVE: { - temp=_movecsr; + temp=fMoveCursor; break; } case B_CURSOR_DRAG: { - temp=_dragcsr; + temp=fDragCursor; break; } case B_CURSOR_RESIZE: { - temp=_resizecsr; + temp=fResizeCursor; break; } case B_CURSOR_RESIZE_NWSE: { - temp=_resize_nwse_csr; + temp=fNWSECursor; break; } case B_CURSOR_RESIZE_NESW: { - temp=_resize_nesw_csr; + temp=fNESWCursor; break; } case B_CURSOR_RESIZE_NS: { - temp=_resize_ns_csr; + temp=fNSCursor; break; } case B_CURSOR_RESIZE_EW: { - temp=_resize_ew_csr; + temp=fEWCursor; break; } default: @@ -449,7 +449,7 @@ cursor_which CursorManager::GetCursorWhich(void) cursor_which temp; Lock(); - temp=_current_which; + temp=fCurrentWhich; Unlock(); return temp; } @@ -468,7 +468,7 @@ void CursorManager::ChangeCursor(cursor_which which, int32 token) Lock(); // Find the cursor, based on the token - ServerCursor *cursor=_FindCursor(token); + ServerCursor *cursor=FindCursor(token); // Did we find a cursor with this token? if(!cursor) @@ -482,111 +482,111 @@ void CursorManager::ChangeCursor(cursor_which which, int32 token) { case B_CURSOR_DEFAULT: { - if(_defaultcsr) - delete _defaultcsr; + if(fDefaultCursor) + delete fDefaultCursor; - _defaultcsr=cursor; + fDefaultCursor=cursor; if(cursor->GetAppSignature()) cursor->SetAppSignature(""); - _cursorlist->RemoveItem(cursor); + fCursorList->RemoveItem(cursor); break; } case B_CURSOR_TEXT: { - if(_textcsr) - delete _textcsr; + if(fTextCursor) + delete fTextCursor; - _textcsr=cursor; + fTextCursor=cursor; if(cursor->GetAppSignature()) cursor->SetAppSignature(""); - _cursorlist->RemoveItem(cursor); + fCursorList->RemoveItem(cursor); break; } case B_CURSOR_MOVE: { - if(_movecsr) - delete _movecsr; + if(fMoveCursor) + delete fMoveCursor; - _movecsr=cursor; + fMoveCursor=cursor; if(cursor->GetAppSignature()) cursor->SetAppSignature(""); - _cursorlist->RemoveItem(cursor); + fCursorList->RemoveItem(cursor); break; } case B_CURSOR_DRAG: { - if(_dragcsr) - delete _dragcsr; + if(fDragCursor) + delete fDragCursor; - _dragcsr=cursor; + fDragCursor=cursor; if(cursor->GetAppSignature()) cursor->SetAppSignature(""); - _cursorlist->RemoveItem(cursor); + fCursorList->RemoveItem(cursor); break; } case B_CURSOR_RESIZE: { - if(_resizecsr) - delete _resizecsr; + if(fResizeCursor) + delete fResizeCursor; - _resizecsr=cursor; + fResizeCursor=cursor; if(cursor->GetAppSignature()) cursor->SetAppSignature(""); - _cursorlist->RemoveItem(cursor); + fCursorList->RemoveItem(cursor); break; } case B_CURSOR_RESIZE_NWSE: { - if(_resize_nwse_csr) - delete _resize_nwse_csr; + if(fNWSECursor) + delete fNWSECursor; - _resize_nwse_csr=cursor; + fNWSECursor=cursor; if(cursor->GetAppSignature()) cursor->SetAppSignature(""); - _cursorlist->RemoveItem(cursor); + fCursorList->RemoveItem(cursor); break; } case B_CURSOR_RESIZE_NESW: { - if(_resize_nesw_csr) - delete _resize_nesw_csr; + if(fNESWCursor) + delete fNESWCursor; - _resize_nesw_csr=cursor; + fNESWCursor=cursor; if(cursor->GetAppSignature()) cursor->SetAppSignature(""); - _cursorlist->RemoveItem(cursor); + fCursorList->RemoveItem(cursor); break; } case B_CURSOR_RESIZE_NS: { - if(_resize_ns_csr) - delete _resize_ns_csr; + if(fNSCursor) + delete fNSCursor; - _resize_ns_csr=cursor; + fNSCursor=cursor; if(cursor->GetAppSignature()) cursor->SetAppSignature(""); - _cursorlist->RemoveItem(cursor); + fCursorList->RemoveItem(cursor); break; } case B_CURSOR_RESIZE_EW: { - if(_resize_ew_csr) - delete _resize_ew_csr; + if(fEWCursor) + delete fEWCursor; - _resize_ew_csr=cursor; + fEWCursor=cursor; if(cursor->GetAppSignature()) cursor->SetAppSignature(""); - _cursorlist->RemoveItem(cursor); + fCursorList->RemoveItem(cursor); break; } default: @@ -601,12 +601,12 @@ void CursorManager::ChangeCursor(cursor_which which, int32 token) \param token ID of the cursor to find \return The cursor or NULL if not found */ -ServerCursor *CursorManager::_FindCursor(int32 token) +ServerCursor *CursorManager::FindCursor(int32 token) { ServerCursor *temp; - for(int32 i=0; i<_cursorlist->CountItems();i++) + for(int32 i=0; iCountItems();i++) { - temp=(ServerCursor*)_cursorlist->ItemAt(i); + temp=(ServerCursor*)fCursorList->ItemAt(i); if(temp && temp->_token==token) return temp; } diff --git a/src/servers/app/server/CursorManager.h b/src/servers/app/server/CursorManager.h index 3072d9a09b..ff29db7f87 100644 --- a/src/servers/app/server/CursorManager.h +++ b/src/servers/app/server/CursorManager.h @@ -62,22 +62,22 @@ public: void ChangeCursor(cursor_which which, int32 token); void SetDefaults(void); private: - ServerCursor *_FindCursor(int32 token); + ServerCursor *FindCursor(int32 token); - BList *_cursorlist; - TokenHandler _tokenizer; + BList *fCursorList; + TokenHandler fTokenizer; // System cursor members - ServerCursor *_defaultcsr, - *_textcsr, - *_movecsr, - *_dragcsr, - *_resizecsr, - *_resize_nwse_csr, - *_resize_nesw_csr, - *_resize_ns_csr, - *_resize_ew_csr; - cursor_which _current_which; + ServerCursor *fDefaultCursor, + *fTextCursor, + *fMoveCursor, + *fDragCursor, + *fResizeCursor, + *fNWSECursor, + *fNESWCursor, + *fNSCursor, + *fEWCursor; + cursor_which fCurrentWhich; }; extern CursorManager *cursormanager; diff --git a/src/servers/app/server/Decorator.cpp b/src/servers/app/server/Decorator.cpp index 7c696f59b6..3055cf9df1 100644 --- a/src/servers/app/server/Decorator.cpp +++ b/src/servers/app/server/Decorator.cpp @@ -49,20 +49,22 @@ Decorator::Decorator(BRect rect, int32 wlook, int32 wfeel, int32 wflags) _title_string=new BString; _driver=NULL; - /// xxx.Set(0,0,1,1) produces a rectangle 2 pixels wide, that - // WILL be drawn on screen. We so not want that... so... - // [ A BRect when instantiated is made invalid, so, no need for: ] -/* _closerect.Set( 0, 0, -1, -1); + /// xxx.Set(0,0,1,1) produces a rectangle 2 pixels wide, that + // WILL be drawn on screen. We so not want that... so... + // [ A BRect when instantiated is made invalid, so, no need for: ] +/* + _closerect.Set( 0, 0, -1, -1); _zoomrect.Set( 0, 0, -1, -1); _minimizerect.Set( 0, 0, -1, -1); _resizerect.Set( 0, 0, -1, -1); */ _frame=rect; - // !!! rect rectangle MUST remain intact - it is top_view's area !!! - // Decorator drawing MUST be done arround that area !!! + + // rect rectangle MUST remain intact - it is top_view's area + // Decorator drawing MUST be done arround that area //_tabrect.Set(rect.left,rect.top,rect.right, rect.top+((rect.bottom-rect.top)/4)); - // [ A BRect when instantiated is made invalid, so, no need for: ] -/* _tabrect.Set( 0, 0, -1, -1 ); */ + // [ A BRect when instantiated is made invalid, so, no need for: ] +// _tabrect.Set( 0, 0, -1, -1 ); _look=wlook; _feel=wfeel; @@ -594,7 +596,3 @@ void Decorator::_DoLayout(void) { } -/* - @log - * changed SetFont to acomodate(eng?) with LayerData's 'font' member witch is now allocated on stack. -*/ diff --git a/src/servers/app/server/DefaultDecorator.cpp b/src/servers/app/server/DefaultDecorator.cpp index d56b6f72a9..620e3efa57 100644 --- a/src/servers/app/server/DefaultDecorator.cpp +++ b/src/servers/app/server/DefaultDecorator.cpp @@ -34,6 +34,7 @@ #include "RGBColor.h" #include "RectUtils.h" #include +#include "FontServer.h" //#define USE_VIEW_FILL_HACK @@ -52,7 +53,12 @@ DefaultDecorator::DefaultDecorator(BRect rect, int32 wlook, int32 wfeel, int32 w taboffset=0; titlepixelwidth=0; - + + SetFont(fontserver->GetSystemBold()); + _drawdata.font.SetSize(14); + _drawdata.font.SetFlags(B_FORCE_ANTIALIASING); + _drawdata.font.SetSpacing(B_STRING_SPACING); + framecolors=new RGBColor[6]; framecolors[0].SetColor(152,152,152); framecolors[1].SetColor(255,255,255); @@ -60,7 +66,9 @@ DefaultDecorator::DefaultDecorator(BRect rect, int32 wlook, int32 wfeel, int32 w framecolors[3].SetColor(136,136,136); framecolors[4].SetColor(152,152,152); framecolors[5].SetColor(96,96,96); - + + + // Set appropriate colors based on the current focus value. In this case, each decorator // defaults to not having the focus. _SetFocus(); @@ -365,7 +373,7 @@ void DefaultDecorator::_DrawTitle(BRect r) titlestr+="..."; titlecount+=2; } - + // The text position needs tweaked when working as a floating window because the closerect placement // is a little different. If it isn't moved, title placement looks really funky if(_look==B_FLOATING_WINDOW_LOOK) diff --git a/src/servers/app/server/Desktop.cpp b/src/servers/app/server/Desktop.cpp index 168dcc4a75..b63f265043 100644 --- a/src/servers/app/server/Desktop.cpp +++ b/src/servers/app/server/Desktop.cpp @@ -199,8 +199,8 @@ void Desktop::SetActiveRootLayer(RootLayer* rl) fActiveRootLayer = rl; -// TODO: fix!!!!!!!!!!!!!!!!!!!!!!!! or not? - // also set the new front and focus +// TODO: fix... or not? +// also set the new front and focus // SetFrontWinBorder(fActiveRootLayer->ActiveWorkspace()->FrontLayer()); // SetFocusWinBorder(fActiveRootLayer->ActiveWorkspace()->FocusLayer()); @@ -362,7 +362,7 @@ WinBorder* Desktop::FocusWinBorder(void) const //--------------------------------------------------------------------------- void Desktop::MouseEventHandler(PortMessage *msg) { -// TODO: locking mechanism needs SERIOUS rethought!!!! + // TODO: locking mechanism needs SERIOUS rethought switch(msg->Code()) { case B_MOUSE_DOWN: @@ -420,7 +420,7 @@ void Desktop::MouseEventHandler(PortMessage *msg) invalidRegion.Include(&(activeFocus->fFull)); invalidRegion.Include(&(activeFocus->fTopLayer->fFull)); activeFocus->fParent->FullInvalidate(invalidRegion); -// TODO: this is a hack!!! Should be something like this: +// TODO: this is a hack! Should be something like this: // void Layer::RebuildAndForceRedraw(invalidReg, target){ // BPoint pt(0,0); // StartRebuildRegions(invalidRegion, NULL, B_LAYER_NONE, pt); @@ -875,19 +875,6 @@ mode_mouse Desktop::FFMouseMode(void) const return fMouseMode; } -bool Desktop::ReadWorkspaceData(void) -{ - // TODO: implement - STRACE(("Desktop::ReadWorkspaceData unimplemented\n")); - return true; -} - -void Desktop::SaveWorkspaceData(void) -{ - // TODO: implement - STRACE(("Desktop::ReadWorkspaceData unimplemented\n")); -} - void Desktop::RemoveSubsetWindow(WinBorder* wb) { WinBorder *winBorder = NULL; diff --git a/src/servers/app/server/Desktop.h b/src/servers/app/server/Desktop.h index b3e9759d7a..7bb211ffa5 100644 --- a/src/servers/app/server/Desktop.h +++ b/src/servers/app/server/Desktop.h @@ -54,31 +54,31 @@ public: // Methods for multiple monitors. Screen *ScreenAt(int32 index) const; int32 ScreenCount(void) const; - Screen* ActiveScreen(void) const; + Screen *ActiveScreen(void) const; void SetActiveRootLayerByIndex(int32 listIndex); - void SetActiveRootLayer(RootLayer* rl); - RootLayer* RootLayerAt(int32 index); - RootLayer* ActiveRootLayer(void) const; + void SetActiveRootLayer(RootLayer *rl); + RootLayer *RootLayerAt(int32 index); + RootLayer *ActiveRootLayer(void) const; int32 ActiveRootLayerIndex(void) const; int32 CountRootLayers(void) const; - DisplayDriver* GetDisplayDriver(void) const; + DisplayDriver *GetDisplayDriver(void) const; // Methods for layer(WinBorder) manipulation. - void AddWinBorder(WinBorder* winBorder); - void RemoveWinBorder(WinBorder* winBorder); - bool HasWinBorder(WinBorder* winBorder); - void SetFrontWinBorder(WinBorder* winBorder); - void SetFocusWinBorder(WinBorder* winBorder); - WinBorder* FrontWinBorder(void) const; - WinBorder* FocusWinBorder(void) const; + void AddWinBorder(WinBorder *winBorder); + void RemoveWinBorder(WinBorder *winBorder); + bool HasWinBorder(WinBorder *winBorder); + void SetFrontWinBorder(WinBorder *winBorder); + void SetFocusWinBorder(WinBorder *winBorder); + WinBorder *FrontWinBorder(void) const; + WinBorder *FocusWinBorder(void) const; // Input related methods void MouseEventHandler(PortMessage *msg); void KeyboardEventHandler(PortMessage *msg); - void SetDragMessage(BMessage* msg); - BMessage* DragMessage(void) const; + void SetDragMessage(BMessage *msg); + BMessage *DragMessage(void) const; // Methods for various desktop stuff handled by the server void SetScrollBarInfo(const scroll_bar_info &info); @@ -93,16 +93,13 @@ public: void SetFFMouseMode(const mode_mouse &value); mode_mouse FFMouseMode(void) const; - bool ReadWorkspaceData(void); - void SaveWorkspaceData(void); - // Debugging methods void PrintToStream(void); void PrintVisibleInRootLayerNo(int32 no); // "Private" to app_server :-) - means they should not be used very much - void RemoveSubsetWindow(WinBorder* wb); - WinBorder* FindWinBorderByServerWindowTokenAndTeamID(int32 token, team_id teamID); + void RemoveSubsetWindow(WinBorder *wb); + WinBorder *FindWinBorderByServerWindowTokenAndTeamID(int32 token, team_id teamID); BLocker fGeneralLock; BLocker fLayerLock; @@ -112,16 +109,16 @@ private: BMessage *fDragMessage; BList fRootLayerList; - RootLayer* fActiveRootLayer; - WinBorder* fFrontWinBorder; - WinBorder* fFocusWinBorder; - WinBorder* fMouseTarget; + RootLayer *fActiveRootLayer; + WinBorder *fFrontWinBorder; + WinBorder *fFocusWinBorder; + WinBorder *fMouseTarget; BList fScreenList; // '1' or 'n' Screen(s). Not sure it's needed though. int32 fScreenMode; - Screen* fActiveScreen; + Screen *fActiveScreen; scroll_bar_info fScrollBarInfo; menu_info fMenuInfo; @@ -130,6 +127,6 @@ private: int32 fScreenShotIndex; }; -extern Desktop* desktop; +extern Desktop *desktop; #endif // _DESKTOP_H_ diff --git a/src/servers/app/server/Layer.cpp b/src/servers/app/server/Layer.cpp index 554f2a6742..eb4233e7f9 100644 --- a/src/servers/app/server/Layer.cpp +++ b/src/servers/app/server/Layer.cpp @@ -378,8 +378,8 @@ void Layer::FullInvalidate(const BRegion& region) { STRACE(("Layer(%s)::FullInvalidate():\n", GetName())); #ifdef DEBUG_LAYER - region.PrintToStream(); - printf("\n"); + region.PrintToStream(); + printf("\n"); #endif BPoint pt(0,0); @@ -394,8 +394,8 @@ void Layer::Invalidate(const BRegion& region) { STRACE(("Layer(%s)::Invalidate():\n", GetName())); #ifdef DEBUG_LAYER - region.PrintToStream(); - printf("\n"); + region.PrintToStream(); + printf("\n"); #endif gRedrawReg = region; @@ -440,7 +440,7 @@ void Layer::RequestDraw(const BRegion ®, Layer *startFrom) Draw(fUpdateReg.Frame()); fDriver->ConstrainClippingRegion(NULL); -// TODO: (WARNING!): For the Update code is MUST NOT be emptied!!! + // TODO: WARNING: For the Update code is MUST NOT be emptied fUpdateReg.MakeEmpty(); } } @@ -465,9 +465,11 @@ void Layer::RequestDraw(const BRegion ®, Layer *startFrom) void Layer::Draw(const BRect &r) { // TODO/NOTE: this should be an empty method! the next lines are for testing only -printf("Layer::Draw\n"); -r.PrintToStream(); - STRACE(("Layer::Draw() Called\n")); + +#ifdef DEBUG_LAYER +printf("Layer::Draw: "); +r.PrintToStream(); +#endif /* RGBColor col(152,102,51); fDriver->FillRect(fUpdateReg.Frame(), col); @@ -547,7 +549,7 @@ void Layer::RebuildFullRegion( ) else fFull.Set( fFrame ); - // TODO: restrict to screen coordinates!!! + // TODO: restrict to screen coordinates // TODO: Convert to screen coordinates! LayerData *ld; ld = fLayerData; @@ -942,7 +944,6 @@ void Layer::MoveBy(float x, float 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); diff --git a/src/servers/app/server/PicturePlayer.cpp b/src/servers/app/server/PicturePlayer.cpp index 43c5aa24ff..37bd0dc9e4 100644 --- a/src/servers/app/server/PicturePlayer.cpp +++ b/src/servers/app/server/PicturePlayer.cpp @@ -224,11 +224,14 @@ status_t PicturePlayer::Play(int32 tableEntries,void *userData, LayerData *d) char *string = new char[len + 1]; GetData(string, len); string[len] = '\0'; -// float deltax = GetFloat(); -// float deltay = GetFloat(); + float deltax = GetFloat(); + float deltay = GetFloat(); - // TODO: The deltas given are escapements. Find out how they translate into - // escapement_delta units. + // TODO: The deltas given are escapements. They seem to be called deltax and deltay + // despite the fact that they are space and non-space escapements. Find out which is which when possible. + // My best guess is that deltax corresponds to escapement_delta.nonspace. + fldata.edelta.nonspace=deltax; + fldata.edelta.space=deltay; fdriver->DrawString(string,len,fldata.penlocation,&fldata); delete string; diff --git a/src/servers/app/server/RootLayer.cpp b/src/servers/app/server/RootLayer.cpp index 5c7de63ff1..56938e8587 100644 --- a/src/servers/app/server/RootLayer.cpp +++ b/src/servers/app/server/RootLayer.cpp @@ -30,6 +30,8 @@ #include #include #include +#include +#include #include "Globals.h" #include "RootLayer.h" @@ -40,6 +42,7 @@ #include "ServerWindow.h" #include "ServerApp.h" #include "Desktop.h" +#include "ServerConfig.h" #include "FMWList.h" #include "DisplayDriver.h" @@ -66,6 +69,10 @@ RootLayer::RootLayer(const char *name, int32 workspaceCount, fRows = 0; fColumns = 0; + // TODO: this should eventually be replaced by a method to convert the monitor + // number to an index in the name, i.e. workspace_settings_1 for screen #1 + ReadWorkspaceData(WORKSPACE_DATA_LIST); + // TODO: read these 3 from a configuration file. fScreenXResolution = 0; fScreenYResolution = 0; @@ -74,7 +81,6 @@ RootLayer::RootLayer(const char *name, int32 workspaceCount, fViewToken = 0; // is this used for WinBorders? fHidden = false; - SetWorkspaceCount(workspaceCount); } RootLayer::~RootLayer() @@ -82,84 +88,6 @@ RootLayer::~RootLayer() // RootLayer object just uses Screen objects, it is not allowed to delete them. } -void RootLayer::Draw(const BRect &r) -{ - // REMOVEME: This method is here because of DisplayDriver testing ONLY. - // It should be removed when testing is finished - - STRACE(("*RootLayer(%s)::Draw(r)\n", GetName())); - - RGBColor c(51,102,152); - fDriver->FillRect(r, c); - - STRACE(("#RootLayer(%s)::Draw(r) END\n", GetName())); - -#ifdef DISPLAYDRIVER_TEST_HACK - DisplayDriver *_driver = fDriver; - int8 pattern[8]; - int8 pattern2[8]; - memset(pattern,255,8); - memset(pattern2,128+64+32+16,8); - BRect r1(100,100,1500,1100); - BPoint pts[4]; - pts[0].x = 200; - pts[0].y = 200; - pts[1].x = 400; - pts[1].y = 1000; - pts[2].x = 600; - pts[2].y = 400; - pts[3].x = 1200; - pts[3].y = 800; - BPoint triangle[3]; - BRect triangleRect(100,100,400,300); - triangle[0].x = 100; - triangle[0].y = 100; - triangle[1].x = 100; - triangle[1].y = 300; - triangle[2].x = 400; - triangle[2].y = 300; - BPoint polygon[6]; - BRect polygonRect(100,100,300,400); - polygon[0].x = 100; - polygon[0].y = 100; - polygon[1].x = 100; - polygon[1].y = 400; - polygon[2].x = 200; - polygon[2].y = 300; - polygon[3].x = 300; - polygon[3].y = 400; - polygon[4].x = 300; - polygon[4].y = 100; - polygon[5].x = 200; - polygon[5].y = 200; - - fLayerData->highcolor.SetColor(255,0,0,255); - fLayerData->lowcolor.SetColor(255,255,255,255); - _driver->FillRect(r1,fLayerData,pattern); - - fLayerData->highcolor.SetColor(255,255,0,255); - _driver->StrokeLine(BPoint(100,100),BPoint(1500,1100),fLayerData,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 - -} - void RootLayer::MoveBy(float x, float y) { } @@ -189,6 +117,99 @@ Layer* RootLayer::VirtualBottomChild() const return fActiveWorkspace->GoToBottomItem(); } +void RootLayer::ReadWorkspaceData(const char *path) +{ + BMessage msg, settings; + BFile file(path,B_READ_ONLY); + char string[20]; + + if(file.InitCheck()==B_OK && msg.Unflatten(&file)==B_OK) + { + int32 count; + + if(msg.FindInt32("workspace_count",&count)!=B_OK) + count=9; + + SetWorkspaceCount(count); + + for(int32 i=0; iGetSettings(settings); + settings.MakeEmpty(); + } + else + ws->GetDefaultSettings(); + } + } + else + { + SetWorkspaceCount(9); + + for(int32 i=0; i<9; i++) + { + Workspace *ws=(Workspace*)fWorkspaceList.ItemAt(i); + if(!ws) + continue; + + ws->GetDefaultSettings(); + } + } +} + +void RootLayer::SaveWorkspaceData(const char *path) +{ + BMessage msg,dummy; + BFile file(path,B_READ_WRITE | B_CREATE_FILE); + + if(file.InitCheck()!=B_OK) + { + printf("ERROR: Couldn't save workspace data in RootLayer\n"); + return; + } + + char string[20]; + int32 count=fWorkspaceList.CountItems(); + + if(msg.Unflatten(&file)==B_OK) + { + // if we were successful in unflattening the file, it means we're + // going to need to save over the existing data + for(int32 i=0; iPutSettings(&dummy,i); + msg.AddMessage(string,&dummy); + } + else + { + // We're not supposed to have this happen, but we'll suck it up, anyway. :P + Workspace::PutDefaultSettings(&msg,i); + } + } +} + void RootLayer::AddWinBorderToWorkspaces(WinBorder* winBorder, uint32 wks) { if (!(fMainLock.IsLocked())) @@ -567,7 +588,7 @@ void RootLayer::SetWorkspaceCount(const int32 count) for(int i=0; i < count; i++) { - workspacePtr = fWSPtrList.ItemAt(i); + workspacePtr = fWorkspaceList.ItemAt(i); if (workspacePtr) newWSPtrList.AddItem(workspacePtr); else @@ -579,10 +600,10 @@ void RootLayer::SetWorkspaceCount(const int32 count) } // delete other Workspace objects if the count is smaller than current one. - for (int j=count; j < fWSPtrList.CountItems(); j++) + for (int j=count; j < fWorkspaceList.CountItems(); j++) { Workspace *ws = NULL; - ws = static_cast(fWSPtrList.ItemAt(j)); + ws = static_cast(fWorkspaceList.ItemAt(j)); if (ws) delete ws; else @@ -592,7 +613,7 @@ void RootLayer::SetWorkspaceCount(const int32 count) } } - fWSPtrList = newWSPtrList; + fWorkspaceList = newWSPtrList; fMainLock.Unlock(); STRACE(("*RootLayer::SetWorkspaceCount(%ld) - main lock released\n", count)); @@ -609,13 +630,13 @@ void RootLayer::SetWorkspaceCount(const int32 count) int32 RootLayer::WorkspaceCount() const { - return fWSPtrList.CountItems(); + return fWorkspaceList.CountItems(); } Workspace* RootLayer::WorkspaceAt(const int32 index) const { Workspace *ws = NULL; - ws = static_cast(fWSPtrList.ItemAt(index-1)); + ws = static_cast(fWorkspaceList.ItemAt(index-1)); return ws; } @@ -623,7 +644,7 @@ Workspace* RootLayer::WorkspaceAt(const int32 index) const void RootLayer::SetActiveWorkspaceByIndex(const int32 index) { Workspace *ws = NULL; - ws = static_cast(fWSPtrList.ItemAt(index-1)); + ws = static_cast(fWorkspaceList.ItemAt(index-1)); if (ws) SetActiveWorkspace(ws); } @@ -679,10 +700,10 @@ void RootLayer::PrintToStream() printf("Screen rows: %ld\nScreen columns: %ld\n", fRows, fColumns); printf("Resolution for all Screens: %ldx%ldx%ld\n", fScreenXResolution, fScreenYResolution, fColorSpace); printf("Workspace list:\n"); - for(int32 i=0; iID()); - ((Workspace*)fWSPtrList.ItemAt(i))->PrintToStream(); + printf("\t~~~Workspace: %ld\n", ((Workspace*)fWorkspaceList.ItemAt(i))->ID()); + ((Workspace*)fWorkspaceList.ItemAt(i))->PrintToStream(); printf("~~~~~~~~\n"); } printf("Active Workspace: %ld\n", fActiveWorkspace? fActiveWorkspace->ID(): -1); diff --git a/src/servers/app/server/RootLayer.h b/src/servers/app/server/RootLayer.h index 8f92b64549..ad09dbee3b 100644 --- a/src/servers/app/server/RootLayer.h +++ b/src/servers/app/server/RootLayer.h @@ -56,7 +56,6 @@ public: DisplayDriver *driver); virtual ~RootLayer(void); - virtual void Draw(const BRect &r); virtual void MoveBy(float x, float y); virtual void ResizeBy(float x, float y); @@ -65,6 +64,9 @@ public: virtual Layer *VirtualLowerSibling(void) const; virtual Layer *VirtualUpperSibling(void) const; virtual Layer *VirtualBottomChild(void) const; + + void ReadWorkspaceData(const char *path); + void SaveWorkspaceData(const char *path); void AddWinBorder(WinBorder *winBorder); void RemoveWinBorder(WinBorder *winBorder); @@ -108,7 +110,7 @@ private: int32 fScreenYResolution; uint32 fColorSpace; - BList fWSPtrList; + BList fWorkspaceList; Workspace *fActiveWorkspace; }; diff --git a/src/servers/app/server/ServerBitmap.cpp b/src/servers/app/server/ServerBitmap.cpp index 7797fa0c7b..fa6eea07f8 100644 --- a/src/servers/app/server/ServerBitmap.cpp +++ b/src/servers/app/server/ServerBitmap.cpp @@ -42,8 +42,9 @@ ServerBitmap::ServerBitmap(BRect rect,color_space space, int32 flags, _initialized=false; _area=B_ERROR; -//!!! WARNING !!! '1' is added to the width and height. Same is done in FBBitmap -// subclass, so if you modify here make sure to do the same under FBBitmap::SetSize(...) + + // WARNING: '1' is added to the width and height. Same is done in FBBitmap + // subclass, so if you modify here make sure to do the same under FBBitmap::SetSize(...) _width=rect.IntegerWidth()+1; _height=rect.IntegerHeight()+1; _space=space; diff --git a/src/servers/app/server/ServerWindow.cpp b/src/servers/app/server/ServerWindow.cpp index 361cd30e97..df0aac0b1c 100644 --- a/src/servers/app/server/ServerWindow.cpp +++ b/src/servers/app/server/ServerWindow.cpp @@ -215,14 +215,9 @@ ServerWindow::~ServerWindow(void) cl = NULL; - STRACE(("#ServerWindow(%s) will exit NOW!!!\n", fTitle.String())); + STRACE(("#ServerWindow(%s) will exit NOW\n", fTitle.String())); } -//5700 - fara servo , fara cas -//6300 - 1,4 -//6700 - 1,6 -//7100 - 1,4 -//7500 - 1,6 -//------------------------------------------------------------------------------ + //! Forces the window border to update its decorator void ServerWindow::ReplaceDecorator(void) { diff --git a/src/servers/app/server/WinBorder.cpp b/src/servers/app/server/WinBorder.cpp index f7e1e8bb87..963da4d157 100644 --- a/src/servers/app/server/WinBorder.cpp +++ b/src/servers/app/server/WinBorder.cpp @@ -350,15 +350,17 @@ void WinBorder::MouseUp(PortMessage *msg) void WinBorder::HighlightDecorator(const bool &active) { -printf("Decorator->Highlight\n"); + STRACE(("Decorator->Highlight\n")); fDecorator->SetFocus(active); } void WinBorder::Draw(const BRect &r) { - STRACE(("WinBorder(%s)::Draw()\n", GetName())); -printf("WinBorder::DRAW\n"); -r.PrintToStream(); + #ifdef DEBUG_WINBORDER + printf("WinBorder(%s)::Draw() : ", GetName())); + r.PrintToStream(); + #endif + // if we have a visible region, it is decorator's one. if(fDecorator) { @@ -371,10 +373,11 @@ r.PrintToStream(); */ fDecorator->Draw(fUpdateReg.Frame()); } + // clear background, *only IF* our view color is different to B_TRANSPARENT_COLOR! // TODO: DO That! - // TODO: UNcomment!!! -// TODO !!! UPDATE code !!! + // TODO: UNcomment + // TODO: UPDATE code /* BMessage msg; msg.what = _UPDATE_; diff --git a/src/servers/app/server/Workspace.cpp b/src/servers/app/server/Workspace.cpp index 539ee4d097..47bf58bd36 100644 --- a/src/servers/app/server/Workspace.cpp +++ b/src/servers/app/server/Workspace.cpp @@ -55,7 +55,8 @@ #endif -Workspace::Workspace(const uint32 colorspace, int32 ID, const RGBColor& BGColor, RootLayer* owner){ +Workspace::Workspace(const uint32 colorspace, int32 ID, const RGBColor& BGColor, RootLayer *owner) +{ fID = ID; fSpace = colorspace; fBGColor = BGColor; @@ -67,12 +68,28 @@ Workspace::Workspace(const uint32 colorspace, int32 ID, const RGBColor& BGColor, fCurrentItem= NULL; fFocusItem = NULL; fFrontItem = NULL; + + fVirtualWidth=-1; + fVirtualHeight=-1; + + // TODO: find out more about good default values and init the structure to them + fDisplayTiming.pixel_clock=0; + fDisplayTiming.h_display=0; + fDisplayTiming.h_sync_start=0; + fDisplayTiming.h_sync_end=0; + fDisplayTiming.h_total=0; + fDisplayTiming.v_display=0; + fDisplayTiming.v_sync_start=0; + fDisplayTiming.v_sync_end=0; + fDisplayTiming.v_total=0; + fDisplayTiming.flags=0; } -//--------------------------------------------------------------------------- -Workspace::~Workspace(){ -//printf("~Workspace( %ld )\n", fID); + +Workspace::~Workspace(void) +{ ListData *toast; - while(fBottomItem){ + while(fBottomItem) + { toast = fBottomItem; fBottomItem = fBottomItem->upperItem; @@ -84,17 +101,19 @@ Workspace::~Workspace(){ fFocusItem = NULL; fFrontItem = NULL; } -//--------------------------------------------------------------------------- -/* Adds layer ptr to workspace's list of WinBorders. After the item is added - * a *smart* search is performed to set the new front WinBorder. Of course, - * the first candidate is 'layer', but if it is hidden or it has the - * B_AVOID_FRONT flag, surely it won't get that status. - * This method also calls SearchAndSetNewFocus witch searches for a WinBorder, - * to give focus to, having as preferred 'layer'. - * Remember, some windows having B_AVOID_FOCUS can't have the focus state. - */ -bool Workspace::AddLayerPtr(WinBorder* layer){ - // allocate a new item + +/* + Adds layer ptr to workspace's list of WinBorders. After the item is added a + *smart* search is performed to set the new front WinBorder. Of course, + the first candidate is 'layer', but if it is hidden or it has the + B_AVOID_FRONT flag, surely it won't get that status. + This method also calls SearchAndSetNewFocus which searches for a WinBorder, + to give focus to, having as preferred 'layer'. + Remember, some windows having B_AVOID_FOCUS can't have the focus state. +*/ +bool Workspace::AddLayerPtr(WinBorder *layer) +{ + // allocate a new item ListData *item; item = new ListData; @@ -102,40 +121,48 @@ bool Workspace::AddLayerPtr(WinBorder* layer){ item->upperItem = NULL; item->lowerItem = NULL; - opLock.Lock(); - // insert 'item' at the end. It doesn't matter where we add it, - // it will be placed correctly by SearchAndSetNewFront(item->layerPtr); + fOpLock.Lock(); + + // insert 'item' at the end. It doesn't matter where we add it, + // it will be placed correctly by SearchAndSetNewFront(item->layerPtr); InsertItem(item, NULL); - opLock.Unlock(); + fOpLock.Unlock(); -STRACE(("\n*AddLayerPtr(%s) -", layer->GetName())); + STRACE(("\n*AddLayerPtr(%s) -", layer->GetName())); - // this may happen in case of subset windows. - if(!(layer->IsHidden())){ - // do a *smart* search and set the new 'front' + // this may happen in case of subset windows. + if(!(layer->IsHidden())) + { + // do a *smart* search and set the new 'front' SearchAndSetNewFront(layer); - // do a *smart* search and set the new 'focus' + a redraw + + // do a *smart* search and set the new 'focus' + a redraw SetFocusLayer(layer); } return true; } -/* Removes a WinBorder from workspace's list. It DOES NOT delete it! - * If this window was the front/focus one it calls SearchAndSetNew(Front/Focus) - * to give the respective state to the window below her. - */ -//--------------------------------------------------------------------------- -bool Workspace::RemoveLayerPtr(WinBorder* layer){ - if (!layer) + +/* + Removes a WinBorder from workspace's list. It DOES NOT delete it! + If this window was the front/focus one it calls SearchAndSetNew(Front/Focus) + to give the respective state to the window below her. +*/ +bool Workspace::RemoveLayerPtr(WinBorder *layer) +{ + if(!layer) return false; -STRACE(("\n*Workspace(%ld)::RemoveLayerPtr(%s)\n", ID(), layer->GetName())); -STRACE(("BEFORE ANY opperation:\n")); -STRACESTREAM(); - // search to see if this workspace has WinBorder's pointer in its list + + STRACE(("\n*Workspace(%ld)::RemoveLayerPtr(%s)\n", ID(), layer->GetName())); + STRACE(("BEFORE ANY opperation:\n")); + STRACESTREAM(); + + // search to see if this workspace has WinBorder's pointer in its list ListData *item = NULL; - opLock.Lock(); - if ((item = HasItem(layer))){ + fOpLock.Lock(); + if((item = HasItem(layer))) + { ListData *nextItem = NULL; bool wasFront = false; bool wasFocus = false; @@ -143,21 +170,21 @@ STRACESTREAM(); wasFront = FrontLayer() == layer; wasFocus = FocusLayer() == layer; - // prepare to set new front/focus if this layer was front/focus + // prepare to set new front/focus if this layer was front/focus nextItem = item->upperItem; - if (wasFront) + if(wasFront) SearchAndSetNewFront(nextItem? nextItem->layerPtr: NULL); - // remove some windows. - if (item && item->layerPtr->fLevel == B_NORMAL_FEEL) + // remove some windows. + if(item && item->layerPtr->fLevel == B_NORMAL_FEEL) { ListData *listItem = item->lowerItem; while(listItem && (listItem->layerPtr->fLevel == B_FLOATING_SUBSET_FEEL - || listItem->layerPtr->fLevel == B_FLOATING_APP_FEEL - || listItem->layerPtr->fLevel == B_MODAL_SUBSET_FEEL)) + || listItem->layerPtr->fLevel == B_FLOATING_APP_FEEL + || listItem->layerPtr->fLevel == B_MODAL_SUBSET_FEEL)) { - // *carefuly* remove the item from the list + // *carefuly* remove the item from the list ListData *itemX = listItem; listItem = listItem->lowerItem; RemoveItem(itemX); @@ -168,55 +195,60 @@ STRACESTREAM(); RemoveItem(item); delete item; STRACESTREAM(); - opLock.Unlock(); + fOpLock.Unlock(); - // reset some internal variables + // reset some internal variables layer->SetMainWinBorder(NULL); + // its RootLayer is set to NULL by Layer::RemoveChild(layer); STRACE(("Layer %s found and removed from Workspace No %ld\n", layer->GetName(), ID())); - if (wasFocus) + if(wasFocus) SetFocusLayer(nextItem? nextItem->layerPtr: NULL); else Invalidate(); return true; } - else{ + else + { STRACE(("Layer %s NOT found in Workspace No %ld\n", layer->GetName(), ID())); - opLock.Unlock(); + fOpLock.Unlock(); return false; } } -//--------------------------------------------------------------------------- -bool Workspace::HideSubsetWindows(WinBorder* layer){ - if (!layer) + +bool Workspace::HideSubsetWindows(WinBorder *layer) +{ + if(!layer) return false; - // search to see if this workspace has WinBorder's pointer in its list + // search to see if this workspace has WinBorder's pointer in its list ListData *item = NULL; - opLock.Lock(); - if ((item = HasItem(layer))){ + fOpLock.Lock(); + if((item = HasItem(layer))) + { ListData *nextItem = NULL; - // prepare to set new front/focus if this layer was front/focus + // prepare to set new front/focus if this layer was front/focus nextItem = item->upperItem; SearchAndSetNewFront(nextItem? nextItem->layerPtr: NULL); - // we don't care bout focus in this method!!! + + // we don't care about focus in this method //SearchAndSetNewFocus(nextItem? nextItem->layerPtr: NULL); - // remove some windows. - if (item && item->layerPtr->fLevel == B_NORMAL_FEEL) + // remove some windows. + if(item && item->layerPtr->fLevel == B_NORMAL_FEEL) { ListData *listItem = item->lowerItem; while(listItem && (listItem->layerPtr->fLevel == B_FLOATING_SUBSET_FEEL - || listItem->layerPtr->fLevel == B_FLOATING_APP_FEEL - || listItem->layerPtr->fLevel == B_MODAL_SUBSET_FEEL)) + || listItem->layerPtr->fLevel == B_FLOATING_APP_FEEL + || listItem->layerPtr->fLevel == B_MODAL_SUBSET_FEEL)) { - // *carefuly* remove the item from the list + // carefully remove the item from the list ListData *itemX = listItem; listItem = listItem->lowerItem; RemoveItem(itemX); @@ -224,18 +256,20 @@ bool Workspace::HideSubsetWindows(WinBorder* layer){ } } - opLock.Unlock(); + fOpLock.Unlock(); return true; } - else{ - opLock.Unlock(); + else + { + fOpLock.Unlock(); return false; } } -//--------------------------------------------------------------------------- -WinBorder* Workspace::SetFocusLayer(WinBorder* layer){ -STRACE(("\n@Workspace(%ld)::SetFOCUSLayer( %s )\n", ID(), layer? layer->GetName(): "NULL")); + +WinBorder *Workspace::SetFocusLayer(WinBorder *layer) +{ + STRACE(("\n@Workspace(%ld)::SetFOCUSLayer( %s )\n", ID(), layer? layer->GetName(): "NULL")); if(!(desktop->fGeneralLock.IsLocked())) debugger("Workspace::SetFocusLayer - desktop->fGeneralLock must be LOCKED!\n"); @@ -244,257 +278,294 @@ STRACE(("\n@Workspace(%ld)::SetFOCUSLayer( %s )\n", ID(), layer? layer->GetName( SearchAndSetNewFocus(layer); - if (previousFocus != FocusLayer()){ - if (previousFocus) + if(previousFocus != FocusLayer()) + { + if(previousFocus) previousFocus->HighlightDecorator(false); - if (FocusLayer()){ + if(FocusLayer()) FocusLayer()->HighlightDecorator(true); - } } -STRACE(("\n#Workspace(%ld)::SetFOCUSLayer( %s ) ENDED\n", ID(), layer? layer->GetName(): "NULL")); + + STRACE(("\n#Workspace(%ld)::SetFOCUSLayer( %s ) ENDED\n", ID(), layer? layer->GetName(): "NULL")); + return FocusLayer(); } -//--------------------------------------------------------------------------- -WinBorder* Workspace::FocusLayer() const{ + +WinBorder *Workspace::FocusLayer() const +{ return fFocusItem ? fFocusItem->layerPtr : NULL; } -//--------------------------------------------------------------------------- -WinBorder* Workspace::SetFrontLayer(WinBorder* layer){ -STRACE(("\n@Workspace(%ld)::SetFrontLayer( %s )\n", ID(), layer? layer->GetName(): "NULL")); + +WinBorder *Workspace::SetFrontLayer(WinBorder *layer) +{ + STRACE(("\n@Workspace(%ld)::SetFrontLayer( %s )\n", ID(), layer? layer->GetName(): "NULL")); if(!(desktop->fGeneralLock.IsLocked())) debugger("Workspace::SetFRONTLayer - desktop->fGeneralLock must be LOCKED!\n"); SearchAndSetNewFront(layer); -STRACESTREAM(); -// TODO: remove??? + + STRACESTREAM(); + + // TODO: remove? Invalidate(); return fFrontItem? fFrontItem->layerPtr: NULL;; } -//--------------------------------------------------------------------------- -WinBorder* Workspace::FrontLayer() const{ + +WinBorder *Workspace::FrontLayer() const +{ return fFrontItem? fFrontItem->layerPtr: NULL; } -//--------------------------------------------------------------------------- -WinBorder* Workspace::GoToBottomItem(){ + +WinBorder *Workspace::GoToBottomItem(void) +{ fCurrentItem = fBottomItem; return fCurrentItem ? fCurrentItem->layerPtr : NULL; } -//--------------------------------------------------------------------------- -WinBorder* Workspace::GoToUpperItem(){ - if (fCurrentItem){ + +WinBorder *Workspace::GoToUpperItem(void) +{ + if(fCurrentItem) + { fCurrentItem = fCurrentItem->upperItem; return fCurrentItem ? fCurrentItem->layerPtr : NULL; } else return NULL; } -//--------------------------------------------------------------------------- -WinBorder* Workspace::GoToTopItem(){ + +WinBorder *Workspace::GoToTopItem(void) +{ fCurrentItem = fTopItem; return fCurrentItem ? fCurrentItem->layerPtr : NULL; } -//--------------------------------------------------------------------------- -WinBorder* Workspace::GoToLowerItem(){ - if (fCurrentItem){ + +WinBorder *Workspace::GoToLowerItem(void) +{ + if(fCurrentItem) + { fCurrentItem = fCurrentItem->lowerItem; return fCurrentItem ? fCurrentItem->layerPtr : NULL; } else return NULL; } -//--------------------------------------------------------------------------- -bool Workspace::GoToItem(WinBorder* layer){ - if (!layer) + +bool Workspace::GoToItem(WinBorder *layer) +{ + if(!layer) return false; - if (fCurrentItem && fCurrentItem->layerPtr == layer){ + if(fCurrentItem && fCurrentItem->layerPtr == layer) return true; - } - for( ListData *item = fBottomItem; item != NULL; item = item->upperItem){ - if (item->layerPtr == layer){ + for( ListData *item = fBottomItem; item != NULL; item = item->upperItem) + { + if(item->layerPtr == layer) + { fCurrentItem = item; return true; } } return false; } -//--------------------------------------------------------------------------- -WinBorder* Workspace::SearchWinBorder(BPoint pt){ -// TODO: implement correctly once you have clipping code working -// For the moment, take windows from front to back and see in witch one 'pt' falls - WinBorder *target = NULL; - opLock.Lock(); - for( WinBorder *wb = GoToBottomItem(); wb; wb = GoToUpperItem()){ +WinBorder *Workspace::SearchWinBorder(BPoint pt) +{ + // TODO: implement correctly once you have clipping code working + + // For the moment, take windows from front to back and see in which one 'pt' falls + WinBorder *target = NULL; + fOpLock.Lock(); + + for( WinBorder *wb = GoToBottomItem(); wb; wb = GoToUpperItem()) + { // wb->PrintToStream(); - if (!wb->IsHidden() && wb->HasPoint(pt)){ + if(!wb->IsHidden() && wb->HasPoint(pt)) + { STRACE(("%s - SELECTED!\n", wb->GetName())); target = wb; break; } } - opLock.Unlock(); + fOpLock.Unlock(); return target; } -//--------------------------------------------------------------------------- -void Workspace::Invalidate(){ -//TODO: *****!*!*!*!*!*!*!**!***REMOVE this! For Test purposes only! -/* opLock.Lock(); + +void Workspace::Invalidate(void) +{ + //TODO: Remove. Testing purposes only! + +/* fOpLock.Lock(); if(fOwner->ActiveWorkspace() == this) fOwner->FullInvalidate(fOwner->Bounds()); - opLock.Unlock();*/ -//---------------- + fOpLock.Unlock();*/ + } -//--------------------------------------------------------------------------- -void Workspace::InsertItem(ListData* item, ListData* before){ - // insert before one other item; - if (before){ - if (before->upperItem) + +void Workspace::InsertItem(ListData *item, ListData *before) +{ + // insert before one other item; + if(before) + { + if(before->upperItem) before->upperItem->lowerItem = item; item->upperItem = before->upperItem; before->upperItem = item; item->lowerItem = before; - // if we're inserting at top of the stack, change it accordingly. + // if we're inserting at top of the stack, change it accordingly. if(fTopItem == before) fTopItem = item; } + else + { // insert item at bottom. - else{ item->upperItem = fBottomItem; - if (fBottomItem) + if(fBottomItem) fBottomItem->lowerItem = item; fBottomItem = item; - if (!fTopItem) + if(!fTopItem) fTopItem = item; } } -//--------------------------------------------------------------------------- -void Workspace::RemoveItem(ListData* item){ - if (!item) + +void Workspace::RemoveItem(ListData *item) +{ + if(!item) return; - if (fBottomItem == item){ + if(fBottomItem == item) fBottomItem = item->upperItem; - } - else{ + else item->lowerItem->upperItem = item->upperItem; - } - if (fTopItem == item){ + + if(fTopItem == item) fTopItem = item->lowerItem; - } - else{ + else item->upperItem->lowerItem = item->lowerItem; - } - - // set all these to NULL to avoid confusion later. + + // set all these to NULL to avoid confusion later. item->upperItem = NULL; item->lowerItem = NULL; - if (fFocusItem == item){ + if(fFocusItem == item) + { fFocusItem->layerPtr->HighlightDecorator(false); fFocusItem = NULL; } - if (fFrontItem == item) + + if(fFrontItem == item) fFrontItem = NULL; - if (fCurrentItem == item) + + if(fCurrentItem == item) fCurrentItem = NULL; } -//--------------------------------------------------------------------------- -ListData* Workspace::HasItem(ListData* item){ - for (ListData *itemX = fBottomItem; itemX != NULL; itemX = itemX->upperItem){ - if (item == itemX){ + +ListData *Workspace::HasItem(ListData *item) +{ + for (ListData *itemX = fBottomItem; itemX != NULL; itemX = itemX->upperItem) + { + if(item == itemX) return itemX; - } } return NULL; } -//--------------------------------------------------------------------------- -ListData* Workspace::HasItem(WinBorder* layer){ - for (ListData *item = fBottomItem; item != NULL; item = item->upperItem){ - if (item->layerPtr == layer){ + +ListData *Workspace::HasItem(WinBorder *layer) +{ + for (ListData *item = fBottomItem; item != NULL; item = item->upperItem) + { + if(item->layerPtr == layer) return item; - } } return NULL; } -/* This, also is a "smart" method. Firstly this funtionality was in - * SearchAndSetNewFront, but I've split it for reasons of clarity. Anyway, - * what is to be noticed is that those 2 methods work hand-in-hand. - * What FindPlace() litelaly does, is *place* the 'pref' item into its - * >right< place! If 'pref->layerPtr'(the WinBorder in ListData structure) - * does not meet some conditions a search for another, valid, WinBorder is - * being made. - * - * NOTE: Do NOT be confussed! This method places the preferred window *ONLY*! - * Other windows that need to be placed before it, *WILL* be placed by almost - * all code found in SearchAndSetNewFront - */ -//--------------------------------------------------------------------------- -ListData* Workspace::FindPlace(ListData* pref){ - // if we received a NULL value, we stil have to give 'front' state to some window... - if (!pref) +/* + This, also is a "smart" method. Firstly this funtionality was in + SearchAndSetNewFront, but I've split it for reasons of clarity. Anyway, + what is to be noticed is that those 2 methods work hand-in-hand. + What FindPlace() litelaly does, isplace* the 'pref' item into its + >right< place! If 'pref->layerPtr'(the WinBorder in ListData structure) + does not meet some conditions a search for another, valid, WinBorder is + being made. + + NOTE: Do NOT be confussed! This method places the preferred windowONLY*! + Other windows that need to be placed before it, *WILL* be placed by almost + all code found in SearchAndSetNewFront +*/ + +ListData *Workspace::FindPlace(ListData *pref) +{ + // if we received a NULL value, we stil have to give 'front' state to some window... + if(!pref) pref = HasItem(fBottomItem); else pref = HasItem(pref); ListData *item = NULL; - // search a window that is not hidden and does *not* have B_AVOID_FRONT flag. + // search a window that is not hidden and does *not* have B_AVOID_FRONT flag. item = pref; - while(pref && item->lowerItem != pref && (pref->upperItem || pref->lowerItem)){ - if ( !(item->layerPtr->Window()->Flags() & B_AVOID_FRONT) && !(item->layerPtr->IsHidden()) ) + while(pref && item->lowerItem != pref && (pref->upperItem || pref->lowerItem)) + { + if( !(item->layerPtr->Window()->Flags() & B_AVOID_FRONT) && !(item->layerPtr->IsHidden()) ) break; + STRACE(("item: %s - pref: %s\n", item->layerPtr->GetName(), pref->layerPtr->GetName())); - if (item == fTopItem) + + if(item == fTopItem) item = fBottomItem; else item = item->upperItem; } - // if true, it means we have windows with B_AVOID_FRONT flag *only*, - // or they are all hidden. Pick one, if you can. - if (pref && item->lowerItem == pref){ - for (item = fBottomItem; item; item = item->upperItem){ - if ( !(item->layerPtr->IsHidden()) ) + // if true, it means we have windows with B_AVOID_FRONT flag *only*, + // or they are all hidden. Pick one, if you can. + if(pref && item->lowerItem == pref) + { + for (item = fBottomItem; item; item = item->upperItem) + { + if( !(item->layerPtr->IsHidden()) ) break; } } - // if the search took place or not... + // if the search took place or not... pref = item; - // we have exhausted all possibilities to make pref a vaid pointer... so... exit now. - if (!pref) + // we have exhausted all possibilities to make pref a vaid pointer... so... exit now. + if(!pref) return NULL; - // temporally remove 'pref' to reinsert it later in the *right* place + // temporarily remove 'pref' to reinsert it later in the right place RemoveItem(pref); - // we start searching its place + // we start searching its place ListData *cursor = fBottomItem; int32 feel = pref->layerPtr->Window()->Feel(); - switch(feel){ - case B_NORMAL_WINDOW_FEEL:{ - while(cursor && cursor->layerPtr->fLevel > B_MODAL_APP_FEEL){ + switch(feel) + { + case B_NORMAL_WINDOW_FEEL: + { + while(cursor && cursor->layerPtr->fLevel > B_MODAL_APP_FEEL) cursor = cursor->upperItem; - } + InsertItem(pref, cursor? cursor->lowerItem: NULL); break; } - case B_SYSTEM_LAST:{ - while(cursor && cursor->layerPtr->fLevel > pref->layerPtr->fLevel){ + case B_SYSTEM_LAST: + { + while(cursor && cursor->layerPtr->fLevel > pref->layerPtr->fLevel) cursor = cursor->upperItem; - } + InsertItem(pref, cursor? cursor->lowerItem: fTopItem); break; } @@ -502,271 +573,327 @@ ListData* Workspace::FindPlace(ListData* pref){ case B_SYSTEM_FIRST: case B_FLOATING_ALL_WINDOW_FEEL: case B_MODAL_ALL_WINDOW_FEEL: - case B_MODAL_APP_WINDOW_FEEL:{ - while(cursor && cursor->layerPtr->fLevel > pref->layerPtr->fLevel){ + case B_MODAL_APP_WINDOW_FEEL: + { + while(cursor && cursor->layerPtr->fLevel > pref->layerPtr->fLevel) cursor = cursor->upperItem; - } + InsertItem(pref, cursor? cursor->lowerItem: NULL); break; } + case B_FLOATING_SUBSET_WINDOW_FEEL: + { // place in front of: its main window, other subset windows and in front // of other application's floating windows. // 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->fLevel <= pref->layerPtr->fLevel + for(cursor = fBottomItem; cursor; cursor = cursor->upperItem) + { + if(cursor->layerPtr->fLevel <= pref->layerPtr->fLevel && (cursor->layerPtr == pref->layerPtr->MainWinBorder() - || cursor->layerPtr->MainWinBorder() == pref->layerPtr->MainWinBorder()) - ) - { break; } - else if(pref->layerPtr->fLevel == B_FLOATING_SUBSET_FEEL - && cursor->layerPtr->fLevel == B_FLOATING_APP_FEEL) - { break; } + || cursor->layerPtr->MainWinBorder() == pref->layerPtr->MainWinBorder()) ) + { + break; + } + else + if(pref->layerPtr->fLevel == B_FLOATING_SUBSET_FEEL && + cursor->layerPtr->fLevel == B_FLOATING_APP_FEEL) + { + break; + } } - if (cursor) + if(cursor) InsertItem(pref, cursor? cursor->lowerItem: NULL); break; } + case B_MODAL_SUBSET_WINDOW_FEEL: + { // place this SUBSET_MODAL behind APP_MODAL ones if they belong // to the same application OR, in front of all MODAL/NORMAL if // it belongs to another application - case B_MODAL_SUBSET_WINDOW_FEEL:{ - for(cursor = fBottomItem; cursor; cursor = cursor->upperItem){ - if (cursor->layerPtr->fLevel <= pref->layerPtr->fLevel) + + for(cursor = fBottomItem; cursor; cursor = cursor->upperItem) + { + if(cursor->layerPtr->fLevel <= pref->layerPtr->fLevel) break; - else if(pref->layerPtr->fLevel == B_MODAL_SUBSET_FEEL - && cursor->layerPtr->fLevel == B_MODAL_APP_FEEL - && pref->layerPtr->Window()->ClientTeamID() - != cursor->layerPtr->Window()->ClientTeamID()) + 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; + } } - if (cursor) + + if(cursor) InsertItem(pref, cursor? cursor->lowerItem: NULL); + break; } + case B_FLOATING_APP_WINDOW_FEEL: + { // place in front of: its main window, other floating windows // 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->fLevel <= pref->layerPtr->fLevel - && pref->layerPtr->Window()->ClientTeamID() == - cursor->layerPtr->Window()->ClientTeamID()) - { break; } + for(cursor = fBottomItem; cursor; cursor = cursor->upperItem) + { + if(cursor->layerPtr->fLevel <= pref->layerPtr->fLevel && + pref->layerPtr->Window()->ClientTeamID() == cursor->layerPtr->Window()->ClientTeamID()) + { + break; + } } - if (cursor) + if(cursor) InsertItem(pref, cursor? cursor->lowerItem: NULL); + break; } } return pref; } -/* This method is the key to correct window arangement!!! - * With the help of FindPlace it correctly aranges windows. FindPlace, only - * inserted the window in the correct place, this method also brings all - * other windows that are supposed to be in front of her - I'm talking here - * about floating and modal windows. - * It also clerverly selects the new FINAL front window. +/* + This method is the key to correct window arangement + With the help of FindPlace it correctly aranges windows. FindPlace, only + inserted the window in the correct place, this method also brings all + other windows that are supposed to be in front of her - I'm talking here + about floating and modal windows. + It also cleverly selects the new FINAL front window. */ -//--------------------------------------------------------------------------- -void Workspace::SearchAndSetNewFront(WinBorder* preferred){ -STRACE(("*WS(%ld)::SASNF(%s)\n", ID(), preferred? preferred->GetName(): "NULL")); -opLock.Lock(); - // the new front must not be the same as the previous one. - if (fFrontItem && fFrontItem->layerPtr == preferred && !(preferred->IsHidden())){ -STRACE(("-WS(%ld)::SASNF(%s) - opperation not needed! Workspace data:", - ID(), preferred? preferred->GetName(): "NULL")); -STRACESTREAM(); -STRACE(("#WS(%ld)::SASNF(%s) ENDED 1\n", ID(), preferred? preferred->GetName(): "NULL")); - opLock.Unlock(); + +void Workspace::SearchAndSetNewFront(WinBorder *preferred) +{ + STRACE(("*WS(%ld)::SASNF(%s)\n", ID(), preferred? preferred->GetName(): "NULL")); + fOpLock.Lock(); + + // the new front must not be the same as the previous one. + if(fFrontItem && fFrontItem->layerPtr == preferred && !(preferred->IsHidden())) + { + STRACE(("-WS(%ld)::SASNF(%s) - opperation not needed! Workspace data:", + ID(), preferred? preferred->GetName(): "NULL")); + STRACESTREAM(); + STRACE(("#WS(%ld)::SASNF(%s) ENDED 1\n", ID(), preferred? preferred->GetName(): "NULL")); + + fOpLock.Unlock(); return; } - // properly place this 'preferred' WinBorder. + // properly place this 'preferred' WinBorder. ListData *lastInserted; lastInserted = FindPlace(HasItem(preferred)); preferred = lastInserted? lastInserted->layerPtr: NULL; -STRACE(("-WS(%ld)::SASNF(%s) - after FindPlace...", ID(), preferred? preferred->GetName(): "NULL")); -STRACESTREAM(); - // if the new front layer is the same... there is no point continuing - if(fFrontItem == lastInserted){ -STRACE(("-WS(%ld)::SASNF(%s) - new front layer is the same as the old one. Stop!", ID(), preferred? preferred->GetName(): "NULL")); -STRACESTREAM(); -STRACE(("#WS(%ld)::SASNF(%s) ENDED 2\n", ID(), preferred? preferred->GetName(): "NULL")); - opLock.Unlock(); + STRACE(("-WS(%ld)::SASNF(%s) - after FindPlace...", ID(), preferred? preferred->GetName(): "NULL")); + STRACESTREAM(); + + // if the new front layer is the same... there is no point continuing + if(fFrontItem == lastInserted) + { + STRACE(("-WS(%ld)::SASNF(%s) - new front layer is the same as the old one. Stop!", ID(), preferred? preferred->GetName(): "NULL")); + STRACESTREAM(); + STRACE(("#WS(%ld)::SASNF(%s) ENDED 2\n", ID(), preferred? preferred->GetName(): "NULL")); + + fOpLock.Unlock(); return; } -if(!lastInserted){ - STRACE(("PAAAAANIC: Workspace::SASNF(): 'lastInserted' IS NULL\n")); -} -else{ - STRACE(("\n&&&&Processing for: %s\n", lastInserted->layerPtr->GetName())); -} + if(!lastInserted) + { + STRACE(("PAAAAANIC: Workspace::SASNF(): 'lastInserted' IS NULL\n")); + } + else + { + STRACE(("\n&&&&Processing for: %s\n", lastInserted->layerPtr->GetName())); + } - if (lastInserted && !(lastInserted->layerPtr->IsHidden())){ + if(lastInserted && !(lastInserted->layerPtr->IsHidden())) + { int32 prefFeel = preferred->Window()->Feel(); - if (prefFeel == B_NORMAL_WINDOW_FEEL){ -STRACE((" NORMAL Window '%s' -", preferred? preferred->GetName(): "NULL")); - if (fFrontItem){ + if(prefFeel == B_NORMAL_WINDOW_FEEL) + { + STRACE((" NORMAL Window '%s' -", preferred? preferred->GetName(): "NULL")); + + if(fFrontItem) + { // if they are in the same team... - if (preferred->Window()->ClientTeamID() == fFrontItem->layerPtr->Window()->ClientTeamID()){ -STRACE((" SAME TeamID\n")); + if(preferred->Window()->ClientTeamID() == fFrontItem->layerPtr->Window()->ClientTeamID()) + { + STRACE((" SAME TeamID\n")); + // collect subset windows that are common to application's windows... // NOTE: A subset window *can* be added to more than just one window. - FMWList commonFMW; - FMWList appFMW; - FMWList finalFMWList; - int32 count, i; + FMWList commonFMW; + FMWList appFMW; + FMWList finalFMWList; + int32 count, i; + // collect floating and modal windows spread across the workspace only if // they are in our window's subset // * also remove them, for repositioning, later. - ListData *listItem = fTopItem; - while(listItem){ - int32 feel = listItem->layerPtr->Window()->Feel(); - if (feel == B_FLOATING_SUBSET_WINDOW_FEEL || feel == B_MODAL_SUBSET_WINDOW_FEEL){ - if(preferred->Window()->fWinFMWList.HasItem(listItem->layerPtr)){ - commonFMW.AddItem(listItem->layerPtr); - // *carefully* remove the item from the list - ListData *item = listItem; - listItem = listItem->lowerItem; - RemoveItem(item); - } - // also remove floating windows. Those, SURELY belong to - // 'fFrontItem' - this being the *old* front window. - else if (feel == B_FLOATING_SUBSET_WINDOW_FEEL){ - // *carefully* remove the item from the list - ListData *item = listItem; - listItem = listItem->lowerItem; - RemoveItem(item); - } - else{ - listItem = listItem->lowerItem; - } - } - // ALSO collect application's floating and modal windows, - // for reinsertion, later. - else if (feel == B_FLOATING_APP_WINDOW_FEEL || feel == B_MODAL_APP_WINDOW_FEEL){ - if(listItem->layerPtr->Window()->ClientTeamID() == - preferred->Window()->ClientTeamID()) + ListData *listItem = fTopItem; + while(listItem) + { + int32 feel = listItem->layerPtr->Window()->Feel(); + if(feel == B_FLOATING_SUBSET_WINDOW_FEEL || feel == B_MODAL_SUBSET_WINDOW_FEEL) { - appFMW.AddItem(listItem->layerPtr); + if(preferred->Window()->fWinFMWList.HasItem(listItem->layerPtr)) + { + commonFMW.AddItem(listItem->layerPtr); + // *carefully* remove the item from the list - ListData *item = listItem; - listItem = listItem->lowerItem; - RemoveItem(item); + ListData *item = listItem; + listItem = listItem->lowerItem; + RemoveItem(item); + } + else + if(feel == B_FLOATING_SUBSET_WINDOW_FEEL) + { + // also remove floating windows. Those, SURELY belong to + // 'fFrontItem' - this being the *old* front window. + + // *carefully* remove the item from the list + ListData *item = listItem; + listItem = listItem->lowerItem; + RemoveItem(item); + } + else + { + listItem = listItem->lowerItem; + } + } + else if(feel == B_FLOATING_APP_WINDOW_FEEL || feel == B_MODAL_APP_WINDOW_FEEL) + { + // ALSO collect application's floating and modal windows, + // for reinsertion, later. + + if(listItem->layerPtr->Window()->ClientTeamID() == + preferred->Window()->ClientTeamID()) + { + appFMW.AddItem(listItem->layerPtr); + + // *carefully* remove the item from the list + ListData *item = listItem; + listItem = listItem->lowerItem; + RemoveItem(item); + } + else + listItem = listItem->lowerItem; } else listItem = listItem->lowerItem; } - else - listItem = listItem->lowerItem; - } - + // put in the final list, items that are not found in the common list - count = preferred->Window()->fWinFMWList.CountItems(); - for (i=0; iWindow()->fWinFMWList.ItemAt(i); - if (commonFMW.HasItem(item)){ + count = preferred->Window()->fWinFMWList.CountItems(); + for (i=0; iWindow()->fWinFMWList.ItemAt(i); + + if(!commonFMW.HasItem(item)) + finalFMWList.AddItem(item); } - else - finalFMWList.AddItem(item); - } - - // colapse the 2 lists - finalFMWList.AddFMWList(&commonFMW); - finalFMWList.AddFMWList(&appFMW); - + + // collapse the 2 lists + finalFMWList.AddFMWList(&commonFMW); + finalFMWList.AddFMWList(&appFMW); + // insert windows found in 'finalFMWList' in Workspace's list. // IF *one* modal is found, do not add floating ones! // see if the last WinBorder in the list is a modal window. // OR if the last one in Workspace's list is a modal window... - WinBorder *wb = (WinBorder*)finalFMWList.LastItem(); - bool lastIsModal = false; - if ( (wb && - (wb->Window()->Feel() == B_MODAL_SUBSET_WINDOW_FEEL - || wb->Window()->Feel() == B_MODAL_APP_WINDOW_FEEL)) - || (fBottomItem && - (fBottomItem->layerPtr->Window()->Feel() == B_MODAL_ALL_WINDOW_FEEL - || fBottomItem->layerPtr->Window()->Feel() == B_SYSTEM_FIRST)) - ) - { lastIsModal = true; } - - // this variable will help us in deciding the new front WinBorder. - WinBorder *finalPreferred = preferred; - // now insert items found in finalFMWList into Workspace - count = finalFMWList.CountItems(); - for(i=0; iWindow()->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL - || wb->Window()->Feel() == B_FLOATING_APP_WINDOW_FEEL) + WinBorder *wb = (WinBorder*)finalFMWList.LastItem(); + bool lastIsModal = false; + if( (wb && + (wb->Window()->Feel() == B_MODAL_SUBSET_WINDOW_FEEL + || wb->Window()->Feel() == B_MODAL_APP_WINDOW_FEEL)) + || (fBottomItem && + (fBottomItem->layerPtr->Window()->Feel() == B_MODAL_ALL_WINDOW_FEEL + || fBottomItem->layerPtr->Window()->Feel() == B_SYSTEM_FIRST)) + ) + { lastIsModal = true; } + + // this variable will help us in deciding the new front WinBorder. + WinBorder *finalPreferred = preferred; + // now insert items found in finalFMWList into Workspace + count = finalFMWList.CountItems(); + for(i=0; iWindow()->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL) - wb->SetMainWinBorder(preferred); - // don't add if the last WinBorder is a modal one. - if (lastIsModal) - continue; + WinBorder *wb = (WinBorder*)finalFMWList.ItemAt(i); + if(wb->Window()->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL + || wb->Window()->Feel() == B_FLOATING_APP_WINDOW_FEEL) + { + // set its new MainWinBorder + if(wb->Window()->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL) + wb->SetMainWinBorder(preferred); + // don't add if the last WinBorder is a modal one. + if(lastIsModal) + continue; + } + else + { + if(wb->Window()->Feel() == B_MODAL_SUBSET_WINDOW_FEEL) + wb->SetMainWinBorder(preferred); + // if this modal window is not hidden, give it the front status. + if(!(wb->IsHidden())) + finalPreferred = wb; + } + + // insert item just after the last inserted one. + ListData *newItem = new ListData(); + newItem->layerPtr = wb; + newItem->lowerItem = lastInserted->lowerItem; + newItem->upperItem = lastInserted; + if(lastInserted->lowerItem) + lastInserted->lowerItem->upperItem = newItem; + lastInserted->lowerItem = newItem; + + if(lastInserted == fBottomItem) + fBottomItem = newItem; + + lastInserted = newItem; } - else{ - if(wb->Window()->Feel() == B_MODAL_SUBSET_WINDOW_FEEL) - wb->SetMainWinBorder(preferred); - // if this modal window is not hidden, give it the front status. - if (!(wb->IsHidden())) - finalPreferred = wb; - } - - // insert item just after the last inserted one. - ListData *newItem = new ListData(); - newItem->layerPtr = wb; - newItem->lowerItem = lastInserted->lowerItem; - newItem->upperItem = lastInserted; - if (lastInserted->lowerItem) - lastInserted->lowerItem->upperItem = newItem; - lastInserted->lowerItem = newItem; + preferred = finalPreferred; + } + else + { + STRACE((" DIFERRENT TeamID\n")); - if(lastInserted == fBottomItem) - fBottomItem = newItem; - - lastInserted = newItem; - } - preferred = finalPreferred; - } - else{ -STRACE((" DIFERRENT TeamID\n")); // remove front window's floating(_SUBSET_/_APP_) windows, if any. - ListData *listItem = fFrontItem->lowerItem; - 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; - RemoveItem(item); - } + ListData *listItem = fFrontItem->lowerItem; + + 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; + RemoveItem(item); + } + // now, jump to et1: to make a 'clean' selecting of // windows to be inserted - fFrontItem = NULL; - goto et1; - } // END: else - if diferrent ClientTeamID()s. - } // if (fFrontItem) && NORMAL_WINDOW - else{ -STRACE((" NO previous FRONT Item\n")); + fFrontItem = NULL; + goto et1; + } // END: else - if different ClientTeamIDs. + + } // if(fFrontItem) && NORMAL_WINDOW + else + { + STRACE((" NO previous FRONT Item\n")); et1: FMWList finalFMWList; int32 count, i; ListData *listItem = fTopItem; // remove window's subset and application's *modal* windows spread // across Workspace's list, to be insert later, in the corect order. - while(listItem){ + while(listItem) + { int32 feel = listItem->layerPtr->Window()->Feel(); - if ((feel == B_MODAL_SUBSET_WINDOW_FEEL + if((feel == B_MODAL_SUBSET_WINDOW_FEEL && preferred->Window()->fWinFMWList.HasItem(listItem->layerPtr)) || (feel == B_MODAL_APP_WINDOW_FEEL && preferred->Window()->ClientTeamID() == @@ -781,55 +908,66 @@ STRACE((" NO previous FRONT Item\n")); else listItem = listItem->lowerItem; } - // add to the final list window's subset windows. (..._SUBSET_...) + + // add to the final list window's subset windows. (..._SUBSET_...) finalFMWList.AddFMWList(&(preferred->Window()->fWinFMWList)); - // also add application's ones. (..._APP_...) + + // also add application's ones. (..._APP_...) finalFMWList.AddFMWList(&(preferred->Window()->App()->fAppFMWList)); - // insert windows found in 'finalFMWList' in Workspace's list. - // IF *one* modal is found, do not add floating ones! + + // insert windows found in 'finalFMWList' in Workspace's list. + // IF *one* modal is found, do not add floating ones! - // see if the last WinBorder in the list is a modal window. + // see if the last WinBorder in the list is a modal window. WinBorder *wb = (WinBorder*)finalFMWList.LastItem(); bool lastIsModal = false; - if ( (wb && - (wb->Window()->Feel() == B_MODAL_SUBSET_WINDOW_FEEL - || wb->Window()->Feel() == B_MODAL_APP_WINDOW_FEEL)) - || (fBottomItem && - (fBottomItem->layerPtr->Window()->Feel() == B_MODAL_ALL_WINDOW_FEEL - || fBottomItem->layerPtr->Window()->Feel() == B_SYSTEM_FIRST)) - ) - { lastIsModal = true; } - // this variable will help us in deciding the new front WinBorder. + if( (wb && (wb->Window()->Feel() == B_MODAL_SUBSET_WINDOW_FEEL || + wb->Window()->Feel() == B_MODAL_APP_WINDOW_FEEL)) || + (fBottomItem && (fBottomItem->layerPtr->Window()->Feel() == B_MODAL_ALL_WINDOW_FEEL || + fBottomItem->layerPtr->Window()->Feel() == B_SYSTEM_FIRST)) + ) + { + lastIsModal = true; + } + + // this variable will help us in deciding the new front WinBorder. WinBorder *finalPreferred = preferred; - // now insert items found in finalFMWList into Workspace + + // now insert items found in finalFMWList into Workspace count = finalFMWList.CountItems(); - for(i=0; iWindow()->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL - || wb->Window()->Feel() == B_FLOATING_APP_WINDOW_FEEL) + for(i=0; iWindow()->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL || + wb->Window()->Feel() == B_FLOATING_APP_WINDOW_FEEL) { - // set its new MainWinBorder + // set its new MainWinBorder if(wb->Window()->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL) wb->SetMainWinBorder(preferred); - // don't add if the last WinBorder is a modal one. - if (lastIsModal) + + // don't add if the last WinBorder is a modal one. + if(lastIsModal) continue; } - else{ + else + { if(wb->Window()->Feel() == B_MODAL_SUBSET_WINDOW_FEEL) wb->SetMainWinBorder(preferred); - // if this modal window is not hidden, give it the front status. - if (!(wb->IsHidden())) + + // if this modal window is not hidden, give it the front status. + if(!(wb->IsHidden())) finalPreferred = wb; } - // insert item just after the last inserted one. + + // insert item just after the last inserted one. ListData *newItem = new ListData(); newItem->layerPtr = wb; newItem->lowerItem = lastInserted->lowerItem; newItem->upperItem = lastInserted; - if (lastInserted->lowerItem) + if(lastInserted->lowerItem) lastInserted->lowerItem->upperItem = newItem; lastInserted->lowerItem = newItem; @@ -840,66 +978,81 @@ STRACE((" NO previous FRONT Item\n")); } preferred = finalPreferred; } // else - if(fFrontItem); + } // END: if _NORMAL_ window. - else if( prefFeel == B_FLOATING_SUBSET_WINDOW_FEEL - || prefFeel == B_FLOATING_APP_WINDOW_FEEL - || prefFeel == B_FLOATING_ALL_WINDOW_FEEL) + else + if( prefFeel == B_FLOATING_SUBSET_WINDOW_FEEL || + prefFeel == B_FLOATING_APP_WINDOW_FEEL || + prefFeel == B_FLOATING_ALL_WINDOW_FEEL) { -STRACE((" FLOATING Window '%s'\n", preferred? preferred->GetName(): "NULL")); + STRACE((" FLOATING Window '%s'\n", preferred? preferred->GetName(): "NULL")); // Do nothing! FindPlace() was called and it has corectly placed our window // We don't have to do noting here. } - else if( prefFeel == B_MODAL_SUBSET_WINDOW_FEEL - || prefFeel == B_MODAL_APP_WINDOW_FEEL) + else + if( prefFeel == B_MODAL_SUBSET_WINDOW_FEEL || + prefFeel == B_MODAL_APP_WINDOW_FEEL) { -STRACE((" MODAL_APP/SUBSET Window '%s'\n", preferred? preferred->GetName(): "NULL")); + STRACE((" MODAL_APP/SUBSET Window '%s'\n", preferred? preferred->GetName(): "NULL")); + FMWList finalMWList; int32 count = 0, i; int32 prefIndex = -1; - - if (fFrontItem && fFrontItem->layerPtr->fLevel == B_NORMAL_FEEL) + + if(fFrontItem && fFrontItem->layerPtr->fLevel == B_NORMAL_FEEL) { - // remove front window's floating(_SUBSET_/_APP_) windows, if any. + // remove front window's floating(_SUBSET_/_APP_) windows, if any. ListData *listItem = fFrontItem->lowerItem; - while(listItem && (listItem->layerPtr->fLevel == B_FLOATING_SUBSET_FEEL - || listItem->layerPtr->fLevel == B_FLOATING_APP_FEEL)) - { // *carefully* remove the item from the list + 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; RemoveItem(item); } } - - // If this is a MODAL_SUBSET window, search it's place in its MainWinBorder - // window subset, and then take all modals after it; then continue talking - // modal windoes *only*, from application's set. - // If it is a MODAL_APP only search an take windows in/from application's set - if (prefFeel == B_MODAL_SUBSET_WINDOW_FEEL){ + + // If this is a MODAL_SUBSET window, search it's place in its MainWinBorder + // window subset, and then take all modals after it; then continue talking + // modal windoes *only*, from application's set. + // If it is a MODAL_APP only search an take windows in/from application's set + if(prefFeel == B_MODAL_SUBSET_WINDOW_FEEL) + { prefIndex = preferred->MainWinBorder()->Window()->fWinFMWList.IndexOf(preferred); count = preferred->MainWinBorder()->Window()->fWinFMWList.CountItems(); - if (prefIndex >= 0){ + + if(prefIndex >= 0) + { WinBorder *wb = NULL; - // add modal windows from its main window subset - windows that are - // positioned after 'preferred'. + + // add modal windows from its main window subset - windows that are + // positioned after 'preferred'. FMWList *listPtr = &(preferred->MainWinBorder()->Window()->fWinFMWList); - for(i = prefIndex+1; i < count; i++){ - // they *all* are modal windows. + for(i = prefIndex+1; i < count; i++) + { + // they *all* are modal windows. wb = (WinBorder*)listPtr->ItemAt(i); wb->SetMainWinBorder(preferred); finalMWList.AddItem(wb); - // remove those windows(if in there), for correct re-insertion later. + + // remove those windows(if in there), for correct re-insertion later. ListData *ld = NULL; if((ld = HasItem(wb))) RemoveItem(ld); } - // add modal windows that are found in application's subset + + // add modal windows that are found in application's subset count = preferred->Window()->App()->fAppFMWList.CountItems(); listPtr = &(preferred->Window()->App()->fAppFMWList); - for(i = 0; i < count; i++){ + for(i = 0; i < count; i++) + { wb = (WinBorder*)listPtr->ItemAt(i); - if (wb->Window()->Feel() == B_MODAL_APP_WINDOW_FEEL){ + if(wb->Window()->Feel() == B_MODAL_APP_WINDOW_FEEL) + { finalMWList.AddItem(wb); - // remove those windows(if in there), for correct re-insertion later. + + // remove those windows(if in there), for correct re-insertion later. ListData *ld = NULL; if((ld = HasItem(wb))) RemoveItem(ld); @@ -907,19 +1060,26 @@ STRACE((" MODAL_APP/SUBSET Window '%s'\n", preferred? preferred->GetName(): "NUL } } } - else if(prefFeel == B_MODAL_APP_WINDOW_FEEL){ + else + if(prefFeel == B_MODAL_APP_WINDOW_FEEL) + { prefIndex = preferred->Window()->App()->fAppFMWList.IndexOf(preferred); count = preferred->Window()->App()->fAppFMWList.CountItems(); - if (prefIndex >= 0){ + if(prefIndex >= 0) + { WinBorder *wb = NULL; - // add modal windows from application's subset - windows that are - // positioned after 'preferred'. + + // add modal windows from application's subset - windows that are + // positioned after 'preferred'. FMWList *listPtr = &(preferred->Window()->App()->fAppFMWList); - for(i = prefIndex+1; i < count; i++){ + for(i = prefIndex+1; i < count; i++) + { wb = (WinBorder*)listPtr->ItemAt(i); - // they *all* are modal windows. + + // they *all* are modal windows. finalMWList.AddItem(wb); - // remove those windows(if in there), for correct re-insertion later. + + // remove those windows(if in there), for correct re-insertion later. ListData *ld = NULL; if((ld = HasItem(wb))) RemoveItem(ld); @@ -927,56 +1087,61 @@ STRACE((" MODAL_APP/SUBSET Window '%s'\n", preferred? preferred->GetName(): "NUL } } - // insert windows found in 'finalMWList' in Workspace's list, after "preferred" + // insert windows found in 'finalMWList' in Workspace's list, after "preferred" count = finalMWList.CountItems(); - // this varable will help us designate the future front. + + // this varable will help us designate the future front. WinBorder *finalPreferred = preferred; - for(i=0; iIsHidden())) finalPreferred = wb; - // insert item just after the last inserted one. - ListData *newItem = new ListData(); + // insert item just after the last inserted one. + ListData *newItem = new ListData(); newItem->layerPtr = wb; newItem->lowerItem = lastInserted->lowerItem; newItem->upperItem = lastInserted; - if (lastInserted->lowerItem) + if(lastInserted->lowerItem) lastInserted->lowerItem->upperItem = newItem; lastInserted->lowerItem = newItem; - if(lastInserted == fBottomItem){ + if(lastInserted == fBottomItem) fBottomItem = newItem; - } - + lastInserted = newItem; } preferred = finalPreferred; } - else if(prefFeel == B_MODAL_ALL_WINDOW_FEEL - || prefFeel == B_SYSTEM_FIRST) + else + if(prefFeel == B_MODAL_ALL_WINDOW_FEEL || + prefFeel == B_SYSTEM_FIRST) { -STRACE((" MODAL ALL/SYSTEM FIRST Window '%s'\n", preferred? preferred->GetName(): "NULL")); - // remove all application's floating windows. - if (fFrontItem && fFrontItem->layerPtr->fLevel == B_NORMAL_FEEL) + STRACE((" MODAL ALL/SYSTEM FIRST Window '%s'\n", preferred? preferred->GetName(): "NULL")); + + // remove all application's floating windows. + if(fFrontItem && fFrontItem->layerPtr->fLevel == B_NORMAL_FEEL) { ListData *listItem = fFrontItem->lowerItem; - while(listItem && - (listItem->layerPtr->fLevel == B_FLOATING_SUBSET_FEEL - || listItem->layerPtr->fLevel == 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 + // *carefully* remove the item from the list ListData *item = listItem; listItem = listItem->lowerItem; RemoveItem(item); } } } - else if(prefFeel == B_SYSTEM_LAST){ + else if(prefFeel == B_SYSTEM_LAST) + { ; // Do Nothing. } - else{ + else + { // We ***should NOT*** reach this point! STRACE(("SERVER: PANIC: \"%s\": What kind of window is this???\n", preferred? preferred->GetName(): "NULL")); } @@ -986,139 +1151,165 @@ STRACE((" MODAL ALL/SYSTEM FIRST Window '%s'\n", preferred? preferred->GetName() ListData *exFrontItem = fFrontItem; ListData *newFrontItem = NULL; - if(preferred && fBottomItem){ + if(preferred && fBottomItem) + { int32 feel = fBottomItem->layerPtr->Window()->Feel(); - // if preferred is one of these *don't* give front state to it! + // if preferred is one of these *don't* give front state to it! if(preferred->fLevel == B_FLOATING_SUBSET_FEEL || preferred->fLevel == B_FLOATING_APP_FEEL || preferred->fLevel == B_FLOATING_ALL_FEEL) { newFrontItem = exFrontItem; } - // if the last in workspace's list is one of these, GIVE focus to it! - else if((feel == B_SYSTEM_FIRST || feel == B_MODAL_ALL_WINDOW_FEEL) + else + if((feel == B_SYSTEM_FIRST || feel == B_MODAL_ALL_WINDOW_FEEL) && !(fBottomItem->layerPtr->IsHidden()) ) { + // if the last in workspace's list is one of these, GIVE focus to it! + newFrontItem = fBottomItem; } + else + if(preferred->fLevel == B_SYSTEM_LAST && !(preferred->IsHidden()) ) + { // the SYSTEM_LAST will get the front status, only if it's the only // WinBorder in this workspace. - else if (preferred->fLevel == B_SYSTEM_LAST - && !(preferred->IsHidden()) ) - { + if(fBottomItem->layerPtr == preferred) newFrontItem = HasItem(preferred); } + else + if( !(preferred->IsHidden()) ) + { // this is in case of MODAL[APP/SUBSET] and NORMAL windows - else if ( !(preferred->IsHidden()) ){ newFrontItem = HasItem(preferred); } - else{ + else + { newFrontItem = NULL; } } - else{ newFrontItem = NULL; } - - if (fFrontItem != newFrontItem){ - fFrontItem = newFrontItem; -// TODO: call a method like... WinBorder::MakeFront(true); + else + { + newFrontItem = NULL; } -opLock.Unlock(); -STRACE(("#WS(%ld)::SASNF(%s) ENDED! Workspace data...", ID(), preferred? preferred->GetName(): "NULL")); -STRACESTREAM(); -} -/* This method performs a simple opperation. It searched the new focus window - * by walking from front to back, cheking for some things, until all variables - * correspond. - */ -//--------------------------------------------------------------------------- -void Workspace::SearchAndSetNewFocus(WinBorder* preferred){ -STRACE(("*WS(%ld)::SASNFocus(%s)\n", ID(), preferred? preferred->GetName(): "NULL")); - opLock.Lock(); + + if(fFrontItem != newFrontItem) + { + fFrontItem = newFrontItem; + // TODO: call a method like... WinBorder::MakeFront(true); + } + fOpLock.Unlock(); + STRACE(("#WS(%ld)::SASNF(%s) ENDED! Workspace data...", ID(), preferred? preferred->GetName(): "NULL")); + STRACESTREAM(); +} + +/* + This method performs a simple opperation. It searched the new focus window + by walking from front to back, cheking for some things, until all variables + correspond. +*/ +void Workspace::SearchAndSetNewFocus(WinBorder *preferred) +{ + STRACE(("*WS(%ld)::SASNFocus(%s)\n", ID(), preferred? preferred->GetName(): "NULL")); + + fOpLock.Lock(); + if(!preferred) preferred = fBottomItem? fBottomItem->layerPtr : NULL; - + bool selectOthers = false; ListData *item = NULL; - - for(item = fBottomItem; item != NULL; item = item->upperItem){ - // if this WinBorder doesn't want to have focus... get to the next one - if (item->layerPtr->Window()->Flags() & B_AVOID_FOCUS) + + for(item = fBottomItem; item != NULL; item = item->upperItem) + { + // if this WinBorder doesn't want to have focus... get to the next one + if(item->layerPtr->Window()->Flags() & B_AVOID_FOCUS) continue; - - if (preferred && item->layerPtr == preferred){ - // our preffered one is hidden so... select another one - if (preferred && preferred->IsHidden()){ + + if(preferred && item->layerPtr == preferred) + { + // our preffered one is hidden so... select another one + if(preferred && preferred->IsHidden()) + { selectOthers = true; continue; } - else{ + else + { break; } } - - if (item->layerPtr->fLevel == B_SYSTEM_FIRST || item->layerPtr->fLevel == B_MODAL_ALL_FEEL) + + if(item->layerPtr->fLevel == B_SYSTEM_FIRST || item->layerPtr->fLevel == B_MODAL_ALL_FEEL) { break; } - - if (item->layerPtr->fLevel == B_MODAL_APP_FEEL + + if(item->layerPtr->fLevel == B_MODAL_APP_FEEL && (preferred && preferred->Window()->ClientTeamID() == item->layerPtr->Window()->ClientTeamID())) { break; } - - if (item->layerPtr->fLevel == 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->fLevel != B_SYSTEM_LAST){ + + // select one window, other than a system_last one! + if(selectOthers && item->layerPtr->fLevel != B_SYSTEM_LAST) + { break; } } - - // there are no windows below us to select. take the one from above us. - if(selectOthers && !item){ - // there HAS to be valid + + // there are no windows below us to select. take the one from above us. + if(selectOthers && !item) + { + // there HAS to be valid item = HasItem(preferred); - if (item) + if(item) item= item->lowerItem; } - - // there are NO windows in front of us, and no regular window below us - // maybe there is a system_last window... - if(!item){ - item = fTopItem; - } - if (item != fFocusItem){ + // there are NO windows in front of us, and no regular window below us + // maybe there is a system_last window... + if(!item) + item = fTopItem; + + if(item != fFocusItem) + { // TODO: item->ColorTabInGrey & send message to client // TODO: item->ColorTabInYellow & send message to client // TODO: Rebuild & Redraw. fFocusItem = item; } - opLock.Unlock(); + fOpLock.Unlock(); } -//--------------------------------------------------------------------------- -void Workspace::BringToFrontANormalWindow(WinBorder* layer){ - switch (layer->Window()->Feel()){ + +void Workspace::BringToFrontANormalWindow(WinBorder *layer) +{ + switch (layer->Window()->Feel()) + { case B_FLOATING_SUBSET_WINDOW_FEEL: - case B_MODAL_SUBSET_WINDOW_FEEL:{ + case B_MODAL_SUBSET_WINDOW_FEEL: + { SearchAndSetNewFront(layer->MainWinBorder()); break; } case B_FLOATING_APP_WINDOW_FEEL: - case B_MODAL_APP_WINDOW_FEEL:{ - opLock.Lock(); + case B_MODAL_APP_WINDOW_FEEL: + { + fOpLock.Lock(); ListData *item = fBottomItem; team_id tid = layer->Window()->ClientTeamID(); - while(item){ + while(item) + { if(item->layerPtr->Window()->ClientTeamID() == tid && item->layerPtr->Window()->Feel() == B_NORMAL_WINDOW_FEEL) { @@ -1126,96 +1317,112 @@ void Workspace::BringToFrontANormalWindow(WinBorder* layer){ } item = item->upperItem; } - if(item){ + + if(item) SearchAndSetNewFront(item->layerPtr); - } - opLock.Unlock(); + + fOpLock.Unlock(); break; } - default:{ + default: + { // in case of MODAL/FLOATING_ALL or _NORMAL_ or SYSTEM_FIRST/LAST do nothing! } } } -/* The method moves a window to the back of its subset. - */ -//--------------------------------------------------------------------------- -void Workspace::MoveToBack(WinBorder* newLast){ -STRACE(("\n!MoveToBack(%s) -", newLast? newLast->GetName(): "NULL")); - // does the list have this element? - ListData *item = HasItem(newLast); - if(item){ - ListData *listItem = NULL; - 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 +// This method moves a window to the back of its subset. +void Workspace::MoveToBack(WinBorder *newLast) +{ + STRACE(("\n!MoveToBack(%s) -", newLast? newLast->GetName(): "NULL")); + + // does the list have this element? + ListData *item = HasItem(newLast); + if(item) + { + ListData *listItem = NULL; + + 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->fLevel == item->layerPtr->fLevel)) listItem = listItem->upperItem; - + break; } - - // those 2 flags form a 'virtual' set, so even if FLOATING_APP - // has a greater priority than FLOATING_SUBSET, it is still moved - // behind FLOATING_SUBSET. + + // those 2 flags form a 'virtual' set, so even if FLOATING_APP + // has a greater priority than FLOATING_SUBSET, it is still moved + // behind FLOATING_SUBSET. case B_FLOATING_SUBSET_FEEL: - case B_FLOATING_APP_FEEL:{ -STRACE((" B_FLOATING_SUBSET_FEEL/B_FLOATING_APP_FEEL window\n")); - // search the place where we should insert it later + case B_FLOATING_APP_FEEL: + { + 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->fLevel == B_FLOATING_SUBSET_FEEL - || listItem->layerPtr->fLevel == B_FLOATING_APP_FEEL)) - listItem = listItem->upperItem; - break; - } - - // the same like with floating window. Those 2 and NORMAL form a'virtual' set. - case B_MODAL_SUBSET_FEEL: - case B_MODAL_APP_FEEL:{ -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->fLevel == B_MODAL_SUBSET_FEEL - || listItem->layerPtr->fLevel == B_MODAL_APP_FEEL - || listItem->layerPtr->fLevel == B_NORMAL_FEEL)) - listItem = listItem->upperItem; - - break; - } - - // here is the simplest, we use the priority levels. - case B_NORMAL_FEEL:{ -STRACE((" B_NORMAL_FEEL window\n")); - listItem = item->upperItem; - while(listItem && (listItem->layerPtr->fLevel >= item->layerPtr->fLevel)){ + while(listItem && (listItem->layerPtr->fLevel == B_FLOATING_SUBSET_FEEL || + listItem->layerPtr->fLevel == B_FLOATING_APP_FEEL)) + { listItem = listItem->upperItem; } + + break; + } + + // the same like with floating window. Those 2 and NORMAL form a'virtual' set. + case B_MODAL_SUBSET_FEEL: + case B_MODAL_APP_FEEL: + { + 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->fLevel == B_MODAL_SUBSET_FEEL || + listItem->layerPtr->fLevel == B_MODAL_APP_FEEL || + listItem->layerPtr->fLevel == B_NORMAL_FEEL)) + { + listItem = listItem->upperItem; + } + + break; + } + + // here is the simplest, we use the priority levels. + case B_NORMAL_FEEL: + { + STRACE((" B_NORMAL_FEEL window\n")); + listItem = item->upperItem; + while(listItem && (listItem->layerPtr->fLevel >= item->layerPtr->fLevel)) + listItem = listItem->upperItem; break; } } - if ((listItem && item->lowerItem == listItem->lowerItem) + if((listItem && item->lowerItem == listItem->lowerItem) || (listItem == NULL && item == fTopItem)) { // do nothing! The window will be in the same position it is now. } - else{ - // if it's a normal window, first remove any floating windows, - // it or its application has - if(newLast->fLevel == B_NORMAL_FEEL && fFrontItem->layerPtr == newLast){ + else + { + // if it's a normal window, first remove any floating windows, + // it or its application has + if(newLast->fLevel == B_NORMAL_FEEL && fFrontItem->layerPtr == newLast) + { ListData *iter = item->lowerItem; - while(iter && - (iter->layerPtr->fLevel == B_FLOATING_SUBSET_FEEL - || iter->layerPtr->fLevel == B_FLOATING_APP_FEEL)) + while(iter && (iter->layerPtr->fLevel == B_FLOATING_SUBSET_FEEL || + iter->layerPtr->fLevel == B_FLOATING_APP_FEEL)) { - // *carefully* remove the item from the list + // *carefully* remove the item from the list ListData *itemX = iter; iter = iter->lowerItem; RemoveItem(itemX); @@ -1226,62 +1433,119 @@ STRACE((" B_NORMAL_FEEL window\n")); WinBorder *nextPreferred = item->upperItem? item->upperItem->layerPtr: NULL; bool wasFront = fFrontItem->layerPtr == newLast; bool wasFocus = fFocusItem->layerPtr == newLast; - // remove item + + // remove item RemoveItem(item); - // insert in the new, right' position. + + // insert in the new, right' position. InsertItem(item, listItem? listItem->lowerItem: fTopItem); - if (wasFront) + if(wasFront) SearchAndSetNewFront(nextPreferred); - if (wasFocus) + if(wasFocus) SearchAndSetNewFocus(nextPreferred); } -STRACESTREAM(); + STRACESTREAM(); } else STRACE((" this operation was not needed\n")); } -//--------------------------------------------------------------------------- -void Workspace::SetLocalSpace(const uint32 colorspace){ + +void Workspace::SetLocalSpace(const uint32 colorspace) +{ fSpace = colorspace; } -//--------------------------------------------------------------------------- -uint32 Workspace::LocalSpace() const{ + +uint32 Workspace::LocalSpace() const +{ return fSpace; } -//--------------------------------------------------------------------------- -void Workspace::SetBGColor(const RGBColor &c){ - fBGColor = c; + +void Workspace::SetBGColor(const RGBColor &c) +{ + fBGColor = c; } -//--------------------------------------------------------------------------- -RGBColor Workspace::BGColor(void) const{ + +RGBColor Workspace::BGColor(void) const +{ return fBGColor; } -//--------------------------------------------------------------------------- -// Debug methods!!! -//--------------------------------------------------------------------------- -void Workspace::PrintToStream() const{ + +/*! + \brief Retrieves settings from a container message passed to PutSettings + \param A BMessage containing data from a PutSettings() call + + This function will place default values whenever a particular setting cannot + be found. +*/ +void Workspace::GetSettings(const BMessage &msg) +{ + // TODO: Implement +} + +//! Sets workspace settings to defaults +void Workspace::GetDefaultSettings(void) +{ + // TODO: Implement +} + +/*! + \brief Places the screen settings for the workspace in the passed BMessage + \param msg BMessage pointer to receive the settings + \param index The index number of the workspace in the desktop + + This function will fail if passed a NULL pointer. The settings for the workspace are + saved in a BMessage + + The format is as follows: + int32 "index" -> workspace index + display_timing "display_timing" -> fDisplayTiming (see Accelerant.h) + uint32 "color_space" -> color space of the workspace + rgb_color "bgcolor" -> background color of the workspace + int16 "virtual_width" -> virtual width of the workspace + int16 "virtual_height" -> virtual height of the workspace + int32 "flags" -> workspace flags +*/ +void Workspace::PutSettings(BMessage *msg, const int32 &index) const +{ + // TODO: Implement +} + +/*! + \brief Places default settings for the workspace in the passed BMessage + \param msg BMessage pointer to receive the settings + \param index The index number of the workspace in the desktop +*/ +void Workspace::PutDefaultSettings(BMessage *msg, const int32 &index) +{ + // TODO: Implement +} + +// Debug methods +void Workspace::PrintToStream() const +{ printf("\nWorkspace %ld hierarchy shown from back to front:\n", fID); - for (ListData *item = fTopItem; item != NULL; item = item->lowerItem){ + for (ListData *item = fTopItem; item != NULL; item = item->lowerItem) + { WinBorder *wb = (WinBorder*)item->layerPtr; printf("\tName: %s\t%s", wb->GetName(), wb->IsHidden()?"Hidden\t": "NOT Hidden"); - if (wb->Window()->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL) + if(wb->Window()->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL) printf("\t%s\n", "B_FLOATING_SUBSET_WINDOW_FEEL"); - if (wb->Window()->Feel() == B_FLOATING_APP_WINDOW_FEEL) + if(wb->Window()->Feel() == B_FLOATING_APP_WINDOW_FEEL) printf("\t%s\n", "B_FLOATING_APP_WINDOW_FEEL"); - if (wb->Window()->Feel() == B_FLOATING_ALL_WINDOW_FEEL) + if(wb->Window()->Feel() == B_FLOATING_ALL_WINDOW_FEEL) printf("\t%s\n", "B_FLOATING_ALL_WINDOW_FEEL"); - if (wb->Window()->Feel() == B_MODAL_SUBSET_WINDOW_FEEL) + if(wb->Window()->Feel() == B_MODAL_SUBSET_WINDOW_FEEL) printf("\t%s\n", "B_MODAL_SUBSET_WINDOW_FEEL"); - if (wb->Window()->Feel() == B_MODAL_APP_WINDOW_FEEL) + if(wb->Window()->Feel() == B_MODAL_APP_WINDOW_FEEL) printf("\t%s\n", "B_MODAL_APP_WINDOW_FEEL"); - if (wb->Window()->Feel() == B_MODAL_ALL_WINDOW_FEEL) + if(wb->Window()->Feel() == B_MODAL_ALL_WINDOW_FEEL) printf("\t%s\n", "B_MODAL_ALL_WINDOW_FEEL"); - if (wb->Window()->Feel() == B_NORMAL_WINDOW_FEEL) + if(wb->Window()->Feel() == B_NORMAL_WINDOW_FEEL) printf("\t%s\n", "B_NORMAL_WINDOW_FEEL"); - if (wb->Window()->Feel() == B_SYSTEM_LAST) + if(wb->Window()->Feel() == B_SYSTEM_LAST) printf("\t%s\n", "B_SYSTEM_LAST"); - if (wb->Window()->Feel() == B_SYSTEM_FIRST) + if(wb->Window()->Feel() == B_SYSTEM_FIRST) printf("\t%s\n", "B_SYSTEM_FIRST"); } printf("Focus Layer:\t%s\n", fFocusItem? fFocusItem->layerPtr->GetName(): "NULL"); @@ -1290,15 +1554,18 @@ void Workspace::PrintToStream() const{ // printf("Top Layer:\t%s\n", fTopItem? fTopItem->layerPtr->GetName(): "NULL"); // printf("Bottom Layer:\t%s\n", fBottomItem? fBottomItem->layerPtr->GetName(): "NULL"); } -//--------------------------------------------------------------------------- -void Workspace::PrintItem(ListData *item) const{ + +void Workspace::PrintItem(ListData *item) const +{ printf("ListData members:\n"); - if (item){ + if(item) + { printf("WinBorder:\t%s\n", item->layerPtr? item->layerPtr->GetName(): "NULL"); printf("UpperItem:\t%s\n", item->upperItem? item->upperItem->layerPtr->GetName(): "NULL"); printf("LowerItem:\t%s\n", item->lowerItem? item->lowerItem->layerPtr->GetName(): "NULL"); } - else{ - printf("NULL item!!!\n"); + else + { + printf("NULL item\n"); } } diff --git a/src/servers/app/server/Workspace.h b/src/servers/app/server/Workspace.h index df7d1cb265..228f536435 100644 --- a/src/servers/app/server/Workspace.h +++ b/src/servers/app/server/Workspace.h @@ -29,6 +29,7 @@ #include #include +#include #include "RGBColor.h" @@ -36,83 +37,104 @@ class WinBorder; class RBGColor; class RootLayer; -struct ListData{ - WinBorder *layerPtr; - ListData *upperItem; - ListData *lowerItem; +struct ListData +{ + WinBorder *layerPtr; + ListData *upperItem; + ListData *lowerItem; }; class Workspace { public: - Workspace(const uint32 colorspace, - int32 ID, - const RGBColor& BGColor, - RootLayer* owner); - ~Workspace(); - - bool AddLayerPtr(WinBorder* layer); - bool RemoveLayerPtr(WinBorder* layer); - bool HideSubsetWindows(WinBorder* layer); - WinBorder* SetFocusLayer(WinBorder* layer); - WinBorder* FocusLayer() const; - WinBorder* SetFrontLayer(WinBorder* layer); - WinBorder* FrontLayer() const; - - void MoveToBack(WinBorder* newLast); - - WinBorder* GoToBottomItem(); // the one that's visible. - WinBorder* GoToUpperItem(); - WinBorder* GoToTopItem(); - WinBorder* GoToLowerItem(); - bool GoToItem(WinBorder* layer); - - WinBorder* SearchWinBorder(BPoint pt); - void Invalidate(); - - void SetLocalSpace(const uint32 colorspace); - uint32 LocalSpace() const; - - void SetBGColor(const RGBColor &c); - RGBColor BGColor(void) const; - - int32 ID() const { return fID; } - -// void SetFlags(const uint32 flags); -// uint32 Flags(void) const; + Workspace(const uint32 colorspace, int32 ID, const RGBColor& BGColor, + RootLayer *owner); + ~Workspace(void); + + bool AddLayerPtr(WinBorder *layer); + bool RemoveLayerPtr(WinBorder *layer); + bool HideSubsetWindows(WinBorder *layer); + WinBorder *SetFocusLayer(WinBorder *layer); + WinBorder *FocusLayer(void) const; + WinBorder *SetFrontLayer(WinBorder *layer); + WinBorder *FrontLayer(void) const; + + void MoveToBack(WinBorder *newLast); + + // The bottom item is the one which is visible + WinBorder *GoToBottomItem(void); + WinBorder *GoToUpperItem(void); + WinBorder *GoToTopItem(void); + WinBorder *GoToLowerItem(void); + bool GoToItem(WinBorder *layer); + + WinBorder *SearchWinBorder(BPoint pt); + void Invalidate(void); + + void SetLocalSpace(const uint32 colorspace); + uint32 LocalSpace(void) const; + + void SetBGColor(const RGBColor &c); + RGBColor BGColor(void) const; + + int32 ID(void) const { return fID; } + + void GetSettings(const BMessage &msg); + void GetDefaultSettings(void); + void PutSettings(BMessage *msg, const int32 &index) const; + static void PutDefaultSettings(BMessage *msg, const int32 &index); + // debug methods - void PrintToStream() const; - void PrintItem(ListData *item) const; - -// .... private :-) - do not use! - void SearchAndSetNewFront(WinBorder* preferred); - void SearchAndSetNewFocus(WinBorder* preferred); - void BringToFrontANormalWindow(WinBorder* layer); - - ListData* HasItem(ListData* item); - ListData* HasItem(WinBorder* layer); - + void PrintToStream(void) const; + void PrintItem(ListData *item) const; + + // TODO: Bad Style. There should be a more elegant way of doing this + // .... private :-) - do not use! + void SearchAndSetNewFront(WinBorder *preferred); + void SearchAndSetNewFocus(WinBorder *preferred); + void BringToFrontANormalWindow(WinBorder *layer); + + ListData *HasItem(ListData *item); + ListData *HasItem(WinBorder *layer); + private: - - void InsertItem(ListData* item, ListData* before); - void RemoveItem(ListData* item); - - ListData* FindPlace(ListData* pref); - - int32 fID; - uint32 fSpace; -// uint32 fFlags; - RGBColor fBGColor; - - BLocker opLock; - - RootLayer *fOwner; - - ListData *fBottomItem, // first visible onscreen - *fTopItem, // the last visible(or covered by other Layers) - *fCurrentItem, // pointer to the currect element in the list - *fFocusItem, // the focus WinBorder - for keyboard events - *fFrontItem; // the one the mouse can bring in front as possible(in its set) + + void InsertItem(ListData *item, ListData *before); + void RemoveItem(ListData *item); + + ListData *FindPlace(ListData *pref); + + int32 fID; + uint32 fSpace; + RGBColor fBGColor; + + BLocker fOpLock; + + RootLayer *fOwner; + + // first visible onscreen + ListData *fBottomItem; + + // the last visible(or covered by other Layers) + ListData *fTopItem; + + // pointer to the currect element in the list + ListData *fCurrentItem; + + // the focus WinBorder - for keyboard events + ListData *fFocusItem; + + // the one the mouse can bring in front as possible(in its set) + ListData *fFrontItem; + + // settings for each workspace -- example taken from R5's app_server_settings file + display_timing fDisplayTiming; + int16 fVirtualWidth; + int16 fVirtualHeight; + + // TODO: find out what specific values need to be contained in fFlags as per R5's server + // not to be confused with display_timing.flags + uint32 fFlags; }; #endif