From e9da22cecc526087b62c39c5d0824ec918b874bc Mon Sep 17 00:00:00 2001
From: Mnikolenko Productengine <mnikolenko@productengine.com>
Date: Fri, 9 Sep 2022 18:53:23 +0300
Subject: [PATCH] SL-18110 Reshape status bar container when hiding navigation
 panel

---
 indra/newview/llviewercontrol.cpp |  2 +-
 indra/newview/llviewerwindow.cpp  | 31 ++++++++++++++++++++++++++-----
 indra/newview/llviewerwindow.h    |  2 ++
 3 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index 9036e875142..3fd5c3e9bb2 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -616,7 +616,7 @@ bool toggle_show_navigation_panel(const LLSD& newvalue)
 
 	LLNavigationBar::getInstance()->setVisible(value);
 	gSavedSettings.setBOOL("ShowMiniLocationPanel", !value);
-
+    gViewerWindow->reshapeStatusBarContainer();
 	return true;
 }
 
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index ae9da976425..76ef71971c7 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -2246,16 +2246,16 @@ void LLViewerWindow::initWorldUI()
 	nav_bar_container->addChild(navbar);
 	nav_bar_container->setVisible(TRUE);
 
-    // Navigation bar is outside visible area, expand status_bar_container to show it
-    S32 new_height = nav_bar_container->getRect().getHeight() + status_bar_container->getRect().getHeight();
-    S32 new_width = status_bar_container->getRect().getWidth();
-    status_bar_container->reshape(new_width, new_height, TRUE);
 
-	
 	if (!gSavedSettings.getBOOL("ShowNavbarNavigationPanel"))
 	{
 		navbar->setVisible(FALSE);
 	}
+    else
+    {
+        reshapeStatusBarContainer();
+    }
+
 
 	// Top Info bar
 	LLPanel* topinfo_bar_container = getRootView()->getChild<LLPanel>("topinfo_bar_container");
@@ -5847,6 +5847,27 @@ LLRect LLViewerWindow::getChatConsoleRect()
 
 	return console_rect;
 }
+
+void LLViewerWindow::reshapeStatusBarContainer()
+{
+    LLPanel* status_bar_container = getRootView()->getChild<LLPanel>("status_bar_container");
+    LLView* nav_bar_container = getRootView()->getChild<LLView>("nav_bar_container");
+
+    S32 new_height = status_bar_container->getRect().getHeight();
+    S32 new_width = status_bar_container->getRect().getWidth();
+
+    if (gSavedSettings.getBOOL("ShowNavbarNavigationPanel"))
+    {
+        // Navigation bar is outside visible area, expand status_bar_container to show it
+        new_height += nav_bar_container->getRect().getHeight();
+    }
+    else
+    {
+        // collapse status_bar_container
+        new_height -= nav_bar_container->getRect().getHeight();
+    }
+    status_bar_container->reshape(new_width, new_height, TRUE);
+}
 //----------------------------------------------------------------------------
 
 
diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h
index 979a5605086..1927e01ddba 100644
--- a/indra/newview/llviewerwindow.h
+++ b/indra/newview/llviewerwindow.h
@@ -177,6 +177,8 @@ class LLViewerWindow : public LLWindowCallbacks
 	bool			getUIVisibility();
 	void			handlePieMenu(S32 x, S32 y, MASK mask);
 
+    void            reshapeStatusBarContainer();
+
 	BOOL handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, EMouseClickType clicktype, BOOL down);
 
 	//
-- 
GitLab