chore: Upgrade to GPUI3 (#6)

* wip: gpui3

* wip: gpui3

* chore: fix clippy
This commit is contained in:
reya
2025-01-28 08:25:49 +07:00
committed by GitHub
parent 3c15e74e56
commit 72a6d79bc5
62 changed files with 2572 additions and 2511 deletions

View File

@@ -1,22 +1,22 @@
use gpui::{ClickEvent, Focusable, InteractiveElement, Stateful, WindowContext};
use gpui::{App, ClickEvent, FocusableWrapper, InteractiveElement, Stateful, Window};
pub trait InteractiveElementExt: InteractiveElement {
/// Set the listener for a double click event.
fn on_double_click(
mut self,
listener: impl Fn(&ClickEvent, &mut WindowContext) + 'static,
listener: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static,
) -> Self
where
Self: Sized,
{
self.interactivity().on_click(move |event, context| {
self.interactivity().on_click(move |event, window, cx| {
if event.up.click_count == 2 {
listener(event, context);
listener(event, window, cx);
}
});
self
}
}
impl<E: InteractiveElement> InteractiveElementExt for Focusable<E> {}
impl<E: InteractiveElement> InteractiveElementExt for FocusableWrapper<E> {}
impl<E: InteractiveElement> InteractiveElementExt for Stateful<E> {}