aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-07-15 09:33:06 -0700
committerGitHub <noreply@github.com>2016-07-15 09:33:06 -0700
commit6640115c9775e7177f79b1d6aa5fddceeeeb22e2 (patch)
treee51a040907bad0ded34847ed42c443cef2745594
parent6f3967b00490c750853ab3b56c54418b321d11a3 (diff)
parentdaeddc4c6f8382d2cae7a97bd3cb800f38ce8f96 (diff)
downloadservo-6640115c9775e7177f79b1d6aa5fddceeeeb22e2.tar.gz
servo-6640115c9775e7177f79b1d6aa5fddceeeeb22e2.zip
Auto merge of #12461 - andrewdavidmackenzie:enable-quit-keyboard-shortcut, r=ConnorGBrewster
Add a keyboard shortcut (Command + Q on Mac or Control + Q on other O… <!-- Please describe your changes on the following line: --> Added code in window.rs to enqueue the Window::Quit event when the Command/Control + Q keyboard shortcut is detected IF keyboard shortcuts are enabled. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #12422 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because there are no tests able to test keyboard shortcuts at the moment <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12461) <!-- Reviewable:end -->
-rw-r--r--ports/glutin/window.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/ports/glutin/window.rs b/ports/glutin/window.rs
index 54fd6e56b49..4e154a5f677 100644
--- a/ports/glutin/window.rs
+++ b/ports/glutin/window.rs
@@ -917,6 +917,11 @@ impl WindowMethods for Window {
self.event_queue.borrow_mut().push(WindowEvent::Reload);
}
}
+ (CMD_OR_CONTROL, Some('q'), _) => {
+ if let Some(true) = PREFS.get("shell.builtin-key-shortcuts.enabled").as_boolean() {
+ self.event_queue.borrow_mut().push(WindowEvent::Quit);
+ }
+ }
_ => {
self.platform_handle_key(key, mods);