* WindowLayer::InWorkspace() was actually nowhere used the way it was
implemented; it now only returns wether or not the window is part of the list specified by the index. This fixes bug #195 and #1553. * HasInSubset() would report "true" for app-floating windows vs. modal app windows which was wrong. * Removed SameSubset() as it isn't needed at all. * SubsetWorkspaces() now take the front window into account for floating windows. * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22549 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -68,10 +68,8 @@ using std::nothrow;
|
|||||||
|
|
||||||
|
|
||||||
WindowLayer::WindowLayer(const BRect& frame, const char *name,
|
WindowLayer::WindowLayer(const BRect& frame, const char *name,
|
||||||
window_look look, window_feel feel,
|
window_look look, window_feel feel, uint32 flags, uint32 workspaces,
|
||||||
uint32 flags, uint32 workspaces,
|
::ServerWindow* window, DrawingEngine* drawingEngine)
|
||||||
::ServerWindow* window,
|
|
||||||
DrawingEngine* drawingEngine)
|
|
||||||
:
|
:
|
||||||
fTitle(name),
|
fTitle(name),
|
||||||
fFrame(frame),
|
fFrame(frame),
|
||||||
@@ -1358,47 +1356,13 @@ WindowLayer::SetFlags(uint32 flags, BRegion* updateRegion)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*! Returns wether or not a window is in the workspace list with the
|
||||||
\brief Returns wether or not the window is visible on the specified
|
specified \a index.
|
||||||
workspace.
|
|
||||||
|
|
||||||
A modal or floating window may be visible on a workscreen if one
|
|
||||||
of its subset windows is visible there.
|
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
WindowLayer::InWorkspace(int32 index) const
|
WindowLayer::InWorkspace(int32 index) const
|
||||||
{
|
{
|
||||||
if (IsNormal())
|
return (fWorkspaces & (1UL << index)) != 0;
|
||||||
return (fWorkspaces & (1UL << index)) != 0;
|
|
||||||
|
|
||||||
if (fFeel == B_MODAL_ALL_WINDOW_FEEL
|
|
||||||
|| fFeel == B_FLOATING_ALL_WINDOW_FEEL)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (fFeel == B_FLOATING_APP_WINDOW_FEEL)
|
|
||||||
return ServerWindow()->App()->InWorkspace(index);
|
|
||||||
|
|
||||||
if (fFeel == B_MODAL_APP_WINDOW_FEEL) {
|
|
||||||
uint32 workspaces = ServerWindow()->App()->Workspaces();
|
|
||||||
if (workspaces == 0) {
|
|
||||||
// The application doesn't seem to have any other windows
|
|
||||||
// open or visible - but we'd like to see modal windows
|
|
||||||
// anyway, at least when they are first opened.
|
|
||||||
return index == fDesktop->CurrentWorkspace();
|
|
||||||
}
|
|
||||||
return (workspaces & (1UL << index)) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fFeel == B_MODAL_SUBSET_WINDOW_FEEL
|
|
||||||
|| fFeel == B_FLOATING_SUBSET_WINDOW_FEEL) {
|
|
||||||
for (int32 i = 0; i < fSubsets.CountItems(); i++) {
|
|
||||||
WindowLayer* window = fSubsets.ItemAt(i);
|
|
||||||
if (!window->IsHidden() && window->InWorkspace(index))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1451,8 +1415,7 @@ WindowLayer::HasModal() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*! \brief Returns the windows that's in behind of the backmost position
|
||||||
\brief Returns the windows that's in behind of the backmost position
|
|
||||||
this window can get.
|
this window can get.
|
||||||
Returns NULL is this window can be the backmost window.
|
Returns NULL is this window can be the backmost window.
|
||||||
*/
|
*/
|
||||||
@@ -1481,8 +1444,7 @@ WindowLayer::Backmost(WindowLayer* window, int32 workspace)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*! \brief Returns the windows that's in front of the frontmost position
|
||||||
\brief Returns the windows that's in front of the frontmost position
|
|
||||||
this window can get.
|
this window can get.
|
||||||
Returns NULL if this window can be the frontmost window.
|
Returns NULL if this window can be the frontmost window.
|
||||||
*/
|
*/
|
||||||
@@ -1552,6 +1514,7 @@ WindowLayer::HasInSubset(const WindowLayer* window) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fFeel == B_FLOATING_APP_WINDOW_FEEL
|
if (fFeel == B_FLOATING_APP_WINDOW_FEEL
|
||||||
|
&& window->Feel() != B_MODAL_APP_WINDOW_FEEL
|
||||||
|| fFeel == B_MODAL_APP_WINDOW_FEEL)
|
|| fFeel == B_MODAL_APP_WINDOW_FEEL)
|
||||||
return window->ServerWindow()->App() == ServerWindow()->App();
|
return window->ServerWindow()->App() == ServerWindow()->App();
|
||||||
|
|
||||||
@@ -1559,34 +1522,12 @@ WindowLayer::HasInSubset(const WindowLayer* window) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
/*! \brief Returns on which workspaces the window should be visible.
|
||||||
WindowLayer::SameSubset(WindowLayer* window)
|
|
||||||
{
|
|
||||||
// TODO: this is probably not needed at all, but it doesn't hurt to have it in svn
|
|
||||||
if (fFeel == B_MODAL_ALL_WINDOW_FEEL || window->Feel() == B_MODAL_ALL_WINDOW_FEEL)
|
|
||||||
return fFeel == window->Feel();
|
|
||||||
|
|
||||||
if (fFeel == B_MODAL_APP_WINDOW_FEEL || window->Feel() == B_MODAL_APP_WINDOW_FEEL)
|
|
||||||
return ServerWindow()->App() == window->ServerWindow()->App();
|
|
||||||
|
|
||||||
if (fFeel == B_MODAL_SUBSET_WINDOW_FEEL) {
|
|
||||||
// we basically need to check if the subsets have anything in common
|
|
||||||
for (int32 i = fSubsets.CountItems(); i-- > 0;) {
|
|
||||||
if (window->HasInSubset(fSubsets.ItemAt(i)))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (window->Feel() == B_MODAL_SUBSET_WINDOW_FEEL) {
|
|
||||||
for (int32 i = window->fSubsets.CountItems(); i-- > 0;) {
|
|
||||||
if (HasInSubset(window->fSubsets.ItemAt(i)))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
A modal or floating window may be visible on a workscreen if one
|
||||||
|
of its subset windows is visible there. Floating windows also need
|
||||||
|
to have a subset as front window to be visible.
|
||||||
|
*/
|
||||||
uint32
|
uint32
|
||||||
WindowLayer::SubsetWorkspaces() const
|
WindowLayer::SubsetWorkspaces() const
|
||||||
{
|
{
|
||||||
@@ -1594,8 +1535,14 @@ WindowLayer::SubsetWorkspaces() const
|
|||||||
|| fFeel == B_FLOATING_ALL_WINDOW_FEEL)
|
|| fFeel == B_FLOATING_ALL_WINDOW_FEEL)
|
||||||
return B_ALL_WORKSPACES;
|
return B_ALL_WORKSPACES;
|
||||||
|
|
||||||
if (fFeel == B_FLOATING_APP_WINDOW_FEEL)
|
if (fFeel == B_FLOATING_APP_WINDOW_FEEL) {
|
||||||
return ServerWindow()->App()->Workspaces();
|
WindowLayer* front = fDesktop->FrontWindow();
|
||||||
|
if (front != NULL && front->IsNormal()
|
||||||
|
&& front->ServerWindow()->App() == ServerWindow()->App())
|
||||||
|
return ServerWindow()->App()->Workspaces();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (fFeel == B_MODAL_APP_WINDOW_FEEL) {
|
if (fFeel == B_MODAL_APP_WINDOW_FEEL) {
|
||||||
uint32 workspaces = ServerWindow()->App()->Workspaces();
|
uint32 workspaces = ServerWindow()->App()->Workspaces();
|
||||||
@@ -1611,13 +1558,19 @@ WindowLayer::SubsetWorkspaces() const
|
|||||||
if (fFeel == B_MODAL_SUBSET_WINDOW_FEEL
|
if (fFeel == B_MODAL_SUBSET_WINDOW_FEEL
|
||||||
|| fFeel == B_FLOATING_SUBSET_WINDOW_FEEL) {
|
|| fFeel == B_FLOATING_SUBSET_WINDOW_FEEL) {
|
||||||
uint32 workspaces = 0;
|
uint32 workspaces = 0;
|
||||||
|
bool hasNormalFront = false;
|
||||||
for (int32 i = 0; i < fSubsets.CountItems(); i++) {
|
for (int32 i = 0; i < fSubsets.CountItems(); i++) {
|
||||||
WindowLayer* window = fSubsets.ItemAt(i);
|
WindowLayer* window = fSubsets.ItemAt(i);
|
||||||
|
|
||||||
if (!window->IsHidden())
|
if (!window->IsHidden())
|
||||||
workspaces |= window->Workspaces();
|
workspaces |= window->Workspaces();
|
||||||
|
if (window == fDesktop->FrontWindow() && window->IsNormal())
|
||||||
|
hasNormalFront = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fFeel == B_FLOATING_SUBSET_WINDOW_FEEL && !hasNormalFront)
|
||||||
|
return 0;
|
||||||
|
|
||||||
return workspaces;
|
return workspaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1717,7 +1670,7 @@ WindowLayer::ValidWindowFlags(window_feel feel)
|
|||||||
// _ShiftPartOfRegion
|
// _ShiftPartOfRegion
|
||||||
void
|
void
|
||||||
WindowLayer::_ShiftPartOfRegion(BRegion* region, BRegion* regionToShift,
|
WindowLayer::_ShiftPartOfRegion(BRegion* region, BRegion* regionToShift,
|
||||||
int32 xOffset, int32 yOffset)
|
int32 xOffset, int32 yOffset)
|
||||||
{
|
{
|
||||||
BRegion* common = fRegionPool.GetRegion(*regionToShift);
|
BRegion* common = fRegionPool.GetRegion(*regionToShift);
|
||||||
if (!common)
|
if (!common)
|
||||||
@@ -1871,6 +1824,7 @@ WindowLayer::_SendUpdateMessage()
|
|||||||
fEffectiveDrawingRegionValid = false;
|
fEffectiveDrawingRegionValid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::BeginUpdate(BPrivate::PortLink& link)
|
WindowLayer::BeginUpdate(BPrivate::PortLink& link)
|
||||||
{
|
{
|
||||||
@@ -2059,9 +2013,10 @@ WindowLayer::_ObeySizeLimits()
|
|||||||
ResizeBy(xDiff, yDiff, NULL);
|
ResizeBy(xDiff, yDiff, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - UpdateSession
|
// #pragma mark - UpdateSession
|
||||||
|
|
||||||
// constructor
|
|
||||||
WindowLayer::UpdateSession::UpdateSession()
|
WindowLayer::UpdateSession::UpdateSession()
|
||||||
: fDirtyRegion(),
|
: fDirtyRegion(),
|
||||||
fInUse(false),
|
fInUse(false),
|
||||||
@@ -2069,12 +2024,12 @@ WindowLayer::UpdateSession::UpdateSession()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// destructor
|
|
||||||
WindowLayer::UpdateSession::~UpdateSession()
|
WindowLayer::UpdateSession::~UpdateSession()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Include
|
|
||||||
void
|
void
|
||||||
WindowLayer::UpdateSession::Include(BRegion* additionalDirty)
|
WindowLayer::UpdateSession::Include(BRegion* additionalDirty)
|
||||||
{
|
{
|
||||||
@@ -2123,5 +2078,3 @@ WindowLayer::UpdateSession::operator=(const WindowLayer::UpdateSession& other)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -476,7 +476,7 @@ WorkspacesLayer::MouseMoved(BMessage* message, BPoint where)
|
|||||||
workspaceFrame.InsetBy(1, 1);
|
workspaceFrame.InsetBy(1, 1);
|
||||||
|
|
||||||
if (index != fSelectedWorkspace) {
|
if (index != fSelectedWorkspace) {
|
||||||
if (!fSelectedWindow->InWorkspace(index) && fSelectedWindow->IsNormal()) {
|
if (fSelectedWindow->IsNormal() && !fSelectedWindow->InWorkspace(index)) {
|
||||||
// move window to this new workspace
|
// move window to this new workspace
|
||||||
uint32 newWorkspaces = fSelectedWindow->Workspaces()
|
uint32 newWorkspaces = fSelectedWindow->Workspaces()
|
||||||
& ~(1UL << fSelectedWorkspace) | (1UL << index);
|
& ~(1UL << fSelectedWorkspace) | (1UL << index);
|
||||||
|
|||||||
Reference in New Issue
Block a user