[Pkg-mozext-commits] [firetray] 92/399: refactor fix buggy restore when window was maximized (restore size and window state also)

David Prévot taffit at alioth.debian.org
Tue Oct 29 18:23:20 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch dfsg-clean
in repository firetray.

commit 04af43779e3441c5c8974689b120832f75d12d96
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Sun Nov 20 22:28:16 2011 +0100

    refactor fix buggy restore when window was maximized (restore size and
    window state also)
---
 src/modules/FiretrayHandler.jsm |   36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/src/modules/FiretrayHandler.jsm b/src/modules/FiretrayHandler.jsm
index 98ea8cc..ee7c984 100644
--- a/src/modules/FiretrayHandler.jsm
+++ b/src/modules/FiretrayHandler.jsm
@@ -134,8 +134,6 @@ firetray.Handler = {
       winOut = winInterface.getInterface(Ci.nsIBaseWindow);
     else if (winType == "XUL")
       winOut = winInterface.getInterface(Ci.nsIXULWindow);
-    else if (winType == "DOMChrome")
-      winOut = winInterface.getInterface(Ci.nsIDOMChromeWindow);
     else {
       ERROR("FIRETRAY: unknown winType '" + winType + "'");
       return null;
@@ -171,7 +169,8 @@ firetray.Handler = {
      * created/delete windows when all are hidden.
      *
      * NOTE: this may not be a good design if we want to show/hide one window
-     * at a time...
+     * at a time... might need win.QueryInterface(Ci.nsIInterfaceRequestor)
+     * .getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
      */
     if (!this._windowsHidden)   // hide
       this._updateHandledDOMWindows();
@@ -186,28 +185,35 @@ firetray.Handler = {
       try {
         if (this._windowsHidden) { // show
 
-          // correct position and size
+          // correct position, size and state
           let x = this._handledDOMWindows[i].rememberedX;
           let y = this._handledDOMWindows[i].rememberedY;
           let cx = this._handledDOMWindows[i].rememberedWidth;
           let cy = this._handledDOMWindows[i].rememberedHeight;
           LOG("set bw.position: " + x + ", " + y + ", " + cx + ", " + cy);
-          // TODO: clean: use 'switch'
-// STATE_MAXIMIZED 	1
-// STATE_MINIMIZED 	2
-// STATE_NORMAL 	3
-// STATE_FULLSCREEN 	4
-          LOG("set maximize: " + this._handledDOMWindows[i].rememberedState);
-          if (this._handledDOMWindows[i].rememberedState === Ci.nsIDOMChromeWindow.STATE_MAXIMIZED)
+          let windowState = this._handledDOMWindows[i].rememberedState;
+          LOG("set windowState: " + windowState);
+
+          switch (windowState) {
+          case Ci.nsIDOMChromeWindow.STATE_MAXIMIZED: // 1
             this._handledDOMWindows[i].QueryInterface(Ci.nsIDOMChromeWindow).maximize();
-          else
+            break;
+          case Ci.nsIDOMChromeWindow.STATE_MINIMIZED: // 2
+            let prefHidesOnMinimize = firetray.Utils.prefService.getBoolPref("hides_on_minimize");
+            if (!prefHidesOnMinimize)
+              this._handledDOMWindows[i].QueryInterface(Ci.nsIDOMChromeWindow).minimize();
+            break;
+          case Ci.nsIDOMChromeWindow.STATE_NORMAL: // 3
             bw.setPositionAndSize(x, y, cx, cy, false); // repaint
-          LOG("TEST maximize: " + this._handledDOMWindows[i].QueryInterface(Ci.nsIDOMChromeWindow).windowState);
+            break;
+          case Ci.nsIDOMChromeWindow.STATE_FULLSCREEN: // 4
+            // FIXME: NOT IMPLEMENTED YET
+          default:
+          }
+          LOG("maximize after: " + this._handledDOMWindows[i].QueryInterface(Ci.nsIDOMChromeWindow).windowState);
 
           bw.visibility = true;
 
-
-
         } else {                // hide
 
           // remember position and size

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firetray.git



More information about the Pkg-mozext-commits mailing list