* added a fOriginalFlags that contains the unaltered flags as set by the client

* when changing feel, the original flags are now restored.
* added B_SAME_POSITION_IN_ALL_WORKSPACES to valid flags, so that they can be
  set by the user.
* fixed masking out invalid flags (actually all but the valid flags were kept...)
* everytime B_SAME_POSITION_IN_ALL_WORKSPACES can be set (either in SetFlags()
  or in SetFeel() the position is propagated to all window lists.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15441 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-12-09 14:06:30 +00:00
parent ccfb624b7a
commit 159fdf2038
3 changed files with 33 additions and 14 deletions

View File

@ -109,7 +109,6 @@ WindowLayer::WindowLayer(const BRect& frame, const char *name,
fLook(look),
fFeel(feel),
fFlags(flags),
fWorkspaces(workspaces),
fCurrentWorkspace(-1),
@ -125,7 +124,8 @@ WindowLayer::WindowLayer(const BRect& frame, const char *name,
fLook = B_TITLED_WINDOW_LOOK;
if (!IsValidFeel(fFeel))
fFeel = B_NORMAL_WINDOW_FEEL;
fFlags &= ValidWindowFlags();
SetFlags(flags, NULL);
if (fLook != B_NO_BORDER_WINDOW_LOOK) {
fDecorator = gDecorManager.AllocateDecorator(fDesktop, frame, name, fLook, fFlags);
@ -371,6 +371,18 @@ WindowLayer::VisibleContentRegion()
// #pragma mark -
void
WindowLayer::_PropagatePosition()
{
if ((fFlags & B_SAME_POSITION_IN_ALL_WORKSPACES) == 0)
return;
for (int32 i = 0; i < kListCount; i++) {
Anchor(i).position = fFrame.LeftTop();
}
}
void
WindowLayer::MoveBy(int32 x, int32 y)
{
@ -382,13 +394,7 @@ WindowLayer::MoveBy(int32 x, int32 y)
fWindow->HandleDirectConnection(B_DIRECT_STOP);
fFrame.OffsetBy(x, y);
// propagate position if asked for
if (fFlags & B_SAME_POSITION_IN_ALL_WORKSPACES) {
for (int32 i = 0; i <= kWorkingList; i++) {
Anchor(i).position = fFrame.LeftTop();
}
}
_PropagatePosition();
fWindow->HandleDirectConnection(B_DIRECT_START | B_BUFFER_MOVED);
@ -1222,17 +1228,26 @@ WindowLayer::SetFeel(window_feel feel)
// having modal windows with B_AVOID_FRONT or B_AVOID_FOCUS doesn't
// make that much sense, so we filter those flags out on demand
fFlags &= ~ValidWindowFlags(fFeel);
fFlags = fOriginalFlags;
fFlags &= ValidWindowFlags(fFeel);
if (!IsNormal())
if (!IsNormal()) {
fFlags |= B_SAME_POSITION_IN_ALL_WORKSPACES;
_PropagatePosition();
}
}
void
WindowLayer::SetFlags(uint32 flags, BRegion* updateRegion)
{
fFlags = flags & ~ValidWindowFlags(fFeel);
fOriginalFlags = flags;
fFlags = flags & ValidWindowFlags(fFeel);
if (!IsNormal())
fFlags |= B_SAME_POSITION_IN_ALL_WORKSPACES;
if ((fFlags & B_SAME_POSITION_IN_ALL_WORKSPACES) != 0)
_PropagatePosition();
if (fDecorator == NULL)
return;
@ -1540,6 +1555,7 @@ WindowLayer::ValidWindowFlags()
| B_NOT_ANCHORED_ON_ACTIVATE
| B_ASYNCHRONOUS_CONTROLS
| B_QUIT_ON_WINDOW_CLOSE
| B_SAME_POSITION_IN_ALL_WORKSPACES
| kWorkspacesWindowFlag
| kWindowScreenFlag;
}

View File

@ -205,13 +205,13 @@ class WindowLayer {
click_type _ActionFor(const BMessage* msg) const;
void _ObeySizeLimits();
void _PropagatePosition();
BString fTitle;
// TODO: no fp rects anywhere
BRect fFrame;
window_anchor fAnchor[kWorkingList + 1];
// one for each desktop, and one working anchor
window_anchor fAnchor[kListCount];
// the visible region is only recalculated from the
// Desktop thread, when using it, Desktop::ReadLockClipping()
@ -301,6 +301,7 @@ class WindowLayer {
window_look fLook;
window_feel fFeel;
uint32 fOriginalFlags;
uint32 fFlags;
uint32 fWorkspaces;
int32 fCurrentWorkspace;

View File

@ -42,6 +42,8 @@ enum window_lists {
kAllWindowList = 32,
kSubsetList,
kWorkingList,
kListCount
};
struct window_anchor {