Don't send a resize event if the window size didn't change

This commit is contained in:
Seth Fowler 2013-06-27 19:04:01 -07:00
parent 677fce2546
commit 72f5e5f30d
2 changed files with 9 additions and 4 deletions

View file

@ -182,9 +182,14 @@ impl CompositorTask {
let layout_chan_clone = layout_chan.clone(); let layout_chan_clone = layout_chan.clone();
// Hook the windowing system's resize callback up to the resize rate limiter. // Hook the windowing system's resize callback up to the resize rate limiter.
do window.set_resize_callback |width, height| { do window.set_resize_callback |width, height| {
debug!("osmain: window resized to %ux%u", width, height); let new_size = Size2D(width as int, height as int);
*window_size = Size2D(width as int, height as int); if *window_size != new_size {
layout_chan_clone.chan.send(RouteScriptMsg(SendEventMsg(ResizeEvent(width, height)))); debug!("osmain: window resized to %ux%u", width, height);
*window_size = new_size;
layout_chan_clone.chan.send(RouteScriptMsg(SendEventMsg(ResizeEvent(width, height))));
} else {
debug!("osmain: dropping window resize since size is still %ux%u", width, height);
}
} }
let layout_chan_clone = layout_chan.clone(); let layout_chan_clone = layout_chan.clone();

View file

@ -440,7 +440,7 @@ impl ScriptContext {
/// ///
/// This function fails if there is no root frame. /// This function fails if there is no root frame.
fn reflow(&mut self, goal: ReflowGoal) { fn reflow(&mut self, goal: ReflowGoal) {
debug!("script: performing reflow"); debug!("script: performing reflow for goal %?", goal);
// Now, join the layout so that they will see the latest changes we have made. // Now, join the layout so that they will see the latest changes we have made.
self.join_layout(); self.join_layout();