mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Restore glutin close on escape functionality. Also fix linux compile error.
This commit is contained in:
parent
59b9d14ca4
commit
bfa2f1f3e1
1 changed files with 3 additions and 4 deletions
|
@ -230,12 +230,12 @@ impl WindowMethods for Window {
|
||||||
#[cfg(target_os="linux")]
|
#[cfg(target_os="linux")]
|
||||||
fn native_metadata(&self) -> NativeGraphicsMetadata {
|
fn native_metadata(&self) -> NativeGraphicsMetadata {
|
||||||
match self.glutin {
|
match self.glutin {
|
||||||
Windowed(ref window) => {
|
WindowHandle::Windowed(ref window) => {
|
||||||
NativeGraphicsMetadata {
|
NativeGraphicsMetadata {
|
||||||
display: unsafe { window.platform_display() }
|
display: unsafe { window.platform_display() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Headless(_) => {
|
WindowHandle::Headless(_) => {
|
||||||
NativeGraphicsMetadata {
|
NativeGraphicsMetadata {
|
||||||
display: ptr::null_mut()
|
display: ptr::null_mut()
|
||||||
}
|
}
|
||||||
|
@ -264,8 +264,6 @@ impl WindowMethods for Window {
|
||||||
/// Helper function to handle keyboard events.
|
/// Helper function to handle keyboard events.
|
||||||
fn handle_key(&self, key: Key, mods: constellation_msg::KeyModifiers) {
|
fn handle_key(&self, key: Key, mods: constellation_msg::KeyModifiers) {
|
||||||
match key {
|
match key {
|
||||||
// TODO(negge): handle window close event
|
|
||||||
Key::Escape => {},
|
|
||||||
Key::Equal if mods.contains(CONTROL) => { // Ctrl-+
|
Key::Equal if mods.contains(CONTROL) => { // Ctrl-+
|
||||||
self.event_queue.borrow_mut().push(Zoom(1.1));
|
self.event_queue.borrow_mut().push(Zoom(1.1));
|
||||||
}
|
}
|
||||||
|
@ -368,6 +366,7 @@ impl Window {
|
||||||
(_, VirtualKeyCode::RShift) => self.toggle_modifier(RIGHT_SHIFT),
|
(_, VirtualKeyCode::RShift) => self.toggle_modifier(RIGHT_SHIFT),
|
||||||
(_, VirtualKeyCode::LAlt) => self.toggle_modifier(LEFT_ALT),
|
(_, VirtualKeyCode::LAlt) => self.toggle_modifier(LEFT_ALT),
|
||||||
(_, VirtualKeyCode::RAlt) => self.toggle_modifier(RIGHT_ALT),
|
(_, VirtualKeyCode::RAlt) => self.toggle_modifier(RIGHT_ALT),
|
||||||
|
(ElementState::Pressed, VirtualKeyCode::Escape) => return true,
|
||||||
(ElementState::Pressed, key_code) => {
|
(ElementState::Pressed, key_code) => {
|
||||||
match glutin_key_to_script_key(key_code) {
|
match glutin_key_to_script_key(key_code) {
|
||||||
Ok(key) => {
|
Ok(key) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue