mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Remove WindowNavigateMsg
This commit is contained in:
parent
18c5ba108d
commit
0cce5776a7
4 changed files with 16 additions and 25 deletions
|
@ -35,7 +35,7 @@ use time::{precise_time_ns, precise_time_s};
|
||||||
use touch::{TouchHandler, TouchAction};
|
use touch::{TouchHandler, TouchAction};
|
||||||
use webrender;
|
use webrender;
|
||||||
use webrender_api::{self, ClipId, LayoutPoint, LayoutVector2D, ScrollEventPhase, ScrollLocation, ScrollClamping};
|
use webrender_api::{self, ClipId, LayoutPoint, LayoutVector2D, ScrollEventPhase, ScrollLocation, ScrollClamping};
|
||||||
use windowing::{self, MouseWindowEvent, WindowEvent, WindowMethods, WindowNavigateMsg};
|
use windowing::{self, MouseWindowEvent, WindowEvent, WindowMethods};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
enum UnableToComposite {
|
enum UnableToComposite {
|
||||||
|
@ -1294,11 +1294,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_navigation_window_event(&self, direction: WindowNavigateMsg) {
|
fn on_navigation_window_event(&self, direction: TraversalDirection) {
|
||||||
let direction = match direction {
|
|
||||||
windowing::WindowNavigateMsg::Forward => TraversalDirection::Forward(1),
|
|
||||||
windowing::WindowNavigateMsg::Back => TraversalDirection::Back(1),
|
|
||||||
};
|
|
||||||
let top_level_browsing_context_id = match self.root_pipeline {
|
let top_level_browsing_context_id = match self.root_pipeline {
|
||||||
Some(ref pipeline) => pipeline.top_level_browsing_context_id,
|
Some(ref pipeline) => pipeline.top_level_browsing_context_id,
|
||||||
None => return warn!("Sending navigation to constellation with no root pipeline."),
|
None => return warn!("Sending navigation to constellation with no root pipeline."),
|
||||||
|
|
|
@ -8,7 +8,7 @@ use compositor_thread::EventLoopWaker;
|
||||||
use euclid::{Point2D, Size2D};
|
use euclid::{Point2D, Size2D};
|
||||||
use euclid::{TypedPoint2D, TypedRect, ScaleFactor, TypedSize2D};
|
use euclid::{TypedPoint2D, TypedRect, ScaleFactor, TypedSize2D};
|
||||||
use gleam::gl;
|
use gleam::gl;
|
||||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState};
|
use msg::constellation_msg::{Key, KeyModifiers, KeyState, TraversalDirection};
|
||||||
use net_traits::net_error_list::NetError;
|
use net_traits::net_error_list::NetError;
|
||||||
use script_traits::{DevicePixel, LoadData, MouseButton, TouchEventType, TouchId, TouchpadPressurePhase};
|
use script_traits::{DevicePixel, LoadData, MouseButton, TouchEventType, TouchId, TouchpadPressurePhase};
|
||||||
use servo_geometry::DeviceIndependentPixel;
|
use servo_geometry::DeviceIndependentPixel;
|
||||||
|
@ -25,12 +25,6 @@ pub enum MouseWindowEvent {
|
||||||
MouseUp(MouseButton, TypedPoint2D<f32, DevicePixel>),
|
MouseUp(MouseButton, TypedPoint2D<f32, DevicePixel>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub enum WindowNavigateMsg {
|
|
||||||
Forward,
|
|
||||||
Back,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Events that the windowing system sends to Servo.
|
/// Events that the windowing system sends to Servo.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub enum WindowEvent {
|
pub enum WindowEvent {
|
||||||
|
@ -66,7 +60,7 @@ pub enum WindowEvent {
|
||||||
/// Sent when the user resets zoom to default.
|
/// Sent when the user resets zoom to default.
|
||||||
ResetZoom,
|
ResetZoom,
|
||||||
/// Sent when the user uses chrome navigation (i.e. backspace or shift-backspace).
|
/// Sent when the user uses chrome navigation (i.e. backspace or shift-backspace).
|
||||||
Navigation(WindowNavigateMsg),
|
Navigation(TraversalDirection),
|
||||||
/// Sent when the user quits the application
|
/// Sent when the user quits the application
|
||||||
Quit,
|
Quit,
|
||||||
/// Sent when a key input state changes
|
/// Sent when a key input state changes
|
||||||
|
|
|
@ -8,13 +8,14 @@ use frame::{ServoCefFrame, ServoCefFrameExtensions};
|
||||||
use interfaces::{CefBrowser, CefBrowserHost, CefClient, CefFrame, CefRequestContext};
|
use interfaces::{CefBrowser, CefBrowserHost, CefClient, CefFrame, CefRequestContext};
|
||||||
use interfaces::{cef_browser_t, cef_browser_host_t, cef_client_t, cef_frame_t};
|
use interfaces::{cef_browser_t, cef_browser_host_t, cef_client_t, cef_frame_t};
|
||||||
use interfaces::{cef_request_context_t};
|
use interfaces::{cef_request_context_t};
|
||||||
|
use msg::constellation_msg::TraversalDirection;
|
||||||
use servo::Browser;
|
use servo::Browser;
|
||||||
use servo::servo_url::ServoUrl;
|
use servo::servo_url::ServoUrl;
|
||||||
use types::{cef_browser_settings_t, cef_string_t, cef_window_info_t, cef_window_handle_t};
|
use types::{cef_browser_settings_t, cef_string_t, cef_window_info_t, cef_window_handle_t};
|
||||||
use window;
|
use window;
|
||||||
use wrappers::CefWrap;
|
use wrappers::CefWrap;
|
||||||
|
|
||||||
use compositing::windowing::{WindowNavigateMsg, WindowEvent};
|
use compositing::windowing::WindowEvent;
|
||||||
use glutin_app;
|
use glutin_app;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
use std::cell::{Cell, RefCell};
|
use std::cell::{Cell, RefCell};
|
||||||
|
@ -69,11 +70,11 @@ cef_class_impl! {
|
||||||
}}
|
}}
|
||||||
|
|
||||||
fn go_back(&this,) -> () {{
|
fn go_back(&this,) -> () {{
|
||||||
this.send_window_event(WindowEvent::Navigation(WindowNavigateMsg::Back));
|
this.send_window_event(WindowEvent::Navigation(TraversalDirection::Back(1)));
|
||||||
}}
|
}}
|
||||||
|
|
||||||
fn go_forward(&this,) -> () {{
|
fn go_forward(&this,) -> () {{
|
||||||
this.send_window_event(WindowEvent::Navigation(WindowNavigateMsg::Forward));
|
this.send_window_event(WindowEvent::Navigation(TraversalDirection::Forward(1)));
|
||||||
}}
|
}}
|
||||||
|
|
||||||
// Returns the main (top-level) frame for the browser window.
|
// Returns the main (top-level) frame for the browser window.
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
use NestedEventLoopListener;
|
use NestedEventLoopListener;
|
||||||
use compositing::compositor_thread::EventLoopWaker;
|
use compositing::compositor_thread::EventLoopWaker;
|
||||||
use compositing::windowing::{AnimationState, MouseWindowEvent, WindowNavigateMsg};
|
use compositing::windowing::{AnimationState, MouseWindowEvent};
|
||||||
use compositing::windowing::{WindowEvent, WindowMethods};
|
use compositing::windowing::{WindowEvent, WindowMethods};
|
||||||
use euclid::{Point2D, Size2D, TypedPoint2D, TypedVector2D, TypedRect, ScaleFactor, TypedSize2D};
|
use euclid::{Point2D, Size2D, TypedPoint2D, TypedVector2D, TypedRect, ScaleFactor, TypedSize2D};
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
|
@ -20,7 +20,7 @@ use glutin::TouchPhase;
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
use glutin::os::macos::{ActivationPolicy, WindowBuilderExt};
|
use glutin::os::macos::{ActivationPolicy, WindowBuilderExt};
|
||||||
use msg::constellation_msg::{self, Key};
|
use msg::constellation_msg::{self, Key};
|
||||||
use msg::constellation_msg::{ALT, CONTROL, KeyState, NONE, SHIFT, SUPER};
|
use msg::constellation_msg::{ALT, CONTROL, KeyState, NONE, SHIFT, SUPER, TraversalDirection};
|
||||||
use net_traits::net_error_list::NetError;
|
use net_traits::net_error_list::NetError;
|
||||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||||
use osmesa_sys;
|
use osmesa_sys;
|
||||||
|
@ -930,10 +930,10 @@ impl Window {
|
||||||
fn platform_handle_key(&self, key: Key, mods: constellation_msg::KeyModifiers) {
|
fn platform_handle_key(&self, key: Key, mods: constellation_msg::KeyModifiers) {
|
||||||
match (mods, key) {
|
match (mods, key) {
|
||||||
(CMD_OR_CONTROL, Key::LeftBracket) => {
|
(CMD_OR_CONTROL, Key::LeftBracket) => {
|
||||||
self.event_queue.borrow_mut().push(WindowEvent::Navigation(WindowNavigateMsg::Back));
|
self.event_queue.borrow_mut().push(WindowEvent::Navigation(TraversalDirection::Back(1)));
|
||||||
}
|
}
|
||||||
(CMD_OR_CONTROL, Key::RightBracket) => {
|
(CMD_OR_CONTROL, Key::RightBracket) => {
|
||||||
self.event_queue.borrow_mut().push(WindowEvent::Navigation(WindowNavigateMsg::Forward));
|
self.event_queue.borrow_mut().push(WindowEvent::Navigation(TraversalDirection::Forward(1)));
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
@ -1220,10 +1220,10 @@ impl WindowMethods for Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
(NONE, None, Key::NavigateForward) => {
|
(NONE, None, Key::NavigateForward) => {
|
||||||
self.event_queue.borrow_mut().push(WindowEvent::Navigation(WindowNavigateMsg::Forward));
|
self.event_queue.borrow_mut().push(WindowEvent::Navigation(TraversalDirection::Forward(1)));
|
||||||
}
|
}
|
||||||
(NONE, None, Key::NavigateBackward) => {
|
(NONE, None, Key::NavigateBackward) => {
|
||||||
self.event_queue.borrow_mut().push(WindowEvent::Navigation(WindowNavigateMsg::Back));
|
self.event_queue.borrow_mut().push(WindowEvent::Navigation(TraversalDirection::Back(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
(NONE, None, Key::Escape) => {
|
(NONE, None, Key::Escape) => {
|
||||||
|
@ -1233,10 +1233,10 @@ impl WindowMethods for Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
(CMD_OR_ALT, None, Key::Right) => {
|
(CMD_OR_ALT, None, Key::Right) => {
|
||||||
self.event_queue.borrow_mut().push(WindowEvent::Navigation(WindowNavigateMsg::Forward));
|
self.event_queue.borrow_mut().push(WindowEvent::Navigation(TraversalDirection::Forward(1)));
|
||||||
}
|
}
|
||||||
(CMD_OR_ALT, None, Key::Left) => {
|
(CMD_OR_ALT, None, Key::Left) => {
|
||||||
self.event_queue.borrow_mut().push(WindowEvent::Navigation(WindowNavigateMsg::Back));
|
self.event_queue.borrow_mut().push(WindowEvent::Navigation(TraversalDirection::Back(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
(NONE, None, Key::PageDown) => {
|
(NONE, None, Key::PageDown) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue