toolkit/content/macWindowMenu.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 // -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 function macWindowMenuDidShow()
     8 {
     9   var windowManagerDS =
    10     Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator']
    11               .getService(Components.interfaces.nsIWindowDataSource);
    12   var sep = document.getElementById("sep-window-list");
    13   // Using double parens to avoid warning
    14   while ((sep = sep.nextSibling)) {
    15     var url = sep.getAttribute('id');
    16     var win = windowManagerDS.getWindowForResource(url);
    17     if (win.document.documentElement.getAttribute("inwindowmenu") == "false")
    18       sep.hidden = true;
    19     else if (win == window)
    20       sep.setAttribute("checked", "true");
    21   }
    22 }
    24 function toOpenWindow( aWindow )
    25 {
    26   // deminiaturize the window, if it's in the Dock
    27   if (aWindow.windowState == STATE_MINIMIZED)
    28     aWindow.restore();
    29   aWindow.document.commandDispatcher.focusedWindow.focus();
    30 }
    32 function ShowWindowFromResource( node )
    33 {
    34   var windowManagerDS =
    35     Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator']
    36               .getService(Components.interfaces.nsIWindowDataSource);
    38   var desiredWindow = null;
    39   var url = node.getAttribute('id');
    40   desiredWindow = windowManagerDS.getWindowForResource( url );
    41   if (desiredWindow)
    42     toOpenWindow(desiredWindow);
    43 }
    45 function zoomWindow()
    46 {
    47   if (window.windowState == STATE_NORMAL)
    48     window.maximize();
    49   else
    50     window.restore();
    51 }

mercurial