diff --git a/src/servers/app/server/AppServer.cpp b/src/servers/app/server/AppServer.cpp index 19b7ac5c77..465f66bc74 100644 --- a/src/servers/app/server/AppServer.cpp +++ b/src/servers/app/server/AppServer.cpp @@ -30,13 +30,18 @@ #include "DisplayDriver.h" #include "PortLink.h" #include "ServerApp.h" -#include "ServerConfig.h" #include "ServerProtocol.h" #include "ServerWindow.h" #include "DefaultDecorator.h" +#include "RGBColor.h" +// Globals + +//! Used to access the app_server from new_decorator AppServer *app_server=NULL; +//! Default background color for workspaces +RGBColor workspace_default_color(51,102,160); /*! \brief Constructor @@ -44,6 +49,9 @@ AppServer *app_server=NULL; threads, loads user preferences for the UI and decorator, and allocates various locks. */ AppServer::AppServer(void) +#if DISPLAYDRIVER != HWDRIVER + : BApplication (SERVER_SIGNATURE) +#endif { _mouseport=create_port(100,SERVER_INPUT_PORT); _messageport=create_port(100,SERVER_PORT_NAME); @@ -196,9 +204,12 @@ int32 AppServer::PollerThread(void *data) index+=sizeof(float); tempy=*((float*)index); index+=sizeof(float); - - appserver->_driver->MoveCursorTo(tempx,tempy); - ServerWindow::HandleMouseEvent(msgcode,msgbuffer); + + if(appserver->_driver) + { + appserver->_driver->MoveCursorTo(tempx,tempy); + ServerWindow::HandleMouseEvent(msgcode,msgbuffer); + } break; } case B_KEY_DOWN: @@ -259,10 +270,14 @@ int32 AppServer::PicassoThread(void *data) return 0; } -//! The call that starts it all... -void AppServer::Run(void) +/*! + \brief The call that starts it all... + \return Always 0 +*/ +thread_id AppServer::Run(void) { MainLoop(); + return 0; } diff --git a/src/servers/app/server/AppServer.h b/src/servers/app/server/AppServer.h index 6c1aa7cb92..681a3bac8f 100644 --- a/src/servers/app/server/AppServer.h +++ b/src/servers/app/server/AppServer.h @@ -4,8 +4,10 @@ #include #include #include +#include #include #include "Decorator.h" +#include "ServerConfig.h" class Layer; class BMessage; @@ -20,21 +22,24 @@ class DisplayDriver; application start and quit messages. It also starts the housekeeping threads and initializes most of the server's globals. */ +#if DISPLAYDRIVER == HWDRIVER class AppServer +#else +class AppServer : public BApplication +#endif { public: AppServer(void); ~AppServer(void); static int32 PollerThread(void *data); static int32 PicassoThread(void *data); - void Run(void); + thread_id Run(void); void MainLoop(void); bool LoadDecorator(const char *path); void DispatchMessage(int32 code, int8 *buffer); void Broadcast(int32 code); void HandleKeyMessage(int32 code, int8 *buffer); ServerApp *FindApp(const char *sig); - private: friend Decorator *new_decorator(BRect rect, const char *title, int32 wlook, int32 wfeel, int32 wflags, DisplayDriver *ddriver); diff --git a/src/servers/app/server/BitmapManager.cpp b/src/servers/app/server/BitmapManager.cpp index 8b51c15cb9..7edd484962 100644 --- a/src/servers/app/server/BitmapManager.cpp +++ b/src/servers/app/server/BitmapManager.cpp @@ -1,9 +1,29 @@ -/* - BitmapManager: - Handler for allocating and freeing area memory for BBitmaps on the server side. - Utilizes the public domain pool allocator BGET. -*/ - +//------------------------------------------------------------------------------ +// Copyright (c) 2001-2002, 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: BitmapManager.cpp +// Author: DarkWyrm +// Description: Handler for allocating and freeing area memory for BBitmaps +// on the server side. Utilizes the BGET pool allocator. +//------------------------------------------------------------------------------ #include "BitmapManager.h" #include "ServerBitmap.h" #include diff --git a/src/servers/app/server/BitmapManager.h b/src/servers/app/server/BitmapManager.h index dbb88b24d9..adeddb6735 100644 --- a/src/servers/app/server/BitmapManager.h +++ b/src/servers/app/server/BitmapManager.h @@ -1,3 +1,29 @@ +//------------------------------------------------------------------------------ +// Copyright (c) 2001-2002, 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: BitmapManager.h +// Author: DarkWyrm +// Description: Handler for allocating and freeing area memory for BBitmaps +// on the server side. Utilizes the BGET pool allocator. +//------------------------------------------------------------------------------ #ifndef BITMAP_MANAGER_H_ #define BITMAP_MANAGER_H_ diff --git a/src/servers/app/server/DefaultDecorator.cpp b/src/servers/app/server/DefaultDecorator.cpp index 2f7b5d6f25..b5e46e90b6 100644 --- a/src/servers/app/server/DefaultDecorator.cpp +++ b/src/servers/app/server/DefaultDecorator.cpp @@ -1,3 +1,29 @@ +//------------------------------------------------------------------------------ +// Copyright (c) 2001-2002, 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: DefaultDecorator.cpp +// Author: DarkWyrm +// Description: Fallback decorator for the app_server +// +//------------------------------------------------------------------------------ #include "DisplayDriver.h" #include #include "LayerData.h" diff --git a/src/servers/app/server/DefaultDecorator.h b/src/servers/app/server/DefaultDecorator.h index f62c66b272..2c9c0c0174 100644 --- a/src/servers/app/server/DefaultDecorator.h +++ b/src/servers/app/server/DefaultDecorator.h @@ -1,3 +1,29 @@ +//------------------------------------------------------------------------------ +// Copyright (c) 2001-2002, 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: DefaultDecorator.h +// Author: DarkWyrm +// Description: Fallback decorator for the app_server +// +//------------------------------------------------------------------------------ #ifndef _DEFAULT_DECORATOR_H_ #define _DEFAULT_DECORATOR_H_ diff --git a/src/servers/app/server/Desktop.cpp b/src/servers/app/server/Desktop.cpp index 159a42fdcd..13fbf5eb97 100644 --- a/src/servers/app/server/Desktop.cpp +++ b/src/servers/app/server/Desktop.cpp @@ -27,6 +27,7 @@ #include "DisplayDriver.h" #include "Desktop.h" #include "DesktopClasses.h" +#include "ServerConfig.h" #include "ViewDriver.h" @@ -112,7 +113,7 @@ void InitDesktop(void) // TODO: figure out how to load the workspace data and do it here. // For now, we'll just use 3 workspaces. - Screen *s=new Screen(tdriver,3); + s=new Screen(tdriver,3); desktop_private::screenlist->AddItem(s); } else @@ -292,7 +293,7 @@ screen_id ActiveScreen(void) */ DisplayDriver *GetGfxDriver(screen_id screen=B_MAIN_SCREEN_ID) { - return NULL; + return (desktop_private::activescreen)?desktop_private::activescreen->GetGfxDriver():NULL; } /*! diff --git a/src/servers/app/server/DesktopClasses.cpp b/src/servers/app/server/DesktopClasses.cpp index aaf5ec0ed9..a3f4919af2 100644 --- a/src/servers/app/server/DesktopClasses.cpp +++ b/src/servers/app/server/DesktopClasses.cpp @@ -21,17 +21,15 @@ // // File Name: DesktopClasses.cpp // Author: DarkWyrm -// Gabe Yoder -// Description: Implements the Screen class which provides all -// infrastructure for handling a video card/monitor -// pair. -// Implements the Workspace class which provides all -// infrastructure for drawing the screen. +// Gabe Yoder +// Description: Classes for managing workspaces and screens // //------------------------------------------------------------------------------ - #include "DesktopClasses.h" +// Defined and initialized in AppServer.cpp +extern RGBColor workspace_default_color; + /*! \brief Sets up internal variables needed by the Workspace \param gcinfo The graphics card info @@ -42,14 +40,8 @@ Workspace::Workspace(const graphics_card_info &gcinfo, const frame_buffer_info & _gcinfo=gcinfo; _fbinfo=fbinfo; - //TODO: create the root layer here based on gcinfo and fbinfo. - _rootlayer=NULL; - - /* From Docs - 1) Set background color to RGB(51,102,160) -2) Copy frame_buffer_info and graphics_card_info structure values -3) Create a RootLayer object using the values from the two structures - */ + _rootlayer=new RootLayer(BRect(0,0,fbinfo.display_width-1,fbinfo.display_height-1), "Workspace Root"); + _rootlayer->SetColor(workspace_default_color); } /*! @@ -99,13 +91,16 @@ RootLayer *Workspace::GetRoot(void) */ void Workspace::SetData(const graphics_card_info &gcinfo, const frame_buffer_info &fbinfo) { + 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; - /* From Docs: - 1) Copy the two structures to the internal one -2) Resize the RootLayer -3) If the RootLayer was resized larger, Invalidate the new areas -*/ } /*! @@ -126,30 +121,43 @@ void Workspace::GetData(graphics_card_info *gcinfo, frame_buffer_info *fbinfo) */ Screen::Screen(DisplayDriver *gfxmodule, uint8 workspaces) { - int i; - _workspacelist=NULL; + _driver=gfxmodule; _resolution=0; _activewin=NULL; _currentworkspace=-1; _activeworkspace=NULL; _workspacecount=0; _init=false; - _driver = gfxmodule; + _active=false; - if ( _driver && _driver->Initialize() ) + if (_driver) { - _init = true; - /* TODO: Get approriate display driver info and record it - in _gcinfo and _fbinfo - */ + _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=0; + _fbinfo.display_y=0; + + // right now, we won't do anything with the gcinfo structure. ** LAZY PROGRAMMER ALERT ** :P _workspacelist = new BList(workspaces); _workspacecount = workspaces; - for (i=0; iAddItem(new Workspace(_gcinfo,_fbinfo)); } + _resolution=_driver->GetMode(); + _currentworkspace=0; + _activeworkspace=(Workspace*)_workspacelist->ItemAt(0); + _workspacecount=workspaces; + _activeworkspace->GetRoot()->Show(); + _activeworkspace->GetRoot()->RequestDraw(); } } @@ -249,11 +257,12 @@ void Screen::SetWorkspace(int32 index) } /*! - \brief Activates the Screen - \param active (Defaults to true) + \brief Changes the active status of the screen + \param active Flag - should the screen be active? */ void Screen::Activate(bool active) { + _active=active; } /*! @@ -266,11 +275,11 @@ DisplayDriver *Screen::GetGfxDriver(void) } /*! - \brief - \param index - \param res - \param stick (Default is true) - \return + \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) { @@ -278,25 +287,36 @@ status_t Screen::SetSpace(int32 index, int32 res,bool stick) } /*! - \brief - \param win - \param workspace (Default is B_CURRENT_WORKSPACE) + \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) { + if(!win) + return; } /*! - \brief - \param win + \brief Removes a Window from the desktop + \param win The window to remove + + If the window does not belong to this screen or has not been added to the desktop, + this function will fail. */ void Screen::RemoveWindow(ServerWindow *win) { + if(!win) + return; } /*! - \brief - \return + \brief Returns the active window in the current workspace + \return The active window in the current workspace */ ServerWindow *Screen::ActiveWindow(void) { @@ -304,11 +324,16 @@ ServerWindow *Screen::ActiveWindow(void) } /*! - \brief - \param win + \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) { + } /*! diff --git a/src/servers/app/server/DesktopClasses.h b/src/servers/app/server/DesktopClasses.h index a22f5844b9..ea543fd402 100644 --- a/src/servers/app/server/DesktopClasses.h +++ b/src/servers/app/server/DesktopClasses.h @@ -21,15 +21,10 @@ // // File Name: DesktopClasses.h // Author: DarkWyrm -// Gabe Yoder -// Description: Implements the Screen class which provides all -// infrastructure for handling a video card/monitor -// pair. -// Implements the Workspace class which provides all -// infrastructure for drawing the screen. +// Gabe Yoder +// Description: Classes for managing workspaces and screens // //------------------------------------------------------------------------------ - #ifndef DESKTOPCLASSES_H #define DESKTOPCLASSES_H @@ -88,7 +83,7 @@ protected: int32 _workspacecount; BList *_workspacelist; DisplayDriver *_driver; - bool _init; + bool _init, _active; Workspace *_activeworkspace; graphics_card_info _gcinfo; frame_buffer_info _fbinfo; diff --git a/src/servers/app/server/DisplayDriver.cpp b/src/servers/app/server/DisplayDriver.cpp index c8a41cb1da..7ac2af66b1 100644 --- a/src/servers/app/server/DisplayDriver.cpp +++ b/src/servers/app/server/DisplayDriver.cpp @@ -608,6 +608,15 @@ uint16 DisplayDriver::GetWidth(void) return _buffer_width; } +/*! + \brief Returns the number of bytes used in each row of the frame buffer + \return The number of bytes used in each row of the frame buffer +*/ +uint32 DisplayDriver::GetBytesPerRow(void) +{ + return _bytes_per_row; +} + /*! \brief Returns the screen mode constant in use by the driver \return Current screen mode @@ -699,6 +708,19 @@ void DisplayDriver::_SetMode(int32 m) _buffer_mode=m; } +/*! + \brief Internal row size-setting function + \param bpr Number of bytes per row in the frame buffer + + _SetBytesPerRow must be called from within any implementation of SetMode. Note that this + does not actually change the size of the row; it just updates the state variable used + to talk with the outside world. +*/ +void DisplayDriver::_SetBytesPerRow(uint32 bpr) +{ + _bytes_per_row=bpr; +} + /*! \brief Obtains the current cursor for the driver. \return Pointer to the current cursor object. diff --git a/src/servers/app/server/DisplayDriver.h b/src/servers/app/server/DisplayDriver.h index f4ee82b4ae..de13755f2a 100644 --- a/src/servers/app/server/DisplayDriver.h +++ b/src/servers/app/server/DisplayDriver.h @@ -145,6 +145,7 @@ public: uint8 GetDepth(void); uint16 GetHeight(void); uint16 GetWidth(void); + uint32 GetBytesPerRow(void); int32 GetMode(void); bool IsCursorObscured(bool state); @@ -155,6 +156,7 @@ protected: void _SetHeight(uint16 h); void _SetWidth(uint16 w); void _SetMode(int32 m); + void _SetBytesPerRow(uint32 bpr); ServerCursor *_GetCursor(void); private: @@ -163,6 +165,7 @@ private: uint16 _buffer_width; uint16 _buffer_height; int32 _buffer_mode; + uint32 _bytes_per_row; bool _is_cursor_hidden; bool _is_cursor_obscured; ServerCursor *_cursor; diff --git a/src/servers/app/server/Layer.cpp b/src/servers/app/server/Layer.cpp index a5e0b7883a..dee753579f 100644 --- a/src/servers/app/server/Layer.cpp +++ b/src/servers/app/server/Layer.cpp @@ -463,6 +463,11 @@ void Layer::RequestDraw(const BRect &r) */ } +void Layer::RequestDraw(void) +{ + RequestDraw(Bounds()); +} + /*! \brief Determines whether the layer needs to be redrawn \return True if the layer needs to be redrawn, false if not diff --git a/src/servers/app/server/Layer.h b/src/servers/app/server/Layer.h index 34aab1ae2a..427672fef4 100644 --- a/src/servers/app/server/Layer.h +++ b/src/servers/app/server/Layer.h @@ -69,7 +69,8 @@ public: void Invalidate(BRect rect); void Invalidate(BRegion region); void RebuildRegions(bool include_children=true); - void RequestDraw(const BRect &r); + virtual void RequestDraw(const BRect &r); + virtual void RequestDraw(void); bool IsDirty(void) const; void Show(void); diff --git a/src/servers/app/server/RootLayer.cpp b/src/servers/app/server/RootLayer.cpp index 3f0ab39ee1..86147f1b6c 100644 --- a/src/servers/app/server/RootLayer.cpp +++ b/src/servers/app/server/RootLayer.cpp @@ -21,11 +21,10 @@ // // File Name: RootLayer.cpp // Author: Gabe Yoder -// DarkWyrm -// Description: Implements the RootLayer class +// DarkWyrm +// Description: Class used for the top layer of each workspace's Layer tree // //------------------------------------------------------------------------------ - #include #include "RootLayer.h" #include "Desktop.h" @@ -39,6 +38,8 @@ RootLayer::RootLayer(BRect rect, const char *layername) : Layer(rect,layername,B_FOLLOW_NONE,0, NULL) { _driver=GetGfxDriver(); + _invalid=new BRegion(Bounds()); + _is_dirty=true; } /*! @@ -65,7 +66,7 @@ void RootLayer::RequestDraw(const BRect &r) */ void RootLayer::RequestDraw(void) { - if(!_invalid) + if(!_is_dirty) return; // Redraw the base @@ -108,20 +109,46 @@ RGBColor RootLayer::GetColor(void) const return _layerdata->lowcolor; } -/*! - \brief Empty function to disable moving the RootLayer -*/ +//! Empty function to disable moving the RootLayer void RootLayer::MoveBy(float x, float y) { } -/*! - \brief Empty function to disable moving the RootLayer -*/ +//! Empty function to disable moving the RootLayer void RootLayer::MoveBy(BPoint pt) { } +//! Reimplemented for RootLayer special case +void RootLayer::ResizeBy(float x, float y) +{ + BRect oldframe=_frame; + _frame.right+=x; + _frame.bottom+=y; + + // We'll need to rebuild the regions of the child layers + // because resizing will affect the visible regions + RebuildRegions(true); + + // If we've gotten bigger, we'll need to repaint the new areas + if(x>0) + { + BRect dx(oldframe.right,oldframe.top, _frame.right, _frame.bottom); + Invalidate(dx); + } + if(y>0) + { + BRect dy(oldframe.left,oldframe.bottom, _frame.right, _frame.bottom); + Invalidate(dy); + } +} + +//! Reimplemented for RootLayer special case +void RootLayer::ResizeBy(BPoint pt) +{ + ResizeBy(pt.x,pt.y); +} + /*! \brief Assigns a particular display driver to the RootLayer \param d The new display driver (ignored if NULL) diff --git a/src/servers/app/server/RootLayer.h b/src/servers/app/server/RootLayer.h index b2a9789d8c..8f445f0db8 100644 --- a/src/servers/app/server/RootLayer.h +++ b/src/servers/app/server/RootLayer.h @@ -21,8 +21,8 @@ // // File Name: RootLayer.h // Author: Gabe Yoder -// DarkWyrm -// Description: Implements the RootLayer class +// DarkWyrm +// Description: Class used for the top layer of each workspace's Layer tree // //------------------------------------------------------------------------------ #ifndef _ROOTLAYER_H_ @@ -40,6 +40,8 @@ public: void RequestDraw(const BRect &r); void MoveBy(float x, float y); void MoveBy(BPoint pt); + void ResizeBy(float x, float y); + void ResizeBy(BPoint pt); void SetDriver(DisplayDriver *driver); void SetColor(const RGBColor &col); RGBColor GetColor(void) const; diff --git a/src/servers/app/server/ScreenDriver.cpp b/src/servers/app/server/ScreenDriver.cpp index 7d7109905f..31329fc985 100644 --- a/src/servers/app/server/ScreenDriver.cpp +++ b/src/servers/app/server/ScreenDriver.cpp @@ -21,6 +21,7 @@ // // File Name: ScreenDriver.cpp // Author: DarkWyrm +// Gabe Yoder // Description: BWindowScreen graphics module // //------------------------------------------------------------------------------ @@ -1220,12 +1221,12 @@ void ScreenDriver::SetPixelPattern(int x, int y, uint8 *pattern, uint8 patternin if(fbuffer->IsConnected()) { - uint64 *p64=(uint64*)pattern; +// uint64 *p64=(uint64*)pattern; // check for transparency in mask. If transparent, we can quit here - bool transparent_bit= - ( *p64 & ~((uint64)2 << (32-patternindex)))?true:false; +// bool transparent_bit= +// ( *p64 & ~((uint64)2 << (32-patternindex)))?true:false; // bool highcolor_bit= // ( *p64 & ~((uint64)2 << (64-patternindex)))?true:false; diff --git a/src/servers/app/server/ScreenDriver.h b/src/servers/app/server/ScreenDriver.h index 03ed251d44..1cd82c460f 100644 --- a/src/servers/app/server/ScreenDriver.h +++ b/src/servers/app/server/ScreenDriver.h @@ -21,6 +21,7 @@ // // File Name: ScreenDriver.h // Author: DarkWyrm +// Gabe Yoder // Description: BWindowScreen graphics module // //------------------------------------------------------------------------------ diff --git a/src/servers/app/server/ServerConfig.h b/src/servers/app/server/ServerConfig.h index caab04d35d..ed50fb8ebb 100644 --- a/src/servers/app/server/ServerConfig.h +++ b/src/servers/app/server/ServerConfig.h @@ -27,6 +27,10 @@ // Comment this out if DISPLAYDRIVER is defined as HWDRIVER. #define ENABLE_INPUT_SERVER_EMULATION +// This is the application signature of our app_server when running as a +// regular application. When running as the app_server, this is not used. +#define SERVER_SIGNATURE "application/x-vnd.obe-OBAppServer" + // Server port names. The input port is the port which is used to receive // input messages from the Input Server. The other is the "main" port for // the server and is utilized mostly by BApplication objects. diff --git a/src/servers/app/server/TokenHandler.cpp b/src/servers/app/server/TokenHandler.cpp index e1b0d66018..577769d256 100644 --- a/src/servers/app/server/TokenHandler.cpp +++ b/src/servers/app/server/TokenHandler.cpp @@ -30,8 +30,6 @@ TokenHandler::TokenHandler(void) { _index=-1; - _lock=create_sem(1,"tokenhandler_sem"); - _excludes=new BList(0); } @@ -39,7 +37,6 @@ TokenHandler::TokenHandler(void) TokenHandler::~TokenHandler(void) { ResetExcludes(); - delete_sem(_lock); delete _excludes; } @@ -53,13 +50,13 @@ int32 TokenHandler::GetToken(void) { int32 value; - acquire_sem(_lock); + _lock.Lock(); _index++; while(IsExclude(_index)) _index++; value=_index; - release_sem(_lock); + _lock.Unlock(); return value; } @@ -70,25 +67,25 @@ int32 TokenHandler::GetToken(void) */ void TokenHandler::ExcludeValue(int32 value) { - acquire_sem(_lock); + _lock.Lock(); if(!IsExclude(value)) _excludes->AddItem(new int32(value)); - release_sem(_lock); + _lock.Unlock(); } //! Resets the token index void TokenHandler::Reset(void) { - acquire_sem(_lock); + _lock.Lock(); _index=-1; - release_sem(_lock); + _lock.Unlock(); } //! Empties object of all assigned excluded values void TokenHandler::ResetExcludes(void) { - acquire_sem(_lock); + _lock.Lock(); int32 *temp; for(int32 i=0; i<_excludes->CountItems();i++) { @@ -97,7 +94,7 @@ void TokenHandler::ResetExcludes(void) delete temp; } _excludes->MakeEmpty(); - release_sem(_lock); + _lock.Unlock(); } /*! @@ -110,7 +107,7 @@ bool TokenHandler::IsExclude(int32 value) bool match=false; int32 *temp; - acquire_sem(_lock); + _lock.Lock(); for(int32 i=0;i<_excludes->CountItems();i++) { temp=(int32*)_excludes->ItemAt(i); @@ -120,6 +117,6 @@ bool TokenHandler::IsExclude(int32 value) break; } } - delete_sem(_lock); + _lock.Unlock(); return match; } diff --git a/src/servers/app/server/TokenHandler.h b/src/servers/app/server/TokenHandler.h index 5ad093577c..c7904a7dfd 100644 --- a/src/servers/app/server/TokenHandler.h +++ b/src/servers/app/server/TokenHandler.h @@ -29,6 +29,7 @@ #include #include +#include /*! \class TokenHandler TokenHandler.h @@ -46,7 +47,7 @@ public: bool IsExclude(int32 value); private: int32 _index; - sem_id _lock; + BLocker _lock; BList *_excludes; }; diff --git a/src/servers/app/server/ViewDriver.cpp b/src/servers/app/server/ViewDriver.cpp index bd734df1a3..b28f394052 100644 --- a/src/servers/app/server/ViewDriver.cpp +++ b/src/servers/app/server/ViewDriver.cpp @@ -24,6 +24,9 @@ // Description: BView/BWindow combination graphics module // //------------------------------------------------------------------------------ + +// TODO: Update this to have GetMode, GetWidth, etc return the proper values + #include #include #include @@ -202,7 +205,7 @@ void VDView::MouseUp(BPoint pt) } VDWindow::VDWindow(void) - : BWindow(BRect(100,60,740,540),"OBOS App Server, P7",B_TITLED_WINDOW, + : BWindow(BRect(100,60,740,540),"OpenBeOS App Server",B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE) { view=new VDView(Bounds()); diff --git a/src/servers/app/server/WinBorder.cpp b/src/servers/app/server/WinBorder.cpp index 46149b8d60..68314754d5 100644 --- a/src/servers/app/server/WinBorder.cpp +++ b/src/servers/app/server/WinBorder.cpp @@ -1,3 +1,29 @@ +//------------------------------------------------------------------------------ +// Copyright (c) 2001-2002, 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: WinBorder.cpp +// Author: DarkWyrm +// Description: Layer subclass which handles window management +// +//------------------------------------------------------------------------------ #include #include #include @@ -266,6 +292,10 @@ void WinBorder::Draw(BRect update_rect) */ } +void WinBorder::RequestDraw(const BRect &r) +{ +} + void WinBorder::RequestDraw(void) { /* diff --git a/src/servers/app/server/WinBorder.h b/src/servers/app/server/WinBorder.h index f6443e5301..aa61612f71 100644 --- a/src/servers/app/server/WinBorder.h +++ b/src/servers/app/server/WinBorder.h @@ -1,3 +1,29 @@ +//------------------------------------------------------------------------------ +// Copyright (c) 2001-2002, 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: WinBorder.h +// Author: DarkWyrm +// Description: Layer subclass which handles window management +// +//------------------------------------------------------------------------------ #ifndef _WINBORDER_H_ #define _WINBORDER_H_ @@ -15,6 +41,7 @@ public: WinBorder(BRect r, const char *name, int32 resize, int32 flags, ServerWindow *win); ~WinBorder(void); void RequestDraw(void); + void RequestDraw(const BRect &r); void MoveBy(BPoint pt); void MoveBy(float x, float y); void ResizeBy(BPoint pt); diff --git a/src/servers/app/server/areafunc.c b/src/servers/app/server/areafunc.c index 556bbb84d4..7414af323a 100644 --- a/src/servers/app/server/areafunc.c +++ b/src/servers/app/server/areafunc.c @@ -1,3 +1,29 @@ +/*------------------------------------------------------------------------------ +// Copyright (c) 2001-2002, 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: areafunc.c +// Author: DarkWyrm +// Description: C functions for interfacing with the BGET pool allocator +// +//------------------------------------------------------------------------------*/ #include #include "bget.h" #include diff --git a/src/servers/app/server/bget.c b/src/servers/app/server/bget.c index 15d3b25912..ac782410ca 100644 --- a/src/servers/app/server/bget.c +++ b/src/servers/app/server/bget.c @@ -1,3 +1,30 @@ +/*------------------------------------------------------------------------------ +// Copyright (c) 2001-2002, 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: bget.c +// Author: John Walker +// Description: BGET pool allocator. Originally released into public domain. +// Distributed with OpenBeOS under MIT license +// +//------------------------------------------------------------------------------*/ /*#define DoTestProg 1*/ /* defined if not used as a library */ #define NDEBUG #define TestProg 20000 /* Generate built-in test program