Browse Source

Added functional bar minimize window function

Toby Chui 3 years ago
parent
commit
06dd207f20
1 changed files with 21 additions and 4 deletions
  1. 21 4
      web/desktop.system

+ 21 - 4
web/desktop.system

@@ -1708,11 +1708,19 @@
                 //Generate the stackedWindowList
                 var windowIdList = JSON.parse(decodeURIComponent($(this).attr("windowidgroup")));
                 if (windowIdList.length == 1) {
-                    //There are only one window in this group. Focus that floatWindow
+                    //There are only one window in this group. 
+                   
+                    //Focus that floatWindow if it is in the back
                     var targetFW = getFloatWindowByID(windowIdList[0]);
-                    $(targetFW).fadeIn(100);
-                    MoveFloatWindowToTop(targetFW);
-                    stackedFloatWindowListShown = false;
+                    if (FloatWindowIsTopped(targetFW) && !($(targetFW).css('display') == 'none')){
+                        //Top Window. Hide it
+                        $(targetFW).fadeOut(100);
+                    }else{
+                        //Bring it to front
+                        $(targetFW).fadeIn(100);
+                        MoveFloatWindowToTop(targetFW);
+                        stackedFloatWindowListShown = false;
+                    }
 
                     if (checkIfFloatWindowOutsideWindowArea(targetFW)){
                         //This floatWindow is outside of the display area.
@@ -2288,6 +2296,15 @@
             MoveFloatWindowToTop(object);
         }
 
+        function FloatWindowIsTopped(object){
+            if ($(object).attr("windowId") == $(focusedWindow).attr("windowId")) {
+                //Top Window
+                return true;
+            }
+
+            return false;
+        }
+
         function MoveFloatWindowToTop(object) {
             var windowID = $(object).attr("windowId");
             var windowZindex = $(object).css("z-index");