From fb072d3724fc05034109ef172bde39b421c02d99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 13 Apr 2006 14:44:00 +0000 Subject: [PATCH] * 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 --- src/servers/app/Desktop.cpp | 64 +++++++++++++++++++++++++++++-------- 1 file changed, 51 insertions(+), 13 deletions(-) diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index 58d3441508..260de458a7 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -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); } }