diff --git a/headers/os/app/Application.h b/headers/os/app/Application.h index 0df9705d39..5816e99cf2 100644 --- a/headers/os/app/Application.h +++ b/headers/os/app/Application.h @@ -151,8 +151,8 @@ private: BWindow* window_at(uint32 index, bool incl_menus) const; status_t get_window_list(BList* list, bool incl_menus) const; static int32 async_quit_entry(void*); - static BResources* _app_resources; - static BLocker _app_resources_lock; + static BResources* sAppResources; + static BLocker sAppResourcesLock; const char* fAppName; BPrivate::PortLink* fServerLink; diff --git a/src/kits/app/Application.cpp b/src/kits/app/Application.cpp index d86bbb5722..613ef659fd 100644 --- a/src/kits/app/Application.cpp +++ b/src/kits/app/Application.cpp @@ -44,8 +44,8 @@ using namespace BPrivate; BApplication *be_app = NULL; BMessenger be_app_messenger; -BResources *BApplication::_app_resources = NULL; -BLocker BApplication::_app_resources_lock("_app_resources_lock"); +BResources *BApplication::sAppResources = NULL; +BLocker BApplication::sAppResourcesLock("_app_resources_lock"); static property_info sPropertyInfo[] = { @@ -566,12 +566,8 @@ BApplication::MessageReceived(BMessage *message) BMessage specifier; int32 what; const char *property = NULL; - bool scriptHandled = false; - if (message->GetCurrentSpecifier(&index, &specifier, &what, &property) == B_OK) { - if (ScriptReceived(message, index, &specifier, what, property)) - scriptHandled = true; - } - if (!scriptHandled) + if (message->GetCurrentSpecifier(&index, &specifier, &what, &property) < B_OK) + || !ScriptReceived(message, index, &specifier, what, property)) BLooper::MessageReceived(message); break; } @@ -761,15 +757,12 @@ BApplication::GetAppInfo(app_info *info) const BResources * BApplication::AppResources() { - if (!_app_resources_lock.Lock()) - return NULL; - + BObjectLocker lock(sAppResourcesLock); + // BApplication caches its resources, so check // if it already happened. - if (_app_resources != NULL) { - _app_resources_lock.Unlock(); - return _app_resources; - } + if (sAppResources != NULL) + return sAppResources; entry_ref ref; bool found = false; @@ -792,13 +785,11 @@ BApplication::AppResources() if (resources->SetTo(&file, false) < B_OK) delete resources; else - _app_resources = resources; + sAppResources = resources; } } - _app_resources_lock.Unlock(); - - return _app_resources; + return sAppResources; } @@ -878,8 +869,6 @@ BApplication::DispatchMessage(BMessage *message, BHandler *handler) } // TODO: Handle these as well - // 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:"); diff --git a/src/kits/app/Handler.cpp b/src/kits/app/Handler.cpp index b8b91660f7..3ccc59ca81 100644 --- a/src/kits/app/Handler.cpp +++ b/src/kits/app/Handler.cpp @@ -673,7 +673,8 @@ BMessage: what = (0x0, or 0) status_t BHandler::StartWatching(BMessenger messenger, uint32 what) { - fObserverList ? fObserverList : fObserverList = new _ObserverList; + if (fObserverList == NULL) + fObserverList = new _ObserverList; return fObserverList->StartObserving(messenger, what); } @@ -681,15 +682,15 @@ BHandler::StartWatching(BMessenger messenger, uint32 what) status_t BHandler::StartWatchingAll(BMessenger messenger) { - fObserverList ? fObserverList : fObserverList = new _ObserverList; - return fObserverList->StartObserving(messenger, B_OBSERVER_OBSERVE_ALL); + return StartWatching(messenger, B_OBSERVER_OBSERVE_ALL); } status_t BHandler::StopWatching(BMessenger messenger, uint32 what) { - fObserverList ? fObserverList : fObserverList = new _ObserverList; + if (fObserverList == NULL) + fObserverList = new _ObserverList; return fObserverList->StopObserving(messenger, what); } @@ -697,8 +698,7 @@ BHandler::StopWatching(BMessenger messenger, uint32 what) status_t BHandler::StopWatchingAll(BMessenger messenger) { - fObserverList ? fObserverList : fObserverList = new _ObserverList; - return fObserverList->StopObserving(messenger, B_OBSERVER_OBSERVE_ALL); + return StopWatching(messenger, B_OBSERVER_OBSERVE_ALL); } @@ -721,7 +721,8 @@ BHandler::StartWatchingAll(BHandler *handler) status_t BHandler::StopWatching(BHandler *handler, uint32 what) { - fObserverList ? fObserverList : fObserverList = new _ObserverList; + if (fObserverList == NULL) + fObserverList = new _ObserverList; return fObserverList->StopObserving(handler, what); } @@ -729,8 +730,7 @@ BHandler::StopWatching(BHandler *handler, uint32 what) status_t BHandler::StopWatchingAll(BHandler *handler) { - fObserverList ? fObserverList : fObserverList = new _ObserverList; - return fObserverList->StopObserving(handler, B_OBSERVER_OBSERVE_ALL); + return StopWatching(handler, B_OBSERVER_OBSERVE_ALL); } diff --git a/src/kits/interface/BTextView/TextView.cpp b/src/kits/interface/BTextView/TextView.cpp index 9971096c5d..56aed0f357 100644 --- a/src/kits/interface/BTextView/TextView.cpp +++ b/src/kits/interface/BTextView/TextView.cpp @@ -1538,17 +1538,15 @@ BTextView::GetSelection(int32 *outStart, int32 *outEnd) const void -BTextView::SetFontAndColor(const BFont *inFont, uint32 inMode, - const rgb_color *inColor) +BTextView::SetFontAndColor(const BFont *inFont, uint32 inMode, const rgb_color *inColor) { SetFontAndColor(fSelStart, fSelEnd, inFont, inMode, inColor); } void -BTextView::SetFontAndColor(int32 startOffset, int32 endOffset, - const BFont *inFont, uint32 inMode, - const rgb_color *inColor) +BTextView::SetFontAndColor(int32 startOffset, int32 endOffset, const BFont *inFont, + uint32 inMode, const rgb_color *inColor) { CALLED(); @@ -2679,10 +2677,7 @@ BTextView::UnflattenRunArray(const void *data, int32 *outSize) run_array->runs[i].font.SetSize(array->styles[i].size); run_array->runs[i].font.SetShear(array->styles[i].shear); run_array->runs[i].font.SetFace(array->styles[i].face); - run_array->runs[i].color.red = array->styles[i].red; - run_array->runs[i].color.green = array->styles[i].green; - run_array->runs[i].color.blue = array->styles[i].blue; - run_array->runs[i].color.alpha = array->styles[i].alpha; + run_array->runs[i].color = array->styles[i]; } if (outSize) diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp index 32e9344a1f..f49c1e8b0c 100644 --- a/src/kits/interface/View.cpp +++ b/src/kits/interface/View.cpp @@ -3556,7 +3556,7 @@ BView::ResolveSpecifier(BMessage *msg, int32 index, BMessage *specifier, BMessage replyMsg(B_MESSAGE_NOT_UNDERSTOOD); replyMsg.AddInt32("error", B_NAME_NOT_FOUND); - replyMsg.AddString("message", "This window doesn't have a self"); + replyMsg.AddString("message", "This window doesn't have a shelf"); msg->SendReply(&replyMsg); return NULL; }