mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 770135 - Make it possible to exit customize mode by pressing Esc or clicking the menu button. r=jaws.
This commit is contained in:
parent
00eb851676
commit
f4ec4bb1c3
@ -60,6 +60,14 @@ CustomizeMode.prototype = {
|
||||
|
||||
CustomizableUI.addListener(this);
|
||||
|
||||
// Add a keypress listener to the tab-view-deck so that we can quickly
|
||||
// exit customization mode when pressing ESC
|
||||
let tabViewDeck = document.getElementById("tab-view-deck");
|
||||
tabViewDeck.addEventListener("keypress", this, false);
|
||||
// Same goes for the menu button - if we're customizing, a click to the
|
||||
// menu button means a quick exit from customization mode.
|
||||
window.PanelUI.menuButton.addEventListener("click", this, false);
|
||||
|
||||
// Let everybody in this window know that we're about to customize.
|
||||
let evt = document.createEvent("CustomEvent");
|
||||
evt.initCustomEvent("CustomizationStart", true, true, window);
|
||||
@ -106,6 +114,10 @@ CustomizeMode.prototype = {
|
||||
exit: function(aToolboxChanged) {
|
||||
CustomizableUI.removeListener(this);
|
||||
|
||||
let tabViewDeck = this.document.getElementById("tab-view-deck");
|
||||
tabViewDeck.removeEventListener("keypress", this, false);
|
||||
this.window.PanelUI.menuButton.removeEventListener("click", this, false);
|
||||
|
||||
this.depopulatePalette();
|
||||
|
||||
this.visiblePalette.removeEventListener("dragstart", this);
|
||||
@ -355,6 +367,18 @@ CustomizeMode.prototype = {
|
||||
case "drop":
|
||||
this._onDragDrop(aEvent);
|
||||
break;
|
||||
case "keypress":
|
||||
if (aEvent.keyCode === aEvent.DOM_VK_ESCAPE) {
|
||||
this.exit();
|
||||
}
|
||||
break;
|
||||
case "click":
|
||||
if (aEvent.button == 0 &&
|
||||
aEvent.originalTarget == this.window.PanelUI.menuButton) {
|
||||
this.exit();
|
||||
aEvent.preventDefault();
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user