Skip to content

Commit

Permalink
borrow_mut -> replace
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Nov 9, 2023
1 parent 3041de3 commit 9e8fb18
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions crates/eframe/src/native/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1110,13 +1110,13 @@ mod glow_integration {
);
}

*self.running.borrow_mut() = Some(GlowWinitRunning {
self.running.replace(Some(GlowWinitRunning {
glutin_ctx,
gl,
painter,
integration: Rc::new(RefCell::new(integration)),
app: Rc::new(RefCell::new(app)),
});
}));

Ok(())
}
Expand Down Expand Up @@ -1742,16 +1742,18 @@ mod glow_integration {

match &event {
winit::event::WindowEvent::Focused(new_focused) => {
*self.focused_viewport.borrow_mut() = new_focused
.then(|| {
running
.glutin_ctx
.borrow_mut()
.viewport_maps
.get(window_id)
.copied()
})
.flatten();
self.focused_viewport.replace(
new_focused
.then(|| {
running
.glutin_ctx
.borrow_mut()
.viewport_maps
.get(window_id)
.copied()
})
.flatten(),
);
}
winit::event::WindowEvent::Resized(physical_size) => {
repaint_asap = true;
Expand Down Expand Up @@ -2705,8 +2707,8 @@ mod wgpu_integration {

match &event {
winit::event::WindowEvent::Focused(new_focused) => {
*self.focused_viewport.borrow_mut() =
new_focused.then(|| viewport_id).flatten();
self.focused_viewport
.replace(new_focused.then(|| viewport_id).flatten());
}
winit::event::WindowEvent::Resized(physical_size) => {
repaint_asap = true;
Expand Down

0 comments on commit 9e8fb18

Please sign in to comment.