Moved gPrivateScreen into the BPrivate namespace. Small cleanups to Application.cpp. Refined some comments. Used strdup() instead of new because it`s nicer for strings.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10514 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -29,6 +29,7 @@
|
|||||||
// Standard Includes -----------------------------------------------------------
|
// Standard Includes -----------------------------------------------------------
|
||||||
#include <new>
|
#include <new>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
// System Includes -------------------------------------------------------------
|
// System Includes -------------------------------------------------------------
|
||||||
@@ -69,10 +70,11 @@ BResources *BApplication::_app_resources = NULL;
|
|||||||
BLocker BApplication::_app_resources_lock("_app_resources_lock");
|
BLocker BApplication::_app_resources_lock("_app_resources_lock");
|
||||||
|
|
||||||
|
|
||||||
// This isn't static because it's used by PrivateScreen.cpp
|
// Used by PrivateScreen.cpp
|
||||||
// TODO: Move it to the BPrivate namespace (or prepend a "_" to the name),
|
// TODO: This setup won`t let us have multiple screens. Change this.
|
||||||
// but maybe we'll want to handle screens differently
|
namespace BPrivate {
|
||||||
BPrivateScreen *gPrivateScreen = NULL;
|
BPrivateScreen *gPrivateScreen = NULL;
|
||||||
|
};
|
||||||
|
|
||||||
static property_info
|
static property_info
|
||||||
sPropertyInfo[] = {
|
sPropertyInfo[] = {
|
||||||
@@ -305,7 +307,7 @@ BApplication::InitData(const char *signature, status_t *_error)
|
|||||||
fInitError = fileInfo.SetTo(&file);
|
fInitError = fileInfo.SetTo(&file);
|
||||||
if (fInitError == B_OK) {
|
if (fInitError == B_OK) {
|
||||||
fileInfo.GetAppFlags(&appFlags);
|
fileInfo.GetAppFlags(&appFlags);
|
||||||
char appFileSignature[B_MIME_TYPE_LENGTH + 1];
|
char appFileSignature[B_MIME_TYPE_LENGTH];
|
||||||
// compare the file signature and the supplied signature
|
// compare the file signature and the supplied signature
|
||||||
if (fileInfo.GetSignature(appFileSignature) == B_OK
|
if (fileInfo.GetSignature(appFileSignature) == B_OK
|
||||||
&& strcasecmp(appFileSignature, signature) != 0) {
|
&& strcasecmp(appFileSignature, signature) != 0) {
|
||||||
@@ -755,12 +757,12 @@ BApplication::CountLoopers() const
|
|||||||
BLooper *
|
BLooper *
|
||||||
BApplication::LooperAt(int32 index) const
|
BApplication::LooperAt(int32 index) const
|
||||||
{
|
{
|
||||||
BLooper *Looper = NULL;
|
BLooper *looper = NULL;
|
||||||
BObjectLocker<BLooperList> ListLock(gLooperList);
|
BObjectLocker<BLooperList> listLock(gLooperList);
|
||||||
if (ListLock.IsLocked())
|
if (listLock.IsLocked())
|
||||||
Looper = gLooperList.LooperAt(index);
|
looper = gLooperList.LooperAt(index);
|
||||||
|
|
||||||
return Looper;
|
return looper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -867,9 +869,10 @@ BApplication::DispatchMessage(BMessage *message, BHandler *handler)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case B_READY_TO_RUN:
|
case B_READY_TO_RUN:
|
||||||
if (!fReadyToRunCalled)
|
if (!fReadyToRunCalled) {
|
||||||
ReadyToRun();
|
ReadyToRun();
|
||||||
fReadyToRunCalled = true;
|
fReadyToRunCalled = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B_ABOUT_REQUESTED:
|
case B_ABOUT_REQUESTED:
|
||||||
@@ -890,17 +893,14 @@ BApplication::DispatchMessage(BMessage *message, BHandler *handler)
|
|||||||
|
|
||||||
case _SHOW_DRAG_HANDLES_:
|
case _SHOW_DRAG_HANDLES_:
|
||||||
case B_APP_ACTIVATED:
|
case B_APP_ACTIVATED:
|
||||||
|
// These two are handled by BTextView classes, so
|
||||||
|
// BApplication probably forwards these messages to them.
|
||||||
|
case _DISPOSE_DRAG_:
|
||||||
|
case _PING_:
|
||||||
puts("not yet handled message:");
|
puts("not yet handled message:");
|
||||||
message->PrintToStream();
|
message->PrintToStream();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
|
||||||
// These two are handled by BTextView, don't know if also
|
|
||||||
// by other classes
|
|
||||||
case _DISPOSE_DRAG_:
|
|
||||||
case _PING_:
|
|
||||||
break;
|
|
||||||
*/
|
|
||||||
default:
|
default:
|
||||||
BLooper::DispatchMessage(message, handler);
|
BLooper::DispatchMessage(message, handler);
|
||||||
break;
|
break;
|
||||||
@@ -1192,10 +1192,8 @@ BApplication::do_argv(BMessage *message)
|
|||||||
const char *arg = NULL;
|
const char *arg = NULL;
|
||||||
error = message->FindString("argv", i, &arg);
|
error = message->FindString("argv", i, &arg);
|
||||||
if (error == B_OK && arg) {
|
if (error == B_OK && arg) {
|
||||||
argv[i] = new(std::nothrow) char[strlen(arg) + 1];
|
argv[i] = strdup(arg);
|
||||||
if (argv[i])
|
if (argv[i] == NULL)
|
||||||
strcpy(argv[i], arg);
|
|
||||||
else
|
|
||||||
error = B_NO_MEMORY;
|
error = B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1208,7 +1206,7 @@ BApplication::do_argv(BMessage *message)
|
|||||||
// cleanup
|
// cleanup
|
||||||
if (argv) {
|
if (argv) {
|
||||||
for (int32 i = 0; i < argc; i++)
|
for (int32 i = 0; i < argc; i++)
|
||||||
delete[] argv[i];
|
free(argv[i]);
|
||||||
delete[] argv;
|
delete[] argv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,9 +46,13 @@ struct screen_desc {
|
|||||||
|
|
||||||
|
|
||||||
// Defined in Application.cpp
|
// Defined in Application.cpp
|
||||||
|
namespace BPrivate {
|
||||||
extern BPrivateScreen *gPrivateScreen;
|
extern BPrivateScreen *gPrivateScreen;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
using namespace BPrivate;
|
||||||
|
|
||||||
BPrivateScreen *
|
BPrivateScreen *
|
||||||
BPrivateScreen::CheckOut(BWindow *win)
|
BPrivateScreen::CheckOut(BWindow *win)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user