From 609f6f9a254133ec9f798b40bc03de41a7473095 Mon Sep 17 00:00:00 2001
From: Zach Fox <fox@highfidelity.io>
Date: Wed, 9 Oct 2019 15:46:50 -0700
Subject: [PATCH] Fix minimize bug; fix bug where FTUE window appears behind
 Interface window

---
 scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js | 7 ++++++-
 scripts/simplifiedUI/ui/simplifiedUI.js                 | 4 ++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js b/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js
index d28376daae..2a5767a4c0 100644
--- a/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js
+++ b/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js
@@ -450,6 +450,7 @@ function onGeometryChanged(rect) {
 
 
 function onWindowMinimizedChanged(isMinimized) {
+    isWindowMinimized = isMinimized;
     maybeChangeEmoteIndicatorVisibility(!isMinimized);
 }
 
@@ -546,8 +547,12 @@ function showEmoteAppBar() {
 }
 
 
+// There is currently no property in the Window Scripting Interface to determine
+// whether the Interface window is currently minimized. This feels like an oversight.
+// We should add that functionality to the Window Scripting Interface, and remove `isWindowMinimized` below.
+var isWindowMinimized = false;
 function maybeChangeEmoteIndicatorVisibility(desiredVisibility) {
-    if (Window.minimized || HMD.active) {
+    if (isWindowMinimized || HMD.active) {
         desiredVisibility = false;
     }
 
diff --git a/scripts/simplifiedUI/ui/simplifiedUI.js b/scripts/simplifiedUI/ui/simplifiedUI.js
index b0485528e0..368f663308 100644
--- a/scripts/simplifiedUI/ui/simplifiedUI.js
+++ b/scripts/simplifiedUI/ui/simplifiedUI.js
@@ -363,6 +363,8 @@ var INITIAL_LAUNCH_QML_PATH = Script.resolvePath("./simplifiedFTUE/InitialLaunch
 var INITIAL_LAUNCH_WINDOW_TITLE = "Initial Launch";
 var INITIAL_LAUNCH_PRESENTATION_MODE = Desktop.PresentationMode.NATIVE;
 var INITIAL_WINDOW_FLAGS = 0x00000001 | // Qt::Window
+0x00000008 | // Qt::Popup
+0x00000002 | // Qt::Tool
 0x00000800 | // Qt::FramelessWindowHint
 0x40000000; // Qt::NoDropShadowWindowHint
 var initialLaunchWindow = false;
@@ -396,6 +398,8 @@ var SECOND_LAUNCH_QML_PATH = Script.resolvePath("simplifiedFTUE/SecondLaunchWind
 var SECOND_LAUNCH_WINDOW_TITLE = "Second Launch";
 var SECOND_LAUNCH_PRESENTATION_MODE = Desktop.PresentationMode.NATIVE;
 var SECOND_WINDOW_FLAGS = 0x00000001 | // Qt::Window
+0x00000008 | // Qt::Popup
+0x00000002 | // Qt::Tool
 0x00000800 | // Qt::FramelessWindowHint
 0x40000000; // Qt::NoDropShadowWindowHint
 var secondLaunchWindow = false;