Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: lib/keySelector.js

Issue 4578973954605056: Fixed: Accel is always mapped to Control, no matter what the actual browser setting is (Closed)
Left Patch Set: Created Jan. 10, 2014, 3:59 p.m.
Right Patch Set: Turns out, the initial patch reverted https://hg.adblockplus.org/buildtools/rev/26e006a86708 which … Created Jan. 10, 2014, 4:06 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of the Adblock Plus build tools, 2 * This file is part of the Adblock Plus build tools,
3 * Copyright (C) 2006-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 15 matching lines...) Expand all
26 ALT: "alt", 26 ALT: "alt",
27 META: "meta", 27 META: "meta",
28 __proto__: null 28 __proto__: null
29 }; 29 };
30 30
31 /** 31 /**
32 * Sets the correct value of validModifiers.ACCEL. 32 * Sets the correct value of validModifiers.ACCEL.
33 */ 33 */
34 function initAccelKey() 34 function initAccelKey()
35 { 35 {
36 validModifiers.ACCEL = "control";
36 try 37 try
37 { 38 {
38 let accelKey = Services.prefs.getIntPref("ui.key.accelKey"); 39 let accelKey = Services.prefs.getIntPref("ui.key.accelKey");
39 if (accelKey == Ci.nsIDOMKeyEvent.DOM_VK_CONTROL) 40 if (accelKey == Ci.nsIDOMKeyEvent.DOM_VK_CONTROL)
40 validModifiers.ACCEL = "control"; 41 validModifiers.ACCEL = "control";
41 else if (accelKey == Ci.nsIDOMKeyEvent.DOM_VK_ALT) 42 else if (accelKey == Ci.nsIDOMKeyEvent.DOM_VK_ALT)
42 validModifiers.ACCEL = "alt"; 43 validModifiers.ACCEL = "alt";
43 else if (accelKey == Ci.nsIDOMKeyEvent.DOM_VK_META) 44 else if (accelKey == Ci.nsIDOMKeyEvent.DOM_VK_META)
44 validModifiers.ACCEL = "meta"; 45 validModifiers.ACCEL = "meta";
45 } 46 }
46 catch(e) 47 catch(e)
47 { 48 {
48 validModifiers.ACCEL = "control";
49 Cu.reportError(e); 49 Cu.reportError(e);
50 } 50 }
51 } 51 }
52 52
53 exports.KeySelector = KeySelector; 53 exports.KeySelector = KeySelector;
54 54
55 /** 55 /**
56 * This class provides capabilities to find and use available keyboard shortcut 56 * This class provides capabilities to find and use available keyboard shortcut
57 * keys. 57 * keys.
58 * @param {ChromeWindow} window the window where to look up existing shortcut 58 * @param {ChromeWindow} window the window where to look up existing shortcut
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 return false; 219 return false;
220 if (key.meta != event.metaKey || key.control != event.ctrlKey) 220 if (key.meta != event.metaKey || key.control != event.ctrlKey)
221 return false; 221 return false;
222 222
223 if (key.char && event.charCode && String.fromCharCode(event.charCode).toUpperC ase() == key.char) 223 if (key.char && event.charCode && String.fromCharCode(event.charCode).toUpperC ase() == key.char)
224 return true; 224 return true;
225 if (key.code && event.keyCode && event.keyCode == key.code) 225 if (key.code && event.keyCode && event.keyCode == key.code)
226 return true; 226 return true;
227 return false; 227 return false;
228 }; 228 };
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld