Merge branch 'main' into fix-panel-resize

This commit is contained in:
Max Brunsfeld 2023-12-19 08:55:55 -08:00
commit cf037ea4a8
13 changed files with 131 additions and 95 deletions

View file

@ -567,12 +567,7 @@ impl<'a> VisualTestContext<'a> {
pub fn window_title(&mut self) -> Option<String> {
self.cx
.update_window(self.window, |_, cx| {
cx.window
.platform_window
.as_test()
.unwrap()
.window_title
.clone()
cx.window.platform_window.as_test().unwrap().title.clone()
})
.unwrap()
}

View file

@ -1061,7 +1061,7 @@ impl Interactivity {
{
cx.focus(&focus_handle);
// If there is a parent that is also focusable, prevent it
// from trasferring focus because we already did so.
// from transferring focus because we already did so.
cx.prevent_default();
}
}

View file

@ -293,7 +293,7 @@ impl std::fmt::Debug for ListItem {
}
}
#[derive(Debug, Clone, Copy)]
#[derive(Debug, Clone, Copy, Default)]
pub struct ListOffset {
pub item_ix: usize,
pub offset_in_item: Pixels,

View file

@ -21,7 +21,8 @@ pub(crate) struct TestWindowHandlers {
pub struct TestWindow {
pub(crate) bounds: WindowBounds,
display: Rc<dyn PlatformDisplay>,
pub(crate) window_title: Option<String>,
pub(crate) title: Option<String>,
pub(crate) edited: bool,
pub(crate) input_handler: Option<Arc<Mutex<Box<dyn PlatformInputHandler>>>>,
pub(crate) handlers: Arc<Mutex<TestWindowHandlers>>,
platform: Weak<TestPlatform>,
@ -41,7 +42,8 @@ impl TestWindow {
input_handler: None,
sprite_atlas: Arc::new(TestAtlas::new()),
handlers: Default::default(),
window_title: Default::default(),
title: Default::default(),
edited: false,
}
}
}
@ -109,11 +111,11 @@ impl PlatformWindow for TestWindow {
}
fn set_title(&mut self, title: &str) {
self.window_title = Some(title.to_owned());
self.title = Some(title.to_owned());
}
fn set_edited(&mut self, _edited: bool) {
unimplemented!()
fn set_edited(&mut self, edited: bool) {
self.edited = edited;
}
fn show_character_palette(&self) {

View file

@ -773,6 +773,10 @@ impl<'a> WindowContext<'a> {
self.window.platform_window.set_title(title);
}
pub fn set_window_edited(&mut self, edited: bool) {
self.window.platform_window.set_edited(edited);
}
pub fn display(&self) -> Option<Rc<dyn PlatformDisplay>> {
self.platform
.displays()