[Pkg-mozext-commits] [tabmixplus] 04/23: Disallow mouse down on TabsToolbar to start dragging the window when one of the key modifiers is down

David Prévot taffit at moszumanska.debian.org
Wed Feb 17 18:33:59 UTC 2016


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

taffit pushed a commit to branch master
in repository tabmixplus.

commit ff1a3d427e4ca18cf8f2f3833dee647869fc98fc
Author: onemen <tabmix.onemen at gmail.com>
Date:   Fri Feb 5 22:45:38 2016 +0200

    Disallow mouse down on TabsToolbar to start dragging the window when one of the key modifiers is down
---
 chrome/content/flst/lasttab.js | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/chrome/content/flst/lasttab.js b/chrome/content/flst/lasttab.js
index 96edb69..b720909 100644
--- a/chrome/content/flst/lasttab.js
+++ b/chrome/content/flst/lasttab.js
@@ -93,14 +93,19 @@ var TMP_LastTab = {
 
   handleEvent: function(event) {
     switch (event.type) {
+      case "blur":
+        this.updateDisallowDrag(false);
+        break;
       case "keydown":
         this.OnKeyDown(event);
+        this.disallowDragwindow(true);
         break;
       case "keypress":
         this.OnKeyPress(event);
         break;
       case "keyup":
         this.OnKeyUp(event);
+        this.disallowDragwindow(false);
         break;
       case "DOMMenuItemActive":
         this.ItemActive(event);
@@ -111,6 +116,29 @@ var TMP_LastTab = {
     }
   },
 
+ /**
+  * disallow mouse down on TabsToolbar to start dragging the window when one
+  * of the key modifiers is down
+  */
+  disallowDragwindow: function(keyDown) {
+    if (!Tabmix.isVersion(470)) {
+      return;
+    }
+    if (Tabmix.prefs.getBoolPref("tabbar.click_dragwindow") &&
+        keyDown == Tabmix.keyModifierDown &&
+        keyDown != this.disallowDragState) {
+      this.updateDisallowDrag(keyDown);
+    }
+  },
+
+  disallowDragState: false,
+  updateDisallowDrag: function(disallow) {
+    let el = disallow ? "addEventListener" : "removeEventListener";
+    window[el]("blur", this);
+    this.disallowDragState = disallow;
+    Tabmix.setItem("TabsToolbar", "tabmix-disallow-drag", disallow || null);
+  },
+
   ItemActive: function(event) {
     TabmixAllTabs.updateMenuItemActive(event);
     if (this.respondToMouseInTabList) {

-- 
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