aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTremoneck <tremoneck@gmail.com>2017-07-10 12:43:01 +0200
committerTremoneck <tremoneck@gmail.com>2017-07-11 08:08:57 +0200
commite5e3748a463769ba7f404ffc760b8638a9ca418a (patch)
tree992f405a63b524391de2765e6fcb3a6e2fd6b233
parent95a85a301f1d014c45448a4d5d4f5a8497904af6 (diff)
downloadservo-e5e3748a463769ba7f404ffc760b8638a9ca418a.tar.gz
servo-e5e3748a463769ba7f404ffc760b8638a9ca418a.zip
Move WR profiler keybindings to glutin window, where the other keybindings
are located
-rw-r--r--components/compositing/compositor.rs19
-rw-r--r--components/compositing/windowing.rs3
-rw-r--r--ports/glutin/window.rs3
3 files changed, 12 insertions, 13 deletions
diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs
index 94c806414db..32dea8e272e 100644
--- a/components/compositing/compositor.rs
+++ b/components/compositing/compositor.rs
@@ -11,7 +11,7 @@ use gfx_traits::Epoch;
use gleam::gl;
use image::{DynamicImage, ImageFormat, RgbImage};
use ipc_channel::ipc::{self, IpcSharedMemory};
-use msg::constellation_msg::{Key, KeyModifiers, KeyState, CONTROL};
+use msg::constellation_msg::{Key, KeyModifiers, KeyState};
use msg::constellation_msg::{PipelineId, PipelineIndex, PipelineNamespaceId, TraversalDirection};
use net_traits::image::base::{Image, PixelFormat};
use profile_traits::time::{self, ProfilerCategory, profile};
@@ -825,6 +825,11 @@ impl<Window: WindowMethods> IOCompositor<Window> {
warn!("Sending reload to constellation failed ({}).", e);
}
}
+
+ WindowEvent::ToggleWebRenderProfiler => {
+ let profiler_enabled = self.webrender.get_profiler_enabled();
+ self.set_webrender_profiler_enabled(!profiler_enabled);
+ }
}
}
@@ -1313,18 +1318,6 @@ impl<Window: WindowMethods> IOCompositor<Window> {
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);
diff --git a/components/compositing/windowing.rs b/components/compositing/windowing.rs
index ac8d6a8ea21..94dfca5268e 100644
--- a/components/compositing/windowing.rs
+++ b/components/compositing/windowing.rs
@@ -76,6 +76,8 @@ pub enum WindowEvent {
KeyEvent(Option<char>, Key, KeyState, KeyModifiers),
/// Sent when Ctr+R/Apple+R is called to reload the current page.
Reload,
+ /// Toggles the Web renderer profiler on and off
+ ToggleWebRenderProfiler,
}
impl Debug for WindowEvent {
@@ -98,6 +100,7 @@ impl Debug for WindowEvent {
WindowEvent::Navigation(..) => write!(f, "Navigation"),
WindowEvent::Quit => write!(f, "Quit"),
WindowEvent::Reload => write!(f, "Reload"),
+ WindowEvent::ToggleWebRenderProfiler => write!(f, "ToggleWebRenderProfiler"),
}
}
}
diff --git a/ports/glutin/window.rs b/ports/glutin/window.rs
index c82327b2335..1893fb2d47a 100644
--- a/ports/glutin/window.rs
+++ b/ports/glutin/window.rs
@@ -1290,6 +1290,9 @@ impl WindowMethods for Window {
self.event_queue.borrow_mut().push(WindowEvent::Quit);
}
}
+ (CONTROL, None, Key::F12) => {
+ self.event_queue.borrow_mut().push(WindowEvent::ToggleWebRenderProfiler);
+ }
_ => {
self.platform_handle_key(key, mods);