* 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
+16 -17
View File
@@ -1106,14 +1106,17 @@ Desktop::_UpdateFloating(int32 previousWorkspace, int32 nextWorkspace,
&& floating->Feel() != B_FLOATING_APP_WINDOW_FEEL) && floating->Feel() != B_FLOATING_APP_WINDOW_FEEL)
continue; continue;
if (fFront != NULL && fFront->IsNormal() && floating->HasInSubset(fFront)) { if (fFront != NULL && fFront->IsNormal()
&& floating->HasInSubset(fFront)) {
// is now visible // is now visible
if (_Windows(previousWorkspace).HasWindow(floating) if (_Windows(previousWorkspace).HasWindow(floating)
&& previousWorkspace != nextWorkspace) { && previousWorkspace != nextWorkspace
&& !floating->InSubsetWorkspace(previousWorkspace)) {
// but no longer on the previous workspace // but no longer on the previous workspace
_Windows(previousWorkspace).RemoveWindow(floating); _Windows(previousWorkspace).RemoveWindow(floating);
floating->SetCurrentWorkspace(-1); floating->SetCurrentWorkspace(-1);
} }
if (!_Windows(nextWorkspace).HasWindow(floating)) { if (!_Windows(nextWorkspace).HasWindow(floating)) {
// but wasn't before // but wasn't before
_Windows(nextWorkspace).AddWindow(floating, _Windows(nextWorkspace).AddWindow(floating,
@@ -1122,11 +1125,11 @@ Desktop::_UpdateFloating(int32 previousWorkspace, int32 nextWorkspace,
if (mouseEventWindow != fFront) if (mouseEventWindow != fFront)
_ShowWindow(floating); _ShowWindow(floating);
// TODO: // TODO: put the floating last in the floating window list to
// put the floating last in the floating window list to preserve // preserve the on screen window order
// 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 // was visible, but is no longer
_Windows(previousWorkspace).RemoveWindow(floating); _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) (only desktop windows can't be back windows)
*/ */
void 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) (only normal and modal windows can be front windows)
The only place where you don't want to update floating windows is 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. specifed window.
If newIndex is not -1, it will move all subset windows that belong to 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 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)) { if (subset->HasInSubset(window)) {
// adopt the workspace change // adopt the workspace change
if (newIndex != -1) { SetWindowWorkspaces(subset, subset->SubsetWorkspaces());
_Windows(newIndex).AddWindow(subset);
_Windows(previousIndex).RemoveWindow(subset);
} else
SetWindowWorkspaces(subset, subset->SubsetWorkspaces());
} }
} }
} }
@@ -1967,6 +1963,9 @@ void
Desktop::_ChangeWindowWorkspaces(Window* window, uint32 oldWorkspaces, Desktop::_ChangeWindowWorkspaces(Window* window, uint32 oldWorkspaces,
uint32 newWorkspaces) uint32 newWorkspaces)
{ {
if (oldWorkspaces == newWorkspaces)
return;
// apply changes to the workspaces' window lists // apply changes to the workspaces' window lists
LockAllWindows(); LockAllWindows();
+11
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 // #pragma mark - static
+8 -7
View File
@@ -209,6 +209,7 @@ public:
bool HasInSubset(const Window* window) const; bool HasInSubset(const Window* window) const;
bool SameSubset(Window* window); bool SameSubset(Window* window);
uint32 SubsetWorkspaces() const; uint32 SubsetWorkspaces() const;
bool InSubsetWorkspace(int32 index) const;
bool HasWorkspacesViews() const bool HasWorkspacesViews() const
{ return fWorkspacesViewCount != 0; } { return fWorkspacesViewCount != 0; }
@@ -250,7 +251,7 @@ protected:
void _ObeySizeLimits(); void _ObeySizeLimits();
void _PropagatePosition(); void _PropagatePosition();
BString fTitle; BString fTitle;
// TODO: no fp rects anywhere // TODO: no fp rects anywhere
BRect fFrame; BRect fFrame;
@@ -259,7 +260,7 @@ protected:
// the visible region is only recalculated from the // the visible region is only recalculated from the
// Desktop thread, when using it, Desktop::ReadLockClipping() // Desktop thread, when using it, Desktop::ReadLockClipping()
// has to be called // has to be called
BRegion fVisibleRegion; BRegion fVisibleRegion;
BRegion fVisibleContentRegion; BRegion fVisibleContentRegion;
// our part of the "global" dirty region // our part of the "global" dirty region
@@ -313,15 +314,15 @@ protected:
public: public:
UpdateSession(); UpdateSession();
virtual ~UpdateSession(); virtual ~UpdateSession();
void Include(BRegion* additionalDirty); void Include(BRegion* additionalDirty);
void Exclude(BRegion* dirtyInNextSession); void Exclude(BRegion* dirtyInNextSession);
inline BRegion& DirtyRegion() inline BRegion& DirtyRegion()
{ return fDirtyRegion; } { return fDirtyRegion; }
void MoveBy(int32 x, int32 y); void MoveBy(int32 x, int32 y);
void SetUsed(bool used); void SetUsed(bool used);
inline bool IsUsed() const inline bool IsUsed() const
{ return fInUse; } { return fInUse; }
@@ -331,7 +332,7 @@ protected:
{ return fCause & UPDATE_EXPOSE; } { return fCause & UPDATE_EXPOSE; }
inline bool IsRequest() const inline bool IsRequest() const
{ return fCause & UPDATE_REQUEST; } { return fCause & UPDATE_REQUEST; }
private: private:
BRegion fDirtyRegion; BRegion fDirtyRegion;
bool fInUse; bool fInUse;