Skip to content

Commit

Permalink
Make quit-on-escape optional
Browse files Browse the repository at this point in the history
  • Loading branch information
paulrouget committed May 16, 2016
1 parent 66acb10 commit 911a67b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion ports/glutin/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use util::geometry::ScreenPx;
use util::opts;
#[cfg(not(target_os = "android"))]
use util::opts::RenderApi;
use util::prefs;
use util::resource_files;

static mut g_nested_event_loop_listener: Option<*mut (NestedEventLoopListener + 'static)> = None;
Expand Down Expand Up @@ -768,7 +769,9 @@ impl WindowMethods for Window {
}

(NONE, Key::Escape) => {
self.event_queue.borrow_mut().push(WindowEvent::Quit);
if let Some(true) = prefs::get_pref("shell.quit-on-escape.enabled").as_boolean() {
self.event_queue.borrow_mut().push(WindowEvent::Quit);
}
}

(CMD_OR_ALT, Key::Right) => {
Expand Down
3 changes: 2 additions & 1 deletion resources/prefs.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"layout.writing-mode.enabled": false,
"network.http.redirection-limit": 20,
"network.mime.sniff": false,
"shell.homepage": "http://servo.org",
"shell.native-titlebar.enabled": true,
"shell.homepage": "http://servo.org"
"shell.quit-on-escape.enabled": true
}

0 comments on commit 911a67b

Please sign in to comment.