diff --git a/src/kits/Jamfile b/src/kits/Jamfile index 2ba1151353..9ea2a38c4f 100644 --- a/src/kits/Jamfile +++ b/src/kits/Jamfile @@ -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) { diff --git a/src/kits/app/Application.cpp b/src/kits/app/Application.cpp index 2b4b00d4e1..1b9d2709e7 100644 --- a/src/kits/app/Application.cpp +++ b/src/kits/app/Application.cpp @@ -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. diff --git a/src/kits/interface/Bitmap.cpp b/src/kits/interface/Bitmap.cpp index a8f182ca7f..f96f1c73ad 100644 --- a/src/kits/interface/Bitmap.cpp +++ b/src/kits/interface/Bitmap.cpp @@ -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;