mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Changed Msg::KeyEvent to take in KeyState and moved the checks in CompositorTask::send_key_event to Compositor::handle_browser_message
This commit is contained in:
parent
b262fc16e0
commit
37cb876f4e
3 changed files with 7 additions and 7 deletions
|
@ -358,8 +358,10 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(Msg::KeyEvent(key, modified), ShutdownState::NotShuttingDown) => {
|
(Msg::KeyEvent(key, state, modified), ShutdownState::NotShuttingDown) => {
|
||||||
self.window.handle_key(key, modified);
|
if state == KeyState::Pressed {
|
||||||
|
self.window.handle_key(key, modified);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(Msg::SetCursor(cursor), ShutdownState::NotShuttingDown) => {
|
(Msg::SetCursor(cursor), ShutdownState::NotShuttingDown) => {
|
||||||
|
|
|
@ -91,9 +91,7 @@ impl ScriptListener for Box<CompositorProxy+'static+Send> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn send_key_event(&mut self, key: Key, state: KeyState, modifiers: KeyModifiers) {
|
fn send_key_event(&mut self, key: Key, state: KeyState, modifiers: KeyModifiers) {
|
||||||
if state == KeyState::Pressed {
|
self.send(Msg::KeyEvent(key, state, modifiers));
|
||||||
self.send(Msg::KeyEvent(key, modifiers));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +216,7 @@ pub enum Msg {
|
||||||
/// composite should happen. (See the `scrolling` module.)
|
/// composite should happen. (See the `scrolling` module.)
|
||||||
ScrollTimeout(u64),
|
ScrollTimeout(u64),
|
||||||
/// Sends an unconsumed key event back to the compositor.
|
/// Sends an unconsumed key event back to the compositor.
|
||||||
KeyEvent(Key, KeyModifiers),
|
KeyEvent(Key, KeyState, KeyModifiers),
|
||||||
/// Changes the cursor.
|
/// Changes the cursor.
|
||||||
SetCursor(Cursor),
|
SetCursor(Cursor),
|
||||||
/// Informs the compositor that the paint task for the given pipeline has exited.
|
/// Informs the compositor that the paint task for the given pipeline has exited.
|
||||||
|
|
|
@ -893,7 +893,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
||||||
CompositorEvent::KeyEvent(key, state, mods))).unwrap();
|
CompositorEvent::KeyEvent(key, state, mods))).unwrap();
|
||||||
},
|
},
|
||||||
None => self.compositor_proxy.clone_compositor_proxy()
|
None => self.compositor_proxy.clone_compositor_proxy()
|
||||||
.send(CompositorMsg::KeyEvent(key, mods))
|
.send(CompositorMsg::KeyEvent(key, state, mods))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue