* Modal windows are now correctly taken into account: no click go through to a

window with a modal window. This also completes the fix for bug #439.
* Made some methods const that should have been const in the first place.
* Note, there is now a Desktop::_WindowHasModal() and WindowLayer::HasModal() -
  the latter only works in the current workspace.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17121 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-04-13 13:56:01 +00:00
parent b57f2b537e
commit cc4612fe3f
2 changed files with 30 additions and 6 deletions
+25 -3
View File
@@ -532,14 +532,14 @@ WindowLayer::Anchor(int32 index)
WindowLayer*
WindowLayer::NextWindow(int32 index)
WindowLayer::NextWindow(int32 index) const
{
return fAnchor[index].next;
}
WindowLayer*
WindowLayer::PreviousWindow(int32 index)
WindowLayer::PreviousWindow(int32 index) const
{
return fAnchor[index].previous;
}
@@ -793,6 +793,9 @@ WindowLayer::MouseDown(BMessage* message, BPoint where, int32* _viewToken)
}
} else {
if (ViewLayer* view = ViewAt(where)) {
if (HasModal())
return;
// clicking a simple ViewLayer
if (!IsFocus()) {
DesktopSettings desktopSettings(fDesktop);
@@ -865,6 +868,9 @@ WindowLayer::MouseUp(BMessage* message, BPoint where, int32* _viewToken)
fIsSlidingTab = false;
if (ViewLayer* view = ViewAt(where)) {
if (HasModal())
return;
*_viewToken = view->Token();
view->MouseUp(message, where);
}
@@ -1316,6 +1322,22 @@ WindowLayer::IsNormal() const
}
bool
WindowLayer::HasModal() const
{
for (WindowLayer* window = NextWindow(fCurrentWorkspace); window != NULL;
window = window->NextWindow(fCurrentWorkspace)) {
if (window->IsHidden() || !window->IsModal())
continue;
if (window->HasInSubset(this))
return true;
}
return false;
}
/*!
\brief Returns the windows that's in behind of the backmost position
this window can get.
@@ -1399,7 +1421,7 @@ WindowLayer::RemoveFromSubset(WindowLayer* window)
bool
WindowLayer::HasInSubset(WindowLayer* window)
WindowLayer::HasInSubset(const WindowLayer* window) const
{
if (fFeel == window->Feel() || fFeel == B_NORMAL_WINDOW_FEEL)
return false;
+5 -3
View File
@@ -49,8 +49,8 @@ class WindowLayer {
const char* Title() const { return fTitle.String(); }
window_anchor& Anchor(int32 index);
WindowLayer* NextWindow(int32 index);
WindowLayer* PreviousWindow(int32 index);
WindowLayer* NextWindow(int32 index) const;
WindowLayer* PreviousWindow(int32 index) const;
::Desktop* Desktop() const { return fDesktop; }
::Decorator* Decorator() const { return fDecorator; }
@@ -188,12 +188,14 @@ class WindowLayer {
bool IsFloating() const;
bool IsNormal() const;
bool HasModal() const;
WindowLayer* Frontmost(WindowLayer* first = NULL, int32 workspace = -1);
WindowLayer* Backmost(WindowLayer* first = NULL, int32 workspace = -1);
bool AddToSubset(WindowLayer* window);
void RemoveFromSubset(WindowLayer* window);
bool HasInSubset(WindowLayer* window);
bool HasInSubset(const WindowLayer* window) const;
bool SameSubset(WindowLayer* window);
uint32 SubsetWorkspaces() const;