diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-11-04 03:11:32 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-04 03:11:32 -0500 |
commit | 651e40f33eff08f836b76024b77bddc77089490c (patch) | |
tree | f66c3852464fc5f4019e6c0e708ca2f7d73d91f0 /components/compositing/compositor.rs | |
parent | 0c6a277b099683e8cb87630fb6483bc89ed09aa4 (diff) | |
parent | 2843f069334932dbf0b3a087fd53300f349390fb (diff) | |
download | servo-651e40f33eff08f836b76024b77bddc77089490c.tar.gz servo-651e40f33eff08f836b76024b77bddc77089490c.zip |
Auto merge of #14057 - glennw:update-wr-keys, r=metajack
Update WR, add some key mappings, bind Ctrl-F12 to WR profiler.
<!-- 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/14057)
<!-- Reviewable:end -->
Diffstat (limited to 'components/compositing/compositor.rs')
-rw-r--r-- | components/compositing/compositor.rs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index dca6d253e56..70292acee1b 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -18,7 +18,7 @@ use gleam::gl::types::{GLint, GLsizei}; use image::{DynamicImage, ImageFormat, RgbImage}; use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory}; use ipc_channel::router::ROUTER; -use msg::constellation_msg::{Key, KeyModifiers, KeyState}; +use msg::constellation_msg::{Key, KeyModifiers, KeyState, CONTROL}; use msg::constellation_msg::{PipelineId, PipelineIndex, PipelineNamespaceId, TraversalDirection}; use net_traits::image::base::{Image, PixelFormat}; use profile_traits::mem::{self, Reporter, ReporterRequest}; @@ -1302,7 +1302,23 @@ impl<Window: WindowMethods> IOCompositor<Window> { } } - fn on_key_event(&self, ch: Option<char>, key: Key, state: KeyState, modifiers: KeyModifiers) { + fn on_key_event(&mut self, + ch: Option<char>, + key: Key, + state: KeyState, + modifiers: KeyModifiers) { + // Steal a few key events for webrender debug options. + if modifiers.contains(CONTROL) && state == KeyState::Pressed { + match key { + Key::F12 => { + let profiler_enabled = self.webrender.get_profiler_enabled(); + self.webrender.set_profiler_enabled(!profiler_enabled); + return; + } + _ => {} + } + } + let msg = ConstellationMsg::KeyEvent(ch, key, state, modifiers); if let Err(e) = self.constellation_chan.send(msg) { warn!("Sending key event to constellation failed ({}).", e); |