Only synthesize mouse moves on scene construction if window is active
This commit is contained in:
parent
02e39e756b
commit
a620665bed
2 changed files with 11 additions and 2 deletions
|
@ -1005,6 +1005,13 @@ impl MutableAppContext {
|
||||||
.and_then(|window| window.root_view.clone().downcast::<T>())
|
.and_then(|window| window.root_view.clone().downcast::<T>())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn window_is_active(&self, window_id: usize) -> bool {
|
||||||
|
self.cx
|
||||||
|
.windows
|
||||||
|
.get(&window_id)
|
||||||
|
.map_or(false, |window| window.is_active)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn render_view(
|
pub fn render_view(
|
||||||
&mut self,
|
&mut self,
|
||||||
window_id: usize,
|
window_id: usize,
|
||||||
|
|
|
@ -122,8 +122,10 @@ impl Presenter {
|
||||||
self.text_layout_cache.finish_frame();
|
self.text_layout_cache.finish_frame();
|
||||||
self.cursor_styles = scene.cursor_styles();
|
self.cursor_styles = scene.cursor_styles();
|
||||||
|
|
||||||
if let Some(event) = self.last_mouse_moved_event.clone() {
|
if cx.window_is_active(self.window_id) {
|
||||||
self.dispatch_event(event, cx)
|
if let Some(event) = self.last_mouse_moved_event.clone() {
|
||||||
|
self.dispatch_event(event, cx)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log::error!("could not find root_view_id for window {}", self.window_id);
|
log::error!("could not find root_view_id for window {}", self.window_id);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue