Make BorrowedWithFontSystem borrow FontSystem mutably

This commit is contained in:
Edgar Geier 2023-03-12 10:30:09 +01:00
parent 057b5b6fa9
commit 46e9ef0246
No known key found for this signature in database
GPG key ID: DE2B55319457EB56
11 changed files with 37 additions and 31 deletions

View file

@ -96,7 +96,7 @@ where
//TODO: allow lazy shape
let mut editor = self.editor.lock().unwrap();
editor
.borrow_with(&FONT_SYSTEM)
.borrow_with(&mut FONT_SYSTEM.lock().unwrap())
.buffer_mut()
.shape_until(i32::max_value());
@ -167,7 +167,9 @@ where
let view_w = viewport.width.min(layout.bounds().width) - self.padding.horizontal() as f32;
let view_h = viewport.height.min(layout.bounds().height) - self.padding.vertical() as f32;
let mut editor = editor.borrow_with(&FONT_SYSTEM);
let mut font_system = FONT_SYSTEM.lock().unwrap();
let mut editor = editor.borrow_with(&mut font_system);
editor.buffer_mut().set_size(view_w, view_h);
@ -239,7 +241,8 @@ where
) -> Status {
let state = tree.state.downcast_mut::<State>();
let mut editor = self.editor.lock().unwrap();
let mut editor = editor.borrow_with(&FONT_SYSTEM);
let mut font_system = FONT_SYSTEM.lock().unwrap();
let mut editor = editor.borrow_with(&mut font_system);
let mut status = Status::Ignored;
match event {