diff --git a/headers/os/app/Application.h b/headers/os/app/Application.h index 22692b6652..849b4bf677 100644 --- a/headers/os/app/Application.h +++ b/headers/os/app/Application.h @@ -101,6 +101,7 @@ private: friend class BServer; BApplication(const char* signature, + const char* looperName, bool initGUI, status_t* error); BApplication(uint32 signature); BApplication(const BApplication&); diff --git a/headers/private/app/Server.h b/headers/private/app/Server.h index dcd9ced094..bce3226073 100644 --- a/headers/private/app/Server.h +++ b/headers/private/app/Server.h @@ -1,5 +1,5 @@ /* - * Copyright 2005, Haiku. + * Copyright 2005-2015, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -8,16 +8,22 @@ #ifndef _SERVER_H #define _SERVER_H + #include + class BServer : public BApplication { public: - BServer(const char* signature, bool initGUI, status_t *error); + BServer(const char* signature, bool initGUI, + status_t *error); + BServer(const char* signature, const char* + looperName, bool initGUI, status_t *error); - status_t InitGUIContext(); + status_t InitGUIContext(); private: - bool fGUIContextInitialized; + bool fGUIContextInitialized; }; + #endif // _SERVER_H diff --git a/src/kits/app/Application.cpp b/src/kits/app/Application.cpp index 4d00e18b44..ff51d2c5e8 100644 --- a/src/kits/app/Application.cpp +++ b/src/kits/app/Application.cpp @@ -52,6 +52,8 @@ using namespace BPrivate; +static const char* kDefaultLooperName = "AppLooperPort"; + BApplication* be_app = NULL; BMessenger be_app_messenger; @@ -210,19 +212,6 @@ check_app_signature(const char* signature) } -// Returns the looper name for a given signature. -// Normally this is "AppLooperPort", but in case of the registrar it gets a -// special name. -static const char* -looper_name_for(const char* signature) -{ - if (signature != NULL && !strcasecmp(signature, kRegistrarSignature)) - return BPrivate::get_roster_port_name(); - - return "AppLooperPort"; -} - - #ifndef RUN_WITHOUT_REGISTRAR // Fills the passed BMessage with B_ARGV_RECEIVED infos. static void @@ -255,7 +244,7 @@ fill_argv_message(BMessage &message) BApplication::BApplication(const char* signature) : - BLooper(looper_name_for(signature)) + BLooper(kDefaultLooperName) { _InitData(signature, true, NULL); } @@ -263,16 +252,16 @@ BApplication::BApplication(const char* signature) BApplication::BApplication(const char* signature, status_t* _error) : - BLooper(looper_name_for(signature)) + BLooper(kDefaultLooperName) { _InitData(signature, true, _error); } -BApplication::BApplication(const char* signature, bool initGUI, - status_t* _error) +BApplication::BApplication(const char* signature, const char* looperName, + bool initGUI, status_t* _error) : - BLooper(looper_name_for(signature)) + BLooper(looperName != NULL ? looperName : kDefaultLooperName) { _InitData(signature, initGUI, _error); } @@ -282,7 +271,7 @@ BApplication::BApplication(BMessage* data) // Note: BeOS calls the private BLooper(int32, port_id, const char*) // constructor here, test if it's needed : - BLooper(looper_name_for(NULL)) + BLooper(kDefaultLooperName) { const char* signature = NULL; data->FindString("mime_sig", &signature); diff --git a/src/kits/app/Server.cpp b/src/kits/app/Server.cpp index af64252d1b..906b254555 100644 --- a/src/kits/app/Server.cpp +++ b/src/kits/app/Server.cpp @@ -1,22 +1,35 @@ /* - * Copyright 2005, Haiku. + * Copyright 2005-2015, Haiku. * Distributed under the terms of the MIT License. * * Authors: + * Axel Dörfler, axeld@pinc-software.de * Ingo Weinhold */ + #include -// constructor + BServer::BServer(const char* signature, bool initGUI, status_t *error) - : BApplication(signature, initGUI, error), - fGUIContextInitialized(false) + : + BApplication(signature, NULL, initGUI, error), + fGUIContextInitialized(false) { - fGUIContextInitialized = (initGUI && (!error || *error == B_OK)); + fGUIContextInitialized = initGUI && (error == NULL || *error == B_OK); } -// InitGUIContext + +BServer::BServer(const char* signature, const char* looperName, bool initGUI, + status_t *error) + : + BApplication(signature, looperName, initGUI, error), + fGUIContextInitialized(false) +{ + fGUIContextInitialized = initGUI && (error == NULL || *error == B_OK); +} + + status_t BServer::InitGUIContext() { diff --git a/src/servers/registrar/Registrar.cpp b/src/servers/registrar/Registrar.cpp index 76cf3e3ca2..0a87150513 100644 --- a/src/servers/registrar/Registrar.cpp +++ b/src/servers/registrar/Registrar.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2014, Haiku, Inc. All Rights Reserved. + * Copyright 2001-2015, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -55,9 +55,10 @@ static const bigtime_t kRosterSanityEventInterval = 1000000LL; \param error Passed to the BApplication constructor for returning an error code. */ -Registrar::Registrar(status_t *error) +Registrar::Registrar(status_t* _error) : - BServer(kRegistrarSignature, false, error), + BServer(kRegistrarSignature, BPrivate::get_roster_port_name(), false, + _error), fRoster(NULL), fClipboardHandler(NULL), fMIMEManager(NULL),