Pass WindowContext to ViewHandle::is_focused

This commit is contained in:
Antonio Scandurra 2023-04-14 12:12:08 +02:00
parent 74ca223114
commit 98dce89379
3 changed files with 8 additions and 9 deletions

View file

@ -3928,12 +3928,8 @@ impl<T: View> ViewHandle<T> {
});
}
#[cfg(any(test, feature = "test-support"))]
pub fn is_focused(&self, cx: &AppContext) -> bool {
cx.read_window(self.window_id, |cx| {
cx.focused_view_id() == Some(self.view_id)
})
.unwrap_or(false)
pub fn is_focused(&self, cx: &WindowContext) -> bool {
cx.focused_view_id() == Some(self.view_id)
}
}