mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
libservo: Remove EmbedderEvent::WindowResize
(#35277)
Remove this event which is completely unused. In addition, lots of code becomes dead once this happens, so remove that as well. It may be possible that a different behavior is necessary immediately following a window resize, but the new API will handle this in a different way than this embedder event -- which complicates how the event loop is spun in both the API and servoshell. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
c94ac5bccb
commit
d5daa31b1f
3 changed files with 6 additions and 42 deletions
|
@ -51,8 +51,6 @@ pub enum EmbedderEvent {
|
|||
/// Sent when part of the window is marked dirty and needs to be redrawn. Before sending this
|
||||
/// message, the window must make the same GL context as in `PrepareRenderingEvent` current.
|
||||
Refresh,
|
||||
/// Sent when the window is resized.
|
||||
WindowResize,
|
||||
/// Sent when the platform theme changes.
|
||||
ThemeChange(Theme),
|
||||
/// Sent when a navigation request from script is allowed/refused.
|
||||
|
@ -142,7 +140,6 @@ impl Debug for EmbedderEvent {
|
|||
match *self {
|
||||
EmbedderEvent::Idle => write!(f, "Idle"),
|
||||
EmbedderEvent::Refresh => write!(f, "Refresh"),
|
||||
EmbedderEvent::WindowResize => write!(f, "Resize"),
|
||||
EmbedderEvent::ThemeChange(..) => write!(f, "ThemeChange"),
|
||||
EmbedderEvent::Keyboard(..) => write!(f, "Keyboard"),
|
||||
EmbedderEvent::IMEComposition(..) => write!(f, "IMEComposition"),
|
||||
|
|
|
@ -643,17 +643,13 @@ impl Servo {
|
|||
)
|
||||
}
|
||||
|
||||
fn handle_window_event(&mut self, event: EmbedderEvent) -> bool {
|
||||
fn handle_window_event(&mut self, event: EmbedderEvent) {
|
||||
match event {
|
||||
EmbedderEvent::Idle => {},
|
||||
|
||||
EmbedderEvent::Refresh => {
|
||||
self.compositor.borrow_mut().composite();
|
||||
},
|
||||
|
||||
EmbedderEvent::WindowResize => {
|
||||
return self.compositor.borrow_mut().on_rendering_context_resized();
|
||||
},
|
||||
EmbedderEvent::ThemeChange(theme) => {
|
||||
let msg = ConstellationMsg::ThemeChange(theme);
|
||||
if let Err(e) = self.constellation_proxy.try_send(msg) {
|
||||
|
@ -918,7 +914,6 @@ impl Servo {
|
|||
self.send_to_constellation(ConstellationMsg::Clipboard(clipboard_event));
|
||||
},
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
fn send_to_constellation(&self, msg: ConstellationMsg) {
|
||||
|
@ -955,21 +950,19 @@ impl Servo {
|
|||
self.messages_for_embedder.drain(..)
|
||||
}
|
||||
|
||||
pub fn handle_events(&mut self, events: impl IntoIterator<Item = EmbedderEvent>) -> bool {
|
||||
pub fn handle_events(&mut self, events: impl IntoIterator<Item = EmbedderEvent>) {
|
||||
if self.compositor.borrow_mut().receive_messages() {
|
||||
self.receive_messages();
|
||||
}
|
||||
let mut need_resize = false;
|
||||
for event in events {
|
||||
trace!("servo <- embedder EmbedderEvent {:?}", event);
|
||||
need_resize |= self.handle_window_event(event);
|
||||
self.handle_window_event(event);
|
||||
}
|
||||
if self.compositor.borrow().shutdown_state != ShutdownState::FinishedShuttingDown {
|
||||
self.compositor.borrow_mut().perform_updates();
|
||||
} else {
|
||||
self.messages_for_embedder.push(EmbedderMsg::Shutdown);
|
||||
}
|
||||
need_resize
|
||||
}
|
||||
|
||||
pub fn repaint_synchronously(&mut self) {
|
||||
|
|
|
@ -58,7 +58,6 @@ pub struct App {
|
|||
}
|
||||
|
||||
enum Present {
|
||||
Immediate,
|
||||
Deferred,
|
||||
None,
|
||||
}
|
||||
|
@ -251,7 +250,6 @@ impl App {
|
|||
// Take any new embedder messages from Servo.
|
||||
let servo = self.servo.as_mut().expect("Servo should be running.");
|
||||
let mut embedder_messages: Vec<_> = servo.get_events().collect();
|
||||
let mut need_resize = false;
|
||||
let mut need_present = false;
|
||||
let mut need_update = false;
|
||||
loop {
|
||||
|
@ -266,7 +264,8 @@ impl App {
|
|||
need_update |= servo_event_response.need_update;
|
||||
|
||||
// Runs the compositor, and receives and collects embedder messages from various Servo components.
|
||||
need_resize |= servo.handle_events(vec![]);
|
||||
servo.handle_events(vec![]);
|
||||
|
||||
if self.webviews.shutdown_requested() {
|
||||
return PumpResult::Shutdown;
|
||||
}
|
||||
|
@ -278,9 +277,7 @@ impl App {
|
|||
}
|
||||
}
|
||||
|
||||
let present = if need_resize {
|
||||
Present::Immediate
|
||||
} else if need_present {
|
||||
let present = if need_present {
|
||||
Present::Deferred
|
||||
} else {
|
||||
Present::None
|
||||
|
@ -322,24 +319,6 @@ impl App {
|
|||
}
|
||||
}
|
||||
match present {
|
||||
Present::Immediate => {
|
||||
// The window was resized.
|
||||
trace!("PumpResult::Present::Immediate");
|
||||
|
||||
// If we had resized any of the viewports in response to this, we would need to
|
||||
// call Servo::repaint_synchronously. At the moment we don’t, so there won’t be
|
||||
// any paint scheduled, and calling it would hang the compositor forever.
|
||||
if let Some(ref mut minibrowser) = self.minibrowser {
|
||||
minibrowser.update(
|
||||
window.winit_window().unwrap(),
|
||||
&mut self.webviews,
|
||||
self.servo.as_ref(),
|
||||
"PumpResult::Present::Immediate",
|
||||
);
|
||||
minibrowser.paint(window.winit_window().unwrap());
|
||||
}
|
||||
self.servo.as_mut().unwrap().present();
|
||||
},
|
||||
Present::Deferred => {
|
||||
// The compositor has painted to this frame.
|
||||
trace!("PumpResult::Present::Deferred");
|
||||
|
@ -385,11 +364,6 @@ impl App {
|
|||
},
|
||||
PumpResult::Continue { present, .. } => {
|
||||
match present {
|
||||
Present::Immediate => {
|
||||
// The window was resized.
|
||||
trace!("PumpResult::Present::Immediate");
|
||||
self.servo.as_mut().unwrap().present();
|
||||
},
|
||||
Present::Deferred => {
|
||||
// The compositor has painted to this frame.
|
||||
trace!("PumpResult::Present::Deferred");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue