From 8436893ffd56c8e23e11be418b288f29ae19f49a Mon Sep 17 00:00:00 2001 From: DarkWyrm Date: Sun, 29 Aug 2004 15:01:44 +0000 Subject: [PATCH] Remove a couple desktop-related files no longer needed More specific TODO comments so we can use grep to understand in a general sense what still needs done git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8708 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/server/AppServer.cpp | 2 +- src/servers/app/server/Desktop.cpp | 32 +- src/servers/app/server/DesktopClasses.cpp | 522 ---------------------- src/servers/app/server/DesktopClasses.h | 131 ------ src/servers/app/server/ServerApp.cpp | 10 +- src/servers/app/server/ServerWindow.cpp | 131 +++--- src/servers/app/server/Workspace.cpp | 17 +- 7 files changed, 98 insertions(+), 747 deletions(-) delete mode 100644 src/servers/app/server/DesktopClasses.cpp delete mode 100644 src/servers/app/server/DesktopClasses.h diff --git a/src/servers/app/server/AppServer.cpp b/src/servers/app/server/AppServer.cpp index bf4bca5035..8a736fe296 100644 --- a/src/servers/app/server/AppServer.cpp +++ b/src/servers/app/server/AppServer.cpp @@ -107,7 +107,7 @@ AppServer::AppServer(void) // Used for testing purposes - // TODO: Uncomment when actually put to use. Commented out for speed + // TODO: Re-enable scanning of all font directories when server is actually put to use fontserver->ScanDirectory("/boot/beos/etc/fonts/ttfonts/"); // fontserver->ScanDirectory("/boot/beos/etc/fonts/PS-Type1/"); // fontserver->ScanDirectory("/boot/home/config/fonts/ttfonts/"); diff --git a/src/servers/app/server/Desktop.cpp b/src/servers/app/server/Desktop.cpp index 70cffd0de6..721620ad92 100644 --- a/src/servers/app/server/Desktop.cpp +++ b/src/servers/app/server/Desktop.cpp @@ -113,11 +113,10 @@ void Desktop::Init(void) Screen *sc = new Screen(driver, BPoint(640, 480), B_RGB32, driverCount); - // TODO: be careful, it may fail to initialize! - Monitor may not support 640x480 + // TODO: be careful, of screen initialization - monitor may not support 640x480 fScreenList.AddItem(sc); - // TODO: remove this when you have a real Driver. - if (driverCount == 1) + if ( (DISPLAYDRIVER != HWDRIVER) && (driverCount == 1) ) initDrivers = false; } else @@ -196,9 +195,7 @@ void Desktop::SetActiveRootLayer(RootLayer* rl) fActiveRootLayer = rl; -// TODO: -// hide the mouse in the old ActiveRootLayer -// show the mouse in new ActiveRootLayer + // TODO: hide mouse in the old ActiveRootLayer & show it in the new ActiveRootLayer fActiveRootLayer->FullInvalidate(fActiveRootLayer->Bounds()); } @@ -356,7 +353,7 @@ printf("Focus: %s\n", ws->FocusLayer()->GetName()); // may be or may be empty. - // TODO: what if modal of floating windows are in front of us? + // TODO: B_MOUSE_DOWN: what if modal of floating windows are in front of us? invalidRegion.Include(&(activeFocus->fFull)); invalidRegion.Include(&(activeFocus->fTopLayer->fFull)); activeFocus->fParent->RebuildAndForceRedraw(invalidRegion, activeFocus); @@ -487,7 +484,7 @@ printf("2Focus: %s\n", ws->FocusLayer()->GetName()); msg.Read(&evt.wheel_delta_y); msg.Read(&evt.modifiers); - // TODO: Pass this on to the client ServerWindow + // TODO: B_MOUSE_WHEEL_CHANGED - Pass this on to the client ServerWindow break; } default: @@ -542,7 +539,7 @@ void Desktop::KeyboardEventHandler(int32 code, BPortLink& msg) if(modifiers & (B_LEFT_COMMAND_KEY | B_LEFT_CONTROL_KEY | B_LEFT_SHIFT_KEY)) { - // TODO: Set to Safe Mode here. (DisplayDriver API change) + // TODO: Set to Safe Mode in KeyboardEventHandler:B_KEY_DOWN. (DisplayDriver API change) STRACE(("Safe Video Mode invoked - code unimplemented\n")); break; } @@ -553,7 +550,7 @@ void Desktop::KeyboardEventHandler(int32 code, BPortLink& msg) { STRACE(("Set Workspace %ld\n",scancode-1)); - //TODO: change + //TODO: SetWorkspace in KeyboardEventHandler //SetWorkspace(scancode-2); break; } @@ -600,7 +597,7 @@ void Desktop::KeyboardEventHandler(int32 code, BPortLink& msg) { if(modifiers & (B_LEFT_CONTROL_KEY | B_LEFT_SHIFT_KEY | B_LEFT_OPTION_KEY)) { - // TODO: Set to Safe Mode here. (DisplayDriver API change) + // TODO: Set to Safe Mode in KeyboardEventHandler:B_KEY_DOWN. (DisplayDriver API change) STRACE(("Safe Video Mode invoked - code unimplemented\n")); break; } @@ -608,7 +605,7 @@ void Desktop::KeyboardEventHandler(int32 code, BPortLink& msg) if(modifiers & (B_LEFT_SHIFT_KEY | B_LEFT_CONTROL_KEY)) { STRACE(("Set Workspace %ld\n",scancode-1)); - //TODO: resolve + //TODO: SetWorkspace in KeyboardEventHandler //SetWorkspace(scancode-2); break; } @@ -653,7 +650,7 @@ void Desktop::KeyboardEventHandler(int32 code, BPortLink& msg) // We got this far, so apparently it's safe to pass to the active // window. - // TODO: Pass on to client window with the focus + // TODO: Pass on key down message to client window with the focus break; } case B_KEY_UP: @@ -720,7 +717,7 @@ void Desktop::KeyboardEventHandler(int32 code, BPortLink& msg) // We got this far, so apparently it's safe to pass to the active // window. - // TODO: Pass on to client window with the focus + // TODO: Pass on key up message to client window with the focus break; } case B_UNMAPPED_KEY_DOWN: @@ -747,7 +744,8 @@ void Desktop::KeyboardEventHandler(int32 code, BPortLink& msg) #ifdef DEBUG_KEYHANDLING printf("Unmapped Key Down: 0x%lx\n", scancode); #endif - // TODO: Pass on to client window with the focus + + // TODO: Pass on unmapped key down message to client window with the focus break; } case B_UNMAPPED_KEY_UP: @@ -775,7 +773,7 @@ void Desktop::KeyboardEventHandler(int32 code, BPortLink& msg) printf("Unmapped Key Up: 0x%lx\n", scancode); #endif - // TODO: Pass on to client window with the focus + // TODO: Pass on unmapped key up message to client window with the focus break; } case B_MODIFIERS_CHANGED: @@ -803,7 +801,7 @@ void Desktop::KeyboardEventHandler(int32 code, BPortLink& msg) printf("Modifiers Changed\n"); #endif - // TODO: Pass on to client window with the focus + // TODO: Pass on modifier change message to client window with the focus break; } default: diff --git a/src/servers/app/server/DesktopClasses.cpp b/src/servers/app/server/DesktopClasses.cpp deleted file mode 100644 index 1a69d89a0e..0000000000 --- a/src/servers/app/server/DesktopClasses.cpp +++ /dev/null @@ -1,522 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2003, OpenBeOS -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -// File Name: DesktopClasses.cpp -// Author: DarkWyrm -// Gabe Yoder -// Description: Classes for managing workspaces and screens -// -//------------------------------------------------------------------------------ -#include -#include -#include -#include -#include "DesktopClasses.h" -#include "TokenHandler.h" -#include "ServerWindow.h" -#include "WinBorder.h" -#include "RootLayer.h" -#include "Desktop.h" -#include "DisplayDriver.h" -#include "Decorator.h" - - -//#define DEBUG_WORKSPACE -//#define DEBUG_SCREEN - -#ifdef DEBUG_WORKSPACE -# include -# define STRACE_WS(x) printf x -#else -# define STRACE_WS(x) ; -#endif - -#ifdef DEBUG_SCREEN -# include -# define STRACE_SCREEN(x) printf x -#else -# define STRACE_SCREEN(x) ; -#endif - -// Defined and initialized in AppServer.cpp -extern RGBColor workspace_default_color; -TokenHandler screen_id_handler; - -/*! - \brief Sets up internal variables needed by the Workspace - \param gcinfo The graphics card info - \param fbinfo The frame buffer info - \param gfxdriver DisplayDriver for the associated RootLayer -*/ -Workspace::Workspace(const graphics_card_info &gcinfo, const frame_buffer_info &fbinfo, Screen *screen) -{ - _gcinfo=gcinfo; - _fbinfo=fbinfo; - - _screen=screen; - _rootlayer=new RootLayer(BRect(0,0,fbinfo.display_width-1,fbinfo.display_height-1), - "Workspace Root",_screen->GetGfxDriver()); - _rootlayer->SetColor(workspace_default_color); -STRACE_WS(("Workspace::Workspace(%s)\n",_rootlayer->GetName())); -} - -/*! - \brief Constructor to accept data from reading R5's settings -*/ -Workspace::Workspace(as_workspace_data *data, Screen *screen) -{ - //TODO: Implement -} - -/*! - \brief Deletes the heap memory used by the Workspace -*/ -Workspace::~Workspace(void) -{ -STRACE_WS(("Workspace::~Workspace(%s)\n",_rootlayer->GetName())); - if(_rootlayer) - { - _rootlayer->PruneTree(); - delete _rootlayer; - } -} - -/*! - \brief Sets the background color of the workspace - \param c The new background color - Note: This does not refresh the display -*/ -void Workspace::SetBGColor(const RGBColor &c) -{ -STRACE_WS(("Workspace::SetBGColor(): ")); - c.PrintToStream(); - _rootlayer->SetColor(c); -} - -/*! - \brief Returns the background color of the workspace - \return The background color -*/ -RGBColor Workspace::BGColor() -{ - return _rootlayer->GetColor(); -} - -/*! - \brief Returns a pointer to the RootLayer object - \return The RootLayer object -*/ -RootLayer *Workspace::GetRoot(void) -{ - return _rootlayer; -} - -/*! - \brief Changes the graphics data and resizes the RootLayer accordingly - \param gcinfo The new graphics card info - \param fbinfo The new frame buffer info -*/ -void Workspace::SetData(const graphics_card_info &gcinfo, const frame_buffer_info &fbinfo) -{ -STRACE_WS(("Workspace::SetData(%s)\n",_rootlayer->GetName())); - if(_fbinfo.display_width!=fbinfo.display_width || - _fbinfo.display_height!=fbinfo.display_height) - { - // We won't need to invalidate the new regions as mentioned in the original implementation - // docs because RootLayer reimplements ResizeBy to handle this - _rootlayer->ResizeBy( (fbinfo.display_width-_fbinfo.display_width), - (fbinfo.display_height-_fbinfo.display_height) ); - } - _gcinfo=gcinfo; - _fbinfo=fbinfo; -} - -/*! - \brief Obtains the graphics card info and frame buffer info - \param gcinfo The graphics card info structure that receives the data - \param fbinfo The frame buffer info structure that receives the data -*/ -void Workspace::GetData(graphics_card_info *gcinfo, frame_buffer_info *fbinfo) -{ - *gcinfo=_gcinfo; - *fbinfo=_fbinfo; -} - -/*! - - \brief Changes the size and mode of the workspace - \param res The new resolution mode of the workspace -*/ -void Workspace::SetSpace(int32 res) -{ -STRACE_WS(("Workspace::SetSpace(%ld) unimplemented\n",res)); - // TODO: Implement -} - -/*! - \brief Sets up internal variables needed by Screen - \param gfxmodule Pointer to the uninitialized display driver to use - \param workspaces The number of workspaces on this screen -*/ -Screen::Screen(DisplayDriver *gfxmodule) -{ -STRACE_SCREEN(("Screen::Screen(%s,%u)\n",gfxmodule?"driver":"NULL",workspaces)); - _workspacelist=NULL; - _driver=gfxmodule; - _resolution=0; - _activewin=NULL; - _currentworkspace=-1; - _activeworkspace=NULL; - _workspacecount=0; - _init=false; - _active=false; - _id.id=screen_id_handler.GetToken(); - - if (_driver) - { - _init=true; - - _fbinfo.bits_per_pixel=_driver->GetDepth(); - _fbinfo.bytes_per_row=_driver->GetBytesPerRow(); - _fbinfo.width=_driver->GetWidth(); - _fbinfo.height=_driver->GetHeight(); - _fbinfo.display_width=_driver->GetWidth(); - _fbinfo.display_height=_driver->GetHeight(); - _fbinfo.display_x=_driver->GetWidth(); - _fbinfo.display_y=_driver->GetHeight(); - - _gcinfo.width=_driver->GetWidth(); - _gcinfo.height=_driver->GetHeight(); - _gcinfo.bytes_per_row=_driver->GetBytesPerRow(); - _gcinfo.bits_per_pixel=_driver->GetDepth(); - - // right now, we won't do anything with the gcinfo structure. ** LAZY PROGRAMMER ALERT ** :P - - _workspacelist = new BList(); - _workspacecount = 0; - _resolution=_driver->GetMode(); - } -} - -/*! - \brief Deletes the heap memory used by the Screen and shuts down the driver -*/ -Screen::~Screen(void) -{ -STRACE_SCREEN(("Screen::~Screen\n")); - if ( _workspacelist ) - { - int i; - for (i=0; i<_workspacecount; i++) - delete (Workspace *)_workspacelist->ItemAt(i); - delete _workspacelist; - } - if ( _driver ) - _driver->Shutdown(); -} - -/*! - \brief Adds a workspace with default settings to the screen object - \param index The position within the workspace list (default = -1 = end) -*/ -void Screen::AddWorkspace(int32 index) -{ -STRACE_SCREEN(("Screen::AddWorkspace(%ld)\n",index+1)); - Workspace *workspace = new Workspace(_gcinfo,_fbinfo,this); - if ( (index == -1) || !_workspacelist->AddItem(workspace,index) ) - _workspacelist->AddItem(workspace); -} - -/*! - \brief Adds a workspace object to the screen - \param workspace The workspace to add. - \param index Optional index to insert workspace at. Defaults to adding to end of list. - - This function will do nothing if workspace is NULL. -*/ -void Screen::AddWorkspace(Workspace *workspace,int32 index) -{ -STRACE_SCREEN(("Screen::AddWorkspace(%s)\n",(workspace && workspace->GetRoot())?workspace->GetRoot()->GetName():"NULL")); - if ( (index==-1) || !_workspacelist->AddItem(workspace,index) ) - _workspacelist->AddItem(workspace); -} - -/*! - \brief Deletes the workspace at the specified index - \param index The position within the workspace list -*/ -void Screen::DeleteWorkspace(int32 index) -{ -STRACE_SCREEN(("Screen::DeleteWorkspace(%ld)\n",index+1)); - Workspace *workspace; - workspace = (Workspace *)_workspacelist->RemoveItem(index); - if ( workspace ) - delete workspace; -} - -/*! - \brief Returns the number of workspaces handled by the screen object - \return The number of workspaces -*/ -int32 Screen::CountWorkspaces(void) -{ - return _workspacecount; -} - -/*! - \brief Sets the number of available workspaces to count - \param count The new number of available workspaces (1 <= count <= 32) - If count is less than the current count, workspaces are deleted from the - end. Any workspaces added are added to the end of the list. -*/ -void Screen::SetWorkspaceCount(int32 count) -{ - int i; - - if ( count < 1 ) - count = 1; - if ( count > 32 ) - count = 32; - if ( _workspacecount == count ) - return; - for (i=_workspacecount; iItemAt(0); - _activeworkspace->GetRoot()->Show(); -// _activeworkspace->GetRoot()->RequestDraw(); - } - } - for (i=_workspacecount; i>count; i--) - DeleteWorkspace(i-1); - _workspacecount = count; - if ( _currentworkspace > count-1 ) - SetWorkspace(count-1); - -STRACE_SCREEN(("Screen::SetWorkspaceCount(%ld)\n",count)); -} - -/*! - \brief Returns the active workspace index - \return The active workspace index -*/ -int32 Screen::CurrentWorkspace(void) -{ - return _currentworkspace; -} - -/*! - \brief Sets the active workspace - \param index The index of the new active workspace -*/ -void Screen::SetWorkspace(int32 index) -{ -STRACE_SCREEN(("Screen::SetWorkspace(%ld)\n",index+1)); - if ( (index >= 0) && (index <= _workspacecount-1) ) - { - _currentworkspace = index; - _activeworkspace = (Workspace *)_workspacelist->ItemAt(index); - } -} - -/*! - \brief Changes the active status of the screen - \param active Flag - should the screen be active? -*/ -void Screen::Activate(bool active) -{ -STRACE_SCREEN(("Screen::Activate(%s)\n",active?"active":"inactive")); - _active=active; -} - -/*! - \brief Returns a pointer to the display driver used by the Screen - \return The display driver -*/ -DisplayDriver *Screen::GetGfxDriver(void) -{ - return _driver; -} - -/*! - \brief Changes the screen's attributes - depth, size, etc. - \param index Workspace to change - \param res Resolution constant defined in GraphicsDefs.h - \param stick Make the change persistent across reboots - \return B_OK if succcessful, B_ERROR if not -*/ -status_t Screen::SetSpace(int32 index, int32 res,bool stick) -{ -STRACE_SCREEN(("Screen::SetSpace(%ld,%ld,%s)\n",index,res,stick?"stick":"non-stick")); - // the specified workspace isn't active, so this should be easy... - Workspace *wkspc=(Workspace*)_workspacelist->ItemAt(index); - if(!wkspc) - return B_ERROR; - wkspc->SetSpace(res); - - if(index==_currentworkspace) - { - // change the statistics of the current workspace - if(_driver) - _driver->SetMode(res); - } - return B_OK; -} - -/*! - \brief Adds a Window to the desktop - \param win Window to add to the desktop - \param workspace Workspace to add the window to - - The ServerWindow's WindowBorder object is added to the RootLayer of the workspace - in question. If the window has already been added to another screen, this function - will remove it from its old parent and add it to the current one. -*/ -void Screen::AddWindow(ServerWindow *win, int32 workspace) -{ -STRACE_SCREEN(("Screen::AddWindow(%s,%ld)\n",win?win->GetTitle():"NULL", workspace+1)); - if(!win || !win->_winborder) - return; - - Layer *rl=GetRootLayer(workspace); - if(rl) - rl->AddChild(win->_winborder); -} - -/*! - \brief Removes a Window from the desktop - \param win The window to remove - - The window will remove itself from whatever screen it has been added to, or if it has not been - added to the desktop, it will do nothing. -*/ -void Screen::RemoveWindow(ServerWindow *win) -{ -STRACE_SCREEN(("Screen::RemoveWindow(%s)\n",win?win->GetTitle():"NULL")); - if(!win || !win->_winborder) - return; - - win->_winborder->RemoveSelf(); -} -/*! - \brief Returns the WinBorder taht contains the point - \param The point - \return The WinBorder that contains the point -*/ -WinBorder* Screen::GetWindowAt( BPoint pt ){ - WinBorder *wb; - Layer *rl = GetRootLayer(); - Layer *child; - for(child = rl->_bottomchild; child!=NULL; child = child->_uppersibling) - { - if(child->_hidden) - continue; - wb = dynamic_cast(child); - if(wb) - { - BRegion reg; - wb->GetDecorator()->GetFootprint(®); - if(reg.Contains(pt)) - return wb; - } - } - return NULL; -} - -/*! - \brief Returns the active window in the current workspace - \return The active window in the current workspace -*/ -ServerWindow *Screen::ActiveWindow(void) -{ - return _activewin; -} - -/*! - \brief Activates a window on the desktop - \param win The window to activate - - If the given window has not been added to the desktop, it will be automatically added - to the current workspace. If, for some reason, the window belongs to a workspace on - another screen, this function will fail. -*/ -void Screen::SetActiveWindow(ServerWindow *win) -{ - if(win) - { - if(win->GetWorkspace()==NULL) - { - // has not been added to desktop - AddWindowToDesktop(win,win->GetWorkspaceIndex(),_id); - } - Workspace *wksp=win->GetWorkspace(); - if(wksp->GetScreen()!=this) - return; -// set_active_winborder(win->_winborder); - } - else{ -// set_active_winborder(NULL); - } - _activewin=win; -} - -/*! - \brief Returns the RootLayer of the specified workspace - \param workspace The index of the workspace (Default is B_CURRENT_WORKSPACE) - \return The RootLayer object -*/ -Layer *Screen::GetRootLayer(int32 workspace) -{ - return (Layer*)_activeworkspace->GetRoot(); -} - -/*! - \brief Indicates whether the Screen is initialized - \return True if initialized, false if not -*/ -bool Screen::IsInitialized(void) -{ - return _init; -} - -/*! - \brief Returns a pointer to the active Workspace object - \return The active workspace object -*/ -Workspace *Screen::GetActiveWorkspace(void) -{ - return _activeworkspace; -} - -/*! - \brief Returns a pointer to the Workspace at the specified index - \return A pointer to the Workspace at the specified index -*/ -Workspace *Screen::GetWorkspace(int32 index) -{ - if(index==_currentworkspace) - return _activeworkspace; - - return (Workspace*)_workspacelist->ItemAt(index); -} diff --git a/src/servers/app/server/DesktopClasses.h b/src/servers/app/server/DesktopClasses.h deleted file mode 100644 index 7c5131fecc..0000000000 --- a/src/servers/app/server/DesktopClasses.h +++ /dev/null @@ -1,131 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2003, OpenBeOS -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -// File Name: DesktopClasses.h -// Author: DarkWyrm -// Gabe Yoder -// Description: Classes for managing workspaces and screens -// -//------------------------------------------------------------------------------ -#ifndef DESKTOPCLASSES_H -#define DESKTOPCLASSES_H - -#include -#include -#include -#include -#include // for workspace defs - -class DisplayDriver; -class ServerWindow; -class RGBColor; -class Screen; -class WinBorder; -class RootLayer; -class Layer; - -/*! - \class Workspace DesktopClasses.h - \brief Object used to handle all things Workspace related. - - Doesn't actually do a whole lot except to couple some associated data with a - RootLayer. -*/ -typedef struct -{ - int index; - display_timing timing; - color_space space; - int res_w; - int res_h; - int32 flags; - int32 bgcolor; -} as_workspace_data; - -class Workspace -{ -public: - Workspace(const graphics_card_info &gcinfo, const frame_buffer_info &fbinfo, Screen *screen); - Workspace(as_workspace_data *data, Screen *screen); - ~Workspace(void); - void SetBGColor(const RGBColor &c); - RGBColor BGColor(); - RootLayer *GetRoot(void); - void SetData(const graphics_card_info &gcinfo, const frame_buffer_info &fbinfo); - void GetData(graphics_card_info *gcinfo, frame_buffer_info *fbinfo); - void SetSpace(int32 res); - //! Returns the screen to which the workspace belongs - Screen *GetScreen(void) { return _screen; } -protected: - RootLayer *_rootlayer; - graphics_card_info _gcinfo; - frame_buffer_info _fbinfo; - Screen *_screen; -}; - -/*! - \class Screen DesktopClasses.h - \brief Handles each DisplayDriver/video card pair and associated management. - - There is only one per monitor. Manages all workspaces displayed on that - particular monitor and also Window-Desktop management for all workspaces therein. -*/ -class Screen -{ -public: - Screen(DisplayDriver *gfxmodule); - ~Screen(void); - void AddWorkspace(int32 index=-1); - void AddWorkspace(Workspace *workspace,int32 index=-1); - void DeleteWorkspace(int32 index); - int32 CountWorkspaces(void); - void SetWorkspaceCount(int32 count); - int32 CurrentWorkspace(void); - void SetWorkspace(int32 index); - void Activate(bool active=true); - DisplayDriver *GetGfxDriver(void); - status_t SetSpace(int32 index, int32 res,bool stick=true); - void AddWindow(ServerWindow *win, int32 workspace=B_CURRENT_WORKSPACE); - void RemoveWindow(ServerWindow *win); - WinBorder* GetWindowAt( BPoint pt ); - ServerWindow *ActiveWindow(void); - void SetActiveWindow(ServerWindow *win); - Layer* GetRootLayer(int32 workspace=B_CURRENT_WORKSPACE); - bool IsInitialized(void); - Workspace *GetWorkspace(int32 index); - Workspace *GetActiveWorkspace(void); - //! Returns the unique identifier for the screen - screen_id GetID(void) { return _id; } -protected: - int32 _resolution; - ServerWindow *_activewin; - int32 _currentworkspace; - int32 _workspacecount; - BList *_workspacelist; - DisplayDriver *_driver; - bool _init, _active; - Workspace *_activeworkspace; - graphics_card_info _gcinfo; - frame_buffer_info _fbinfo; - screen_id _id; -}; - -#endif diff --git a/src/servers/app/server/ServerApp.cpp b/src/servers/app/server/ServerApp.cpp index c840676cc3..e7f72e5ce3 100644 --- a/src/servers/app/server/ServerApp.cpp +++ b/src/servers/app/server/ServerApp.cpp @@ -559,28 +559,30 @@ void ServerApp::_DispatchMessage(int32 code, BPortLink& msg) } case AS_CREATE_PICTURE: { - // TODO: Implement + // TODO: Implement AS_CREATE_PICTURE STRACE(("ServerApp %s: Create Picture unimplemented\n",fSignature.String())); break; } case AS_DELETE_PICTURE: { - // TODO: Implement + // TODO: Implement AS_DELETE_PICTURE STRACE(("ServerApp %s: Delete Picture unimplemented\n",fSignature.String())); break; } case AS_CLONE_PICTURE: { - // TODO: Implement + // TODO: Implement AS_CLONE_PICTURE STRACE(("ServerApp %s: Clone Picture unimplemented\n",fSignature.String())); break; } case AS_DOWNLOAD_PICTURE: { - // TODO; Implement + // TODO; Implement AS_DOWNLOAD_PICTURE + + // What is this particular function call for, anyway? STRACE(("ServerApp %s: Download Picture unimplemented\n",fSignature.String())); break; diff --git a/src/servers/app/server/ServerWindow.cpp b/src/servers/app/server/ServerWindow.cpp index 64166b7823..378c35c095 100644 --- a/src/servers/app/server/ServerWindow.cpp +++ b/src/servers/app/server/ServerWindow.cpp @@ -341,7 +341,7 @@ void ServerWindow::Hide(void) if (ws->FocusLayer() == fWinBorder) ws->SearchAndSetNewFocus(fWinBorder); else{ - // TODO: RootLayer class should take care of this. (or Desktop) + // TODO: RootLayer or Desktop class should take care of invalidating // ws->Invalidate(); } } @@ -520,8 +520,8 @@ void ServerWindow::SetLayerFontState(Layer *layer) { uint32 fontID; fSession->Read((int32*)&fontID); - // TODO: implement later. Currently there is no SetFamAndStyle(uint32) - // in ServerFont class. DW, could you add one? + + // TODO: Implement. ServerFont::SetFamilyAndStyle(uint32) is needed //layer->fLayerData->font-> } @@ -706,7 +706,7 @@ void ServerWindow::DispatchMessage(int32 code) cl->fDriver->DrawBitmap(®ion, sbmp, src, dst, cl->fLayerData); } - // TODO: Adi -- shouldn't this sync with the client? + // TODO: Adi -- shouldn't AS_LAYER_DRAW_BITMAP_SYNC_AT_POINT sync with the client? break; } case AS_LAYER_DRAW_BITMAP_ASYNC_AT_POINT: @@ -753,7 +753,7 @@ void ServerWindow::DispatchMessage(int32 code) cl->fDriver->DrawBitmap(®ion, sbmp, srcRect, dstRect, cl->fLayerData); } - // TODO: Adi -- shouldn't this sync with the client? + // TODO: Adi -- shouldn't AS_LAYER_DRAW_BITMAP_SYNC_IN_RECT sync with the client? break; } case AS_LAYER_DRAW_BITMAP_ASYNC_IN_RECT: @@ -886,7 +886,7 @@ void ServerWindow::DispatchMessage(int32 code) vc = ld->viewcolor.GetColor32(); patt = ld->patt.GetInt64(); - // TODO: DW implement such a method in ServerFont class! + // TODO: Implement when ServerFont::SetfamilyAndStyle(int32) exists fSession->StartMessage(SERVER_TRUE); // Attach font state @@ -952,8 +952,7 @@ void ServerWindow::DispatchMessage(int32 code) fSession->Read(&newWidth); fSession->Read(&newHeight); - // TODO: check for minimum allowed. WinBorder should provide such - // a method, based on its decorator. + // TODO: Check for minimum size allowed. Need WinBorder::GetSizeLimits cl->ResizeBy(newWidth, newHeight); @@ -1033,10 +1032,7 @@ void ServerWindow::DispatchMessage(int32 code) STRACE(("ServerWindow %s: Message AS_LAYER_SET_LINE_MODE: Layer: %s\n",fTitle.String(), cl->fName->String())); int8 lineCap, lineJoin; - // TODO: DW: Shouldn't we lock before modifying certain memebers? - // Redraw code might use an updated value instead of one for which - // it was called. e.g.: different lineCap or lineJoin. Strange results - // would appear. + // TODO: Look into locking scheme relating to Layers and modifying redraw-related members fSession->Read(&lineCap); fSession->Read(&lineJoin); @@ -1251,7 +1247,7 @@ void ServerWindow::DispatchMessage(int32 code) { STRACE(("ServerWindow %s: Message AS_LAYER_CLIP_TO_PICTURE: Layer: %s\n",fTitle.String(), cl->fName->String())); - // TODO: watch out for the coordinate system + // TODO: Watch out for the coordinate system in AS_LAYER_CLIP_TO_PICTURE int32 pictureToken; BPoint where; @@ -1283,7 +1279,7 @@ void ServerWindow::DispatchMessage(int32 code) { //cl->clipToPicture = sp; - // TODO: increase that picture's reference count.(~ allocate a picture) + // TODO: Increase that picture's reference count.(~ allocate a picture) break; } } @@ -1326,7 +1322,7 @@ void ServerWindow::DispatchMessage(int32 code) { STRACE(("ServerWindow %s: Message AS_LAYER_CLIP_TO_INVERSE_PICTURE: Layer: %s\n",fTitle.String(), cl->fName->String())); - // TODO: watch out for the coordinate system + // TODO: Watch out for the coordinate system in AS_LAYER_CLIP_TO_INVERSE_PICTURE int32 pictureToken; BPoint where; @@ -1346,7 +1342,7 @@ void ServerWindow::DispatchMessage(int32 code) { //cl->clipToPicture = sp; - // TODO: increase that picture's reference count.(~ allocate a picture) + // TODO: Increase that picture's reference count.(~ allocate a picture) break; } } @@ -1365,14 +1361,17 @@ void ServerWindow::DispatchMessage(int32 code) case AS_LAYER_GET_CLIP_REGION: { STRACE(("ServerWindow %s: Message AS_LAYER_GET_CLIP_REGION: Layer: %s\n",fTitle.String(), cl->fName->String())); + // if this Layer is hidden, it is clear that its visible region is void. - if (cl->IsHidden()){ + if (cl->IsHidden()) + { fSession->StartMessage(SERVER_TRUE); fSession->Attach(0L); fSession->Flush(); } - else{ - // TODO: watch out for the coordinate system + else + { + // TODO: Watch out for the coordinate system in AS_LAYER_GET_CLIP_REGION BRegion reg; LayerData *ld; int32 noOfRects; @@ -1401,7 +1400,8 @@ void ServerWindow::DispatchMessage(int32 code) case AS_LAYER_SET_CLIP_REGION: { STRACE(("ServerWindow %s: Message AS_LAYER_SET_CLIP_REGION: Layer: %s\n",fTitle.String(), cl->fName->String())); - // TODO: watch out for the coordinate system + + // TODO: Watch out for the coordinate system in AS_LAYER_SET_CLIP_REGION int32 noOfRects; BRect r; @@ -1432,7 +1432,8 @@ void ServerWindow::DispatchMessage(int32 code) case AS_LAYER_INVAL_RECT: { STRACE(("ServerWindow %s: Message AS_LAYER_INVAL_RECT: Layer: %s\n",fTitle.String(), cl->fName->String())); - // TODO: watch out for the coordinate system + + // TODO: Watch out for the coordinate system in AS_LAYER_INVAL_RECT BRect invalRect; fSession->Read(&invalRect); @@ -1444,7 +1445,8 @@ void ServerWindow::DispatchMessage(int32 code) case AS_LAYER_INVAL_REGION: { STRACE(("ServerWindow %s: Message AS_LAYER_INVAL_RECT: Layer: %s\n",fTitle.String(), cl->fName->String())); - // TODO: watch out for the coordinate system + + // TODO: Watch out for the coordinate system AS_LAYER_INVAL_REGION BRegion invalReg; int32 noOfRects; BRect rect; @@ -1479,7 +1481,7 @@ void ServerWindow::DispatchMessage(int32 code) { // Received when a window deletes its internal top view - // TODO: Implement + // TODO: Implement AS_LAYER_DELETE_ROOT STRACE(("ServerWindow %s: Message Delete_Layer_Root unimplemented\n",fTitle.String())); break; } @@ -1497,31 +1499,31 @@ void ServerWindow::DispatchMessage(int32 code) } case AS_SEND_BEHIND: { - // TODO: Implement + // TODO: Implement AS_SEND_BEHIND STRACE(("ServerWindow %s: Message Send_Behind unimplemented\n",fTitle.String())); break; } case AS_ENABLE_UPDATES: { - // TODO: Implement + // TODO: Implement AS_ENABLE_UPDATES STRACE(("ServerWindow %s: Message Enable_Updates unimplemented\n",fTitle.String())); break; } case AS_DISABLE_UPDATES: { - // TODO: Implement + // TODO: Implement AS_DISABLE_UPDATES STRACE(("ServerWindow %s: Message Disable_Updates unimplemented\n",fTitle.String())); break; } case AS_NEEDS_UPDATE: { - // TODO: Implement + // TODO: Implement AS_NEEDS_UPDATE STRACE(("ServerWindow %s: Message Needs_Update unimplemented\n",fTitle.String())); break; } case AS_WINDOW_TITLE: { - // TODO: Implement + // TODO: Implement AS_WINDOW_TITLE STRACE(("ServerWindow %s: Message Set_Title unimplemented\n",fTitle.String())); break; } @@ -1575,43 +1577,43 @@ void ServerWindow::DispatchMessage(int32 code) } case AS_SET_LOOK: { - // TODO: Implement + // TODO: Implement AS_SET_LOOK STRACE(("ServerWindow %s: Message Set_Look unimplemented\n",fTitle.String())); break; } case AS_SET_FLAGS: { - // TODO: Implement + // TODO: Implement AS_SET_FLAGS STRACE(("ServerWindow %s: Message Set_Flags unimplemented\n",fTitle.String())); break; } case AS_SET_FEEL: { - // TODO: Implement + // TODO: Implement AS_SET_FEEL STRACE(("ServerWindow %s: Message Set_Feel unimplemented\n",fTitle.String())); break; } case AS_SET_ALIGNMENT: { - // TODO: Implement + // TODO: Implement AS_SET_ALIGNMENT STRACE(("ServerWindow %s: Message Set_Alignment unimplemented\n",fTitle.String())); break; } case AS_GET_ALIGNMENT: { - // TODO: Implement + // TODO: Implement AS_GET_ALIGNMENT STRACE(("ServerWindow %s: Message Get_Alignment unimplemented\n",fTitle.String())); break; } case AS_GET_WORKSPACES: { - // TODO: Implement + // TODO: Implement AS_GET_WORKSPACES STRACE(("ServerWindow %s: Message Get_Workspaces unimplemented\n",fTitle.String())); break; } case AS_SET_WORKSPACES: { - // TODO: Implement + // TODO: Implement AS_SET_WORKSPACES STRACE(("ServerWindow %s: Message Set_Workspaces unimplemented\n",fTitle.String())); break; } @@ -1662,19 +1664,19 @@ void ServerWindow::DispatchMessage(int32 code) } case B_MINIMIZE: { - // TODO: Implement + // TODO: Implement B_MINIMIZE STRACE(("ServerWindow %s: Message Minimize unimplemented\n",fTitle.String())); break; } case B_WINDOW_ACTIVATED: { - // TODO: Implement + // TODO: Implement B_WINDOW_ACTIVATED STRACE(("ServerWindow %s: Message Window_Activated unimplemented\n",fTitle.String())); break; } case B_ZOOM: { - // TODO: Implement + // TODO: Implement B_ZOOM STRACE(("ServerWindow %s: Message Zoom unimplemented\n",fTitle.String())); break; } @@ -1708,7 +1710,7 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer) if (IsHidden()) return; - // TODO: fix! + // TODO: fix sibling-related clipping calculations in DispatchGraphicsMessage /* WindowClipRegion.Set(fWinBorder->Frame()); sibling = fWinBorder->UpperSibling(); while (sibling) @@ -1717,6 +1719,7 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer) sibling = sibling->UpperSibling(); } */ + if (!WindowClipRegion.Frame().IsValid()) return; @@ -1728,7 +1731,7 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer) code = read_from_buffer(&msgbuffer); view_token = read_from_buffer(&msgbuffer); - //TODO: fix! + //TODO: fix code to find a layer based on a view token in DispatchGraphicsMessage layer = NULL;//fWorkspace->GetRoot()->FindLayer(view_token); if (layer) @@ -1808,7 +1811,7 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer) } case AS_STROKE_ARC: { - // TODO:: Add clipping + // TODO: Add clipping to AS_STROKE_ARC if (sizeRemaining >= AS_STROKE_ARC_MSG_SIZE) { float left, top, right, bottom, angle, span; @@ -1835,7 +1838,7 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer) } case AS_STROKE_BEZIER: { - // TODO:: Add clipping + // TODO: Add clipping to AS_STROKE_BEZIER if (sizeRemaining >= AS_STROKE_BEZIER_MSG_SIZE) { BPoint *pts; @@ -1862,7 +1865,7 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer) } case AS_STROKE_ELLIPSE: { - // TODO:: Add clipping + // TODO: Add clipping AS_STROKE_ELLIPSE if (sizeRemaining >= AS_STROKE_ELLIPSE_MSG_SIZE) { float left, top, right, bottom; @@ -1886,7 +1889,7 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer) } case AS_STROKE_LINE: { - // TODO:: Add clipping + // TODO: Add clipping TO AS_STROKE_LINE if (sizeRemaining >= AS_STROKE_LINE_MSG_SIZE) { float x1, y1, x2, y2; @@ -1911,17 +1914,17 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer) } case AS_STROKE_LINEARRAY: { - // TODO: Implement + // TODO: Implement AS_STROKE_LINEARRAY break; } case AS_STROKE_POLYGON: { - // TODO: Implement + // TODO: Implement AS_STROKE_POLYGON break; } case AS_STROKE_RECT: { - // TODO:: Add clipping + // TODO: Add clipping TO AS_STROKE_RECT if (sizeRemaining >= AS_STROKE_RECT_MSG_SIZE) { float left, top, right, bottom; @@ -1945,7 +1948,7 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer) } case AS_STROKE_ROUNDRECT: { - // TODO:: Add clipping + // TODO: Add clipping AS_STROKE_ROUNDRECT if (sizeRemaining >= AS_STROKE_ROUNDRECT_MSG_SIZE) { float left, top, right, bottom, xrad, yrad; @@ -1971,12 +1974,12 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer) } case AS_STROKE_SHAPE: { - // TODO: Implement + // TODO: Implement AS_STROKE_SHAPE break; } case AS_STROKE_TRIANGLE: { - // TODO:: Add clipping + // TODO:: Add clipping to AS_STROKE_TRIANGLE if (sizeRemaining >= AS_STROKE_TRIANGLE_MSG_SIZE) { BPoint *pts; @@ -2009,7 +2012,7 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer) } case AS_FILL_ARC: { - // TODO:: Add clipping + // TODO:: Add clipping to AS_FILL_ARC if (sizeRemaining >= AS_FILL_ARC_MSG_SIZE) { float left, top, right, bottom, angle, span; @@ -2035,7 +2038,7 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer) } case AS_FILL_BEZIER: { - // TODO:: Add clipping + // TODO:: Add clipping to AS_FILL_BEZIER if (sizeRemaining >= AS_FILL_BEZIER_MSG_SIZE) { BPoint *pts; @@ -2062,7 +2065,7 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer) } case AS_FILL_ELLIPSE: { - // TODO:: Add clipping + // TODO:: Add clipping to AS_FILL_ELLIPSE if (sizeRemaining >= AS_FILL_ELLIPSE_MSG_SIZE) { float left, top, right, bottom; @@ -2086,7 +2089,7 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer) } case AS_FILL_POLYGON: { - // TODO: Implement + // TODO: Implement AS_FILL_POLYGON break; } case AS_FILL_RECT: @@ -2123,12 +2126,12 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer) } case AS_FILL_REGION: { - // TODO: Implement + // TODO: Implement AS_FILL_REGION break; } case AS_FILL_ROUNDRECT: { - // TODO: Add clipping + // TODO: Add clipping to AS_FILL_ROUNDRECT if (sizeRemaining >= AS_FILL_ROUNDRECT_MSG_SIZE) { float left, top, right, bottom, xrad, yrad; @@ -2154,12 +2157,12 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer) } case AS_FILL_SHAPE: { - // TODO: Implement + // TODO: Implement AS_FILL_SHAPE break; } case AS_FILL_TRIANGLE: { - // TODO:: Add clipping + // TODO: Add clipping to AS_FILL_TRIANGLE if (sizeRemaining >= AS_FILL_TRIANGLE_MSG_SIZE) { BPoint *pts; @@ -2192,32 +2195,32 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer) } case AS_MOVEPENBY: { - // TODO: Implement + // TODO: Implement AS_MOVEPENBY break; } case AS_MOVEPENTO: { - // TODO: Implement + // TODO: Implement AS_MOVEPENTO break; } case AS_SETPENSIZE: { - // TODO: Implement + // TODO: Implement AS_SETPENSIZE break; } case AS_DRAW_STRING: { - // TODO: Implement + // TODO: Implement AS_DRAW_STRING break; } case AS_SET_FONT: { - // TODO: Implement + // TODO: Implement AS_SET_FONT break; } case AS_SET_FONT_SIZE: { - // TODO: Implement + // TODO: Implement AS_SET_FONT_SIZE break; } default: diff --git a/src/servers/app/server/Workspace.cpp b/src/servers/app/server/Workspace.cpp index 849685e9f3..7eb26f0158 100644 --- a/src/servers/app/server/Workspace.cpp +++ b/src/servers/app/server/Workspace.cpp @@ -73,7 +73,7 @@ Workspace::Workspace(const uint32 colorspace, int32 ID, const RGBColor& BGColor) fVirtualWidth=-1; fVirtualHeight=-1; - // TODO: find out more about good default values and init the structure to them + // TODO: find out more about good default values for display timing and init the structure to them fDisplayTiming.pixel_clock=0; fDisplayTiming.h_display=0; fDisplayTiming.h_sync_start=0; @@ -1071,7 +1071,8 @@ void Workspace::SearchAndSetNewFront(WinBorder *preferred) if(fFrontItem != newFrontItem) { fFrontItem = newFrontItem; - // TODO: call a method like... WinBorder::MakeFront(true); + + // TODO: call a method something like WinBorder::MakeFront(true); } STRACE(("#WS(%ld)::SASNF(%s) ENDED! Workspace data...", ID(), preferred? preferred->GetName(): "NULL")); @@ -1154,8 +1155,8 @@ void Workspace::SearchAndSetNewFocus(WinBorder *preferred) if(item != fFocusItem) { - // TODO: item->ColorTabInGrey & send message to client - // TODO: item->ColorTabInYellow & send message to client + // TODO: redraw old item in inactive colors & send message to client + // TODO: redraw new item in active colors & send message to client // TODO: Rebuild & Redraw. fFocusItem = item; } @@ -1360,14 +1361,14 @@ RGBColor Workspace::BGColor(void) const */ void Workspace::GetSettings(const BMessage &msg) { - // TODO: Implement + // TODO: Implement GetSettings } //---------------------------------------------------------------------------------- //! Sets workspace settings to defaults void Workspace::GetDefaultSettings(void) { - // TODO: Implement + // TODO: Implement GetDefaultSettings } //---------------------------------------------------------------------------------- @@ -1390,7 +1391,7 @@ void Workspace::GetDefaultSettings(void) */ void Workspace::PutSettings(BMessage *msg, const int32 &index) const { - // TODO: Implement + // TODO: Implement PutSettings } //---------------------------------------------------------------------------------- @@ -1401,7 +1402,7 @@ void Workspace::PutSettings(BMessage *msg, const int32 &index) const */ void Workspace::PutDefaultSettings(BMessage *msg, const int32 &index) { - // TODO: Implement + // TODO: Implement PutDefaultSettings } //----------------------------------------------------------------------------------