From d3233e787aaf1ba0558a714d5216ea70c7249c36 Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Mon, 3 Jul 2023 23:29:01 +0300
Subject: [PATCH] SL-19929 New inventory feature notification should appear on
 top

---
 indra/newview/llagent.cpp                     |  7 ++++++-
 .../llfloaternewfeaturenotification.cpp       | 21 ++++++++++++-------
 .../newview/llfloaternewfeaturenotification.h | 12 +++++------
 3 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 2430ca5f83d..85741340324 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -582,7 +582,12 @@ void LLAgent::showLatestFeatureNotification()
     S32 feature_version = gSavedSettings.getS32("LastUIFeatureVersion");
     if (feature_version < UI_FEATURE_VERSION)
     {
-        LLFloaterReg::showInstance("new_feature_notification");
+        // Need to open on top even if called from onOpen,
+        // do on idle to make sure it's on top
+        doOnIdleOneTime([]()
+                        {
+                            LLFloaterReg::showInstance("new_feature_notification");
+                        });
         gSavedSettings.setS32("LastUIFeatureVersion", UI_FEATURE_VERSION);
     }
 }
diff --git a/indra/newview/llfloaternewfeaturenotification.cpp b/indra/newview/llfloaternewfeaturenotification.cpp
index e04b1a5da5a..7c3fe8cdc8f 100644
--- a/indra/newview/llfloaternewfeaturenotification.cpp
+++ b/indra/newview/llfloaternewfeaturenotification.cpp
@@ -30,7 +30,7 @@
 
 
 LLFloaterNewFeatureNotification::LLFloaterNewFeatureNotification(const LLSD& key)
-	:	LLFloater(key)
+  : LLFloater(key)
 {
 }
 
@@ -40,24 +40,29 @@ LLFloaterNewFeatureNotification::~LLFloaterNewFeatureNotification()
 
 BOOL LLFloaterNewFeatureNotification::postBuild()
 {
-	setCanDrag(FALSE);
-	getChild<LLButton>("close_btn")->setCommitCallback(boost::bind(&LLFloaterNewFeatureNotification::onCloseBtn, this));
-	return TRUE;
+    setCanDrag(FALSE);
+    getChild<LLButton>("close_btn")->setCommitCallback(boost::bind(&LLFloaterNewFeatureNotification::onCloseBtn, this));
+    return TRUE;
 }
 
 void LLFloaterNewFeatureNotification::onOpen(const LLSD& key)
 {
-	centerOnScreen();
+    centerOnScreen();
 }
 
 void LLFloaterNewFeatureNotification::onCloseBtn()
 {
-	closeFloater();
+    closeFloater();
 }
 
 void LLFloaterNewFeatureNotification::centerOnScreen()
 {
-	LLVector2 window_size = LLUI::getInstance()->getWindowSize();
-	centerWithin(LLRect(0, 0, ll_round(window_size.mV[VX]), ll_round(window_size.mV[VY])));
+    LLVector2 window_size = LLUI::getInstance()->getWindowSize();
+    centerWithin(LLRect(0, 0, ll_round(window_size.mV[VX]), ll_round(window_size.mV[VY])));
+    LLFloaterView* parent = dynamic_cast<LLFloaterView*>(getParent());
+    if (parent)
+    {
+        parent->bringToFront(this);
+    }
 }
 
diff --git a/indra/newview/llfloaternewfeaturenotification.h b/indra/newview/llfloaternewfeaturenotification.h
index 86e9683def8..95501451dc5 100644
--- a/indra/newview/llfloaternewfeaturenotification.h
+++ b/indra/newview/llfloaternewfeaturenotification.h
@@ -30,20 +30,20 @@
 #include "llfloater.h"
 
 class LLFloaterNewFeatureNotification:
-	public LLFloater
+    public LLFloater
 {
-	friend class LLFloaterReg;
+    friend class LLFloaterReg;
 public:
-	BOOL postBuild() override;
-	void onOpen(const LLSD& key) override;
+    BOOL postBuild() override;
+    void onOpen(const LLSD& key) override;
 
 private:
     LLFloaterNewFeatureNotification(const LLSD& key);
     /*virtual*/	~LLFloaterNewFeatureNotification();
 
-	void centerOnScreen();
+    void centerOnScreen();
 
-	void onCloseBtn();	
+    void onCloseBtn();	
 };
 
 #endif
-- 
GitLab