diff --git a/Cargo.lock b/Cargo.lock index 26077234..a6b23914 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -474,7 +474,7 @@ dependencies = [ "bitflags 2.6.0", "cexpr", "clang-sys", - "itertools 0.13.0", + "itertools 0.11.0", "log", "prettyplease", "proc-macro2", @@ -950,7 +950,7 @@ dependencies = [ [[package]] name = "collections" version = "0.1.0" -source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#543fe4c094abdc5ebc54e8a5f5e9559ee1b30f55" +source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0e42c019fe7ecb989586e50e7a94f06017395134" dependencies = [ "rustc-hash", ] @@ -1313,7 +1313,7 @@ dependencies = [ [[package]] name = "derive_refineable" version = "0.1.0" -source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#543fe4c094abdc5ebc54e8a5f5e9559ee1b30f55" +source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0e42c019fe7ecb989586e50e7a94f06017395134" dependencies = [ "proc-macro2", "quote", @@ -2266,7 +2266,7 @@ dependencies = [ [[package]] name = "gpui" version = "0.1.0" -source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#543fe4c094abdc5ebc54e8a5f5e9559ee1b30f55" +source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0e42c019fe7ecb989586e50e7a94f06017395134" dependencies = [ "anyhow", "as-raw-xcb-connection", @@ -2365,7 +2365,7 @@ dependencies = [ [[package]] name = "gpui_macros" version = "0.1.0" -source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#543fe4c094abdc5ebc54e8a5f5e9559ee1b30f55" +source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0e42c019fe7ecb989586e50e7a94f06017395134" dependencies = [ "proc-macro2", "quote", @@ -2555,7 +2555,7 @@ dependencies = [ [[package]] name = "http_client" version = "0.1.0" -source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#543fe4c094abdc5ebc54e8a5f5e9559ee1b30f55" +source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0e42c019fe7ecb989586e50e7a94f06017395134" dependencies = [ "anyhow", "bytes", @@ -3071,11 +3071,12 @@ dependencies = [ [[package]] name = "media" version = "0.1.0" -source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#543fe4c094abdc5ebc54e8a5f5e9559ee1b30f55" +source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0e42c019fe7ecb989586e50e7a94f06017395134" dependencies = [ "anyhow", "bindgen", "core-foundation 0.9.4", + "ctor", "foreign-types", "metal", "objc", @@ -3379,7 +3380,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ - "proc-macro-crate 3.2.0", + "proc-macro-crate 1.3.1", "proc-macro2", "quote", "syn 2.0.86", @@ -4350,7 +4351,7 @@ dependencies = [ [[package]] name = "refineable" version = "0.1.0" -source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#543fe4c094abdc5ebc54e8a5f5e9559ee1b30f55" +source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0e42c019fe7ecb989586e50e7a94f06017395134" dependencies = [ "derive_refineable", ] @@ -4671,7 +4672,7 @@ checksum = "d369a96f978623eb3dc28807c4852d6cc617fed53da5d3c400feff1ef34a714a" [[package]] name = "semantic_version" version = "0.1.0" -source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#543fe4c094abdc5ebc54e8a5f5e9559ee1b30f55" +source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0e42c019fe7ecb989586e50e7a94f06017395134" dependencies = [ "anyhow", "serde", @@ -5089,7 +5090,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "sum_tree" version = "0.1.0" -source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#543fe4c094abdc5ebc54e8a5f5e9559ee1b30f55" +source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0e42c019fe7ecb989586e50e7a94f06017395134" dependencies = [ "arrayvec", "log", @@ -5748,7 +5749,7 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] name = "util" version = "0.1.0" -source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#543fe4c094abdc5ebc54e8a5f5e9559ee1b30f55" +source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#0e42c019fe7ecb989586e50e7a94f06017395134" dependencies = [ "anyhow", "async-fs 1.6.0", diff --git a/crates/ui/src/dock/dock.rs b/crates/ui/src/dock/dock.rs index b3cd2a42..7834fccc 100644 --- a/crates/ui/src/dock/dock.rs +++ b/crates/ui/src/dock/dock.rs @@ -245,7 +245,7 @@ impl Dock { .when(axis.is_horizontal(), |this| this.h_full().w(HANDLE_SIZE)) .when(axis.is_vertical(), |this| this.w_full().h(HANDLE_SIZE)), ) - .on_drag(ResizePanel {}, move |info, cx| { + .on_drag(ResizePanel {}, move |info, _, cx| { cx.stop_propagation(); view.update(cx, |view, _| { view.is_resizing = true; diff --git a/crates/ui/src/dock/tab_panel.rs b/crates/ui/src/dock/tab_panel.rs index cf3cbbf4..3389e7cc 100644 --- a/crates/ui/src/dock/tab_panel.rs +++ b/crates/ui/src/dock/tab_panel.rs @@ -405,7 +405,7 @@ impl TabPanel { panel: panel.clone(), tab_panel: view, }, - |drag, cx| { + |drag, _, cx| { cx.stop_propagation(); cx.new_view(|_| drag.clone()) }, @@ -441,10 +441,13 @@ impl TabPanel { view.set_active_ix(ix, cx); })) .when(state.draggable, |this| { - this.on_drag(DragPanel::new(panel.clone(), view.clone()), |drag, cx| { - cx.stop_propagation(); - cx.new_view(|_| drag.clone()) - }) + this.on_drag( + DragPanel::new(panel.clone(), view.clone()), + |drag, _, cx| { + cx.stop_propagation(); + cx.new_view(|_| drag.clone()) + }, + ) }) .when(state.droppable, |this| { this.drag_over::(|this, _, cx| { diff --git a/crates/ui/src/list/list.rs b/crates/ui/src/list/list.rs index f2ef2561..0eca616f 100644 --- a/crates/ui/src/list/list.rs +++ b/crates/ui/src/list/list.rs @@ -8,13 +8,13 @@ use crate::{ theme::ActiveTheme, v_flex, IconName, Size, }; -use gpui::px; use gpui::{ actions, div, prelude::FluentBuilder, uniform_list, AnyElement, AppContext, Entity, FocusHandle, FocusableView, InteractiveElement, IntoElement, KeyBinding, Length, ListSizingBehavior, MouseButton, ParentElement, Render, SharedString, Styled, Task, UniformListScrollHandle, View, ViewContext, VisualContext, WindowContext, }; +use gpui::{px, ScrollStrategy}; use smol::Timer; actions!(list, [Cancel, Confirm, SelectPrev, SelectNext]); @@ -209,7 +209,8 @@ where fn scroll_to_selected_item(&mut self, _cx: &mut ViewContext) { if let Some(ix) = self.selected_index { - self.vertical_scroll_handle.scroll_to_item(ix); + self.vertical_scroll_handle + .scroll_to_item(ix, ScrollStrategy::Top); } } @@ -233,7 +234,8 @@ where search.await; let _ = this.update(&mut cx, |this, _| { - this.vertical_scroll_handle.scroll_to_item(0); + this.vertical_scroll_handle + .scroll_to_item(0, ScrollStrategy::Top); this.last_query = Some(text); }); diff --git a/crates/ui/src/resizable/panel.rs b/crates/ui/src/resizable/panel.rs index f76f67c0..3221e167 100644 --- a/crates/ui/src/resizable/panel.rs +++ b/crates/ui/src/resizable/panel.rs @@ -150,7 +150,7 @@ impl ResizablePanelGroup { let view = cx.view().clone(); resize_handle(("resizable-handle", ix), self.axis).on_drag( DragPanel((cx.entity_id(), ix, self.axis)), - move |drag_panel, cx| { + move |drag_panel, _, cx| { cx.stop_propagation(); // Set current resizing panel ix view.update(cx, |view, _| { diff --git a/crates/ui/src/scroll/scrollable_mask.rs b/crates/ui/src/scroll/scrollable_mask.rs index 2320279a..a6f29ba8 100644 --- a/crates/ui/src/scroll/scrollable_mask.rs +++ b/crates/ui/src/scroll/scrollable_mask.rs @@ -149,7 +149,7 @@ impl Element for ScrollableMask { } if old_offset != scroll_handle.offset() { - cx.notify(view_id); + cx.notify(Some(view_id)); cx.stop_propagation(); } } diff --git a/crates/ui/src/scroll/scrollbar.rs b/crates/ui/src/scroll/scrollbar.rs index 3868bcc1..56f7cb45 100644 --- a/crates/ui/src/scroll/scrollbar.rs +++ b/crates/ui/src/scroll/scrollbar.rs @@ -493,7 +493,7 @@ impl Element for Scrollbar { scroll_handle.offset(), Some(Instant::now()), )); - cx.notify(view_id); + cx.notify(Some(view_id)); } } } @@ -514,7 +514,7 @@ impl Element for Scrollbar { state.set(state.get().with_drag_pos(axis, pos)); - cx.notify(view_id); + cx.notify(Some(view_id)); } else { // click on the scrollbar, jump to the position // Set the thumb bar center to the click position @@ -554,13 +554,13 @@ impl Element for Scrollbar { if bounds.contains(&event.position) { if state.get().hovered_axis != Some(axis) { state.set(state.get().with_hovered(Some(axis))); - cx.notify(view_id); + cx.notify(Some(view_id)); } } else { if state.get().hovered_axis == Some(axis) { if state.get().hovered_axis.is_some() { state.set(state.get().with_hovered(None)); - cx.notify(view_id); + cx.notify(Some(view_id)); } } } @@ -569,13 +569,12 @@ impl Element for Scrollbar { if thumb_bounds.contains(&event.position) { if state.get().hovered_on_thumb != Some(axis) { state.set(state.get().with_hovered_on_thumb(Some(axis))); - - cx.notify(view_id); + cx.notify(Some(view_id)); } } else { if state.get().hovered_on_thumb == Some(axis) { state.set(state.get().with_hovered_on_thumb(None)); - cx.notify(view_id); + cx.notify(Some(view_id)); } } @@ -607,7 +606,7 @@ impl Element for Scrollbar { }; scroll_handle.set_offset(offset); - cx.notify(view_id); + cx.notify(Some(view_id)); } } }); @@ -619,8 +618,7 @@ impl Element for Scrollbar { move |_event: &MouseUpEvent, phase, cx| { if phase.bubble() { state.set(state.get().with_unset_drag_pos()); - - cx.notify(view_id); + cx.notify(Some(view_id)); } } }); diff --git a/crates/ui/src/slider.rs b/crates/ui/src/slider.rs index f095793a..731f480c 100644 --- a/crates/ui/src/slider.rs +++ b/crates/ui/src/slider.rs @@ -119,7 +119,7 @@ impl Slider { div() .id("slider-thumb") - .on_drag(DragThumb(entity_id), |drag, cx| { + .on_drag(DragThumb(entity_id), |drag, _, cx| { cx.stop_propagation(); cx.new_view(|_| drag.clone()) }) diff --git a/crates/ui/src/table.rs b/crates/ui/src/table.rs index 5097652b..9ebcc52e 100644 --- a/crates/ui/src/table.rs +++ b/crates/ui/src/table.rs @@ -12,7 +12,7 @@ use gpui::{ actions, canvas, div, prelude::FluentBuilder, px, uniform_list, AppContext, Bounds, Div, DragMoveEvent, Edges, Entity, EntityId, EventEmitter, FocusHandle, FocusableView, InteractiveElement, IntoElement, KeyBinding, MouseButton, ParentElement, Pixels, Point, Render, - ScrollHandle, SharedString, Stateful, StatefulInteractiveElement as _, Styled, + ScrollHandle, ScrollStrategy, SharedString, Stateful, StatefulInteractiveElement as _, Styled, UniformListScrollHandle, ViewContext, VisualContext as _, WindowContext, }; @@ -343,7 +343,8 @@ where } fn scroll_to_row(&mut self, row_ix: usize, cx: &mut ViewContext) { - self.vertical_scroll_handle.scroll_to_item(row_ix); + self.vertical_scroll_handle + .scroll_to_item(row_ix, ScrollStrategy::Top); cx.notify(); } @@ -352,7 +353,8 @@ where self.right_clicked_row = None; self.selected_row = Some(row_ix); if let Some(row_ix) = self.selected_row { - self.vertical_scroll_handle.scroll_to_item(row_ix); + self.vertical_scroll_handle + .scroll_to_item(row_ix, ScrollStrategy::Top); } cx.emit(TableEvent::SelectRow(row_ix)); cx.notify(); @@ -707,7 +709,7 @@ where } }; })) - .on_drag(ResizeCol((cx.entity_id(), ix)), |drag, cx| { + .on_drag(ResizeCol((cx.entity_id(), ix)), |drag, _, cx| { cx.stop_propagation(); cx.new_view(|_| drag.clone()) }) @@ -809,7 +811,7 @@ where name, width: col_group.width, }, - |drag, cx| { + |drag, _, cx| { cx.stop_propagation(); cx.new_view(|_| drag.clone()) },