From 2ccad1f632c815397f16f7062d97cd02bdede8b8 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Sun, 25 Sep 2011 23:04:43 +0000 Subject: [PATCH] * Fix decorator reloading of windows in a stack. When reloading the decorator all tabs have to be added to the decorator, the focus and the top layer tab must be set. The decorator does not know about the window and the window stack, thus the window has to do it itself. * Add Joseph Groover to the author list. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42768 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Window.cpp | 25 +++++++++++++++++++++--- src/servers/app/decorator/DecorManager.h | 1 + 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp index 3d43bf34d8..d4b003700d 100644 --- a/src/servers/app/Window.cpp +++ b/src/servers/app/Window.cpp @@ -587,14 +587,24 @@ Window::ReloadDecor() if (stack == NULL) return false; + // only reload the window at the first position + if (stack->WindowAt(0) != this) + return true; + if (fLook != B_NO_BORDER_WINDOW_LOOK) { // we need a new decorator decorator = gDecorManager.AllocateDecorator(this); if (decorator == NULL) return false; - int32 index = PositionInStack(); - if (IsFocus()) - decorator->SetFocus(index, true); + + // add all tabs to the decorator + for (int32 i = 1; i < stack->CountWindows(); i++) { + Window* window = stack->WindowAt(i); + BRegion dirty; + DesktopSettings settings(fDesktop); + decorator->AddTab(settings, window->Title(), window->Look(), + window->Flags(), -1, &dirty); + } } windowBehaviour = gDecorManager.AllocateWindowBehaviour(this); @@ -608,6 +618,15 @@ Window::ReloadDecor() delete fWindowBehaviour; fWindowBehaviour = windowBehaviour; + // set the correct focus and top layer tab + for (int32 i = 0; i < stack->CountWindows(); i++) { + Window* window = stack->WindowAt(i); + if (window->IsFocus()) + decorator->SetFocus(i, true); + if (window == stack->TopLayerWindow()) + decorator->SetTopTap(i); + } + return true; } diff --git a/src/servers/app/decorator/DecorManager.h b/src/servers/app/decorator/DecorManager.h index ab67a2e319..5240b01bce 100644 --- a/src/servers/app/decorator/DecorManager.h +++ b/src/servers/app/decorator/DecorManager.h @@ -5,6 +5,7 @@ * Author: * DarkWyrm * Clemens Zeidler + * Joseph Groover */ #ifndef DECOR_MANAGER_H #define DECOR_MANAGER_H