Fix bug in NotificationWindow where the window would be double hidden.
Also simplify and rename _ResizeAll(), now that AppGroupViews remove themselves.
This commit is contained in:
@@ -98,7 +98,7 @@ NotificationWindow::WorkspaceActivated(int32 /*workspace*/, bool active)
|
|||||||
{
|
{
|
||||||
// Ensure window is in the correct position
|
// Ensure window is in the correct position
|
||||||
if (active)
|
if (active)
|
||||||
_ResizeAll();
|
_ShowHide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -187,7 +187,7 @@ NotificationWindow::MessageReceived(BMessage* message)
|
|||||||
|
|
||||||
group->AddInfo(view);
|
group->AddInfo(view);
|
||||||
|
|
||||||
_ResizeAll();
|
_ShowHide();
|
||||||
|
|
||||||
reply.AddInt32("error", B_OK);
|
reply.AddInt32("error", B_OK);
|
||||||
} else
|
} else
|
||||||
@@ -210,8 +210,6 @@ NotificationWindow::MessageReceived(BMessage* message)
|
|||||||
|
|
||||||
if (it != fViews.end())
|
if (it != fViews.end())
|
||||||
fViews.erase(it);
|
fViews.erase(it);
|
||||||
|
|
||||||
_ResizeAll();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kRemoveGroupView:
|
case kRemoveGroupView:
|
||||||
@@ -233,8 +231,7 @@ NotificationWindow::MessageReceived(BMessage* message)
|
|||||||
if (GetLayout()->RemoveView(view))
|
if (GetLayout()->RemoveView(view))
|
||||||
delete view;
|
delete view;
|
||||||
|
|
||||||
if (fAppViews.size() == 0)
|
_ShowHide();
|
||||||
Hide();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -311,39 +308,14 @@ NotificationWindow::Width()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
NotificationWindow::_ResizeAll()
|
NotificationWindow::_ShowHide()
|
||||||
{
|
{
|
||||||
appview_t::iterator aIt;
|
if (fAppViews.empty() && !IsHidden()) {
|
||||||
bool shouldHide = true;
|
Hide();
|
||||||
|
|
||||||
for (aIt = fAppViews.begin(); aIt != fAppViews.end(); aIt++) {
|
|
||||||
AppGroupView* app = aIt->second;
|
|
||||||
if (app->HasChildren()) {
|
|
||||||
shouldHide = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shouldHide) {
|
|
||||||
if (!IsHidden())
|
|
||||||
Hide();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (aIt = fAppViews.begin(); aIt != fAppViews.end(); aIt++) {
|
|
||||||
AppGroupView* view = aIt->second;
|
|
||||||
|
|
||||||
if (!view->HasChildren()) {
|
|
||||||
if (!view->IsHidden())
|
|
||||||
view->Hide();
|
|
||||||
} else {
|
|
||||||
if (view->IsHidden())
|
|
||||||
view->Show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SetPosition();
|
SetPosition();
|
||||||
|
|
||||||
if (IsHidden())
|
if (IsHidden())
|
||||||
Show();
|
Show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public:
|
|||||||
int32 Timeout();
|
int32 Timeout();
|
||||||
float Width();
|
float Width();
|
||||||
|
|
||||||
void _ResizeAll();
|
void _ShowHide();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class AppGroupView;
|
friend class AppGroupView;
|
||||||
|
|||||||
Reference in New Issue
Block a user