mirror of
https://github.com/servo/servo.git
synced 2025-07-16 20:03:39 +01:00
Auto merge of #21477 - paulrouget:fixzoom, r=Manishearth
Fix zoom keybindings - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #21457 (github issue number if applicable). <!-- 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/21477) <!-- Reviewable:end -->
This commit is contained in:
commit
d8471e335b
1 changed files with 7 additions and 10 deletions
|
@ -170,23 +170,20 @@ impl Browser {
|
||||||
/// Handle key events after they have been handled by Servo.
|
/// Handle key events after they have been handled by Servo.
|
||||||
fn handle_key_from_servo(&mut self, _: Option<BrowserId>, ch: Option<char>,
|
fn handle_key_from_servo(&mut self, _: Option<BrowserId>, ch: Option<char>,
|
||||||
key: Key, state: KeyState, mods: KeyModifiers) {
|
key: Key, state: KeyState, mods: KeyModifiers) {
|
||||||
if state == KeyState::Pressed {
|
if state == KeyState::Released {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
match (mods, ch, key) {
|
match (mods, ch, key) {
|
||||||
(_, Some('+'), _) => {
|
(CMD_OR_CONTROL, Some('='), _) | (CMD_OR_CONTROL, Some('+'), _) => {
|
||||||
if mods & !KeyModifiers::SHIFT == CMD_OR_CONTROL {
|
|
||||||
self.event_queue.push(WindowEvent::Zoom(1.1));
|
self.event_queue.push(WindowEvent::Zoom(1.1));
|
||||||
} else if mods & !KeyModifiers::SHIFT == CMD_OR_CONTROL | KeyModifiers::ALT {
|
|
||||||
self.event_queue.push(WindowEvent::PinchZoom(1.1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
(_, Some('='), _) if mods == (CMD_OR_CONTROL | KeyModifiers::SHIFT) => {
|
||||||
|
self.event_queue.push(WindowEvent::Zoom(1.1));
|
||||||
|
},
|
||||||
(CMD_OR_CONTROL, Some('-'), _) => {
|
(CMD_OR_CONTROL, Some('-'), _) => {
|
||||||
self.event_queue.push(WindowEvent::Zoom(1.0 / 1.1));
|
self.event_queue.push(WindowEvent::Zoom(1.0 / 1.1));
|
||||||
}
|
}
|
||||||
(_, Some('-'), _) if mods == CMD_OR_CONTROL | KeyModifiers::ALT => {
|
|
||||||
self.event_queue.push(WindowEvent::PinchZoom(1.0 / 1.1));
|
|
||||||
}
|
|
||||||
(CMD_OR_CONTROL, Some('0'), _) => {
|
(CMD_OR_CONTROL, Some('0'), _) => {
|
||||||
self.event_queue.push(WindowEvent::ResetZoom);
|
self.event_queue.push(WindowEvent::ResetZoom);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue