* When changing a window's feel, it's now also moved to the front if

necessary.
* Also, newly exposed window areas are now refreshed when a change
  of feel also changed the window order.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17122 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-04-13 14:44:00 +00:00
parent cc4612fe3f
commit fb072d3724

View File

@ -1749,24 +1749,62 @@ Desktop::SetWindowFeel(WindowLayer *window, window_feel newFeel)
if (!workspace_in_workspaces(i, window->Workspaces()))
continue;
WindowLayer* frontmost = window->Frontmost(_Windows(i).FirstWindow(), i);
if (frontmost == NULL)
continue;
bool changed = false;
BRegion visibleBefore;
if (i == fCurrentWorkspace && window->IsVisible())
visibleBefore = window->VisibleRegion();
// check if the frontmost window is really in front of it
WindowLayer* backmost = window->Backmost(_Windows(i).LastWindow(), i);
if (backmost != NULL) {
// check if the backmost window is really behind it
WindowLayer* previous = window->PreviousWindow(i);
while (previous != NULL) {
if (previous == backmost)
break;
WindowLayer* next = window->NextWindow(i);
while (next != NULL) {
if (next == frontmost)
break;
previous = previous->PreviousWindow(i);
}
next = next->NextWindow(i);
if (previous == NULL) {
// need to reinsert window before its backmost window
_Windows(i).RemoveWindow(window);
_Windows(i).AddWindow(window, backmost->NextWindow(i));
changed = true;
}
}
if (next == NULL) {
// need to reinsert window behind its frontmost window
_Windows(i).RemoveWindow(window);
_Windows(i).AddWindow(window, frontmost);
WindowLayer* frontmost = window->Frontmost(_Windows(i).FirstWindow(), i);
if (frontmost != NULL) {
// check if the frontmost window is really in front of it
WindowLayer* next = window->NextWindow(i);
while (next != NULL) {
if (next == frontmost)
break;
next = next->NextWindow(i);
}
if (next == NULL) {
// need to reinsert window behind its frontmost window
_Windows(i).RemoveWindow(window);
_Windows(i).AddWindow(window, frontmost);
changed = true;
}
}
if (i == fCurrentWorkspace && changed) {
BRegion dummy;
_RebuildClippingForAllWindows(dummy);
// mark everything dirty that is no longer visible, or
// is now visible and wasn't before
BRegion visibleAfter(window->VisibleRegion());
BRegion dirty(visibleAfter);
dirty.Exclude(&visibleBefore);
visibleBefore.Exclude(&visibleAfter);
dirty.Include(&visibleBefore);
MarkDirty(dirty);
}
}