[Pkg-mozext-commits] [tabmixplus] 05/61: Properly handle Ctrl/Command + W in shortcuts edit box, the default behavior is to close the preferences window

David Prévot taffit at moszumanska.debian.org
Fri Aug 28 19:09:16 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 882ce309c54eb7704ea2ddb0507d5cec30bf5ea1
Author: onemen <tabmix.onemen at gmail.com>
Date:   Mon Jul 6 16:17:07 2015 +0300

    Properly handle Ctrl/Command + W in shortcuts edit box, the default behavior is to close the preferences window
---
 chrome/content/preferences/shortcuts.xml | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/chrome/content/preferences/shortcuts.xml b/chrome/content/preferences/shortcuts.xml
index b15284e..ecc7b35 100644
--- a/chrome/content/preferences/shortcuts.xml
+++ b/chrome/content/preferences/shortcuts.xml
@@ -17,6 +17,7 @@
         <xul:textbox class="shortcut-edit-box" anonid="editBox" style="width:200px;"
                      xbl:inherits="value,disabled=blocked" context=" "
                      placeholder="&shortcuts.placeholder;"
+                     onkeydown="document.getBindingParent(this).onKeyDown(event);"
                      onkeypress="document.getBindingParent(this).handleKeyEvents(event);"
                      onfocus="document.getBindingParent(this).updateFocus(true);"
                      onblur="document.getBindingParent(this).updateFocus(false);"
@@ -115,8 +116,19 @@
         ]]></body>
       </method>
 
+      <method name="onKeyDown">
+        <parameter name="event"/>
+        <body><![CDATA[
+          // handle Ctrl/Command + W
+          let control = !event.shiftKey && (event.ctrlKey || event.metaKey);
+          if (control && event.keyCode == 87)
+            this.handleKeyEvents(event, true);
+        ]]></body>
+      </method>
+
       <method name="handleKeyEvents">
         <parameter name="event"/>
+        <parameter name="ctrl_w"/>
         <body><![CDATA[
           event.preventDefault();
           event.stopPropagation();
@@ -159,7 +171,8 @@
             for (let keycode of Object.keys(Ci.nsIDOMKeyEvent)) {
               let val = Ci.nsIDOMKeyEvent[keycode];
               if (val == eKeyCode) {
-                key.keycode = keycode.replace("DOM_","");
+                let str = ctrl_w ? "DOM_VK_" : "DOM_";
+                key.keycode = keycode.replace(str, "");
                 break;
               }
             }

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