* Desktop::_UpdateFloating() and Desktop::_UpdateSubsetWorkspaces() both

assumed that there was only a single window that was responsible for the
  workspaces of a floating/subset window. Of course, any number of windows
  can make up the workspaces of those. This fixes bug #2506.
* Added a Window::InSubsetWorkspace() method to complement SubsetWorkspaces().
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26371 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2008-07-10 14:17:23 +00:00
parent d24ece5186
commit bd2509c549
3 changed files with 35 additions and 24 deletions

View File

@ -1106,14 +1106,17 @@ Desktop::_UpdateFloating(int32 previousWorkspace, int32 nextWorkspace,
&& floating->Feel() != B_FLOATING_APP_WINDOW_FEEL)
continue;
if (fFront != NULL && fFront->IsNormal() && floating->HasInSubset(fFront)) {
if (fFront != NULL && fFront->IsNormal()
&& floating->HasInSubset(fFront)) {
// is now visible
if (_Windows(previousWorkspace).HasWindow(floating)
&& previousWorkspace != nextWorkspace) {
&& previousWorkspace != nextWorkspace
&& !floating->InSubsetWorkspace(previousWorkspace)) {
// but no longer on the previous workspace
_Windows(previousWorkspace).RemoveWindow(floating);
floating->SetCurrentWorkspace(-1);
}
if (!_Windows(nextWorkspace).HasWindow(floating)) {
// but wasn't before
_Windows(nextWorkspace).AddWindow(floating,
@ -1122,11 +1125,11 @@ Desktop::_UpdateFloating(int32 previousWorkspace, int32 nextWorkspace,
if (mouseEventWindow != fFront)
_ShowWindow(floating);
// TODO:
// put the floating last in the floating window list to preserve
// the on screen window order
// TODO: put the floating last in the floating window list to
// preserve the on screen window order
}
} else if (_Windows(previousWorkspace).HasWindow(floating)) {
} else if (_Windows(previousWorkspace).HasWindow(floating)
&& !floating->InSubsetWorkspace(previousWorkspace)) {
// was visible, but is no longer
_Windows(previousWorkspace).RemoveWindow(floating);
@ -1140,8 +1143,7 @@ Desktop::_UpdateFloating(int32 previousWorkspace, int32 nextWorkspace,
}
/*!
Search the visible windows for a valid back window
/*! Search the visible windows for a valid back window
(only desktop windows can't be back windows)
*/
void
@ -1160,8 +1162,7 @@ Desktop::_UpdateBack()
}
/*!
Search the visible windows for a valid front window
/*! Search the visible windows for a valid front window
(only normal and modal windows can be front windows)
The only place where you don't want to update floating windows is
@ -1915,8 +1916,7 @@ Desktop::SetWindowDecoratorSettings(Window* window, const BMessage& settings)
}
/*!
Updates the workspaces of all subset windows with regard to the
/*! Updates the workspaces of all subset windows with regard to the
specifed window.
If newIndex is not -1, it will move all subset windows that belong to
the specifed window to the new workspace; this form is only called by
@ -1950,11 +1950,7 @@ Desktop::_UpdateSubsetWorkspaces(Window* window, int32 previousIndex,
if (subset->HasInSubset(window)) {
// adopt the workspace change
if (newIndex != -1) {
_Windows(newIndex).AddWindow(subset);
_Windows(previousIndex).RemoveWindow(subset);
} else
SetWindowWorkspaces(subset, subset->SubsetWorkspaces());
SetWindowWorkspaces(subset, subset->SubsetWorkspaces());
}
}
}
@ -1967,6 +1963,9 @@ void
Desktop::_ChangeWindowWorkspaces(Window* window, uint32 oldWorkspaces,
uint32 newWorkspaces)
{
if (oldWorkspaces == newWorkspaces)
return;
// apply changes to the workspaces' window lists
LockAllWindows();

View File

@ -1606,6 +1606,17 @@ Window::SubsetWorkspaces() const
}
/*! Returns wether or not a window is in the subset workspace list with the
specified \a index.
See SubsetWorkspaces().
*/
bool
Window::InSubsetWorkspace(int32 index) const
{
return (SubsetWorkspaces() & (1UL << index)) != 0;
}
// #pragma mark - static

View File

@ -209,6 +209,7 @@ public:
bool HasInSubset(const Window* window) const;
bool SameSubset(Window* window);
uint32 SubsetWorkspaces() const;
bool InSubsetWorkspace(int32 index) const;
bool HasWorkspacesViews() const
{ return fWorkspacesViewCount != 0; }
@ -250,7 +251,7 @@ protected:
void _ObeySizeLimits();
void _PropagatePosition();
BString fTitle;
BString fTitle;
// TODO: no fp rects anywhere
BRect fFrame;
@ -259,7 +260,7 @@ protected:
// the visible region is only recalculated from the
// Desktop thread, when using it, Desktop::ReadLockClipping()
// has to be called
BRegion fVisibleRegion;
BRegion fVisibleContentRegion;
// our part of the "global" dirty region
@ -313,15 +314,15 @@ protected:
public:
UpdateSession();
virtual ~UpdateSession();
void Include(BRegion* additionalDirty);
void Exclude(BRegion* dirtyInNextSession);
inline BRegion& DirtyRegion()
{ return fDirtyRegion; }
void MoveBy(int32 x, int32 y);
void SetUsed(bool used);
inline bool IsUsed() const
{ return fInUse; }
@ -331,7 +332,7 @@ protected:
{ return fCause & UPDATE_EXPOSE; }
inline bool IsRequest() const
{ return fCause & UPDATE_REQUEST; }
private:
BRegion fDirtyRegion;
bool fInUse;