BServer/BApplication: added constructor for looper name.
* Added an extra looperName argument to the private BApplication constructor that BServer is using. * This is now used to fix the ugliness that gave the registrar a different looper name, and even saves a string comparison.
This commit is contained in:
@@ -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&);
|
||||
|
||||
@@ -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 <Application.h>
|
||||
|
||||
|
||||
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
|
||||
|
||||
@@ -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);
|
||||
|
||||
+19
-6
@@ -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 <bonefish@cs.tu-berlin.de>
|
||||
*/
|
||||
|
||||
|
||||
#include <Server.h>
|
||||
|
||||
// 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()
|
||||
{
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user