From d4272f888e3fde9f37b0d7ff81034301e7629d38 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Tue, 31 Aug 2010 02:04:46 +0000 Subject: [PATCH] Fix SendWindowBehind. It now sets the window layer position behind the specified window. If behindOf is NULL it is send to the bottom. Please review if it really was broken! At least it has not worked as I had expected and what I read from bebook. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38473 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Desktop.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index dfd5de61d1..aea9913fc8 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -1032,7 +1032,7 @@ Desktop::SendWindowBehind(Window* window, Window* behindOf) // TODO: should the "not in current workspace" be handled anyway? // (the code below would have to be changed then, though) - if (window == BackWindow() + if ((behindOf == NULL && window == BackWindow()) || !window->InWorkspace(fCurrentWorkspace) || (behindOf != NULL && !behindOf->InWorkspace(fCurrentWorkspace))) { UnlockAllWindows(); @@ -1047,19 +1047,21 @@ Desktop::SendWindowBehind(Window* window, Window* behindOf) // might be dirty after the window is send to back BRegion dirty(window->VisibleRegion()); - // detach window and re-attach at desired position - Window* backmost = window->Backmost(behindOf); - CurrentWindows().RemoveWindow(window); - CurrentWindows().AddWindow(window, backmost - ? backmost->NextWindow(fCurrentWorkspace) : BackWindow()); + CurrentWindows().AddWindow(window, behindOf + ? behindOf : BackWindow()); BRegion dummy; _RebuildClippingForAllWindows(dummy); - // mark everything dirty that is no longer visible + // if we send a window to the bottom mark everything dirty that is no + // longer visible, if behindOf is not NULL the window may has rose so + // include the visible region BRegion clean(window->VisibleRegion()); - dirty.Exclude(&clean); + if (!behindOf) + dirty.Exclude(&clean); + else + dirty.Include(&clean); MarkDirty(dirty); _UpdateFronts();