When stacking windows, move the new window to the parent position and size. Simplify the part in S&T that took care of it before.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42615 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler 2011-08-10 01:49:00 +00:00
parent b6ac45afd2
commit fcde9a3249
2 changed files with 29 additions and 18 deletions

View File

@ -2127,8 +2127,20 @@ Window::AddWindowToStack(Window* window)
if (stack == NULL)
return false;
// first collect dirt from the window to add
BRegion dirty;
// move window to the own position
BRect ownFrame = Frame();
BRect frame = window->Frame();
float deltaToX = round(ownFrame.left - frame.left);
float deltaToY = round(ownFrame.top - frame.top);
frame.OffsetBy(deltaToX, deltaToY);
float deltaByX = round(ownFrame.right - frame.right);
float deltaByY = round(ownFrame.bottom - frame.bottom);
dirty.Include(&window->VisibleRegion());
window->MoveBy(deltaToX, deltaToY, false);
window->ResizeBy(deltaByX, deltaByY, &dirty, false);
// first collect dirt from the window to add
::Decorator* otherDecorator = window->Decorator();
if (otherDecorator != NULL)
dirty.Include(otherDecorator->TitleBarRect());

View File

@ -485,32 +485,31 @@ WindowArea::_UnsetNeighbourCorner(Corner* neighbour, Corner* opponent)
void
WindowArea::_MoveToSAT(SATWindow* topWindow)
WindowArea::_MoveToSAT(SATWindow* triggerWindow)
{
int32 workspace = topWindow->GetWindow()->CurrentWorkspace();
Desktop* desktop = topWindow->GetWindow()->Desktop();
int32 workspace = triggerWindow->GetWindow()->CurrentWorkspace();
Desktop* desktop = triggerWindow->GetWindow()->Desktop();
BRect frameSAT(LeftVar()->Value() - kMakePositiveOffset,
TopVar()->Value() - kMakePositiveOffset,
RightVar()->Value() - kMakePositiveOffset,
BottomVar()->Value() - kMakePositiveOffset);
for (int32 i = 0; i < fWindowList.CountItems(); i++) {
SATWindow* window = fWindowList.ItemAt(i);
window->AdjustSizeLimits(frameSAT);
SATWindow* topWindow = TopWindow();
topWindow->AdjustSizeLimits(frameSAT);
BRect frame = window->CompleteWindowFrame();
float deltaToX = round(frameSAT.left - frame.left);
float deltaToY = round(frameSAT.top - frame.top);
frame.OffsetBy(deltaToX, deltaToY);
float deltaByX = round(frameSAT.right - frame.right);
float deltaByY = round(frameSAT.bottom - frame.bottom);
BRect frame = topWindow->CompleteWindowFrame();
float deltaToX = round(frameSAT.left - frame.left);
float deltaToY = round(frameSAT.top - frame.top);
frame.OffsetBy(deltaToX, deltaToY);
float deltaByX = round(frameSAT.right - frame.right);
float deltaByY = round(frameSAT.bottom - frame.bottom);
desktop->MoveWindowBy(topWindow->GetWindow(), deltaToX, deltaToY,
workspace);
// Update frame to the new position
desktop->ResizeWindowBy(topWindow->GetWindow(), deltaByX, deltaByY);
desktop->MoveWindowBy(window->GetWindow(), deltaToX, deltaToY,
workspace);
// Update frame to the new position
desktop->ResizeWindowBy(window->GetWindow(), deltaByX, deltaByY);
}
UpdateSizeConstaints(frameSAT);
}