diff --git a/src/servers/app/AppServer.cpp b/src/servers/app/AppServer.cpp index 567ee08c8f..430b322324 100644 --- a/src/servers/app/AppServer.cpp +++ b/src/servers/app/AppServer.cpp @@ -1,29 +1,9 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2005, Haiku, Inc. -// -// 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: AppServer.cpp -// Author: DarkWyrm -// Description: main manager object for the app_server -// -//------------------------------------------------------------------------------ +/* + * Copyright (c) 2001-2005, Haiku, Inc. + * Distributed under the terms of the MIT license. + * + * Author: DarkWyrm + */ #include #include #include @@ -38,6 +18,7 @@ #include "BitmapManager.h" #include "ColorSet.h" #include "CursorManager.h" +#include "DecorManager.h" #include "DefaultDecorator.h" #include "Desktop.h" #include "DisplayDriver.h" @@ -76,8 +57,7 @@ Desktop *gDesktop; port_id gAppServerPort; -//! Used to access the app_server from new_decorator -static AppServer *sAppServer = NULL; +static AppServer *sAppServer; //! Default background color for workspaces //RGBColor workspace_default_color(51,102,160); @@ -114,11 +94,8 @@ AppServer::AppServer(void) : fAppList = new BList(); fQuittingServer = false; - make_decorator = NULL; - - // We need this in order for new_decorator to be able to instantiate new decorators sAppServer = this; - + // Create the font server and scan the proper directories. fontserver = new FontServer; fontserver->Lock(); @@ -178,8 +155,6 @@ AppServer::AppServer(void) : if (LoadColorSet(SERVER_SETTINGS_DIR COLOR_SETTINGS_NAME,&gui_colorset)!=B_OK) gui_colorset.SetToDefaults(); - InitDecorators(); - // Set up the Desktop gDesktop = new Desktop(); gDesktop->Init(); @@ -196,16 +171,11 @@ AppServer::AppServer(void) : // This locker is for app_server and Picasso to vy for control of the ServerApp list fAppListLock = create_sem(1,"app_server_applist_sem"); - // This locker is to mediate access to the make_decorator pointer - fDecoratorLock = create_sem(1,"app_server_decor_sem"); - // Spawn our thread-monitoring thread fPicassoThreadID = spawn_thread(PicassoThread, "picasso", B_NORMAL_PRIORITY, this); if (fPicassoThreadID >= 0) resume_thread(fPicassoThreadID); - fDecoratorName ="Default"; - #if 0 LaunchCursorThread(); #endif @@ -430,92 +400,6 @@ AppServer::MainLoop(void) } } -/*! - \brief Loads the specified decorator and sets the system's decorator to it. - \param path Path to the decorator to load - \return True if successful, false if not. - - If the server cannot load the specified decorator, nothing changes. Passing a - NULL string to this function sets the decorator to the internal one. -*/ -bool -AppServer::LoadDecorator(const char *path) -{ - // Loads a window decorator based on the supplied path and forces a decorator update. - // If it cannot load the specified decorator, it will retain the current one and - // return false. Note that passing a NULL string to this function sets the decorator - // to the internal one. - - // passing the string "Default" will set the window decorator to the app_server's - // internal one - if(!path) - { - make_decorator= NULL; - return true; - } - - create_decorator *pcreatefunc= NULL; - status_t stat; - image_id addon; - - addon = load_add_on(path); - if (addon < B_OK) - return false; - - // As of now, we do nothing with decorator versions, but the possibility exists - // that the API will change even though I cannot forsee any reason to do so. If - // we *did* do anything with decorator versions, the assignment to a global would - // go here. - - // Get the instantiation function - stat = get_image_symbol(addon, "instantiate_decorator", - B_SYMBOL_TYPE_TEXT, (void**)&pcreatefunc); - if (stat != B_OK) { - unload_add_on(addon); - return false; - } - - BPath temppath(path); - fDecoratorName=temppath.Leaf(); - - acquire_sem(fDecoratorLock); - make_decorator=pcreatefunc; - fDecoratorID=addon; - release_sem(fDecoratorLock); - return true; -} - -//! Loads decorator settings on disk or the default if settings are invalid -void -AppServer::InitDecorators(void) -{ - BMessage settings; - - BDirectory dir; - if (dir.SetTo(SERVER_SETTINGS_DIR) == B_ENTRY_NOT_FOUND) - create_directory(SERVER_SETTINGS_DIR, 0777); - - BString path(SERVER_SETTINGS_DIR); - path += "DecoratorSettings"; - BFile file(path.String(), B_READ_ONLY); - - if (file.InitCheck() == B_OK - && settings.Unflatten(&file) == B_OK) { - BString itemtext; - if (settings.FindString("decorator", &itemtext) == B_OK) { - path.SetTo(DECORATORS_DIR); - path += itemtext; - if (LoadDecorator(path.String())) - return; - } - } - - // We got this far, so something must have gone wrong. We set make_decorator - // to NULL so that the decorator allocation routine knows to utilize the included - // default decorator instead of an addon. - make_decorator = NULL; -} - /*! \brief Message handling function for all messages sent to the app_server \param code ID of the message sent @@ -650,73 +534,6 @@ AppServer::DispatchMessage(int32 code, BPrivate::PortLink &msg) break; } - case AS_SET_DECORATOR: - { - // Received from an application when the user wants to set the window - // decorator to a new one - - // Attached Data: - // char * name of the decorator in the decorators path to use - - char *decname=NULL; - msg.ReadString(&decname); - if (decname) { - if (strcmp(decname, "Default") != 0) { - BString decpath; - decpath.SetTo(DECORATORS_DIR); - decpath += decname; - if (LoadDecorator(decpath.String())) - Broadcast(AS_UPDATE_DECORATOR); - } else { - LoadDecorator(NULL); - Broadcast(AS_UPDATE_DECORATOR); - } - } - free(decname); - break; - } - case AS_GET_DECORATOR: - { - // Attached Data: - // 1) port_id reply port - - port_id replyport = -1; - if (msg.Read(&replyport)(&decindex)CountItems(); i++) { - ServerApp *app = (ServerApp *)fAppList->ItemAt(i); - - if (!app) - { printf("PANIC in AppServer::Broadcast()\n"); continue; } - app->PostMessage(code); - } - - release_sem(fAppListLock); -} - /*! \brief Finds the application with the given signature \param sig MIME signature of the application to find @@ -844,41 +639,30 @@ AppServer::FindApp(const char *sig) return NULL; } +/*! + \brief Send a quick (no attachments) message to all applications + + Quite useful for notification for things like server shutdown, system + color changes, etc. +*/ +void +BroadcastToAllApps(const int32 &code) +{ + acquire_sem(sAppServer->fAppListLock); + + for (int32 i = 0; i < sAppServer->fAppList->CountItems(); i++) { + ServerApp *app = (ServerApp *)sAppServer->fAppList->ItemAt(i); + + if (!app) + { printf("PANIC in Broadcast()\n"); continue; } + app->PostMessage(code); + } + + release_sem(sAppServer->fAppListLock); +} // #pragma mark - - -/*! - \brief Creates a new decorator instance - \param rect Frame size - \param title Title string for the "window" - \param wlook Window look type. See Window.h - \param wfeel Window feel type. See Window.h - \param wflags Window flags. See Window.h - - If a decorator has not been set, we use the default one packaged in with the app_server - being that we can't do anything with a window without one. -*/ -Decorator * -new_decorator(BRect rect, const char *title, int32 wlook, int32 wfeel, - int32 wflags, DisplayDriver *ddriver) -{ - Decorator *dec=NULL; - - if (!sAppServer->make_decorator) - dec = new DefaultDecorator(rect, wlook, wfeel, wflags); - else - dec = sAppServer->make_decorator(rect, wlook, wfeel, wflags); - - gui_colorset.Lock(); - dec->SetDriver(ddriver); - dec->SetColors(gui_colorset); - dec->SetTitle(title); - gui_colorset.Unlock(); - - return dec; -} - /*! \brief Entry function to run the entire server \param argc Number of command-line arguments present diff --git a/src/servers/app/AppServer.h b/src/servers/app/AppServer.h index 8168365ea3..7e1cf96222 100644 --- a/src/servers/app/AppServer.h +++ b/src/servers/app/AppServer.h @@ -13,7 +13,7 @@ #include #include #include -#include "Decorator.h" + #include "ServerConfig.h" class Layer; @@ -22,6 +22,8 @@ class ServerApp; class DisplayDriver; class CursorManager; class BitmapManager; +class DecorManager; +class ColorSet; namespace BPrivate { class PortLink; @@ -42,64 +44,48 @@ class AppServer #endif { public: - AppServer(void); - ~AppServer(void); + AppServer(void); + ~AppServer(void); - static int32 PollerThread(void *data); - static int32 PicassoThread(void *data); - thread_id Run(void); - void MainLoop(void); + static int32 PollerThread(void *data); + static int32 PicassoThread(void *data); + thread_id Run(void); + void MainLoop(void); - bool LoadDecorator(const char *path); - void InitDecorators(void); - - void DispatchMessage(int32 code, BPrivate::PortLink &link); - void Broadcast(int32 code); - - ServerApp* FindApp(const char *sig); + void DispatchMessage(int32 code, BPrivate::PortLink &link); + ServerApp* FindApp(const char *sig); private: - void LaunchCursorThread(); - void LaunchInputServer(); - static int32 CursorThread(void *data); + friend void BroadcastToAllApps(const int32 &code); + + void LaunchCursorThread(); + void LaunchInputServer(); + static int32 CursorThread(void *data); - friend Decorator* new_decorator(BRect rect, const char *title, - int32 wlook, int32 wfeel, int32 wflags, DisplayDriver *ddriver); + port_id fMessagePort; + port_id fServerInputPort; + + volatile bool fQuittingServer; + + BList *fAppList; + thread_id fPicassoThreadID; - // global function pointer - create_decorator *make_decorator; - - port_id fMessagePort; - port_id fServerInputPort; - - image_id fDecoratorID; - - BString fDecoratorName; - - volatile bool fQuittingServer; - - BList *fAppList; - thread_id fPicassoThreadID; + thread_id fISThreadID; + thread_id fCursorThreadID; + sem_id fCursorSem; + area_id fCursorArea; + uint32 *fCursorAddr; - thread_id fISThreadID; - thread_id fCursorThreadID; - sem_id fCursorSem; - area_id fCursorArea; - uint32 *fCursorAddr; - - port_id fISASPort; - port_id fISPort; + port_id fISASPort; + port_id fISPort; - sem_id fActiveAppLock, - fAppListLock, - fDecoratorLock; + sem_id fActiveAppLock; + sem_id fAppListLock; + sem_id fDecoratorLock; - DisplayDriver *fDriver; + DisplayDriver *fDriver; }; -Decorator *new_decorator(BRect rect, const char *title, int32 wlook, int32 wfeel, - int32 wflags, DisplayDriver *ddriver); - extern BitmapManager *bitmapmanager; extern ColorSet gui_colorset; extern AppServer *app_server; diff --git a/src/servers/app/DecorManager.cpp b/src/servers/app/DecorManager.cpp new file mode 100644 index 0000000000..90fdf14b54 --- /dev/null +++ b/src/servers/app/DecorManager.cpp @@ -0,0 +1,285 @@ +/* + * Copyright (c) 2001-2005, Haiku, Inc. + * Distributed under the terms of the MIT license. + * + * Author: DarkWyrm + */ + +#include +#include +#include +#include +#include + +#include "ColorSet.h" +#include "DefaultDecorator.h" +#include "ServerConfig.h" +#include "DecorManager.h" + +// Globals +DecorManager gDecorManager; + +extern ColorSet gui_colorset; + +Decorator* create_default_decorator(BRect rect, int32 wlook, int32 wfeel, + int32 wflags); + +// This is a class used only by the DecorManager to track all the decorators in memory +class DecorInfo +{ +public: + DecorInfo(const image_id &id, const char *name, + create_decorator *alloc); + ~DecorInfo(void); + image_id GetID(void) const { return fID; } + const char * GetName(void) const { return fName.String(); } + Decorator * Instantiate(BRect rect, const char *title, + int32 wlook, int32 wfeel, + int32 wflags, DisplayDriver *ddriver); +private: + + image_id fID; + BString fName; + create_decorator *fAllocator; +}; + +DecorInfo::DecorInfo(const image_id &id, const char *name, create_decorator *alloc) + : fID(id), + fName(name), + fAllocator(alloc) +{ +} + +DecorInfo::~DecorInfo(void) +{ + // Do nothing. Normal programming practice would say that one should unload + // the object's associate image_id. However, there is some funkiness with + // the R5 kernel in which addons aren't unloaded when unload_add_on() is + // called -- perhaps it's lazy unloading or something. In any event, it + // causes crashes which are *extremely* hard to track down to this. + + // Considering the usage of DecorInfo and DecorManager, we can live with + // this because the app_server will not the DecorManager is freed only + // when the app_server quits. It's not pretty, but it gets the job done. +} + +Decorator * +DecorInfo::Instantiate(BRect rect, const char *title, int32 wlook, int32 wfeel, + int32 wflags, DisplayDriver *ddriver) +{ + Decorator *dec = fAllocator(rect, wlook, wfeel, wflags); + + dec->SetDriver(ddriver); + + gui_colorset.Lock(); + dec->SetColors(gui_colorset); + gui_colorset.Unlock(); + + dec->SetTitle(title); + + return dec; +} + +DecorManager::DecorManager(void) + : fDecorList(0), + fCurrentDecor(NULL) +{ + // Start with the default decorator - index is always 0 + DecorInfo *defaultDecor = new DecorInfo(-1, "Default", create_default_decorator); + fDecorList.AddItem( defaultDecor ); + + // Add any on disk + RescanDecorators(); + + // Find out which one should be the active one + BDirectory dir; + if (dir.SetTo(SERVER_SETTINGS_DIR) == B_ENTRY_NOT_FOUND) + create_directory(SERVER_SETTINGS_DIR, 0777); + + BMessage settings; + BFile file(SERVER_SETTINGS_DIR "decorator_settings", B_READ_ONLY); + + // Fallback to the default decorator if something goes wrong + if (file.InitCheck() == B_OK && settings.Unflatten(&file) == B_OK) + { + BString itemtext; + if( settings.FindString("decorator", &itemtext) == B_OK ) + { + fCurrentDecor = FindDecor(itemtext.String()); + } + } + + if(!fCurrentDecor) + fCurrentDecor = (DecorInfo*) fDecorList.ItemAt(0L); +} + +DecorManager::~DecorManager(void) +{ + EmptyList(); +} + +void +DecorManager::RescanDecorators(void) +{ + BDirectory dir(DECORATORS_DIR); + + if(dir.InitCheck() != B_OK) + return; + + entry_ref ref; + BString fullpath; + + while(dir.GetNextRef(&ref)==B_OK) + { + fullpath = DECORATORS_DIR; + fullpath += ref.name; + + // Because this function is used for both initialization and for keeping + // the list up to date, check for existence in the list. Note that we + // do not check to see if a decorator has been removed. This is for + // stability. If there is a decorator in memory already whose file has + // been deleted, it is still available until the next boot, at which point + // it will obviously not be loaded. + + if( FindDecor(ref.name) ) + continue; + + image_id tempID = load_add_on(fullpath.String()); + if(tempID == B_ERROR) + continue; + + // As of now, we do nothing with decorator versions, but the possibility + // exists that the API will change even though I cannot forsee any reason + // to do so. If we *did* do anything with decorator versions, the + // assignment would go here. + + create_decorator *createfunc; + + // Get the instantiation function + status_t status = get_image_symbol(tempID, "instantiate_decorator", + B_SYMBOL_TYPE_TEXT, (void**)&createfunc); + + if (status != B_OK) + { + unload_add_on(tempID); + continue; + } + + fDecorList.AddItem( new DecorInfo(tempID, ref.name, createfunc) ); + } +} + +Decorator * +DecorManager::AllocateDecorator(BRect rect, const char *title, + int32 wlook, int32 wfeel, + int32 wflags, DisplayDriver *ddriver) +{ + // Create a new instance of the current decorator. Ownership is that of the caller + + if(!fCurrentDecor) + { + // We should *never* be here. If we do, it's a bug. + debugger("DecorManager::AllocateDecorator has a NULL decorator"); + return NULL; + } + + return fCurrentDecor->Instantiate(rect,title,wlook,wfeel,wflags,ddriver); +} + +int32 +DecorManager::CountDecorators(void) const +{ + return fDecorList.CountItems(); +} + +int32 +DecorManager::GetDecorator(void) const +{ + return fDecorList.IndexOf( fCurrentDecor ); +} + +bool +DecorManager::SetDecorator(const int32 &index) +{ + DecorInfo *newDecInfo = (DecorInfo*) fDecorList.ItemAt(index); + + if(newDecInfo) + { + fCurrentDecor = newDecInfo; + return true; + } + + return false; +} + +bool +DecorManager::SetR5Decorator(const int32 &value) +{ + BString string; + + switch(value) + { + case 0: string="BeOS"; break; + case 1: string="AmigaOS"; break; + case 2: string="Windows"; break; + case 3: string="MacOS"; break; + default: + return false; + } + + DecorInfo *newDecInfo = FindDecor(string.String()); + if(newDecInfo) + { + fCurrentDecor = newDecInfo; + return true; + } + + return false; +} + +const char * +DecorManager::GetDecoratorName(const int32 &index) +{ + DecorInfo *info = (DecorInfo*) fDecorList.ItemAt(index); + + if(info) + return info->GetName(); + + return NULL; +} + +void +DecorManager::EmptyList(void) +{ + for(int32 i=0; i < fDecorList.CountItems(); i++) + { + DecorInfo *info=(DecorInfo*)fDecorList.ItemAt(i); + delete info; + } + + fCurrentDecor = NULL; +} + +DecorInfo* +DecorManager::FindDecor(const char *name) +{ + if(!name) + return NULL; + + for(int32 i=0; iGetName())==0 ) + return info; + } + + return NULL; +} + +// This is the allocator function for the default decorator +Decorator* create_default_decorator(BRect rect, int32 wlook, int32 wfeel, int32 wflags) +{ + return new DefaultDecorator(rect,wlook,wfeel,wflags); +} + diff --git a/src/servers/app/DecorManager.h b/src/servers/app/DecorManager.h new file mode 100644 index 0000000000..7b59ec7e51 --- /dev/null +++ b/src/servers/app/DecorManager.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2001-2005, Haiku, Inc. + * Distributed under the terms of the MIT license. + * + * Author: DarkWyrm + */ +#ifndef DECORMANAGER_H +#define DECORMANAGER_H + +#include +#include +#include +#include + +#include "Decorator.h" +#include "DisplayDriver.h" + +class DecorInfo; + +class DecorManager : public BLocker +{ +public: + DecorManager(void); + ~DecorManager(void); + + void RescanDecorators(void); + + Decorator * AllocateDecorator(BRect rect, const char *title, + int32 wlook, int32 wfeel, + int32 wflags, DisplayDriver *ddriver); + + int32 CountDecorators(void) const; + + int32 GetDecorator(void) const; + bool SetDecorator(const int32 &index); + bool SetR5Decorator(const int32 &value); + const char * GetDecoratorName(const int32 &index); + + // TODO: Implement this method once the rest of the necessary infrastructure + // is in place +// status_t GetPreview(const int32 &index, ServerBitmap *bitmap); + +private: + void EmptyList(void); + DecorInfo* FindDecor(const char *name); + + BList fDecorList; + DecorInfo* fCurrentDecor; +}; + +extern DecorManager gDecorManager; + +#endif diff --git a/src/servers/app/Jamfile b/src/servers/app/Jamfile index 3182155bab..f4b037f25e 100644 --- a/src/servers/app/Jamfile +++ b/src/servers/app/Jamfile @@ -82,6 +82,7 @@ Server app_server : Desktop.cpp ServerApp.cpp ServerWindow.cpp + DecorManager.cpp # DisplayDriver Classes $(VIEW_DRIVER_SOURCES) diff --git a/src/servers/app/ServerApp.cpp b/src/servers/app/ServerApp.cpp index 6a76d84521..511698f647 100644 --- a/src/servers/app/ServerApp.cpp +++ b/src/servers/app/ServerApp.cpp @@ -27,7 +27,7 @@ #include "BitmapManager.h" #include "BGet++.h" #include "CursorManager.h" - +#include "DecorManager.h" #include "Desktop.h" #include "DisplayDriver.h" #include "FontServer.h" @@ -547,6 +547,72 @@ ServerApp::DispatchMessage(int32 code, BPrivate::LinkReceiver &link) } break; } + case AS_SET_DECORATOR: + { + // Received from an application when the user wants to set the window + // decorator to a new one + + // Attached Data: + // int32 the index of the decorator to use + + int32 index; + link.Read(&index); + if(gDecorManager.SetDecorator(index)) + BroadcastToAllApps(AS_UPDATE_DECORATOR); + + break; + } + case AS_COUNT_DECORATORS: + { + fLink.StartMessage(SERVER_TRUE); + fLink.Attach(gDecorManager.CountDecorators()); + fLink.Flush(); + break; + } + case AS_GET_DECORATOR: + { + fLink.StartMessage(SERVER_TRUE); + fLink.Attach(gDecorManager.GetDecorator()); + fLink.Flush(); + break; + } + case AS_GET_DECORATOR_NAME: + { + int32 index; + link.Read(&index); + + BString str(gDecorManager.GetDecoratorName(index)); + if(str.CountChars() > 0) + { + fLink.StartMessage(SERVER_TRUE); + fLink.AttachString(str.String()); + } + else + fLink.StartMessage(SERVER_FALSE); + + fLink.Flush(); + break; + } + case AS_R5_SET_DECORATOR: + { + // Sort of supports Tracker's nifty Easter Egg. It was easy to do and + // it's kind of neat, so why not? + + // Attached Data: + // int32 value of the decorator to use + // 0: BeOS + // 1: Amiga + // 2: Windows + // 3: MacOS + + int32 decindex = 0; + link.Read(&decindex); + + if(gDecorManager.SetR5Decorator(decindex)) + BroadcastToAllApps(AS_UPDATE_DECORATOR); + + break; + } case AS_CREATE_BITMAP: { STRACE(("ServerApp %s: Received BBitmap creation request\n",fSignature.String())); @@ -650,10 +716,13 @@ ServerApp::DispatchMessage(int32 code, BPrivate::LinkReceiver &link) case AS_DOWNLOAD_PICTURE: { // TODO; Implement AS_DOWNLOAD_PICTURE + STRACE(("ServerApp %s: Download Picture unimplemented\n", fSignature.String())); // What is this particular function call for, anyway? - STRACE(("ServerApp %s: Download Picture unimplemented\n", fSignature.String())); - + + // DW: I think originally it might have been to support + // the undocumented Flatten function. + break; } @@ -906,8 +975,7 @@ ServerApp::DispatchMessage(int32 code, BPrivate::LinkReceiver &link) link.Read(&gui_colorset); gui_colorset.Unlock(); - // TODO: Broadcast an AS_UPDATE_COLORS to all apps - + BroadcastToAllApps(AS_UPDATE_COLORS); break; } case AS_GET_UI_COLOR: @@ -927,6 +995,7 @@ ServerApp::DispatchMessage(int32 code, BPrivate::LinkReceiver &link) fLink.Flush(); break; } + case AS_UPDATED_CLIENT_FONTLIST: { STRACE(("ServerApp %s: Acknowledged update of client-side font list\n", diff --git a/src/servers/app/WinBorder.cpp b/src/servers/app/WinBorder.cpp index 04380f5586..c7ca209b1e 100644 --- a/src/servers/app/WinBorder.cpp +++ b/src/servers/app/WinBorder.cpp @@ -1,31 +1,11 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2005, Haiku, Inc. -// -// 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 -// Adi Oanca -// Stephan Aßmus -// Description: Layer subclass which handles window management -// -//------------------------------------------------------------------------------ +/* + * Copyright (c) 2001-2005, Haiku, Inc. + * Distributed under the terms of the MIT license. + * + * Author: DarkWyrm + * Adi Oanca + * Stephan Aßmus + */ #include #include #include @@ -34,8 +14,8 @@ #include #include "DebugInfoManager.h" -#include "AppServer.h" // for new_decorator() #include "Decorator.h" +#include "DecorManager.h" #include "Desktop.h" #include "Globals.h" #include "MessagePrivate.h" @@ -135,7 +115,8 @@ WinBorder::WinBorder(const BRect &r, QuietlySetFeel(wfeel); if (fFeel != B_NO_BORDER_WINDOW_LOOK) { - fDecorator = new_decorator(r, name, fLook, fFeel, fWindowFlags, fDriver); + fDecorator = gDecorManager.AllocateDecorator(r, name, fLook, fFeel, + fWindowFlags, fDriver); if (fDecorator) fDecorator->GetSizeLimits(&fMinWidth, &fMinHeight, &fMaxWidth, &fMaxHeight); } diff --git a/src/servers/app/WinBorder.h b/src/servers/app/WinBorder.h index 2707bad681..9f6102970d 100644 --- a/src/servers/app/WinBorder.h +++ b/src/servers/app/WinBorder.h @@ -1,31 +1,11 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2005, Haiku, Inc. -// -// 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 -// Adi Oanca -// Stephan Aßmus -// Description: Layer subclass which handles window management -// -//------------------------------------------------------------------------------ +/* + * Copyright (c) 2001-2005, Haiku, Inc. + * Distributed under the terms of the MIT license. + * + * Author: DarkWyrm + * Adi Oanca + * Stephan Aßmus + */ #ifndef _WINBORDER_H_ #define _WINBORDER_H_