Fixed some bugs and added some missing functionality:
- DispatchMessage() would swallow all handled messages, no matter if they were intended for this handler. - B_REFS_RECEIVED does now maintain the recent folder/document lists. - Now calls Pulse() when a B_PULSE is received. - No longer calls ReadyToRun() more than once, no matter how many B_READY_TO_RUN are sent to the app. - Added B_APP_ACTIVATED to the yet unhandled messages; furthermore, the known unhandled messages now dump themselves to stdout. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10494 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -616,38 +616,80 @@ BResources* BApplication::AppResources()
|
|||||||
|
|
||||||
return _app_resources;
|
return _app_resources;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BApplication::DispatchMessage(BMessage* message, BHandler* handler)
|
BApplication::DispatchMessage(BMessage *message, BHandler *handler)
|
||||||
{
|
{
|
||||||
|
if (handler != this) {
|
||||||
|
// it's not ours to dispatch
|
||||||
|
BLooper::DispatchMessage(message, handler);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
case B_ARGV_RECEIVED:
|
case B_ARGV_RECEIVED:
|
||||||
do_argv(message);
|
do_argv(message);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B_REFS_RECEIVED:
|
case B_REFS_RECEIVED:
|
||||||
|
{
|
||||||
|
// this adds the refs that are part of this message to the recent
|
||||||
|
// lists, but only folders and documents are handled here
|
||||||
|
entry_ref ref;
|
||||||
|
int32 i = 0;
|
||||||
|
while (message->FindRef("refs", i++, &ref) == B_OK) {
|
||||||
|
BEntry entry(&ref, true);
|
||||||
|
if (entry.InitCheck() != B_OK)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (entry.IsDirectory())
|
||||||
|
BRoster().AddToRecentFolders(&ref);
|
||||||
|
else {
|
||||||
|
// filter out applications, we only want to have documents
|
||||||
|
// in the recent files list
|
||||||
|
BNode node(&entry);
|
||||||
|
BNodeInfo info(&node);
|
||||||
|
|
||||||
|
char mimeType[B_MIME_TYPE_LENGTH];
|
||||||
|
if (info.GetType(mimeType) != B_OK
|
||||||
|
|| strcasecmp(mimeType, B_APP_MIME_TYPE))
|
||||||
|
BRoster().AddToRecentDocuments(&ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RefsReceived(message);
|
RefsReceived(message);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case B_READY_TO_RUN:
|
case B_READY_TO_RUN:
|
||||||
ReadyToRun();
|
if (!fReadyToRunCalled)
|
||||||
|
ReadyToRun();
|
||||||
fReadyToRunCalled = true;
|
fReadyToRunCalled = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B_ABOUT_REQUESTED:
|
case B_ABOUT_REQUESTED:
|
||||||
AboutRequested();
|
AboutRequested();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case B_PULSE:
|
||||||
|
Pulse();
|
||||||
|
break;
|
||||||
|
|
||||||
// TODO: Handle these as well
|
// TODO: Handle these as well
|
||||||
|
|
||||||
|
case _SHOW_DRAG_HANDLES_:
|
||||||
|
case B_APP_ACTIVATED:
|
||||||
|
case B_QUIT_REQUESTED:
|
||||||
|
puts("not yet handled message:");
|
||||||
|
message->PrintToStream();
|
||||||
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// These two are handled by BTextView, don't know if also
|
// These two are handled by BTextView, don't know if also
|
||||||
// by other classes
|
// by other classes
|
||||||
case _DISPOSE_DRAG_:
|
case _DISPOSE_DRAG_:
|
||||||
case _PING_:
|
case _PING_:
|
||||||
|
|
||||||
case _SHOW_DRAG_HANDLES_:
|
|
||||||
case B_QUIT_REQUESTED:
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
*/
|
*/
|
||||||
default:
|
default:
|
||||||
@@ -655,13 +697,17 @@ BApplication::DispatchMessage(BMessage* message, BHandler* handler)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
void BApplication::SetPulseRate(bigtime_t rate)
|
|
||||||
|
void
|
||||||
|
BApplication::SetPulseRate(bigtime_t rate)
|
||||||
{
|
{
|
||||||
fPulseRate = rate;
|
fPulseRate = rate;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
status_t BApplication::GetSupportedSuites(BMessage* data)
|
|
||||||
|
status_t
|
||||||
|
BApplication::GetSupportedSuites(BMessage *data)
|
||||||
{
|
{
|
||||||
status_t err = B_OK;
|
status_t err = B_OK;
|
||||||
if (!data)
|
if (!data)
|
||||||
|
|||||||
Reference in New Issue
Block a user