From 159fdf2038d9881ac56b130ace34d950dbfdc989 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 9 Dec 2005 14:06:30 +0000 Subject: [PATCH] * 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 --- src/servers/app/WindowLayer.cpp | 40 +++++++++++++++++++++++---------- src/servers/app/WindowLayer.h | 5 +++-- src/servers/app/WindowList.h | 2 ++ 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/servers/app/WindowLayer.cpp b/src/servers/app/WindowLayer.cpp index c47240452f..f811199605 100644 --- a/src/servers/app/WindowLayer.cpp +++ b/src/servers/app/WindowLayer.cpp @@ -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; } diff --git a/src/servers/app/WindowLayer.h b/src/servers/app/WindowLayer.h index ca6774375c..636bc6ace5 100644 --- a/src/servers/app/WindowLayer.h +++ b/src/servers/app/WindowLayer.h @@ -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; diff --git a/src/servers/app/WindowList.h b/src/servers/app/WindowList.h index 6326a6b9ee..9ac33225bb 100644 --- a/src/servers/app/WindowList.h +++ b/src/servers/app/WindowList.h @@ -42,6 +42,8 @@ enum window_lists { kAllWindowList = 32, kSubsetList, kWorkingList, + + kListCount }; struct window_anchor {