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;
|
friend class BServer;
|
||||||
|
|
||||||
BApplication(const char* signature,
|
BApplication(const char* signature,
|
||||||
|
const char* looperName,
|
||||||
bool initGUI, status_t* error);
|
bool initGUI, status_t* error);
|
||||||
BApplication(uint32 signature);
|
BApplication(uint32 signature);
|
||||||
BApplication(const BApplication&);
|
BApplication(const BApplication&);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005, Haiku.
|
* Copyright 2005-2015, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -8,16 +8,22 @@
|
|||||||
#ifndef _SERVER_H
|
#ifndef _SERVER_H
|
||||||
#define _SERVER_H
|
#define _SERVER_H
|
||||||
|
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
|
|
||||||
|
|
||||||
class BServer : public BApplication {
|
class BServer : public BApplication {
|
||||||
public:
|
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:
|
private:
|
||||||
bool fGUIContextInitialized;
|
bool fGUIContextInitialized;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _SERVER_H
|
#endif // _SERVER_H
|
||||||
|
|||||||
@@ -52,6 +52,8 @@
|
|||||||
using namespace BPrivate;
|
using namespace BPrivate;
|
||||||
|
|
||||||
|
|
||||||
|
static const char* kDefaultLooperName = "AppLooperPort";
|
||||||
|
|
||||||
BApplication* be_app = NULL;
|
BApplication* be_app = NULL;
|
||||||
BMessenger be_app_messenger;
|
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
|
#ifndef RUN_WITHOUT_REGISTRAR
|
||||||
// Fills the passed BMessage with B_ARGV_RECEIVED infos.
|
// Fills the passed BMessage with B_ARGV_RECEIVED infos.
|
||||||
static void
|
static void
|
||||||
@@ -255,7 +244,7 @@ fill_argv_message(BMessage &message)
|
|||||||
|
|
||||||
BApplication::BApplication(const char* signature)
|
BApplication::BApplication(const char* signature)
|
||||||
:
|
:
|
||||||
BLooper(looper_name_for(signature))
|
BLooper(kDefaultLooperName)
|
||||||
{
|
{
|
||||||
_InitData(signature, true, NULL);
|
_InitData(signature, true, NULL);
|
||||||
}
|
}
|
||||||
@@ -263,16 +252,16 @@ BApplication::BApplication(const char* signature)
|
|||||||
|
|
||||||
BApplication::BApplication(const char* signature, status_t* _error)
|
BApplication::BApplication(const char* signature, status_t* _error)
|
||||||
:
|
:
|
||||||
BLooper(looper_name_for(signature))
|
BLooper(kDefaultLooperName)
|
||||||
{
|
{
|
||||||
_InitData(signature, true, _error);
|
_InitData(signature, true, _error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BApplication::BApplication(const char* signature, bool initGUI,
|
BApplication::BApplication(const char* signature, const char* looperName,
|
||||||
status_t* _error)
|
bool initGUI, status_t* _error)
|
||||||
:
|
:
|
||||||
BLooper(looper_name_for(signature))
|
BLooper(looperName != NULL ? looperName : kDefaultLooperName)
|
||||||
{
|
{
|
||||||
_InitData(signature, initGUI, _error);
|
_InitData(signature, initGUI, _error);
|
||||||
}
|
}
|
||||||
@@ -282,7 +271,7 @@ BApplication::BApplication(BMessage* data)
|
|||||||
// Note: BeOS calls the private BLooper(int32, port_id, const char*)
|
// Note: BeOS calls the private BLooper(int32, port_id, const char*)
|
||||||
// constructor here, test if it's needed
|
// constructor here, test if it's needed
|
||||||
:
|
:
|
||||||
BLooper(looper_name_for(NULL))
|
BLooper(kDefaultLooperName)
|
||||||
{
|
{
|
||||||
const char* signature = NULL;
|
const char* signature = NULL;
|
||||||
data->FindString("mime_sig", &signature);
|
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.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
|
* Axel Dörfler, [email protected]
|
||||||
* Ingo Weinhold <[email protected]>
|
* Ingo Weinhold <[email protected]>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <Server.h>
|
#include <Server.h>
|
||||||
|
|
||||||
// constructor
|
|
||||||
BServer::BServer(const char* signature, bool initGUI, status_t *error)
|
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
|
status_t
|
||||||
BServer::InitGUIContext()
|
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.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -55,9 +55,10 @@ static const bigtime_t kRosterSanityEventInterval = 1000000LL;
|
|||||||
\param error Passed to the BApplication constructor for returning an
|
\param error Passed to the BApplication constructor for returning an
|
||||||
error code.
|
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),
|
fRoster(NULL),
|
||||||
fClipboardHandler(NULL),
|
fClipboardHandler(NULL),
|
||||||
fMIMEManager(NULL),
|
fMIMEManager(NULL),
|
||||||
|
|||||||
Reference in New Issue
Block a user