Collision with our style guide.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10495 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+276
-211
@@ -62,10 +62,10 @@
|
|||||||
// Local Defines ---------------------------------------------------------------
|
// Local Defines ---------------------------------------------------------------
|
||||||
|
|
||||||
// Globals ---------------------------------------------------------------------
|
// Globals ---------------------------------------------------------------------
|
||||||
BApplication* be_app = NULL;
|
BApplication *be_app = NULL;
|
||||||
BMessenger be_app_messenger;
|
BMessenger be_app_messenger;
|
||||||
|
|
||||||
BResources* BApplication::_app_resources = NULL;
|
BResources *BApplication::_app_resources = NULL;
|
||||||
BLocker BApplication::_app_resources_lock("_app_resources_lock");
|
BLocker BApplication::_app_resources_lock("_app_resources_lock");
|
||||||
|
|
||||||
|
|
||||||
@@ -173,9 +173,9 @@ sPropertyInfo[] = {
|
|||||||
extern const int __libc_argc;
|
extern const int __libc_argc;
|
||||||
extern const char * const *__libc_argv;
|
extern const char * const *__libc_argv;
|
||||||
|
|
||||||
class BMenuWindow : public BWindow
|
class BMenuWindow : public BWindow {
|
||||||
{
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
// debugging
|
// debugging
|
||||||
@@ -189,8 +189,8 @@ static const char* looper_name_for(const char *signature);
|
|||||||
static status_t check_app_signature(const char *signature);
|
static status_t check_app_signature(const char *signature);
|
||||||
static void fill_argv_message(BMessage *message);
|
static void fill_argv_message(BMessage *message);
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
BApplication::BApplication(const char* signature)
|
BApplication::BApplication(const char *signature)
|
||||||
: BLooper(looper_name_for(signature)),
|
: BLooper(looper_name_for(signature)),
|
||||||
fAppName(NULL),
|
fAppName(NULL),
|
||||||
fServerFrom(-1),
|
fServerFrom(-1),
|
||||||
@@ -205,7 +205,8 @@ BApplication::BApplication(const char* signature)
|
|||||||
{
|
{
|
||||||
InitData(signature, NULL);
|
InitData(signature, NULL);
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BApplication::BApplication(const char* signature, status_t* error)
|
BApplication::BApplication(const char* signature, status_t* error)
|
||||||
: BLooper(looper_name_for(signature)),
|
: BLooper(looper_name_for(signature)),
|
||||||
fAppName(NULL),
|
fAppName(NULL),
|
||||||
@@ -221,7 +222,8 @@ BApplication::BApplication(const char* signature, status_t* error)
|
|||||||
{
|
{
|
||||||
InitData(signature, error);
|
InitData(signature, error);
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BApplication::~BApplication()
|
BApplication::~BApplication()
|
||||||
{
|
{
|
||||||
// tell all loopers(usually windows) to quit. Also, wait for them.
|
// tell all loopers(usually windows) to quit. Also, wait for them.
|
||||||
@@ -265,8 +267,9 @@ BApplication::~BApplication()
|
|||||||
// R5 doesn't uninitialize be_app_messenger.
|
// R5 doesn't uninitialize be_app_messenger.
|
||||||
//be_app_messenger = BMessenger();
|
//be_app_messenger = BMessenger();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
BApplication::BApplication(BMessage* data)
|
|
||||||
|
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(looper_name_for(NULL)),
|
||||||
@@ -291,17 +294,20 @@ BApplication::BApplication(BMessage* data)
|
|||||||
SetPulseRate(pulseRate);
|
SetPulseRate(pulseRate);
|
||||||
|
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
BArchivable* BApplication::Instantiate(BMessage* data)
|
|
||||||
|
BArchivable *
|
||||||
|
BApplication::Instantiate(BMessage *data)
|
||||||
{
|
{
|
||||||
if (validate_instantiation(data, "BApplication"))
|
if (validate_instantiation(data, "BApplication"))
|
||||||
return new BApplication(data);
|
return new BApplication(data);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BApplication::Archive(BMessage* data, bool deep) const
|
BApplication::Archive(BMessage *data, bool deep) const
|
||||||
{
|
{
|
||||||
status_t status = BLooper::Archive(data, deep);
|
status_t status = BLooper::Archive(data, deep);
|
||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
@@ -316,17 +322,19 @@ BApplication::Archive(BMessage* data, bool deep) const
|
|||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
status = data->AddInt64("_pulse", fPulseRate);
|
return data->AddInt64("_pulse", fPulseRate);
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
status_t BApplication::InitCheck() const
|
|
||||||
|
status_t
|
||||||
|
BApplication::InitCheck() const
|
||||||
{
|
{
|
||||||
return fInitError;
|
return fInitError;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
thread_id BApplication::Run()
|
|
||||||
|
thread_id
|
||||||
|
BApplication::Run()
|
||||||
{
|
{
|
||||||
AssertLocked();
|
AssertLocked();
|
||||||
|
|
||||||
@@ -346,12 +354,14 @@ thread_id BApplication::Run()
|
|||||||
|
|
||||||
return thread;
|
return thread;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::Quit()
|
|
||||||
|
void
|
||||||
|
BApplication::Quit()
|
||||||
{
|
{
|
||||||
bool unlock = false;
|
bool unlock = false;
|
||||||
if (!IsLocked()) {
|
if (!IsLocked()) {
|
||||||
const char* name = Name();
|
const char *name = Name();
|
||||||
if (!name)
|
if (!name)
|
||||||
name = "no-name";
|
name = "no-name";
|
||||||
printf("ERROR - you must Lock the application object before calling "
|
printf("ERROR - you must Lock the application object before calling "
|
||||||
@@ -385,8 +395,10 @@ void BApplication::Quit()
|
|||||||
if (unlock)
|
if (unlock)
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
bool BApplication::QuitRequested()
|
|
||||||
|
bool
|
||||||
|
BApplication::QuitRequested()
|
||||||
{
|
{
|
||||||
// No windows -- nothing to do.
|
// No windows -- nothing to do.
|
||||||
// TODO: Au contraire, we can have opened windows, and we have
|
// TODO: Au contraire, we can have opened windows, and we have
|
||||||
@@ -394,15 +406,20 @@ bool BApplication::QuitRequested()
|
|||||||
|
|
||||||
return BLooper::QuitRequested();
|
return BLooper::QuitRequested();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::Pulse()
|
|
||||||
|
void
|
||||||
|
BApplication::Pulse()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::ReadyToRun()
|
|
||||||
|
void
|
||||||
|
BApplication::ReadyToRun()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BApplication::MessageReceived(BMessage *message)
|
BApplication::MessageReceived(BMessage *message)
|
||||||
{
|
{
|
||||||
@@ -435,22 +452,32 @@ BApplication::MessageReceived(BMessage *message)
|
|||||||
BLooper::MessageReceived(message);
|
BLooper::MessageReceived(message);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
//------------------------------------------------------------------------------
|
void
|
||||||
void BApplication::ArgvReceived(int32 argc, char** argv)
|
BApplication::ArgvReceived(int32 argc, char **argv)
|
||||||
{
|
{
|
||||||
|
// supposed to be implemented by subclasses
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::AppActivated(bool active)
|
|
||||||
|
void
|
||||||
|
BApplication::AppActivated(bool active)
|
||||||
{
|
{
|
||||||
|
// supposed to be implemented by subclasses
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::RefsReceived(BMessage* a_message)
|
|
||||||
|
void
|
||||||
|
BApplication::RefsReceived(BMessage *message)
|
||||||
{
|
{
|
||||||
|
// supposed to be implemented by subclasses
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::AboutRequested()
|
|
||||||
|
void
|
||||||
|
BApplication::AboutRequested()
|
||||||
{
|
{
|
||||||
thread_info info;
|
thread_info info;
|
||||||
if (get_thread_info(Thread(), &info) == B_OK) {
|
if (get_thread_info(Thread(), &info) == B_OK) {
|
||||||
@@ -458,45 +485,58 @@ void BApplication::AboutRequested()
|
|||||||
alert->Go(NULL);
|
alert->Go(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
BHandler* BApplication::ResolveSpecifier(BMessage* msg, int32 index,
|
|
||||||
BMessage* specifier, int32 form,
|
BHandler *
|
||||||
const char* property)
|
BApplication::ResolveSpecifier(BMessage *msg, int32 index,
|
||||||
|
BMessage *specifier, int32 form, const char *property)
|
||||||
{
|
{
|
||||||
return NULL; // TODO: implement? not implemented?
|
// ToDo: implement ResolveSpecifier()!
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::ShowCursor()
|
|
||||||
|
void
|
||||||
|
BApplication::ShowCursor()
|
||||||
{
|
{
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
link.StartMessage(AS_SHOW_CURSOR);
|
link.StartMessage(AS_SHOW_CURSOR);
|
||||||
link.Flush();
|
link.Flush();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::HideCursor()
|
|
||||||
|
void
|
||||||
|
BApplication::HideCursor()
|
||||||
{
|
{
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
link.StartMessage(AS_HIDE_CURSOR);
|
link.StartMessage(AS_HIDE_CURSOR);
|
||||||
link.Flush();
|
link.Flush();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::ObscureCursor()
|
|
||||||
|
void
|
||||||
|
BApplication::ObscureCursor()
|
||||||
{
|
{
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
link.StartMessage(AS_OBSCURE_CURSOR);
|
link.StartMessage(AS_OBSCURE_CURSOR);
|
||||||
link.Flush();
|
link.Flush();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
bool BApplication::IsCursorHidden() const
|
|
||||||
|
bool
|
||||||
|
BApplication::IsCursorHidden() const
|
||||||
{
|
{
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
int32 code = SERVER_FALSE;
|
int32 code = SERVER_FALSE;
|
||||||
link.StartMessage(AS_QUERY_CURSOR_HIDDEN);
|
link.StartMessage(AS_QUERY_CURSOR_HIDDEN);
|
||||||
link.FlushWithReply(&code);
|
link.FlushWithReply(&code);
|
||||||
return (code==SERVER_TRUE)?true:false;
|
|
||||||
|
return code == SERVER_TRUE;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::SetCursor(const void* cursor)
|
|
||||||
|
void
|
||||||
|
BApplication::SetCursor(const void *cursor)
|
||||||
{
|
{
|
||||||
// BeBook sez: If you want to call SetCursor() without forcing an immediate
|
// BeBook sez: If you want to call SetCursor() without forcing an immediate
|
||||||
// sync of the Application Server, you have to use a BCursor.
|
// sync of the Application Server, you have to use a BCursor.
|
||||||
@@ -504,22 +544,26 @@ void BApplication::SetCursor(const void* cursor)
|
|||||||
BCursor Cursor(cursor);
|
BCursor Cursor(cursor);
|
||||||
SetCursor(&Cursor, true);
|
SetCursor(&Cursor, true);
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::SetCursor(const BCursor* cursor, bool sync)
|
|
||||||
|
void
|
||||||
|
BApplication::SetCursor(const BCursor *cursor, bool sync)
|
||||||
{
|
{
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
int32 code=SERVER_FALSE;
|
int32 code = SERVER_FALSE;
|
||||||
|
|
||||||
link.StartMessage(AS_SET_CURSOR_BCURSOR);
|
link.StartMessage(AS_SET_CURSOR_BCURSOR);
|
||||||
link.Attach<bool>(sync);
|
link.Attach<bool>(sync);
|
||||||
link.Attach<int32>(cursor->m_serverToken);
|
link.Attach<int32>(cursor->m_serverToken);
|
||||||
if(sync)
|
if (sync)
|
||||||
link.FlushWithReply(&code);
|
link.FlushWithReply(&code);
|
||||||
else
|
else
|
||||||
link.Flush();
|
link.Flush();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
int32 BApplication::CountWindows() const
|
|
||||||
|
int32
|
||||||
|
BApplication::CountWindows() const
|
||||||
{
|
{
|
||||||
// BeBook sez: The windows list includes all windows explicitely created by
|
// BeBook sez: The windows list includes all windows explicitely created by
|
||||||
// the app ... but excludes private windows create by Be
|
// the app ... but excludes private windows create by Be
|
||||||
@@ -528,8 +572,10 @@ int32 BApplication::CountWindows() const
|
|||||||
// param is false.
|
// param is false.
|
||||||
return count_windows(false);
|
return count_windows(false);
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
BWindow* BApplication::WindowAt(int32 index) const
|
|
||||||
|
BWindow *
|
||||||
|
BApplication::WindowAt(int32 index) const
|
||||||
{
|
{
|
||||||
// BeBook sez: The windows list includes all windows explicitely created by
|
// BeBook sez: The windows list includes all windows explicitely created by
|
||||||
// the app ... but excludes private windows create by Be
|
// the app ... but excludes private windows create by Be
|
||||||
@@ -538,43 +584,50 @@ BWindow* BApplication::WindowAt(int32 index) const
|
|||||||
// param is false.
|
// param is false.
|
||||||
return window_at(index, false);
|
return window_at(index, false);
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
int32 BApplication::CountLoopers() const
|
|
||||||
{
|
|
||||||
using namespace BPrivate;
|
|
||||||
BObjectLocker<BLooperList> ListLock(gLooperList);
|
|
||||||
if (ListLock.IsLocked())
|
|
||||||
{
|
|
||||||
return gLooperList.CountLoopers();
|
|
||||||
}
|
|
||||||
|
|
||||||
return B_ERROR; // Some bad, non-specific thing has happened
|
|
||||||
}
|
int32
|
||||||
//------------------------------------------------------------------------------
|
BApplication::CountLoopers() const
|
||||||
BLooper* BApplication::LooperAt(int32 index) const
|
|
||||||
{
|
{
|
||||||
using namespace BPrivate;
|
using namespace BPrivate;
|
||||||
BLooper* Looper = NULL;
|
|
||||||
BObjectLocker<BLooperList> ListLock(gLooperList);
|
BObjectLocker<BLooperList> ListLock(gLooperList);
|
||||||
if (ListLock.IsLocked())
|
if (ListLock.IsLocked())
|
||||||
{
|
return gLooperList.CountLoopers();
|
||||||
|
|
||||||
|
// Some bad, non-specific thing has happened
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BLooper *
|
||||||
|
BApplication::LooperAt(int32 index) const
|
||||||
|
{
|
||||||
|
using namespace BPrivate;
|
||||||
|
BLooper *Looper = NULL;
|
||||||
|
BObjectLocker<BLooperList> ListLock(gLooperList);
|
||||||
|
if (ListLock.IsLocked())
|
||||||
Looper = gLooperList.LooperAt(index);
|
Looper = gLooperList.LooperAt(index);
|
||||||
}
|
|
||||||
|
|
||||||
return Looper;
|
return Looper;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
bool BApplication::IsLaunching() const
|
|
||||||
|
bool
|
||||||
|
BApplication::IsLaunching() const
|
||||||
{
|
{
|
||||||
return !fReadyToRunCalled;
|
return !fReadyToRunCalled;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
status_t BApplication::GetAppInfo(app_info* info) const
|
|
||||||
|
status_t
|
||||||
|
BApplication::GetAppInfo(app_info *info) const
|
||||||
{
|
{
|
||||||
return be_roster->GetRunningAppInfo(be_app->Team(), info);
|
return be_roster->GetRunningAppInfo(be_app->Team(), info);
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
BResources* BApplication::AppResources()
|
|
||||||
|
BResources *
|
||||||
|
BApplication::AppResources()
|
||||||
{
|
{
|
||||||
if (!_app_resources_lock.Lock())
|
if (!_app_resources_lock.Lock())
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -595,10 +648,10 @@ BResources* BApplication::AppResources()
|
|||||||
if (be_app && be_roster->GetRunningAppInfo(be_app->Team(), &appInfo) == B_OK) {
|
if (be_app && be_roster->GetRunningAppInfo(be_app->Team(), &appInfo) == B_OK) {
|
||||||
ref = appInfo.ref;
|
ref = appInfo.ref;
|
||||||
found = true;
|
found = true;
|
||||||
|
} else {
|
||||||
} else
|
|
||||||
// Run() hasn't been called yet
|
// Run() hasn't been called yet
|
||||||
found = BPrivate::get_app_ref(&ref) == B_OK;
|
found = BPrivate::get_app_ref(&ref) == B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
BFile file(&ref, B_READ_ONLY);
|
BFile file(&ref, B_READ_ONLY);
|
||||||
@@ -606,7 +659,6 @@ BResources* BApplication::AppResources()
|
|||||||
BResources *resources = new BResources();
|
BResources *resources = new BResources();
|
||||||
if (resources->SetTo(&file, false) < B_OK)
|
if (resources->SetTo(&file, false) < B_OK)
|
||||||
delete resources;
|
delete resources;
|
||||||
|
|
||||||
else
|
else
|
||||||
_app_resources = resources;
|
_app_resources = resources;
|
||||||
}
|
}
|
||||||
@@ -702,6 +754,7 @@ BApplication::DispatchMessage(BMessage *message, BHandler *handler)
|
|||||||
void
|
void
|
||||||
BApplication::SetPulseRate(bigtime_t rate)
|
BApplication::SetPulseRate(bigtime_t rate)
|
||||||
{
|
{
|
||||||
|
// ToDo: implement pulse runner!
|
||||||
fPulseRate = rate;
|
fPulseRate = rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -709,82 +762,57 @@ BApplication::SetPulseRate(bigtime_t rate)
|
|||||||
status_t
|
status_t
|
||||||
BApplication::GetSupportedSuites(BMessage *data)
|
BApplication::GetSupportedSuites(BMessage *data)
|
||||||
{
|
{
|
||||||
status_t err = B_OK;
|
|
||||||
if (!data)
|
if (!data)
|
||||||
{
|
return B_BAD_VALUE;
|
||||||
err = B_BAD_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!err)
|
status_t status = data->AddString("Suites", "suite/vnd.Be-application");
|
||||||
{
|
if (status == B_OK) {
|
||||||
err = data->AddString("Suites", "suite/vnd.Be-application");
|
|
||||||
if (!err)
|
|
||||||
{
|
|
||||||
BPropertyInfo PropertyInfo(sPropertyInfo);
|
BPropertyInfo PropertyInfo(sPropertyInfo);
|
||||||
err = data->AddFlat("message", &PropertyInfo);
|
status = data->AddFlat("message", &PropertyInfo);
|
||||||
if (!err)
|
if (status == B_OK)
|
||||||
{
|
status = BHandler::GetSupportedSuites(data);
|
||||||
err = BHandler::GetSupportedSuites(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return status;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
status_t BApplication::Perform(perform_code d, void* arg)
|
|
||||||
|
status_t
|
||||||
|
BApplication::Perform(perform_code d, void *arg)
|
||||||
{
|
{
|
||||||
return BLooper::Perform(d, arg);
|
return BLooper::Perform(d, arg);
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BApplication::BApplication(uint32 signature)
|
BApplication::BApplication(uint32 signature)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BApplication::BApplication(const BApplication& rhs)
|
BApplication::BApplication(const BApplication& rhs)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BApplication& BApplication::operator=(const BApplication& rhs)
|
BApplication& BApplication::operator=(const BApplication& rhs)
|
||||||
{
|
{
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::_ReservedApplication1()
|
|
||||||
{
|
void BApplication::_ReservedApplication1() {}
|
||||||
}
|
void BApplication::_ReservedApplication2() {}
|
||||||
//------------------------------------------------------------------------------
|
void BApplication::_ReservedApplication3() {}
|
||||||
void BApplication::_ReservedApplication2()
|
void BApplication::_ReservedApplication4() {}
|
||||||
{
|
void BApplication::_ReservedApplication5() {}
|
||||||
}
|
void BApplication::_ReservedApplication6() {}
|
||||||
//------------------------------------------------------------------------------
|
void BApplication::_ReservedApplication7() {}
|
||||||
void BApplication::_ReservedApplication3()
|
void BApplication::_ReservedApplication8() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::_ReservedApplication4()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::_ReservedApplication5()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::_ReservedApplication6()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::_ReservedApplication7()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::_ReservedApplication8()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
bool
|
bool
|
||||||
BApplication::ScriptReceived(BMessage *message, int32 index, BMessage *specifier,
|
BApplication::ScriptReceived(BMessage *message, int32 index,
|
||||||
int32 what, const char *property)
|
BMessage *specifier, int32 what, const char *property)
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
printf("message:\n");
|
printf("message:\n");
|
||||||
@@ -796,13 +824,18 @@ BApplication::ScriptReceived(BMessage *message, int32 index, BMessage *specifier
|
|||||||
printf("property: %s\n", property ? property : "");
|
printf("property: %s\n", property ? property : "");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::run_task()
|
|
||||||
|
void
|
||||||
|
BApplication::run_task()
|
||||||
{
|
{
|
||||||
|
// ToDo: run_task() could be removed completely
|
||||||
task_looper();
|
task_looper();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::InitData(const char* signature, status_t* error)
|
|
||||||
|
void
|
||||||
|
BApplication::InitData(const char *signature, status_t *error)
|
||||||
{
|
{
|
||||||
// check whether there exists already an application
|
// check whether there exists already an application
|
||||||
if (be_app)
|
if (be_app)
|
||||||
@@ -886,7 +919,6 @@ void BApplication::InitData(const char* signature, status_t* error)
|
|||||||
app_info otherAppInfo;
|
app_info otherAppInfo;
|
||||||
if (be_roster->GetRunningAppInfo(otherTeam, &otherAppInfo) == B_OK
|
if (be_roster->GetRunningAppInfo(otherTeam, &otherAppInfo) == B_OK
|
||||||
&& !(otherAppInfo.flags & B_ARGV_ONLY)) {
|
&& !(otherAppInfo.flags & B_ARGV_ONLY)) {
|
||||||
|
|
||||||
// create an B_ARGV_RECEIVED message
|
// create an B_ARGV_RECEIVED message
|
||||||
BMessage argvMessage(B_ARGV_RECEIVED);
|
BMessage argvMessage(B_ARGV_RECEIVED);
|
||||||
fill_argv_message(&argvMessage);
|
fill_argv_message(&argvMessage);
|
||||||
@@ -936,7 +968,6 @@ void BApplication::InitData(const char* signature, status_t* error)
|
|||||||
get_scs();
|
get_scs();
|
||||||
#endif // RUN_WITHOUT_APP_SERVER
|
#endif // RUN_WITHOUT_APP_SERVER
|
||||||
|
|
||||||
|
|
||||||
// init be_app and be_app_messenger
|
// init be_app and be_app_messenger
|
||||||
if (fInitError == B_OK) {
|
if (fInitError == B_OK) {
|
||||||
be_app = this;
|
be_app = this;
|
||||||
@@ -973,29 +1004,37 @@ void BApplication::InitData(const char* signature, status_t* error)
|
|||||||
else if (fInitError != B_OK)
|
else if (fInitError != B_OK)
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::BeginRectTracking(BRect r, bool trackWhole)
|
|
||||||
|
void
|
||||||
|
BApplication::BeginRectTracking(BRect rect, bool trackWhole)
|
||||||
{
|
{
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
link.StartMessage(AS_BEGIN_RECT_TRACKING);
|
link.StartMessage(AS_BEGIN_RECT_TRACKING);
|
||||||
link.Attach<BRect>(r);
|
link.Attach<BRect>(rect);
|
||||||
link.Attach<int32>(trackWhole);
|
link.Attach<int32>(trackWhole);
|
||||||
link.Flush();
|
link.Flush();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::EndRectTracking()
|
|
||||||
|
void
|
||||||
|
BApplication::EndRectTracking()
|
||||||
{
|
{
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
link.StartMessage(AS_END_RECT_TRACKING);
|
link.StartMessage(AS_END_RECT_TRACKING);
|
||||||
link.Flush();
|
link.Flush();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::get_scs()
|
|
||||||
|
void
|
||||||
|
BApplication::get_scs()
|
||||||
{
|
{
|
||||||
gPrivateScreen = new BPrivateScreen();
|
gPrivateScreen = new BPrivateScreen();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::setup_server_heaps()
|
|
||||||
|
void
|
||||||
|
BApplication::setup_server_heaps()
|
||||||
{
|
{
|
||||||
// TODO: implement?
|
// TODO: implement?
|
||||||
|
|
||||||
@@ -1004,42 +1043,57 @@ void BApplication::setup_server_heaps()
|
|||||||
// app_server. Currently (7/29/04), the R1 app_server does not do this and
|
// app_server. Currently (7/29/04), the R1 app_server does not do this and
|
||||||
// may never do this unless a significant need is found for it. --DW
|
// may never do this unless a significant need is found for it. --DW
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void* BApplication::rw_offs_to_ptr(uint32 offset)
|
|
||||||
|
void *
|
||||||
|
BApplication::rw_offs_to_ptr(uint32 offset)
|
||||||
{
|
{
|
||||||
return NULL; // TODO: implement
|
return NULL; // TODO: implement
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void* BApplication::ro_offs_to_ptr(uint32 offset)
|
|
||||||
|
void *
|
||||||
|
BApplication::ro_offs_to_ptr(uint32 offset)
|
||||||
{
|
{
|
||||||
return NULL; // TODO: implement
|
return NULL; // TODO: implement
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void* BApplication::global_ro_offs_to_ptr(uint32 offset)
|
|
||||||
|
void *
|
||||||
|
BApplication::global_ro_offs_to_ptr(uint32 offset)
|
||||||
{
|
{
|
||||||
return NULL; // TODO: implement
|
return NULL; // TODO: implement
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::connect_to_app_server()
|
|
||||||
|
void
|
||||||
|
BApplication::connect_to_app_server()
|
||||||
{
|
{
|
||||||
fServerFrom = find_port(SERVER_PORT_NAME);
|
fServerFrom = find_port(SERVER_PORT_NAME);
|
||||||
if (fServerFrom >= 0) {
|
if (fServerFrom < B_OK) {
|
||||||
|
fInitError = fServerFrom;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Create the port so that the app_server knows where to send messages
|
// Create the port so that the app_server knows where to send messages
|
||||||
fServerTo = create_port(100, "a<fServerTo");
|
fServerTo = create_port(100, "a<fServerTo");
|
||||||
if (fServerTo >= 0) {
|
if (fServerTo < B_OK) {
|
||||||
|
fInitError = fServerTo;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//We can't use BAppServerLink because be_app == NULL
|
// We can't use BAppServerLink because be_app == NULL
|
||||||
|
|
||||||
// AS_CREATE_APP:
|
// AS_CREATE_APP:
|
||||||
|
//
|
||||||
// Attach data:
|
// Attach data:
|
||||||
// 1) port_id - receiver port of a regular app
|
// 1) port_id - receiver port of a regular app
|
||||||
// 2) port_id - looper port for this BApplication
|
// 2) port_id - looper port for this BApplication
|
||||||
// 3) team_id - team identification field
|
// 3) team_id - team identification field
|
||||||
// 4) int32 - handler ID token of the app
|
// 4) int32 - handler ID token of the app
|
||||||
// 5) char * - signature of the regular app
|
// 5) char * - signature of the regular app
|
||||||
BPortLink link(fServerFrom,fServerTo);
|
BPortLink link(fServerFrom, fServerTo);
|
||||||
int32 code=SERVER_FALSE;
|
int32 code = SERVER_FALSE;
|
||||||
|
|
||||||
link.StartMessage(AS_CREATE_APP);
|
link.StartMessage(AS_CREATE_APP);
|
||||||
link.Attach<port_id>(fServerTo);
|
link.Attach<port_id>(fServerTo);
|
||||||
@@ -1053,45 +1107,53 @@ void BApplication::connect_to_app_server()
|
|||||||
// Reply code: SERVER_TRUE
|
// Reply code: SERVER_TRUE
|
||||||
// Reply data:
|
// Reply data:
|
||||||
// 1) port_id server-side application port (fServerFrom value)
|
// 1) port_id server-side application port (fServerFrom value)
|
||||||
if(code==SERVER_TRUE)
|
if (code == SERVER_TRUE)
|
||||||
link.Read<port_id>(&fServerFrom);
|
link.Read<port_id>(&fServerFrom);
|
||||||
else
|
else
|
||||||
debugger("BApplication: couldn't obtain new app_server comm port");
|
debugger("BApplication: couldn't obtain new app_server comm port");
|
||||||
|
}
|
||||||
|
|
||||||
} else
|
|
||||||
fInitError = fServerTo;
|
void
|
||||||
} else
|
BApplication::send_drag(BMessage *message, int32 vs_token, BPoint offset,
|
||||||
fInitError = fServerFrom;
|
BRect dragRect, BHandler *replyTo)
|
||||||
}
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::send_drag(BMessage* msg, int32 vs_token, BPoint offset, BRect drag_rect, BHandler* reply_to)
|
|
||||||
{
|
{
|
||||||
// TODO: implement
|
// TODO: implement
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::send_drag(BMessage* msg, int32 vs_token, BPoint offset, int32 bitmap_token, drawing_mode dragMode, BHandler* reply_to)
|
|
||||||
|
void
|
||||||
|
BApplication::send_drag(BMessage *message, int32 vs_token, BPoint offset,
|
||||||
|
int32 bitmapToken, drawing_mode dragMode, BHandler *replyTo)
|
||||||
{
|
{
|
||||||
// TODO: implement
|
// TODO: implement
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::write_drag(_BSession_* session, BMessage* a_message)
|
|
||||||
|
void
|
||||||
|
BApplication::write_drag(_BSession_ *session, BMessage *message)
|
||||||
{
|
{
|
||||||
// TODO: implement
|
// TODO: implement
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
bool BApplication::quit_all_windows(bool force)
|
|
||||||
|
bool
|
||||||
|
BApplication::quit_all_windows(bool force)
|
||||||
{
|
{
|
||||||
return false; // TODO: implement?
|
return false; // TODO: implement?
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
bool BApplication::window_quit_loop(bool, bool)
|
|
||||||
|
bool
|
||||||
|
BApplication::window_quit_loop(bool, bool)
|
||||||
{
|
{
|
||||||
// TODO: Implement and use in BApplication::QuitRequested()
|
// TODO: Implement and use in BApplication::QuitRequested()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BApplication::do_argv(BMessage* message)
|
BApplication::do_argv(BMessage *message)
|
||||||
{
|
{
|
||||||
// TODO: Consider renaming this function to something
|
// TODO: Consider renaming this function to something
|
||||||
// a bit more descriptive, like "handle_argv_message()",
|
// a bit more descriptive, like "handle_argv_message()",
|
||||||
@@ -1133,12 +1195,15 @@ BApplication::do_argv(BMessage* message)
|
|||||||
delete[] argv;
|
delete[] argv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
uint32 BApplication::InitialWorkspace()
|
|
||||||
|
uint32
|
||||||
|
BApplication::InitialWorkspace()
|
||||||
{
|
{
|
||||||
return fInitialWorkspace;
|
return fInitialWorkspace;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
BApplication::count_windows(bool includeMenus) const
|
BApplication::count_windows(bool includeMenus) const
|
||||||
{
|
{
|
||||||
@@ -1149,7 +1214,8 @@ BApplication::count_windows(bool includeMenus) const
|
|||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BWindow *
|
BWindow *
|
||||||
BApplication::window_at(uint32 index, bool includeMenus) const
|
BApplication::window_at(uint32 index, bool includeMenus) const
|
||||||
{
|
{
|
||||||
@@ -1162,7 +1228,8 @@ BApplication::window_at(uint32 index, bool includeMenus) const
|
|||||||
|
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BApplication::get_window_list(BList *list, bool includeMenus) const
|
BApplication::get_window_list(BList *list, bool includeMenus) const
|
||||||
{
|
{
|
||||||
@@ -1173,7 +1240,9 @@ BApplication::get_window_list(BList *list, bool includeMenus) const
|
|||||||
// Windows are BLoopers, so we can just check each BLooper to see if it's
|
// Windows are BLoopers, so we can just check each BLooper to see if it's
|
||||||
// a BWindow (or BMenuWindow)
|
// a BWindow (or BMenuWindow)
|
||||||
BObjectLocker<BLooperList> listLock(gLooperList);
|
BObjectLocker<BLooperList> listLock(gLooperList);
|
||||||
if (listLock.IsLocked()) {
|
if (!listLock.IsLocked())
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
BLooper *looper = NULL;
|
BLooper *looper = NULL;
|
||||||
for (int32 i = 0; i < gLooperList.CountLoopers(); i++) {
|
for (int32 i = 0; i < gLooperList.CountLoopers(); i++) {
|
||||||
looper = gLooperList.LooperAt(i);
|
looper = gLooperList.LooperAt(i);
|
||||||
@@ -1184,16 +1253,15 @@ BApplication::get_window_list(BList *list, bool includeMenus) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
|
||||||
|
|
||||||
return B_ERROR;
|
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
int32 BApplication::async_quit_entry(void* data)
|
|
||||||
|
int32
|
||||||
|
BApplication::async_quit_entry(void *data)
|
||||||
{
|
{
|
||||||
return 0; // TODO: implement? not implemented?
|
return 0; // TODO: implement? not implemented?
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// check_app_signature
|
// check_app_signature
|
||||||
/*! \brief Checks whether the supplied string is a valid application signature.
|
/*! \brief Checks whether the supplied string is a valid application signature.
|
||||||
@@ -1205,6 +1273,7 @@ int32 BApplication::async_quit_entry(void* data)
|
|||||||
- \c B_OK: \a signature is a valid app signature.
|
- \c B_OK: \a signature is a valid app signature.
|
||||||
- \c B_BAD_VALUE: \a signature is \c NULL or no valid app signature.
|
- \c B_BAD_VALUE: \a signature is \c NULL or no valid app signature.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static
|
static
|
||||||
status_t
|
status_t
|
||||||
check_app_signature(const char *signature)
|
check_app_signature(const char *signature)
|
||||||
@@ -1223,6 +1292,7 @@ check_app_signature(const char *signature)
|
|||||||
return (isValid ? B_OK : B_BAD_VALUE);
|
return (isValid ? B_OK : B_BAD_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// looper_name_for
|
// looper_name_for
|
||||||
/*! \brief Returns the looper name for a given signature.
|
/*! \brief Returns the looper name for a given signature.
|
||||||
|
|
||||||
@@ -1231,6 +1301,7 @@ check_app_signature(const char *signature)
|
|||||||
|
|
||||||
\return The looper name.
|
\return The looper name.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static
|
static
|
||||||
const char*
|
const char*
|
||||||
looper_name_for(const char *signature)
|
looper_name_for(const char *signature)
|
||||||
@@ -1244,6 +1315,7 @@ looper_name_for(const char *signature)
|
|||||||
// fill_argv_message
|
// fill_argv_message
|
||||||
/*! \brief Fills the passed BMessage with B_ARGV_RECEIVED infos.
|
/*! \brief Fills the passed BMessage with B_ARGV_RECEIVED infos.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fill_argv_message(BMessage *message)
|
fill_argv_message(BMessage *message)
|
||||||
{
|
{
|
||||||
@@ -1267,10 +1339,3 @@ fill_argv_message(BMessage *message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* $Log $
|
|
||||||
*
|
|
||||||
* $Id $
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user