Send out B_SOME_APP_LAUNCHED/QUIT messages only for fully registered
apps. This fixes bug #948. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20058 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -238,6 +238,8 @@ PRINT(("ref: %ld, %lld, %s\n", ref.device, ref.directory, ref.name));
|
|||||||
{
|
{
|
||||||
PRINT(("added ref: %ld, %lld, %s\n", info->ref.device, info->ref.directory, info->ref.name));
|
PRINT(("added ref: %ld, %lld, %s\n", info->ref.device, info->ref.directory, info->ref.name));
|
||||||
addingSuccess = (AddApp(info) == B_OK);
|
addingSuccess = (AddApp(info) == B_OK);
|
||||||
|
if (addingSuccess && fullReg)
|
||||||
|
_AppAdded(info);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
token = info->token = _NextToken();
|
token = info->token = _NextToken();
|
||||||
@@ -324,6 +326,7 @@ TRoster::HandleCompleteRegistration(BMessage *request)
|
|||||||
info->thread = thread;
|
info->thread = thread;
|
||||||
info->port = port;
|
info->port = port;
|
||||||
info->state = APP_STATE_REGISTERED;
|
info->state = APP_STATE_REGISTERED;
|
||||||
|
_AppAdded(info);
|
||||||
} else
|
} else
|
||||||
SET_ERROR(error, B_REG_APP_NOT_PRE_REGISTERED);
|
SET_ERROR(error, B_REG_APP_NOT_PRE_REGISTERED);
|
||||||
} else
|
} else
|
||||||
@@ -1202,9 +1205,7 @@ TRoster::AddApp(RosterAppInfo *info)
|
|||||||
|
|
||||||
status_t error = (info ? B_OK : B_BAD_VALUE);
|
status_t error = (info ? B_OK : B_BAD_VALUE);
|
||||||
if (info) {
|
if (info) {
|
||||||
if (fRegisteredApps.AddInfo(info))
|
if (!fRegisteredApps.AddInfo(info))
|
||||||
_AppAdded(info);
|
|
||||||
else
|
|
||||||
error = B_NO_MEMORY;
|
error = B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
@@ -1223,11 +1224,13 @@ TRoster::RemoveApp(RosterAppInfo *info)
|
|||||||
|
|
||||||
if (info) {
|
if (info) {
|
||||||
if (fRegisteredApps.RemoveInfo(info)) {
|
if (fRegisteredApps.RemoveInfo(info)) {
|
||||||
|
if (info->state == APP_STATE_REGISTERED) {
|
||||||
info->state = APP_STATE_UNREGISTERED;
|
info->state = APP_STATE_UNREGISTERED;
|
||||||
_AppRemoved(info);
|
_AppRemoved(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Activates the application identified by \a info.
|
/*! \brief Activates the application identified by \a info.
|
||||||
@@ -1433,7 +1436,7 @@ TRoster::RemoveWatcher(Watcher *watcher)
|
|||||||
|
|
||||||
|
|
||||||
// _AppAdded
|
// _AppAdded
|
||||||
/*! \brief Hook method invoked, when an application has been added.
|
/*! \brief Hook method invoked, when an application has been fully registered.
|
||||||
\param info The RosterAppInfo of the added application.
|
\param info The RosterAppInfo of the added application.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
@@ -1447,7 +1450,7 @@ TRoster::_AppAdded(RosterAppInfo *info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// _AppRemoved
|
// _AppRemoved
|
||||||
/*! \brief Hook method invoked, when an application has been removed.
|
/*! \brief Hook method invoked, when a fully registered application has been removed.
|
||||||
\param info The RosterAppInfo of the removed application.
|
\param info The RosterAppInfo of the removed application.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
@@ -1457,6 +1460,7 @@ TRoster::_AppRemoved(RosterAppInfo *info)
|
|||||||
// deactivate the app, if it was the active one
|
// deactivate the app, if it was the active one
|
||||||
if (info == fActiveApp)
|
if (info == fActiveApp)
|
||||||
UpdateActiveApp(NULL);
|
UpdateActiveApp(NULL);
|
||||||
|
|
||||||
// notify the watchers
|
// notify the watchers
|
||||||
BMessage message(B_SOME_APP_QUIT);
|
BMessage message(B_SOME_APP_QUIT);
|
||||||
_AddMessageWatchingInfo(&message, info);
|
_AddMessageWatchingInfo(&message, info);
|
||||||
@@ -1473,8 +1477,7 @@ void
|
|||||||
TRoster::_AppActivated(RosterAppInfo *info)
|
TRoster::_AppActivated(RosterAppInfo *info)
|
||||||
{
|
{
|
||||||
if (info) {
|
if (info) {
|
||||||
if (info->state == APP_STATE_REGISTERED
|
if (info->state == APP_STATE_REGISTERED) {
|
||||||
|| info->state == APP_STATE_PRE_REGISTERED) {
|
|
||||||
// send B_APP_ACTIVATED to the app
|
// send B_APP_ACTIVATED to the app
|
||||||
BMessenger messenger;
|
BMessenger messenger;
|
||||||
BMessenger::Private messengerPrivate(messenger);
|
BMessenger::Private messengerPrivate(messenger);
|
||||||
@@ -1501,8 +1504,7 @@ void
|
|||||||
TRoster::_AppDeactivated(RosterAppInfo *info)
|
TRoster::_AppDeactivated(RosterAppInfo *info)
|
||||||
{
|
{
|
||||||
if (info) {
|
if (info) {
|
||||||
if (info->state == APP_STATE_REGISTERED
|
if (info->state == APP_STATE_REGISTERED) {
|
||||||
|| info->state == APP_STATE_PRE_REGISTERED) {
|
|
||||||
// send B_APP_ACTIVATED to the app
|
// send B_APP_ACTIVATED to the app
|
||||||
BMessenger messenger;
|
BMessenger messenger;
|
||||||
BMessenger::Private messengerPrivate(messenger);
|
BMessenger::Private messengerPrivate(messenger);
|
||||||
|
|||||||
Reference in New Issue
Block a user