Merge MutableAppContext into AppContext

There may have been a good reason for the difference at some point, or I was
still learning Rust. But now it's just &mut AppContext vs &AppContext.
This commit is contained in:
Nathan Sobo 2023-04-06 15:49:03 -06:00
parent dd00966cc6
commit de9bf6dfbd
112 changed files with 882 additions and 1041 deletions

View file

@ -5,8 +5,8 @@ use gpui::{
elements::{Empty, MouseEventHandler, Overlay},
geometry::{rect::RectF, vector::Vector2F},
scene::{MouseDown, MouseDrag},
CursorStyle, Element, ElementBox, EventContext, MouseButton, MutableAppContext, RenderContext,
View, WeakViewHandle,
AppContext, CursorStyle, Element, ElementBox, EventContext, MouseButton, RenderContext, View,
WeakViewHandle,
};
const DEAD_ZONE: f32 = 4.;
@ -261,7 +261,7 @@ impl<V: View> DragAndDrop<V> {
})
}
pub fn cancel_dragging<P: Any>(&mut self, cx: &mut MutableAppContext) {
pub fn cancel_dragging<P: Any>(&mut self, cx: &mut AppContext) {
if let Some(State::Dragging {
payload, window_id, ..
}) = &self.currently_dragged
@ -274,13 +274,13 @@ impl<V: View> DragAndDrop<V> {
}
}
fn finish_dragging(&mut self, cx: &mut MutableAppContext) {
fn finish_dragging(&mut self, cx: &mut AppContext) {
if let Some(State::Dragging { window_id, .. }) = self.currently_dragged.take() {
self.notify_containers_for_window(window_id, cx);
}
}
fn notify_containers_for_window(&mut self, window_id: usize, cx: &mut MutableAppContext) {
fn notify_containers_for_window(&mut self, window_id: usize, cx: &mut AppContext) {
self.containers.retain(|container| {
if let Some(container) = container.upgrade(cx) {
if container.window_id() == window_id {