Introduced a new build flag and macro RUN_WITHOUT_APP_SERVER, to allow

several things to work without a running app server (the Storage Kit to
begin with).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8695 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2004-08-28 20:18:31 +00:00
parent db10640de9
commit 044be4e258
3 changed files with 38 additions and 3 deletions

View File

@ -8,6 +8,14 @@ if $(RUN_WITHOUT_REGISTRAR) {
SubDirC++Flags $(defines) ;
}
# If defined allows to run applications without the app server
# -- needed until the app server runs on our kernel.
if $(RUN_WITHOUT_APP_SERVER) {
local defines = [ FDefines RUN_WITHOUT_APP_SERVER ] ;
SubDirCcFlags $(defines) ;
SubDirC++Flags $(defines) ;
}
# Collect libopenbeos.so sources.
subdirs = app interface support storage ;
for subdir in $(subdirs) {

View File

@ -251,10 +251,12 @@ BApplication::~BApplication()
// unregister from the roster
BRoster::Private().RemoveApp(Team());
#ifndef RUN_WITHOUT_APP_SERVER
// tell app_server we're quitting...
BPortLink link(fServerFrom);
link.StartMessage(B_QUIT_REQUESTED);
link.Flush();
#endif // RUN_WITHOUT_APP_SERVER
// uninitialize be_app and be_app_messenger
be_app = NULL;
@ -853,6 +855,7 @@ void BApplication::InitData(const char* signature, status_t* error)
// TODO: Not completely sure about the order, but this should be close.
#ifndef RUN_WITHOUT_APP_SERVER
// An app_server connection is necessary for a lot of stuff, so get that first.
if (fInitError == B_OK)
connect_to_app_server();
@ -860,6 +863,7 @@ void BApplication::InitData(const char* signature, status_t* error)
setup_server_heaps();
if (fInitError == B_OK)
get_scs();
#endif // RUN_WITHOUT_APP_SERVER
// init be_app and be_app_messenger
@ -868,10 +872,12 @@ void BApplication::InitData(const char* signature, status_t* error)
be_app_messenger = BMessenger(NULL, this);
}
#ifndef RUN_WITHOUT_APP_SERVER
// Initialize the IK after we have set be_app because of a construction of a
// BAppServerLink (which depends on be_app) nested inside the call to get_menu_info.
if (fInitError == B_OK)
fInitError = _init_interface_kit_();
#endif // RUN_WITHOUT_APP_SERVER
// set the BHandler's name
if (fInitError == B_OK)
SetName(ref.name);
@ -882,10 +888,12 @@ void BApplication::InitData(const char* signature, status_t* error)
create_app_meta_mime(path.Path(), false, true, false);
}
#ifndef RUN_WITHOUT_APP_SERVER
// create global system cursors
// ToDo: these could have a predefined server token to safe the communication!
B_CURSOR_SYSTEM_DEFAULT = new BCursor(B_HAND_CURSOR);
B_CURSOR_I_BEAM = new BCursor(B_I_BEAM_CURSOR);
#endif // RUN_WITHOUT_APP_SERVER
// Return the error or exit, if there was an error and no error variable
// has been supplied.

View File

@ -830,6 +830,9 @@ BBitmap::~BBitmap()
// TODO: don't free fBasePtr, as it's owned by the app_server
// should probably decrement an associated reference count, though,
// so the app_server knows this bitmap isn't used anymore
#ifdef RUN_WITHOUT_APP_SERVER
free(fBasePtr);
#endif // RUN_WITHOUT_APP_SERVER
}
// unarchiving constructor
@ -2158,13 +2161,18 @@ BBitmap::InitObject(BRect bounds, color_space colorSpace, uint32 flags,
{
status_t error = B_OK;
#ifndef RUN_WITHOUT_APP_SERVER
BPrivate::BAppServerLink link;
#endif // RUN_WITHOUT_APP_SERVER
// clean up
if (fBasePtr) {
// free(fBasePtr);
#ifdef RUN_WITHOUT_APP_SERVER
free(fBasePtr);
#endif // RUN_WITHOUT_APP_SERVER
fBasePtr = NULL;
#ifndef RUN_WITHOUT_APP_SERVER
// AS_DELETE_BITMAP:
// Attached Data:
// 1) int32 server token
@ -2183,6 +2191,7 @@ BBitmap::InitObject(BRect bounds, color_space colorSpace, uint32 flags,
fBasePtr=NULL;
fArea=-1;
fServerToken=-1;
#endif // RUN_WITHOUT_APP_SERVER
}
// check params
if (!bounds.IsValid() || !is_supported(colorSpace))
@ -2197,8 +2206,17 @@ BBitmap::InitObject(BRect bounds, color_space colorSpace, uint32 flags,
// allocate the bitmap buffer
if (error == B_OK) {
int32 size = bytesPerRow * (bounds.IntegerHeight() + 1);
// fBasePtr = malloc(size);
#ifdef RUN_WITHOUT_APP_SERVER
fBasePtr = malloc(size);
if (fBasePtr) {
fSize = size;
fColorSpace = colorSpace;
fBounds = bounds;
fBytesPerRow = bytesPerRow;
fFlags = flags;
} else
error = B_NO_MEMORY;
#else
// Ask the server (via our owning application) to create a bitmap.
// Attach Data:
@ -2262,6 +2280,7 @@ BBitmap::InitObject(BRect bounds, color_space colorSpace, uint32 flags,
error = B_NO_MEMORY;
}
#endif // RUN_WITHOUT_APP_SERVER
fWindow = NULL;
fToken = -1;
fOrigArea = -1;