[Pkg-mozext-commits] [tabmixplus] 14/22: Dbl-click to duplicate tab sometimes doesn't work when 'click to select previous tab' is on also clickin on non-selected tab sometimes select previous tab

David Prévot taffit at moszumanska.debian.org
Sun Jan 4 16:46:36 UTC 2015


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

taffit pushed a commit to branch master
in repository tabmixplus.

commit bf3faeeda1cf7c8859ab0131885c7fc3c58c6334
Author: onemen <tabmix.onemen at gmail.com>
Date:   Fri Dec 26 18:25:00 2014 +0200

     Dbl-click to duplicate tab sometimes doesn't work when 'click to select previous tab' is on
     also clickin on non-selected tab sometimes select previous tab
---
 chrome/content/click/click.js       | 27 ++++++++++++++++-----------
 chrome/content/tab/tabbrowser_4.xml |  3 ++-
 2 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/chrome/content/click/click.js b/chrome/content/click/click.js
index daca37d..da81ec8 100644
--- a/chrome/content/click/click.js
+++ b/chrome/content/click/click.js
@@ -4,7 +4,7 @@ XPCOMUtils.defineLazyModuleGetter(Tabmix, "ContextMenu",
   "resource://tabmixplus/ContextMenu.jsm");
 
 var TabmixTabClickOptions = {
-  onDoubleClick: false,
+  _tabFlipTimeOut: null,
   _blockDblClick: false,
 
   // Single click on tab/tabbar
@@ -16,6 +16,8 @@ var TabmixTabClickOptions = {
 
     var leftClick = aEvent.button === 0;
     if (leftClick && aEvent.detail > 1) {
+      if (this._tabFlipTimeOut)
+        this.clearTabFlipTimeOut();
       if (this._blockDblClick)
         setTimeout(function(self) {self._blockDblClick = false;}, 0, this);
       return; // double click (with left button)
@@ -42,7 +44,6 @@ var TabmixTabClickOptions = {
       return;
     }
 
-    this.onDoubleClick = false;
     var clickOutTabs = aEvent.target.localName == "tabs";
     var tab = clickOutTabs ? gBrowser.mCurrentTab : aEvent.target;
 
@@ -58,15 +59,15 @@ var TabmixTabClickOptions = {
       let tabFlip = Tabmix.prefs.getBoolPref("tabFlip");
       if (tabFlip && !aEvent.shiftKey && !aEvent.ctrlKey && !aEvent.altKey && !aEvent.metaKey){
         let self = this;
-        var selectPreviousTab = function (aTab) {
-          if (!self.onDoubleClick) {
-            gBrowser.previousTab(aTab);
-            gBrowser.stopMouseHoverSelect(aTab);
-            gBrowser.selectedBrowser.focus();
-          }
-        };
         let tabFlipDelay = Tabmix.prefs.getIntPref("tabFlipDelay");
-        setTimeout(function (aTab) {selectPreviousTab(aTab);}, tabFlipDelay, tab);
+        if (this._tabFlipTimeOut)
+          this.clearTabFlipTimeOut();
+        this._tabFlipTimeOut = setTimeout(function selectPreviousTab(aTab) {
+          self.clearTabFlipTimeOut();
+          gBrowser.previousTab(aTab);
+          gBrowser.stopMouseHoverSelect(aTab);
+          gBrowser.selectedBrowser.focus();
+        }, tabFlipDelay, tab);
         return;
       }
     }
@@ -99,13 +100,17 @@ var TabmixTabClickOptions = {
       this.clickAction(prefName, clickOutTabs, tab, aEvent);
   },
 
+  clearTabFlipTimeOut: function() {
+    clearTimeout(this._tabFlipTimeOut);
+    this._tabFlipTimeOut = null;
+  },
+
   // Double click on tab/tabbar
   onTabBarDblClick: function TMP_onTabBarDblClick(aEvent) {
     if (!aEvent || aEvent.button !== 0 || aEvent.ctrlKey || aEvent.shiftKey ||
         aEvent.altKey || aEvent.metaKey) {
       return;
     }
-    this.onDoubleClick = true;
 
     // don't do anything if user click on close tab button , or on any other button on tab or tabbar
     var target = aEvent.originalTarget;
diff --git a/chrome/content/tab/tabbrowser_4.xml b/chrome/content/tab/tabbrowser_4.xml
index 50e32bd..527b039 100644
--- a/chrome/content/tab/tabbrowser_4.xml
+++ b/chrome/content/tab/tabbrowser_4.xml
@@ -264,7 +264,8 @@
       <parameter name="aEvent"/>
       <body><![CDATA[
         if ( this == this.parentNode.selectedItem ) {
-          this.setAttribute("clickOnCurrent","true");
+          if (aEvent.detail == 1)
+            this.setAttribute("clickOnCurrent","true");
         }
         // don't allow mouse click/down with modifiers to select tab
         else if (aEvent.shiftKey || aEvent.ctrlKey || aEvent.altKey || aEvent.metaKey)

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



More information about the Pkg-mozext-commits mailing list