mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Move WR profiler keybindings to glutin window, where the other keybindings
are located
This commit is contained in:
parent
95a85a301f
commit
e5e3748a46
3 changed files with 12 additions and 13 deletions
|
@ -11,7 +11,7 @@ use gfx_traits::Epoch;
|
||||||
use gleam::gl;
|
use gleam::gl;
|
||||||
use image::{DynamicImage, ImageFormat, RgbImage};
|
use image::{DynamicImage, ImageFormat, RgbImage};
|
||||||
use ipc_channel::ipc::{self, IpcSharedMemory};
|
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 msg::constellation_msg::{PipelineId, PipelineIndex, PipelineNamespaceId, TraversalDirection};
|
||||||
use net_traits::image::base::{Image, PixelFormat};
|
use net_traits::image::base::{Image, PixelFormat};
|
||||||
use profile_traits::time::{self, ProfilerCategory, profile};
|
use profile_traits::time::{self, ProfilerCategory, profile};
|
||||||
|
@ -825,6 +825,11 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
warn!("Sending reload to constellation failed ({}).", e);
|
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,
|
key: Key,
|
||||||
state: KeyState,
|
state: KeyState,
|
||||||
modifiers: KeyModifiers) {
|
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);
|
let msg = ConstellationMsg::KeyEvent(ch, key, state, modifiers);
|
||||||
if let Err(e) = self.constellation_chan.send(msg) {
|
if let Err(e) = self.constellation_chan.send(msg) {
|
||||||
warn!("Sending key event to constellation failed ({}).", e);
|
warn!("Sending key event to constellation failed ({}).", e);
|
||||||
|
|
|
@ -76,6 +76,8 @@ pub enum WindowEvent {
|
||||||
KeyEvent(Option<char>, Key, KeyState, KeyModifiers),
|
KeyEvent(Option<char>, Key, KeyState, KeyModifiers),
|
||||||
/// Sent when Ctr+R/Apple+R is called to reload the current page.
|
/// Sent when Ctr+R/Apple+R is called to reload the current page.
|
||||||
Reload,
|
Reload,
|
||||||
|
/// Toggles the Web renderer profiler on and off
|
||||||
|
ToggleWebRenderProfiler,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Debug for WindowEvent {
|
impl Debug for WindowEvent {
|
||||||
|
@ -98,6 +100,7 @@ impl Debug for WindowEvent {
|
||||||
WindowEvent::Navigation(..) => write!(f, "Navigation"),
|
WindowEvent::Navigation(..) => write!(f, "Navigation"),
|
||||||
WindowEvent::Quit => write!(f, "Quit"),
|
WindowEvent::Quit => write!(f, "Quit"),
|
||||||
WindowEvent::Reload => write!(f, "Reload"),
|
WindowEvent::Reload => write!(f, "Reload"),
|
||||||
|
WindowEvent::ToggleWebRenderProfiler => write!(f, "ToggleWebRenderProfiler"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1290,6 +1290,9 @@ impl WindowMethods for Window {
|
||||||
self.event_queue.borrow_mut().push(WindowEvent::Quit);
|
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);
|
self.platform_handle_key(key, mods);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue