chore: Bump Rust edition to 2024 (#27800)
Follow-up to https://github.com/zed-industries/zed/pull/27791 Release Notes: - N/A
This commit is contained in:
parent
d50905e000
commit
dc64ec9cc8
802 changed files with 3775 additions and 3662 deletions
|
@ -2,9 +2,9 @@ use std::time::Duration;
|
|||
|
||||
use anyhow::Result;
|
||||
use gpui::{
|
||||
black, bounce, div, ease_in_out, percentage, prelude::*, px, rgb, size, svg, Animation,
|
||||
AnimationExt as _, App, Application, AssetSource, Bounds, Context, SharedString,
|
||||
Transformation, Window, WindowBounds, WindowOptions,
|
||||
Animation, AnimationExt as _, App, Application, AssetSource, Bounds, Context, SharedString,
|
||||
Transformation, Window, WindowBounds, WindowOptions, black, bounce, div, ease_in_out,
|
||||
percentage, prelude::*, px, rgb, size, svg,
|
||||
};
|
||||
|
||||
struct Assets {}
|
||||
|
|
|
@ -5,9 +5,9 @@ use std::{
|
|||
};
|
||||
|
||||
use gpui::{
|
||||
canvas, div, point, prelude::*, px, rgb, size, uniform_list, App, Application, Bounds, Context,
|
||||
MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, Point, Render, SharedString,
|
||||
UniformListScrollHandle, Window, WindowBounds, WindowOptions,
|
||||
App, Application, Bounds, Context, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, Point,
|
||||
Render, SharedString, UniformListScrollHandle, Window, WindowBounds, WindowOptions, canvas,
|
||||
div, point, prelude::*, px, rgb, size, uniform_list,
|
||||
};
|
||||
|
||||
const TOTAL_ITEMS: usize = 10000;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use gpui::{div, img, prelude::*, App, Application, Context, Render, Window, WindowOptions};
|
||||
use gpui::{App, Application, Context, Render, Window, WindowOptions, div, img, prelude::*};
|
||||
use std::path::PathBuf;
|
||||
|
||||
struct GifViewer {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use gpui::{
|
||||
canvas, div, linear_color_stop, linear_gradient, point, prelude::*, px, size, App, Application,
|
||||
Bounds, ColorSpace, Context, Half, Render, Window, WindowOptions,
|
||||
App, Application, Bounds, ColorSpace, Context, Half, Render, Window, WindowOptions, canvas,
|
||||
div, linear_color_stop, linear_gradient, point, prelude::*, px, size,
|
||||
};
|
||||
|
||||
struct GradientViewer {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use gpui::{
|
||||
div, prelude::*, px, rgb, size, App, Application, Bounds, Context, SharedString, Window,
|
||||
WindowBounds, WindowOptions,
|
||||
App, Application, Bounds, Context, SharedString, Window, WindowBounds, WindowOptions, div,
|
||||
prelude::*, px, rgb, size,
|
||||
};
|
||||
|
||||
struct HelloWorld {
|
||||
|
|
|
@ -4,9 +4,9 @@ use std::sync::Arc;
|
|||
|
||||
use anyhow::Result;
|
||||
use gpui::{
|
||||
actions, div, img, prelude::*, px, rgb, size, App, AppContext, Application, AssetSource,
|
||||
Bounds, Context, ImageSource, KeyBinding, Menu, MenuItem, Point, SharedString, SharedUri,
|
||||
TitlebarOptions, Window, WindowBounds, WindowOptions,
|
||||
App, AppContext, Application, AssetSource, Bounds, Context, ImageSource, KeyBinding, Menu,
|
||||
MenuItem, Point, SharedString, SharedUri, TitlebarOptions, Window, WindowBounds, WindowOptions,
|
||||
actions, div, img, prelude::*, px, rgb, size,
|
||||
};
|
||||
use reqwest_client::ReqwestClient;
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@ use std::{path::Path, sync::Arc, time::Duration};
|
|||
|
||||
use anyhow::anyhow;
|
||||
use gpui::{
|
||||
black, div, img, prelude::*, pulsating_between, px, red, size, Animation, AnimationExt, App,
|
||||
Application, Asset, AssetLogger, AssetSource, Bounds, Context, Hsla, ImageAssetLoader,
|
||||
ImageCacheError, ImgResourceLoader, Length, Pixels, RenderImage, Resource, SharedString,
|
||||
Window, WindowBounds, WindowOptions, LOADING_DELAY,
|
||||
Animation, AnimationExt, App, Application, Asset, AssetLogger, AssetSource, Bounds, Context,
|
||||
Hsla, ImageAssetLoader, ImageCacheError, ImgResourceLoader, LOADING_DELAY, Length, Pixels,
|
||||
RenderImage, Resource, SharedString, Window, WindowBounds, WindowOptions, black, div, img,
|
||||
prelude::*, pulsating_between, px, red, size,
|
||||
};
|
||||
|
||||
struct Assets {}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
use std::ops::Range;
|
||||
|
||||
use gpui::{
|
||||
actions, black, div, fill, hsla, opaque_grey, point, prelude::*, px, relative, rgb, rgba, size,
|
||||
white, yellow, App, Application, Bounds, ClipboardItem, Context, CursorStyle, ElementId,
|
||||
ElementInputHandler, Entity, EntityInputHandler, FocusHandle, Focusable, GlobalElementId,
|
||||
KeyBinding, Keystroke, LayoutId, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent,
|
||||
PaintQuad, Pixels, Point, ShapedLine, SharedString, Style, TextRun, UTF16Selection,
|
||||
UnderlineStyle, Window, WindowBounds, WindowOptions,
|
||||
App, Application, Bounds, ClipboardItem, Context, CursorStyle, ElementId, ElementInputHandler,
|
||||
Entity, EntityInputHandler, FocusHandle, Focusable, GlobalElementId, KeyBinding, Keystroke,
|
||||
LayoutId, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, PaintQuad, Pixels, Point,
|
||||
ShapedLine, SharedString, Style, TextRun, UTF16Selection, UnderlineStyle, Window, WindowBounds,
|
||||
WindowOptions, actions, black, div, fill, hsla, opaque_grey, point, prelude::*, px, relative,
|
||||
rgb, rgba, size, white, yellow,
|
||||
};
|
||||
use unicode_segmentation::*;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use gpui::{
|
||||
actions, div, prelude::*, px, rgb, size, App, Application, Bounds, Context, FocusHandle,
|
||||
KeyBinding, Window, WindowBounds, WindowOptions,
|
||||
App, Application, Bounds, Context, FocusHandle, KeyBinding, Window, WindowBounds,
|
||||
WindowOptions, actions, div, prelude::*, px, rgb, size,
|
||||
};
|
||||
|
||||
actions!(example, [CloseWindow]);
|
||||
|
|
|
@ -2,8 +2,9 @@ use std::{fs, path::PathBuf, time::Duration};
|
|||
|
||||
use anyhow::Result;
|
||||
use gpui::{
|
||||
div, hsla, img, point, prelude::*, px, rgb, size, svg, App, Application, AssetSource, Bounds,
|
||||
BoxShadow, ClickEvent, Context, SharedString, Task, Timer, Window, WindowBounds, WindowOptions,
|
||||
App, Application, AssetSource, Bounds, BoxShadow, ClickEvent, Context, SharedString, Task,
|
||||
Timer, Window, WindowBounds, WindowOptions, div, hsla, img, point, prelude::*, px, rgb, size,
|
||||
svg,
|
||||
};
|
||||
|
||||
struct Assets {
|
||||
|
@ -50,23 +51,25 @@ impl HelloWorld {
|
|||
self.opacity = 0.0;
|
||||
cx.notify();
|
||||
|
||||
self._task = Some(cx.spawn_in(window, async move |view, cx| loop {
|
||||
Timer::after(Duration::from_secs_f32(0.05)).await;
|
||||
let mut stop = false;
|
||||
let _ = cx.update(|_, cx| {
|
||||
view.update(cx, |view, cx| {
|
||||
if view.opacity >= 1.0 {
|
||||
stop = true;
|
||||
return;
|
||||
}
|
||||
self._task = Some(cx.spawn_in(window, async move |view, cx| {
|
||||
loop {
|
||||
Timer::after(Duration::from_secs_f32(0.05)).await;
|
||||
let mut stop = false;
|
||||
let _ = cx.update(|_, cx| {
|
||||
view.update(cx, |view, cx| {
|
||||
if view.opacity >= 1.0 {
|
||||
stop = true;
|
||||
return;
|
||||
}
|
||||
|
||||
view.opacity += 0.1;
|
||||
cx.notify();
|
||||
})
|
||||
});
|
||||
view.opacity += 0.1;
|
||||
cx.notify();
|
||||
})
|
||||
});
|
||||
|
||||
if stop {
|
||||
break;
|
||||
if stop {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use gpui::{prelude::*, App, Application, Context, Entity, EventEmitter};
|
||||
use gpui::{App, Application, Context, Entity, EventEmitter, prelude::*};
|
||||
|
||||
struct Counter {
|
||||
count: usize,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use gpui::{
|
||||
canvas, div, linear_color_stop, linear_gradient, point, prelude::*, px, rgb, size, Application,
|
||||
Background, Bounds, ColorSpace, Context, MouseDownEvent, Path, PathBuilder, PathStyle, Pixels,
|
||||
Point, Render, StrokeOptions, Window, WindowOptions,
|
||||
Application, Background, Bounds, ColorSpace, Context, MouseDownEvent, Path, PathBuilder,
|
||||
PathStyle, Pixels, Point, Render, StrokeOptions, Window, WindowOptions, canvas, div,
|
||||
linear_color_stop, linear_gradient, point, prelude::*, px, rgb, size,
|
||||
};
|
||||
|
||||
struct PaintingViewer {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use gpui::{
|
||||
div, linear_color_stop, linear_gradient, pattern_slash, prelude::*, px, rgb, size, App,
|
||||
AppContext, Application, Bounds, Context, Window, WindowBounds, WindowOptions,
|
||||
App, AppContext, Application, Bounds, Context, Window, WindowBounds, WindowOptions, div,
|
||||
linear_color_stop, linear_gradient, pattern_slash, prelude::*, px, rgb, size,
|
||||
};
|
||||
|
||||
struct PatternExample;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use gpui::{
|
||||
actions, div, prelude::*, rgb, App, Application, Context, Menu, MenuItem, Window, WindowOptions,
|
||||
App, Application, Context, Menu, MenuItem, Window, WindowOptions, actions, div, prelude::*, rgb,
|
||||
};
|
||||
|
||||
struct SetMenus;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use gpui::{
|
||||
div, hsla, point, prelude::*, px, relative, rgb, size, App, Application, Bounds, BoxShadow,
|
||||
Context, Div, SharedString, Window, WindowBounds, WindowOptions,
|
||||
App, Application, Bounds, BoxShadow, Context, Div, SharedString, Window, WindowBounds,
|
||||
WindowOptions, div, hsla, point, prelude::*, px, relative, rgb, size,
|
||||
};
|
||||
|
||||
use smallvec::smallvec;
|
||||
|
|
|
@ -3,8 +3,8 @@ use std::path::PathBuf;
|
|||
|
||||
use anyhow::Result;
|
||||
use gpui::{
|
||||
div, prelude::*, px, rgb, size, svg, App, Application, AssetSource, Bounds, Context,
|
||||
SharedString, Window, WindowBounds, WindowOptions,
|
||||
App, Application, AssetSource, Bounds, Context, SharedString, Window, WindowBounds,
|
||||
WindowOptions, div, prelude::*, px, rgb, size, svg,
|
||||
};
|
||||
|
||||
struct Assets {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use gpui::{
|
||||
div, prelude::*, px, size, App, Application, Bounds, Context, Window, WindowBounds,
|
||||
WindowOptions,
|
||||
App, Application, Bounds, Context, Window, WindowBounds, WindowOptions, div, prelude::*, px,
|
||||
size,
|
||||
};
|
||||
|
||||
struct HelloWorld {}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use gpui::{
|
||||
div, prelude::*, px, size, App, Application, Bounds, Context, TextOverflow, Window,
|
||||
WindowBounds, WindowOptions,
|
||||
App, Application, Bounds, Context, TextOverflow, Window, WindowBounds, WindowOptions, div,
|
||||
prelude::*, px, size,
|
||||
};
|
||||
|
||||
struct HelloWorld {}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use gpui::{
|
||||
div, prelude::*, px, rgb, size, uniform_list, App, Application, Bounds, Context, Window,
|
||||
WindowBounds, WindowOptions,
|
||||
App, Application, Bounds, Context, Window, WindowBounds, WindowOptions, div, prelude::*, px,
|
||||
rgb, size, uniform_list,
|
||||
};
|
||||
|
||||
struct UniformListExample {}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use gpui::{
|
||||
div, prelude::*, px, rgb, size, App, Application, Bounds, Context, SharedString, Timer, Window,
|
||||
WindowBounds, WindowKind, WindowOptions,
|
||||
App, Application, Bounds, Context, SharedString, Timer, Window, WindowBounds, WindowKind,
|
||||
WindowOptions, div, prelude::*, px, rgb, size,
|
||||
};
|
||||
|
||||
struct SubWindow {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use gpui::{
|
||||
div, point, prelude::*, px, rgb, App, Application, Bounds, Context, DisplayId, Hsla, Pixels,
|
||||
SharedString, Size, Window, WindowBackgroundAppearance, WindowBounds, WindowKind,
|
||||
WindowOptions,
|
||||
App, Application, Bounds, Context, DisplayId, Hsla, Pixels, SharedString, Size, Window,
|
||||
WindowBackgroundAppearance, WindowBounds, WindowKind, WindowOptions, div, point, prelude::*,
|
||||
px, rgb,
|
||||
};
|
||||
|
||||
struct WindowContent {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use gpui::{
|
||||
black, canvas, div, green, point, prelude::*, px, rgb, size, transparent_black, white, App,
|
||||
Application, Bounds, Context, CursorStyle, Decorations, Hsla, MouseButton, Pixels, Point,
|
||||
App, Application, Bounds, Context, CursorStyle, Decorations, Hsla, MouseButton, Pixels, Point,
|
||||
ResizeEdge, Size, Window, WindowBackgroundAppearance, WindowBounds, WindowDecorations,
|
||||
WindowOptions,
|
||||
WindowOptions, black, canvas, div, green, point, prelude::*, px, rgb, size, transparent_black,
|
||||
white,
|
||||
};
|
||||
|
||||
struct WindowShadow {}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::SharedString;
|
||||
use anyhow::{anyhow, Result};
|
||||
use anyhow::{Result, anyhow};
|
||||
use collections::HashMap;
|
||||
pub use no_action::{is_no_action, NoAction};
|
||||
pub use no_action::{NoAction, is_no_action};
|
||||
use serde_json::json;
|
||||
use std::{
|
||||
any::{Any, TypeId},
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
use std::{
|
||||
any::{type_name, TypeId},
|
||||
any::{TypeId, type_name},
|
||||
cell::{Ref, RefCell, RefMut},
|
||||
marker::PhantomData,
|
||||
mem,
|
||||
ops::{Deref, DerefMut},
|
||||
path::{Path, PathBuf},
|
||||
rc::{Rc, Weak},
|
||||
sync::{atomic::Ordering::SeqCst, Arc},
|
||||
sync::{Arc, atomic::Ordering::SeqCst},
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use anyhow::{Result, anyhow};
|
||||
use derive_more::{Deref, DerefMut};
|
||||
use futures::{
|
||||
Future, FutureExt,
|
||||
channel::oneshot,
|
||||
future::{LocalBoxFuture, Shared},
|
||||
Future, FutureExt,
|
||||
};
|
||||
use parking_lot::RwLock;
|
||||
use slotmap::SlotMap;
|
||||
|
@ -30,14 +30,14 @@ pub use test_context::*;
|
|||
use util::ResultExt;
|
||||
|
||||
use crate::{
|
||||
current_platform, hash, init_app_menus, Action, ActionBuildError, ActionRegistry, Any, AnyView,
|
||||
AnyWindowHandle, AppContext, Asset, AssetSource, BackgroundExecutor, Bounds, ClipboardItem,
|
||||
DispatchPhase, DisplayId, EventEmitter, FocusHandle, FocusMap, ForegroundExecutor, Global,
|
||||
KeyBinding, Keymap, Keystroke, LayoutId, Menu, MenuItem, OwnedMenu, PathPromptOptions, Pixels,
|
||||
Platform, PlatformDisplay, Point, PromptBuilder, PromptHandle, PromptLevel, Render,
|
||||
RenderablePromptHandle, Reservation, ScreenCaptureSource, SharedString, SubscriberSet,
|
||||
Subscription, SvgRenderer, Task, TextSystem, Window, WindowAppearance, WindowHandle, WindowId,
|
||||
WindowInvalidator,
|
||||
Action, ActionBuildError, ActionRegistry, Any, AnyView, AnyWindowHandle, AppContext, Asset,
|
||||
AssetSource, BackgroundExecutor, Bounds, ClipboardItem, DispatchPhase, DisplayId, EventEmitter,
|
||||
FocusHandle, FocusMap, ForegroundExecutor, Global, KeyBinding, Keymap, Keystroke, LayoutId,
|
||||
Menu, MenuItem, OwnedMenu, PathPromptOptions, Pixels, Platform, PlatformDisplay, Point,
|
||||
PromptBuilder, PromptHandle, PromptLevel, Render, RenderablePromptHandle, Reservation,
|
||||
ScreenCaptureSource, SharedString, SubscriberSet, Subscription, SvgRenderer, Task, TextSystem,
|
||||
Window, WindowAppearance, WindowHandle, WindowId, WindowInvalidator, current_platform, hash,
|
||||
init_app_menus,
|
||||
};
|
||||
|
||||
mod async_context;
|
||||
|
@ -1513,15 +1513,15 @@ impl App {
|
|||
pub fn set_prompt_builder(
|
||||
&mut self,
|
||||
renderer: impl Fn(
|
||||
PromptLevel,
|
||||
&str,
|
||||
Option<&str>,
|
||||
&[&str],
|
||||
PromptHandle,
|
||||
&mut Window,
|
||||
&mut App,
|
||||
) -> RenderablePromptHandle
|
||||
+ 'static,
|
||||
PromptLevel,
|
||||
&str,
|
||||
Option<&str>,
|
||||
&[&str],
|
||||
PromptHandle,
|
||||
&mut Window,
|
||||
&mut App,
|
||||
) -> RenderablePromptHandle
|
||||
+ 'static,
|
||||
) {
|
||||
self.prompt_builder = Some(PromptBuilder::Custom(Box::new(renderer)))
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ use crate::{
|
|||
Entity, Focusable, ForegroundExecutor, Global, PromptLevel, Render, Reservation, Result, Task,
|
||||
VisualContext, Window, WindowHandle,
|
||||
};
|
||||
use anyhow::{anyhow, Context as _};
|
||||
use anyhow::{Context as _, anyhow};
|
||||
use derive_more::{Deref, DerefMut};
|
||||
use futures::channel::oneshot;
|
||||
use std::{future::Future, rc::Weak};
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use crate::{seal::Sealed, App, AppContext, VisualContext, Window};
|
||||
use anyhow::{anyhow, Result};
|
||||
use crate::{App, AppContext, VisualContext, Window, seal::Sealed};
|
||||
use anyhow::{Result, anyhow};
|
||||
use collections::FxHashSet;
|
||||
use derive_more::{Deref, DerefMut};
|
||||
use parking_lot::{RwLock, RwLockUpgradableReadGuard};
|
||||
use slotmap::{KeyData, SecondaryMap, SlotMap};
|
||||
use std::{
|
||||
any::{type_name, Any, TypeId},
|
||||
any::{Any, TypeId, type_name},
|
||||
cell::RefCell,
|
||||
cmp::Ordering,
|
||||
fmt::{self, Display},
|
||||
|
@ -14,8 +14,8 @@ use std::{
|
|||
mem,
|
||||
num::NonZeroU64,
|
||||
sync::{
|
||||
atomic::{AtomicUsize, Ordering::SeqCst},
|
||||
Arc, Weak,
|
||||
atomic::{AtomicUsize, Ordering::SeqCst},
|
||||
},
|
||||
thread::panicking,
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@ use crate::{
|
|||
WindowHandle, WindowOptions,
|
||||
};
|
||||
use anyhow::{anyhow, bail};
|
||||
use futures::{channel::oneshot, Stream, StreamExt};
|
||||
use futures::{Stream, StreamExt, channel::oneshot};
|
||||
use std::{cell::RefCell, future::Future, ops::Deref, rc::Rc, sync::Arc, time::Duration};
|
||||
|
||||
/// A TestAppContext is provided to tests created with `#[gpui::test]`, it provides
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::{size, DevicePixels, Result, SharedString, Size};
|
||||
use crate::{DevicePixels, Result, SharedString, Size, size};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use image::{Delay, Frame};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use anyhow::{bail, Context};
|
||||
use anyhow::{Context, bail};
|
||||
use serde::de::{self, Deserialize, Deserializer, Visitor};
|
||||
use std::{
|
||||
fmt::{self, Display, Formatter},
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
//! your own custom layout algorithm or rendering a code editor.
|
||||
|
||||
use crate::{
|
||||
util::FluentBuilder, App, ArenaBox, AvailableSpace, Bounds, Context, DispatchNodeId, ElementId,
|
||||
FocusHandle, LayoutId, Pixels, Point, Size, Style, Window, ELEMENT_ARENA,
|
||||
App, ArenaBox, AvailableSpace, Bounds, Context, DispatchNodeId, ELEMENT_ARENA, ElementId,
|
||||
FocusHandle, LayoutId, Pixels, Point, Size, Style, Window, util::FluentBuilder,
|
||||
};
|
||||
use derive_more::{Deref, DerefMut};
|
||||
pub(crate) use smallvec::SmallVec;
|
||||
|
|
|
@ -2,8 +2,8 @@ use smallvec::SmallVec;
|
|||
use taffy::style::{Display, Position};
|
||||
|
||||
use crate::{
|
||||
point, AnyElement, App, Axis, Bounds, Corner, Edges, Element, GlobalElementId, IntoElement,
|
||||
LayoutId, ParentElement, Pixels, Point, Size, Style, Window,
|
||||
AnyElement, App, Axis, Bounds, Corner, Edges, Element, GlobalElementId, IntoElement, LayoutId,
|
||||
ParentElement, Pixels, Point, Size, Style, Window, point,
|
||||
};
|
||||
|
||||
/// The state that the anchored element element uses to track its children.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::{rgb, Hsla, Rgba, WindowAppearance};
|
||||
use crate::{Hsla, Rgba, WindowAppearance, rgb};
|
||||
|
||||
/// The appearance of the base GPUI colors, used to style GPUI elements
|
||||
///
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
//! constructed by combining these two systems into an all-in-one element.
|
||||
|
||||
use crate::{
|
||||
point, px, size, Action, AnyDrag, AnyElement, AnyTooltip, AnyView, App, Bounds, ClickEvent,
|
||||
DispatchPhase, Element, ElementId, Entity, FocusHandle, Global, GlobalElementId, Hitbox,
|
||||
HitboxId, IntoElement, IsZero, KeyContext, KeyDownEvent, KeyUpEvent, LayoutId,
|
||||
ModifiersChangedEvent, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent,
|
||||
ParentElement, Pixels, Point, Render, ScrollWheelEvent, SharedString, Size, Style,
|
||||
StyleRefinement, Styled, Task, TooltipId, Visibility, Window,
|
||||
Action, AnyDrag, AnyElement, AnyTooltip, AnyView, App, Bounds, ClickEvent, DispatchPhase,
|
||||
Element, ElementId, Entity, FocusHandle, Global, GlobalElementId, Hitbox, HitboxId,
|
||||
IntoElement, IsZero, KeyContext, KeyDownEvent, KeyUpEvent, LayoutId, ModifiersChangedEvent,
|
||||
MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, ParentElement, Pixels, Point,
|
||||
Render, ScrollWheelEvent, SharedString, Size, Style, StyleRefinement, Styled, Task, TooltipId,
|
||||
Visibility, Window, point, px, size,
|
||||
};
|
||||
use collections::HashMap;
|
||||
use refineable::Refineable;
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
use crate::{
|
||||
px, swap_rgba_pa_to_bgra, AbsoluteLength, AnyElement, App, Asset, AssetLogger, Bounds,
|
||||
DefiniteLength, Element, ElementId, GlobalElementId, Hitbox, Image, InteractiveElement,
|
||||
Interactivity, IntoElement, LayoutId, Length, ObjectFit, Pixels, RenderImage, Resource,
|
||||
SharedString, SharedUri, StyleRefinement, Styled, SvgSize, Task, Window,
|
||||
SMOOTH_SVG_SCALE_FACTOR,
|
||||
AbsoluteLength, AnyElement, App, Asset, AssetLogger, Bounds, DefiniteLength, Element,
|
||||
ElementId, GlobalElementId, Hitbox, Image, InteractiveElement, Interactivity, IntoElement,
|
||||
LayoutId, Length, ObjectFit, Pixels, RenderImage, Resource, SMOOTH_SVG_SCALE_FACTOR,
|
||||
SharedString, SharedUri, StyleRefinement, Styled, SvgSize, Task, Window, px,
|
||||
swap_rgba_pa_to_bgra,
|
||||
};
|
||||
use anyhow::{anyhow, Result};
|
||||
use anyhow::{Result, anyhow};
|
||||
|
||||
use futures::{AsyncReadExt, Future};
|
||||
use image::{
|
||||
codecs::{gif::GifDecoder, webp::WebPDecoder},
|
||||
AnimationDecoder, DynamicImage, Frame, ImageBuffer, ImageError, ImageFormat, Rgba,
|
||||
codecs::{gif::GifDecoder, webp::WebPDecoder},
|
||||
};
|
||||
use smallvec::SmallVec;
|
||||
use std::{
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
//! If all of your elements are the same height, see [`UniformList`] for a simpler API
|
||||
|
||||
use crate::{
|
||||
point, px, size, AnyElement, App, AvailableSpace, Bounds, ContentMask, DispatchPhase, Edges,
|
||||
Element, EntityId, FocusHandle, GlobalElementId, Hitbox, IntoElement, Pixels, Point,
|
||||
ScrollWheelEvent, Size, Style, StyleRefinement, Styled, Window,
|
||||
AnyElement, App, AvailableSpace, Bounds, ContentMask, DispatchPhase, Edges, Element, EntityId,
|
||||
FocusHandle, GlobalElementId, Hitbox, IntoElement, Pixels, Point, ScrollWheelEvent, Size,
|
||||
Style, StyleRefinement, Styled, Window, point, px, size,
|
||||
};
|
||||
use collections::VecDeque;
|
||||
use refineable::Refineable as _;
|
||||
|
@ -349,7 +349,7 @@ impl ListState {
|
|||
let mut cursor = state.items.cursor::<(Count, Height)>(&());
|
||||
cursor.seek(&Count(scroll_top.item_ix), Bias::Right, &());
|
||||
|
||||
let scroll_top = cursor.start().1 .0 + scroll_top.offset_in_item;
|
||||
let scroll_top = cursor.start().1.0 + scroll_top.offset_in_item;
|
||||
|
||||
cursor.seek_forward(&Count(ix), Bias::Right, &());
|
||||
if let Some(&ListItem::Measured { size, .. }) = cursor.item() {
|
||||
|
@ -1067,8 +1067,8 @@ mod test {
|
|||
#[gpui::test]
|
||||
fn test_reset_after_paint_before_scroll(cx: &mut TestAppContext) {
|
||||
use crate::{
|
||||
div, list, point, px, size, AppContext, Context, Element, IntoElement, ListState,
|
||||
Render, Styled, Window,
|
||||
AppContext, Context, Element, IntoElement, ListState, Render, Styled, Window, div,
|
||||
list, point, px, size,
|
||||
};
|
||||
|
||||
let cx = cx.add_empty_window();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::{
|
||||
geometry::Negate as _, point, px, radians, size, App, Bounds, Element, GlobalElementId, Hitbox,
|
||||
InteractiveElement, Interactivity, IntoElement, LayoutId, Pixels, Point, Radians, SharedString,
|
||||
Size, StyleRefinement, Styled, TransformationMatrix, Window,
|
||||
App, Bounds, Element, GlobalElementId, Hitbox, InteractiveElement, Interactivity, IntoElement,
|
||||
LayoutId, Pixels, Point, Radians, SharedString, Size, StyleRefinement, Styled,
|
||||
TransformationMatrix, Window, geometry::Negate as _, point, px, radians, size,
|
||||
};
|
||||
use util::ResultExt;
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
use crate::{
|
||||
register_tooltip_mouse_handlers, set_tooltip_on_window, ActiveTooltip, AnyView, App, Bounds,
|
||||
DispatchPhase, Element, ElementId, GlobalElementId, HighlightStyle, Hitbox, IntoElement,
|
||||
LayoutId, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, Point, SharedString, Size,
|
||||
TextOverflow, TextRun, TextStyle, TooltipId, WhiteSpace, Window, WrappedLine,
|
||||
WrappedLineLayout,
|
||||
ActiveTooltip, AnyView, App, Bounds, DispatchPhase, Element, ElementId, GlobalElementId,
|
||||
HighlightStyle, Hitbox, IntoElement, LayoutId, MouseDownEvent, MouseMoveEvent, MouseUpEvent,
|
||||
Pixels, Point, SharedString, Size, TextOverflow, TextRun, TextStyle, TooltipId, WhiteSpace,
|
||||
Window, WrappedLine, WrappedLineLayout, register_tooltip_mouse_handlers, set_tooltip_on_window,
|
||||
};
|
||||
use anyhow::anyhow;
|
||||
use smallvec::SmallVec;
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
//! elements with uniform height.
|
||||
|
||||
use crate::{
|
||||
point, size, AnyElement, App, AvailableSpace, Bounds, ContentMask, Context, Element, ElementId,
|
||||
Entity, GlobalElementId, Hitbox, InteractiveElement, Interactivity, IntoElement, IsZero,
|
||||
LayoutId, ListSizingBehavior, Pixels, Render, ScrollHandle, Size, StyleRefinement, Styled,
|
||||
Window,
|
||||
AnyElement, App, AvailableSpace, Bounds, ContentMask, Context, Element, ElementId, Entity,
|
||||
GlobalElementId, Hitbox, InteractiveElement, Interactivity, IntoElement, IsZero, LayoutId,
|
||||
ListSizingBehavior, Pixels, Render, ScrollHandle, Size, StyleRefinement, Styled, Window, point,
|
||||
size,
|
||||
};
|
||||
use smallvec::SmallVec;
|
||||
use std::{cell::RefCell, cmp, ops::Range, rc::Rc};
|
||||
|
|
|
@ -13,8 +13,8 @@ use std::{
|
|||
pin::Pin,
|
||||
rc::Rc,
|
||||
sync::{
|
||||
atomic::{AtomicUsize, Ordering::SeqCst},
|
||||
Arc,
|
||||
atomic::{AtomicUsize, Ordering::SeqCst},
|
||||
},
|
||||
task::{Context, Poll},
|
||||
time::{Duration, Instant},
|
||||
|
|
|
@ -130,7 +130,7 @@ pub use elements::*;
|
|||
pub use executor::*;
|
||||
pub use geometry::*;
|
||||
pub use global::*;
|
||||
pub use gpui_macros::{register_action, test, AppContext, IntoElement, Render, VisualContext};
|
||||
pub use gpui_macros::{AppContext, IntoElement, Render, VisualContext, register_action, test};
|
||||
pub use http_client;
|
||||
pub use input::*;
|
||||
pub use interactive::*;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{
|
||||
point, seal::Sealed, Context, Empty, IntoElement, Keystroke, Modifiers, Pixels, Point, Render,
|
||||
Window,
|
||||
Context, Empty, IntoElement, Keystroke, Modifiers, Pixels, Point, Render, Window, point,
|
||||
seal::Sealed,
|
||||
};
|
||||
use smallvec::SmallVec;
|
||||
use std::{any::Any, fmt::Debug, ops::Deref, path::PathBuf};
|
||||
|
@ -481,8 +481,8 @@ impl PlatformInput {
|
|||
mod test {
|
||||
|
||||
use crate::{
|
||||
self as gpui, div, AppContext as _, Context, FocusHandle, InteractiveElement, IntoElement,
|
||||
KeyBinding, Keystroke, ParentElement, Render, TestAppContext, Window,
|
||||
self as gpui, AppContext as _, Context, FocusHandle, InteractiveElement, IntoElement,
|
||||
KeyBinding, Keystroke, ParentElement, Render, TestAppContext, Window, div,
|
||||
};
|
||||
|
||||
struct TestView {
|
||||
|
|
|
@ -4,7 +4,7 @@ mod context;
|
|||
pub use binding::*;
|
||||
pub use context::*;
|
||||
|
||||
use crate::{is_no_action, Action, Keystroke};
|
||||
use crate::{Action, Keystroke, is_no_action};
|
||||
use collections::HashMap;
|
||||
use smallvec::SmallVec;
|
||||
use std::any::TypeId;
|
||||
|
@ -219,7 +219,7 @@ impl Keymap {
|
|||
mod tests {
|
||||
use super::*;
|
||||
use crate as gpui;
|
||||
use gpui::{actions, NoAction};
|
||||
use gpui::{NoAction, actions};
|
||||
|
||||
actions!(
|
||||
keymap_test,
|
||||
|
@ -265,38 +265,46 @@ mod tests {
|
|||
keymap.add_bindings(bindings.clone());
|
||||
|
||||
// binding is only enabled in a specific context
|
||||
assert!(keymap
|
||||
.bindings_for_input(
|
||||
&[Keystroke::parse("ctrl-a").unwrap()],
|
||||
&[KeyContext::parse("barf").unwrap()],
|
||||
)
|
||||
.0
|
||||
.is_empty());
|
||||
assert!(!keymap
|
||||
.bindings_for_input(
|
||||
&[Keystroke::parse("ctrl-a").unwrap()],
|
||||
&[KeyContext::parse("editor").unwrap()],
|
||||
)
|
||||
.0
|
||||
.is_empty());
|
||||
assert!(
|
||||
keymap
|
||||
.bindings_for_input(
|
||||
&[Keystroke::parse("ctrl-a").unwrap()],
|
||||
&[KeyContext::parse("barf").unwrap()],
|
||||
)
|
||||
.0
|
||||
.is_empty()
|
||||
);
|
||||
assert!(
|
||||
!keymap
|
||||
.bindings_for_input(
|
||||
&[Keystroke::parse("ctrl-a").unwrap()],
|
||||
&[KeyContext::parse("editor").unwrap()],
|
||||
)
|
||||
.0
|
||||
.is_empty()
|
||||
);
|
||||
|
||||
// binding is disabled in a more specific context
|
||||
assert!(keymap
|
||||
.bindings_for_input(
|
||||
&[Keystroke::parse("ctrl-a").unwrap()],
|
||||
&[KeyContext::parse("editor mode=full").unwrap()],
|
||||
)
|
||||
.0
|
||||
.is_empty());
|
||||
assert!(
|
||||
keymap
|
||||
.bindings_for_input(
|
||||
&[Keystroke::parse("ctrl-a").unwrap()],
|
||||
&[KeyContext::parse("editor mode=full").unwrap()],
|
||||
)
|
||||
.0
|
||||
.is_empty()
|
||||
);
|
||||
|
||||
// binding is globally disabled
|
||||
assert!(keymap
|
||||
.bindings_for_input(
|
||||
&[Keystroke::parse("ctrl-b").unwrap()],
|
||||
&[KeyContext::parse("barf").unwrap()],
|
||||
)
|
||||
.0
|
||||
.is_empty());
|
||||
assert!(
|
||||
keymap
|
||||
.bindings_for_input(
|
||||
&[Keystroke::parse("ctrl-b").unwrap()],
|
||||
&[KeyContext::parse("barf").unwrap()],
|
||||
)
|
||||
.0
|
||||
.is_empty()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::SharedString;
|
||||
use anyhow::{anyhow, Result};
|
||||
use anyhow::{Result, anyhow};
|
||||
use std::fmt;
|
||||
|
||||
/// A datastructure for resolving whether an action should be dispatched
|
||||
|
|
|
@ -8,7 +8,7 @@ use lyon::tessellation::{
|
|||
pub use lyon::math::Transform;
|
||||
pub use lyon::tessellation::{FillOptions, FillRule, StrokeOptions};
|
||||
|
||||
use crate::{point, px, Path, Pixels, Point};
|
||||
use crate::{Path, Pixels, Point, point, px};
|
||||
|
||||
/// Style of the PathBuilder
|
||||
pub enum PathStyle {
|
||||
|
|
|
@ -27,13 +27,13 @@ mod test;
|
|||
mod windows;
|
||||
|
||||
use crate::{
|
||||
point, Action, AnyWindowHandle, App, AsyncWindowContext, BackgroundExecutor, Bounds,
|
||||
DevicePixels, DispatchEventResult, Font, FontId, FontMetrics, FontRun, ForegroundExecutor,
|
||||
GlyphId, GpuSpecs, ImageSource, Keymap, LineLayout, Pixels, PlatformInput, Point,
|
||||
RenderGlyphParams, RenderImage, RenderImageParams, RenderSvgParams, ScaledPixels, Scene,
|
||||
SharedString, Size, SvgRenderer, SvgSize, Task, TaskLabel, Window, DEFAULT_WINDOW_SIZE,
|
||||
Action, AnyWindowHandle, App, AsyncWindowContext, BackgroundExecutor, Bounds,
|
||||
DEFAULT_WINDOW_SIZE, DevicePixels, DispatchEventResult, Font, FontId, FontMetrics, FontRun,
|
||||
ForegroundExecutor, GlyphId, GpuSpecs, ImageSource, Keymap, LineLayout, Pixels, PlatformInput,
|
||||
Point, RenderGlyphParams, RenderImage, RenderImageParams, RenderSvgParams, ScaledPixels, Scene,
|
||||
SharedString, Size, SvgRenderer, SvgSize, Task, TaskLabel, Window, point,
|
||||
};
|
||||
use anyhow::{anyhow, Result};
|
||||
use anyhow::{Result, anyhow};
|
||||
use async_task::Runnable;
|
||||
use futures::channel::oneshot;
|
||||
use image::codecs::gif::GifDecoder;
|
||||
|
@ -1307,11 +1307,7 @@ impl ClipboardItem {
|
|||
}
|
||||
}
|
||||
|
||||
if any_entries {
|
||||
Some(answer)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
if any_entries { Some(answer) } else { None }
|
||||
}
|
||||
|
||||
/// If this item is one ClipboardEntry::String, returns its metadata.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{
|
||||
platform::AtlasTextureList, AtlasKey, AtlasTextureId, AtlasTextureKind, AtlasTile, Bounds,
|
||||
DevicePixels, PlatformAtlas, Point, Size,
|
||||
AtlasKey, AtlasTextureId, AtlasTextureKind, AtlasTile, Bounds, DevicePixels, PlatformAtlas,
|
||||
Point, Size, platform::AtlasTextureList,
|
||||
};
|
||||
use anyhow::Result;
|
||||
use blade_graphics as gpu;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use crate::{PlatformDispatcher, TaskLabel};
|
||||
use async_task::Runnable;
|
||||
use calloop::{
|
||||
EventLoop,
|
||||
channel::{self, Sender},
|
||||
timer::TimeoutAction,
|
||||
EventLoop,
|
||||
};
|
||||
use parking::{Parker, Unparker};
|
||||
use parking_lot::Mutex;
|
||||
|
|
|
@ -14,19 +14,19 @@ use std::{
|
|||
time::Duration,
|
||||
};
|
||||
|
||||
use anyhow::{anyhow, Context as _};
|
||||
use anyhow::{Context as _, anyhow};
|
||||
use async_task::Runnable;
|
||||
use calloop::{channel::Channel, LoopSignal};
|
||||
use calloop::{LoopSignal, channel::Channel};
|
||||
use futures::channel::oneshot;
|
||||
use util::ResultExt as _;
|
||||
#[cfg(any(feature = "wayland", feature = "x11"))]
|
||||
use xkbcommon::xkb::{self, Keycode, Keysym, State};
|
||||
|
||||
use crate::{
|
||||
px, Action, AnyWindowHandle, BackgroundExecutor, ClipboardItem, CursorStyle, DisplayId,
|
||||
Action, AnyWindowHandle, BackgroundExecutor, ClipboardItem, CursorStyle, DisplayId,
|
||||
ForegroundExecutor, Keymap, LinuxDispatcher, Menu, MenuItem, OwnedMenu, PathPromptOptions,
|
||||
Pixels, Platform, PlatformDisplay, PlatformTextSystem, PlatformWindow, Point, Result,
|
||||
ScreenCaptureSource, Task, WindowAppearance, WindowParams,
|
||||
ScreenCaptureSource, Task, WindowAppearance, WindowParams, px,
|
||||
};
|
||||
#[cfg(any(feature = "wayland", feature = "x11"))]
|
||||
pub(crate) const SCROLL_LINES: f32 = 3.0;
|
||||
|
@ -852,7 +852,7 @@ impl crate::Modifiers {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::{px, Point};
|
||||
use crate::{Point, px};
|
||||
|
||||
#[test]
|
||||
fn test_is_within_click_distance() {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use crate::{
|
||||
point, size, Bounds, DevicePixels, Font, FontFeatures, FontId, FontMetrics, FontRun, FontStyle,
|
||||
FontWeight, GlyphId, LineLayout, Pixels, PlatformTextSystem, Point, RenderGlyphParams,
|
||||
ShapedGlyph, SharedString, Size, SUBPIXEL_VARIANTS,
|
||||
Bounds, DevicePixels, Font, FontFeatures, FontId, FontMetrics, FontRun, FontStyle, FontWeight,
|
||||
GlyphId, LineLayout, Pixels, PlatformTextSystem, Point, RenderGlyphParams, SUBPIXEL_VARIANTS,
|
||||
ShapedGlyph, SharedString, Size, point, size,
|
||||
};
|
||||
use anyhow::{anyhow, Context as _, Ok, Result};
|
||||
use anyhow::{Context as _, Ok, Result, anyhow};
|
||||
use collections::HashMap;
|
||||
use cosmic_text::{
|
||||
Attrs, AttrsList, CacheKey, Family, Font as CosmicTextFont, FontSystem, ShapeBuffer, ShapeLine,
|
||||
|
|
|
@ -8,8 +8,8 @@ use std::{
|
|||
};
|
||||
|
||||
use calloop::{
|
||||
timer::{TimeoutAction, Timer},
|
||||
EventLoop, LoopHandle,
|
||||
timer::{TimeoutAction, Timer},
|
||||
};
|
||||
use calloop_wayland_source::WaylandSource;
|
||||
use collections::HashMap;
|
||||
|
@ -21,7 +21,7 @@ use util::ResultExt;
|
|||
use wayland_backend::client::ObjectId;
|
||||
use wayland_backend::protocol::WEnum;
|
||||
use wayland_client::event_created_child;
|
||||
use wayland_client::globals::{registry_queue_init, GlobalList, GlobalListContents};
|
||||
use wayland_client::globals::{GlobalList, GlobalListContents, registry_queue_init};
|
||||
use wayland_client::protocol::wl_callback::{self, WlCallback};
|
||||
use wayland_client::protocol::wl_data_device_manager::DndAction;
|
||||
use wayland_client::protocol::wl_data_offer::WlDataOffer;
|
||||
|
@ -30,12 +30,11 @@ use wayland_client::protocol::{
|
|||
wl_data_device, wl_data_device_manager, wl_data_offer, wl_data_source, wl_output, wl_region,
|
||||
};
|
||||
use wayland_client::{
|
||||
delegate_noop,
|
||||
Connection, Dispatch, Proxy, QueueHandle, delegate_noop,
|
||||
protocol::{
|
||||
wl_buffer, wl_compositor, wl_keyboard, wl_pointer, wl_registry, wl_seat, wl_shm,
|
||||
wl_shm_pool, wl_surface,
|
||||
},
|
||||
Connection, Dispatch, Proxy, QueueHandle,
|
||||
};
|
||||
use wayland_protocols::wp::cursor_shape::v1::client::{
|
||||
wp_cursor_shape_device_v1, wp_cursor_shape_manager_v1,
|
||||
|
@ -64,13 +63,13 @@ use wayland_protocols::xdg::decoration::zv1::client::{
|
|||
use wayland_protocols::xdg::shell::client::{xdg_surface, xdg_toplevel, xdg_wm_base};
|
||||
use wayland_protocols_plasma::blur::client::{org_kde_kwin_blur, org_kde_kwin_blur_manager};
|
||||
use xkbcommon::xkb::ffi::XKB_KEYMAP_FORMAT_TEXT_V1;
|
||||
use xkbcommon::xkb::{self, Keycode, KEYMAP_COMPILE_NO_FLAGS};
|
||||
use xkbcommon::xkb::{self, KEYMAP_COMPILE_NO_FLAGS, Keycode};
|
||||
|
||||
use super::display::WaylandDisplay;
|
||||
use super::window::{ImeInput, WaylandWindowStatePtr};
|
||||
|
||||
use crate::platform::linux::{
|
||||
get_xkb_compose_state, is_within_click_distance, open_uri_internal, read_fd,
|
||||
LinuxClient, get_xkb_compose_state, is_within_click_distance, open_uri_internal, read_fd,
|
||||
reveal_path_internal,
|
||||
wayland::{
|
||||
clipboard::{Clipboard, DataOffer, FILE_LIST_MIME_TYPE, TEXT_MIME_TYPE},
|
||||
|
@ -79,16 +78,14 @@ use crate::platform::linux::{
|
|||
window::WaylandWindow,
|
||||
},
|
||||
xdg_desktop_portal::{Event as XDPEvent, XDPEventSource},
|
||||
LinuxClient,
|
||||
};
|
||||
use crate::platform::{blade::BladeContext, PlatformWindow};
|
||||
use crate::platform::{PlatformWindow, blade::BladeContext};
|
||||
use crate::{
|
||||
point, px, size, AnyWindowHandle, Bounds, CursorStyle, DevicePixels, DisplayId, FileDropEvent,
|
||||
ForegroundExecutor, KeyDownEvent, KeyUpEvent, Keystroke, LinuxCommon, Modifiers,
|
||||
AnyWindowHandle, Bounds, CursorStyle, DOUBLE_CLICK_INTERVAL, DevicePixels, DisplayId,
|
||||
FileDropEvent, ForegroundExecutor, KeyDownEvent, KeyUpEvent, Keystroke, LinuxCommon, Modifiers,
|
||||
ModifiersChangedEvent, MouseButton, MouseDownEvent, MouseExitEvent, MouseMoveEvent,
|
||||
MouseUpEvent, NavigationDirection, Pixels, PlatformDisplay, PlatformInput, Point, ScaledPixels,
|
||||
ScrollDelta, ScrollWheelEvent, Size, TouchPhase, WindowParams, DOUBLE_CLICK_INTERVAL,
|
||||
SCROLL_LINES,
|
||||
MouseUpEvent, NavigationDirection, Pixels, PlatformDisplay, PlatformInput, Point, SCROLL_LINES,
|
||||
ScaledPixels, ScrollDelta, ScrollWheelEvent, Size, TouchPhase, WindowParams, point, px, size,
|
||||
};
|
||||
|
||||
/// Used to convert evdev scancode to xkb scancode
|
||||
|
|
|
@ -7,12 +7,12 @@ use std::{
|
|||
use calloop::{LoopHandle, PostAction};
|
||||
use filedescriptor::Pipe;
|
||||
use strum::IntoEnumIterator;
|
||||
use wayland_client::{protocol::wl_data_offer::WlDataOffer, Connection};
|
||||
use wayland_client::{Connection, protocol::wl_data_offer::WlDataOffer};
|
||||
use wayland_protocols::wp::primary_selection::zv1::client::zwp_primary_selection_offer_v1::ZwpPrimarySelectionOfferV1;
|
||||
|
||||
use crate::{
|
||||
hash, platform::linux::platform::read_fd, ClipboardEntry, ClipboardItem, Image, ImageFormat,
|
||||
WaylandClientStatePtr,
|
||||
ClipboardEntry, ClipboardItem, Image, ImageFormat, WaylandClientStatePtr, hash,
|
||||
platform::linux::platform::read_fd,
|
||||
};
|
||||
|
||||
pub(crate) const TEXT_MIME_TYPE: &str = "text/plain;charset=utf-8";
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use crate::Globals;
|
||||
use util::ResultExt;
|
||||
|
||||
use wayland_client::Connection;
|
||||
use wayland_client::protocol::wl_surface::WlSurface;
|
||||
use wayland_client::protocol::{wl_pointer::WlPointer, wl_shm::WlShm};
|
||||
use wayland_client::Connection;
|
||||
use wayland_cursor::{CursorImageBuffer, CursorTheme};
|
||||
|
||||
pub(crate) struct Cursor {
|
||||
|
|
|
@ -13,7 +13,7 @@ use futures::channel::oneshot::Receiver;
|
|||
use raw_window_handle as rwh;
|
||||
use wayland_backend::client::ObjectId;
|
||||
use wayland_client::WEnum;
|
||||
use wayland_client::{protocol::wl_surface, Proxy};
|
||||
use wayland_client::{Proxy, protocol::wl_surface};
|
||||
use wayland_protocols::wp::fractional_scale::v1::client::wp_fractional_scale_v1;
|
||||
use wayland_protocols::wp::viewporter::client::wp_viewport;
|
||||
use wayland_protocols::xdg::decoration::zv1::client::zxdg_toplevel_decoration_v1;
|
||||
|
@ -22,16 +22,17 @@ use wayland_protocols::xdg::shell::client::xdg_toplevel::{self};
|
|||
use wayland_protocols_plasma::blur::client::org_kde_kwin_blur;
|
||||
|
||||
use crate::platform::{
|
||||
PlatformAtlas, PlatformInputHandler, PlatformWindow,
|
||||
blade::{BladeContext, BladeRenderer, BladeSurfaceConfig},
|
||||
linux::wayland::{display::WaylandDisplay, serial::SerialKind},
|
||||
PlatformAtlas, PlatformInputHandler, PlatformWindow,
|
||||
};
|
||||
use crate::scene::Scene;
|
||||
use crate::{
|
||||
px, size, AnyWindowHandle, Bounds, Decorations, Globals, GpuSpecs, Modifiers, Output, Pixels,
|
||||
AnyWindowHandle, Bounds, Decorations, Globals, GpuSpecs, Modifiers, Output, Pixels,
|
||||
PlatformDisplay, PlatformInput, Point, PromptLevel, RequestFrameOptions, ResizeEdge,
|
||||
ScaledPixels, Size, Tiling, WaylandClientStatePtr, WindowAppearance,
|
||||
WindowBackgroundAppearance, WindowBounds, WindowControls, WindowDecorations, WindowParams,
|
||||
WindowBackgroundAppearance, WindowBounds, WindowControls, WindowDecorations, WindowParams, px,
|
||||
size,
|
||||
};
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
|
@ -9,8 +9,8 @@ use std::{
|
|||
};
|
||||
|
||||
use calloop::{
|
||||
generic::{FdWrapper, Generic},
|
||||
EventLoop, LoopHandle, RegistrationToken,
|
||||
generic::{FdWrapper, Generic},
|
||||
};
|
||||
|
||||
use anyhow::Context as _;
|
||||
|
@ -30,38 +30,37 @@ use x11rb::{
|
|||
AtomEnum, ChangeWindowAttributesAux, ClientMessageData, ClientMessageEvent,
|
||||
ConnectionExt as _, EventMask, KeyPressEvent,
|
||||
},
|
||||
protocol::{randr, render, xinput, xkb, xproto, Event},
|
||||
protocol::{Event, randr, render, xinput, xkb, xproto},
|
||||
resource_manager::Database,
|
||||
wrapper::ConnectionExt as _,
|
||||
xcb_ffi::XCBConnection,
|
||||
};
|
||||
use xim::{x11rb::X11rbClient, AttributeName, Client, InputStyle};
|
||||
use xim::{AttributeName, Client, InputStyle, x11rb::X11rbClient};
|
||||
use xkbc::x11::ffi::{XKB_X11_MIN_MAJOR_XKB_VERSION, XKB_X11_MIN_MINOR_XKB_VERSION};
|
||||
use xkbcommon::xkb::{self as xkbc, LayoutIndex, ModMask, STATE_LAYOUT_EFFECTIVE};
|
||||
|
||||
use super::{
|
||||
button_or_scroll_from_event_detail, get_valuator_axis_index, modifiers_from_state,
|
||||
pressed_button_from_mask, ButtonOrScroll, ScrollDirection,
|
||||
ButtonOrScroll, ScrollDirection, button_or_scroll_from_event_detail, get_valuator_axis_index,
|
||||
modifiers_from_state, pressed_button_from_mask,
|
||||
};
|
||||
use super::{X11Display, X11WindowStatePtr, XcbAtoms};
|
||||
use super::{XimCallbackEvent, XimHandler};
|
||||
|
||||
use crate::platform::{
|
||||
LinuxCommon, PlatformWindow,
|
||||
blade::BladeContext,
|
||||
linux::{
|
||||
get_xkb_compose_state, is_within_click_distance, open_uri_internal,
|
||||
LinuxClient, get_xkb_compose_state, is_within_click_distance, open_uri_internal,
|
||||
platform::{DOUBLE_CLICK_INTERVAL, SCROLL_LINES},
|
||||
reveal_path_internal,
|
||||
xdg_desktop_portal::{Event as XDPEvent, XDPEventSource},
|
||||
LinuxClient,
|
||||
},
|
||||
LinuxCommon, PlatformWindow,
|
||||
};
|
||||
use crate::{
|
||||
modifiers_from_xinput_info, point, px, AnyWindowHandle, Bounds, ClipboardItem, CursorStyle,
|
||||
DisplayId, FileDropEvent, Keystroke, Modifiers, ModifiersChangedEvent, MouseButton, Pixels,
|
||||
Platform, PlatformDisplay, PlatformInput, Point, RequestFrameOptions, ScaledPixels,
|
||||
ScrollDelta, Size, TouchPhase, WindowParams, X11Window,
|
||||
AnyWindowHandle, Bounds, ClipboardItem, CursorStyle, DisplayId, FileDropEvent, Keystroke,
|
||||
Modifiers, ModifiersChangedEvent, MouseButton, Pixels, Platform, PlatformDisplay,
|
||||
PlatformInput, Point, RequestFrameOptions, ScaledPixels, ScrollDelta, Size, TouchPhase,
|
||||
WindowParams, X11Window, modifiers_from_xinput_info, point, px,
|
||||
};
|
||||
|
||||
/// Value for DeviceId parameters which selects all devices.
|
||||
|
|
|
@ -2,7 +2,7 @@ use anyhow::Result;
|
|||
use uuid::Uuid;
|
||||
use x11rb::{connection::Connection as _, xcb_ffi::XCBConnection};
|
||||
|
||||
use crate::{px, Bounds, DisplayId, Pixels, PlatformDisplay, Size};
|
||||
use crate::{Bounds, DisplayId, Pixels, PlatformDisplay, Size, px};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct X11Display {
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
use anyhow::{anyhow, Context as _};
|
||||
use anyhow::{Context as _, anyhow};
|
||||
|
||||
use crate::platform::blade::{BladeContext, BladeRenderer, BladeSurfaceConfig};
|
||||
use crate::{
|
||||
px, size, AnyWindowHandle, Bounds, Decorations, DevicePixels, ForegroundExecutor, GpuSpecs,
|
||||
Modifiers, Pixels, PlatformAtlas, PlatformDisplay, PlatformInput, PlatformInputHandler,
|
||||
PlatformWindow, Point, PromptLevel, RequestFrameOptions, ResizeEdge, ScaledPixels, Scene, Size,
|
||||
Tiling, WindowAppearance, WindowBackgroundAppearance, WindowBounds, WindowDecorations,
|
||||
WindowKind, WindowParams, X11ClientStatePtr,
|
||||
AnyWindowHandle, Bounds, Decorations, DevicePixels, ForegroundExecutor, GpuSpecs, Modifiers,
|
||||
Pixels, PlatformAtlas, PlatformDisplay, PlatformInput, PlatformInputHandler, PlatformWindow,
|
||||
Point, PromptLevel, RequestFrameOptions, ResizeEdge, ScaledPixels, Scene, Size, Tiling,
|
||||
WindowAppearance, WindowBackgroundAppearance, WindowBounds, WindowDecorations, WindowKind,
|
||||
WindowParams, X11ClientStatePtr, px, size,
|
||||
};
|
||||
|
||||
use blade_graphics as gpu;
|
||||
use raw_window_handle as rwh;
|
||||
use util::{maybe, ResultExt};
|
||||
use util::{ResultExt, maybe};
|
||||
use x11rb::{
|
||||
connection::Connection,
|
||||
cookie::{Cookie, VoidCookie},
|
||||
|
@ -31,7 +31,7 @@ use std::{
|
|||
sync::Arc,
|
||||
};
|
||||
|
||||
use super::{X11Display, XINPUT_ALL_DEVICES, XINPUT_ALL_DEVICE_GROUPS};
|
||||
use super::{X11Display, XINPUT_ALL_DEVICE_GROUPS, XINPUT_ALL_DEVICES};
|
||||
x11rb::atom_manager! {
|
||||
pub XcbAtoms: AtomsCookie {
|
||||
XA_ATOM,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::default::Default;
|
||||
|
||||
use x11rb::protocol::{xproto, Event};
|
||||
use x11rb::protocol::{Event, xproto};
|
||||
use xim::{AHashMap, AttributeName, Client, ClientError, ClientHandler, InputStyle};
|
||||
|
||||
pub enum XimCallbackEvent {
|
||||
|
|
|
@ -30,7 +30,7 @@ mod platform;
|
|||
mod window;
|
||||
mod window_appearance;
|
||||
|
||||
use crate::{px, size, DevicePixels, Pixels, Size};
|
||||
use crate::{DevicePixels, Pixels, Size, px, size};
|
||||
use cocoa::{
|
||||
base::{id, nil},
|
||||
foundation::{NSAutoreleasePool, NSNotFound, NSRect, NSSize, NSString, NSUInteger},
|
||||
|
@ -38,7 +38,7 @@ use cocoa::{
|
|||
|
||||
use objc::runtime::{BOOL, NO, YES};
|
||||
use std::{
|
||||
ffi::{c_char, CStr},
|
||||
ffi::{CStr, c_char},
|
||||
ops::Range,
|
||||
};
|
||||
|
||||
|
@ -60,11 +60,7 @@ trait BoolExt {
|
|||
|
||||
impl BoolExt for bool {
|
||||
fn to_objc(self) -> BOOL {
|
||||
if self {
|
||||
YES
|
||||
} else {
|
||||
NO
|
||||
}
|
||||
if self { YES } else { NO }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ use parking::{Parker, Unparker};
|
|||
use parking_lot::Mutex;
|
||||
use std::{
|
||||
ffi::c_void,
|
||||
ptr::{addr_of, NonNull},
|
||||
ptr::{NonNull, addr_of},
|
||||
sync::Arc,
|
||||
time::Duration,
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::{px, size, Bounds, DisplayId, Pixels, PlatformDisplay};
|
||||
use crate::{Bounds, DisplayId, Pixels, PlatformDisplay, px, size};
|
||||
use anyhow::Result;
|
||||
use cocoa::{
|
||||
appkit::NSScreen,
|
||||
|
|
|
@ -103,7 +103,7 @@ mod sys {
|
|||
|
||||
use anyhow::Result;
|
||||
use core_graphics::display::CGDirectDisplayID;
|
||||
use foreign_types::{foreign_type, ForeignType};
|
||||
use foreign_types::{ForeignType, foreign_type};
|
||||
use std::{
|
||||
ffi::c_void,
|
||||
fmt::{self, Debug, Formatter},
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
use crate::{
|
||||
platform::mac::{
|
||||
kTISPropertyUnicodeKeyLayoutData, LMGetKbdType, NSStringExt,
|
||||
TISCopyCurrentKeyboardLayoutInputSource, TISGetInputSourceProperty, UCKeyTranslate,
|
||||
},
|
||||
point, px, KeyDownEvent, KeyUpEvent, Keystroke, Modifiers, ModifiersChangedEvent, MouseButton,
|
||||
KeyDownEvent, KeyUpEvent, Keystroke, Modifiers, ModifiersChangedEvent, MouseButton,
|
||||
MouseDownEvent, MouseExitEvent, MouseMoveEvent, MouseUpEvent, NavigationDirection, Pixels,
|
||||
PlatformInput, ScrollDelta, ScrollWheelEvent, TouchPhase,
|
||||
platform::mac::{
|
||||
LMGetKbdType, NSStringExt, TISCopyCurrentKeyboardLayoutInputSource,
|
||||
TISGetInputSourceProperty, UCKeyTranslate, kTISPropertyUnicodeKeyLayoutData,
|
||||
},
|
||||
point, px,
|
||||
};
|
||||
use cocoa::{
|
||||
appkit::{NSEvent, NSEventModifierFlags, NSEventPhase, NSEventType},
|
||||
base::{id, YES},
|
||||
base::{YES, id},
|
||||
};
|
||||
use core_foundation::data::{CFDataGetBytePtr, CFDataRef};
|
||||
use core_graphics::event::CGKeyCode;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use crate::{
|
||||
platform::AtlasTextureList, AtlasKey, AtlasTextureId, AtlasTextureKind, AtlasTile, Bounds,
|
||||
DevicePixels, PlatformAtlas, Point, Size,
|
||||
AtlasKey, AtlasTextureId, AtlasTextureKind, AtlasTile, Bounds, DevicePixels, PlatformAtlas,
|
||||
Point, Size, platform::AtlasTextureList,
|
||||
};
|
||||
use anyhow::{anyhow, Result};
|
||||
use anyhow::{Result, anyhow};
|
||||
use collections::FxHashMap;
|
||||
use derive_more::{Deref, DerefMut};
|
||||
use etagere::BucketedAtlasAllocator;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use super::metal_atlas::MetalAtlas;
|
||||
use crate::{
|
||||
point, size, AtlasTextureId, AtlasTextureKind, AtlasTile, Background, Bounds, ContentMask,
|
||||
DevicePixels, MonochromeSprite, PaintSurface, Path, PathId, PathVertex, PolychromeSprite,
|
||||
PrimitiveBatch, Quad, ScaledPixels, Scene, Shadow, Size, Surface, Underline,
|
||||
AtlasTextureId, AtlasTextureKind, AtlasTile, Background, Bounds, ContentMask, DevicePixels,
|
||||
MonochromeSprite, PaintSurface, Path, PathId, PathVertex, PolychromeSprite, PrimitiveBatch,
|
||||
Quad, ScaledPixels, Scene, Shadow, Size, Surface, Underline, point, size,
|
||||
};
|
||||
use anyhow::{anyhow, Result};
|
||||
use anyhow::{Result, anyhow};
|
||||
use block::ConcreteBlock;
|
||||
use cocoa::{
|
||||
base::{NO, YES},
|
||||
|
|
|
@ -4,13 +4,12 @@ use crate::{FontFallbacks, FontFeatures};
|
|||
use cocoa::appkit::CGFloat;
|
||||
use core_foundation::{
|
||||
array::{
|
||||
kCFTypeArrayCallBacks, CFArray, CFArrayAppendArray, CFArrayAppendValue,
|
||||
CFArrayCreateMutable, CFArrayGetCount, CFArrayGetValueAtIndex, CFArrayRef,
|
||||
CFMutableArrayRef,
|
||||
CFArray, CFArrayAppendArray, CFArrayAppendValue, CFArrayCreateMutable, CFArrayGetCount,
|
||||
CFArrayGetValueAtIndex, CFArrayRef, CFMutableArrayRef, kCFTypeArrayCallBacks,
|
||||
},
|
||||
base::{kCFAllocatorDefault, CFRelease, TCFType},
|
||||
base::{CFRelease, TCFType, kCFAllocatorDefault},
|
||||
dictionary::{
|
||||
kCFTypeDictionaryKeyCallBacks, kCFTypeDictionaryValueCallBacks, CFDictionaryCreate,
|
||||
CFDictionaryCreate, kCFTypeDictionaryKeyCallBacks, kCFTypeDictionaryValueCallBacks,
|
||||
},
|
||||
number::CFNumber,
|
||||
string::{CFString, CFStringRef},
|
||||
|
@ -18,12 +17,11 @@ use core_foundation::{
|
|||
use core_foundation_sys::locale::CFLocaleCopyPreferredLanguages;
|
||||
use core_graphics::{display::CFDictionary, geometry::CGAffineTransform};
|
||||
use core_text::{
|
||||
font::{cascade_list_for_languages, CTFont, CTFontRef},
|
||||
font::{CTFont, CTFontRef, cascade_list_for_languages},
|
||||
font_descriptor::{
|
||||
kCTFontCascadeListAttribute, kCTFontFeatureSettingsAttribute, CTFontDescriptor,
|
||||
CTFontDescriptorCopyAttributes, CTFontDescriptorCreateCopyWithFeature,
|
||||
CTFontDescriptor, CTFontDescriptorCopyAttributes, CTFontDescriptorCreateCopyWithFeature,
|
||||
CTFontDescriptorCreateWithAttributes, CTFontDescriptorCreateWithNameAndSize,
|
||||
CTFontDescriptorRef,
|
||||
CTFontDescriptorRef, kCTFontCascadeListAttribute, kCTFontFeatureSettingsAttribute,
|
||||
},
|
||||
};
|
||||
use font_kit::font::Font as FontKitFont;
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
use super::{
|
||||
BoolExt,
|
||||
attributed_string::{NSAttributedString, NSMutableAttributedString},
|
||||
events::key_to_native,
|
||||
renderer, screen_capture, BoolExt,
|
||||
renderer, screen_capture,
|
||||
};
|
||||
use crate::{
|
||||
hash, Action, AnyWindowHandle, BackgroundExecutor, ClipboardEntry, ClipboardItem,
|
||||
ClipboardString, CursorStyle, ForegroundExecutor, Image, ImageFormat, Keymap, MacDispatcher,
|
||||
MacDisplay, MacWindow, Menu, MenuItem, PathPromptOptions, Platform, PlatformDisplay,
|
||||
PlatformTextSystem, PlatformWindow, Result, ScreenCaptureSource, SemanticVersion, Task,
|
||||
WindowAppearance, WindowParams,
|
||||
Action, AnyWindowHandle, BackgroundExecutor, ClipboardEntry, ClipboardItem, ClipboardString,
|
||||
CursorStyle, ForegroundExecutor, Image, ImageFormat, Keymap, MacDispatcher, MacDisplay,
|
||||
MacWindow, Menu, MenuItem, PathPromptOptions, Platform, PlatformDisplay, PlatformTextSystem,
|
||||
PlatformWindow, Result, ScreenCaptureSource, SemanticVersion, Task, WindowAppearance,
|
||||
WindowParams, hash,
|
||||
};
|
||||
use anyhow::{anyhow, Context as _};
|
||||
use anyhow::{Context as _, anyhow};
|
||||
use block::ConcreteBlock;
|
||||
use cocoa::{
|
||||
appkit::{
|
||||
|
@ -19,7 +20,7 @@ use cocoa::{
|
|||
NSPasteboardTypePNG, NSPasteboardTypeRTF, NSPasteboardTypeRTFD, NSPasteboardTypeString,
|
||||
NSPasteboardTypeTIFF, NSSavePanel, NSWindow,
|
||||
},
|
||||
base::{id, nil, selector, BOOL, NO, YES},
|
||||
base::{BOOL, NO, YES, id, nil, selector},
|
||||
foundation::{
|
||||
NSArray, NSAutoreleasePool, NSBundle, NSData, NSInteger, NSProcessInfo, NSRange, NSString,
|
||||
NSUInteger, NSURL,
|
||||
|
@ -47,7 +48,7 @@ use ptr::null_mut;
|
|||
use std::{
|
||||
cell::Cell,
|
||||
convert::TryInto,
|
||||
ffi::{c_void, CStr, OsStr},
|
||||
ffi::{CStr, OsStr, c_void},
|
||||
os::{raw::c_char, unix::ffi::OsStrExt},
|
||||
path::{Path, PathBuf},
|
||||
process::Command,
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
use crate::{
|
||||
Pixels, Size,
|
||||
platform::{ScreenCaptureFrame, ScreenCaptureSource, ScreenCaptureStream},
|
||||
px, size, Pixels, Size,
|
||||
px, size,
|
||||
};
|
||||
use anyhow::{anyhow, Result};
|
||||
use anyhow::{Result, anyhow};
|
||||
use block::ConcreteBlock;
|
||||
use cocoa::{
|
||||
base::{id, nil, YES},
|
||||
base::{YES, id, nil},
|
||||
foundation::NSArray,
|
||||
};
|
||||
use core_foundation::base::TCFType;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use crate::{
|
||||
point, px, size, swap_rgba_pa_to_bgra, Bounds, DevicePixels, Font, FontFallbacks, FontFeatures,
|
||||
FontId, FontMetrics, FontRun, FontStyle, FontWeight, GlyphId, LineLayout, Pixels,
|
||||
PlatformTextSystem, Point, RenderGlyphParams, Result, ShapedGlyph, ShapedRun, SharedString,
|
||||
Size, SUBPIXEL_VARIANTS,
|
||||
Bounds, DevicePixels, Font, FontFallbacks, FontFeatures, FontId, FontMetrics, FontRun,
|
||||
FontStyle, FontWeight, GlyphId, LineLayout, Pixels, PlatformTextSystem, Point,
|
||||
RenderGlyphParams, Result, SUBPIXEL_VARIANTS, ShapedGlyph, ShapedRun, SharedString, Size,
|
||||
point, px, size, swap_rgba_pa_to_bgra,
|
||||
};
|
||||
use anyhow::anyhow;
|
||||
use cocoa::appkit::CGFloat;
|
||||
|
@ -14,7 +14,7 @@ use core_foundation::{
|
|||
string::CFString,
|
||||
};
|
||||
use core_graphics::{
|
||||
base::{kCGImageAlphaPremultipliedLast, CGGlyph},
|
||||
base::{CGGlyph, kCGImageAlphaPremultipliedLast},
|
||||
color_space::CGColorSpace,
|
||||
context::CGContext,
|
||||
display::CGPoint,
|
||||
|
@ -639,7 +639,7 @@ mod lenient_font_attributes {
|
|||
string::{CFString, CFStringRef},
|
||||
};
|
||||
use core_text::font_descriptor::{
|
||||
kCTFontFamilyNameAttribute, CTFontDescriptor, CTFontDescriptorCopyAttribute,
|
||||
CTFontDescriptor, CTFontDescriptorCopyAttribute, kCTFontFamilyNameAttribute,
|
||||
};
|
||||
|
||||
pub fn family_name(descriptor: &CTFontDescriptor) -> Option<String> {
|
||||
|
@ -674,7 +674,7 @@ mod lenient_font_attributes {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::{font, px, FontRun, GlyphId, MacTextSystem, PlatformTextSystem};
|
||||
use crate::{FontRun, GlyphId, MacTextSystem, PlatformTextSystem, font, px};
|
||||
|
||||
#[test]
|
||||
fn test_layout_line_bom_char() {
|
||||
|
@ -697,7 +697,7 @@ mod tests {
|
|||
assert_eq!(layout.runs.len(), 1);
|
||||
assert_eq!(layout.runs[0].glyphs.len(), 2);
|
||||
assert_eq!(layout.runs[0].glyphs[0].id, GlyphId(68u32)); // a
|
||||
// There's no glyph for \u{feff}
|
||||
// There's no glyph for \u{feff}
|
||||
assert_eq!(layout.runs[0].glyphs[1].id, GlyphId(69u32)); // b
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use super::{ns_string, renderer, MacDisplay, NSRange, NSStringExt};
|
||||
use super::{MacDisplay, NSRange, NSStringExt, ns_string, renderer};
|
||||
use crate::{
|
||||
platform::PlatformInputHandler, point, px, size, AnyWindowHandle, Bounds, DisplayLink,
|
||||
ExternalPaths, FileDropEvent, ForegroundExecutor, KeyDownEvent, Keystroke, Modifiers,
|
||||
ModifiersChangedEvent, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels,
|
||||
PlatformAtlas, PlatformDisplay, PlatformInput, PlatformWindow, Point, PromptLevel,
|
||||
RequestFrameOptions, ScaledPixels, Size, Timer, WindowAppearance, WindowBackgroundAppearance,
|
||||
WindowBounds, WindowKind, WindowParams,
|
||||
AnyWindowHandle, Bounds, DisplayLink, ExternalPaths, FileDropEvent, ForegroundExecutor,
|
||||
KeyDownEvent, Keystroke, Modifiers, ModifiersChangedEvent, MouseButton, MouseDownEvent,
|
||||
MouseMoveEvent, MouseUpEvent, Pixels, PlatformAtlas, PlatformDisplay, PlatformInput,
|
||||
PlatformWindow, Point, PromptLevel, RequestFrameOptions, ScaledPixels, Size, Timer,
|
||||
WindowAppearance, WindowBackgroundAppearance, WindowBounds, WindowKind, WindowParams,
|
||||
platform::PlatformInputHandler, point, px, size,
|
||||
};
|
||||
use block::ConcreteBlock;
|
||||
use cocoa::{
|
||||
|
@ -28,7 +28,7 @@ use objc::{
|
|||
class,
|
||||
declare::ClassDecl,
|
||||
msg_send,
|
||||
runtime::{Class, Object, Protocol, Sel, BOOL, NO, YES},
|
||||
runtime::{BOOL, Class, NO, Object, Protocol, Sel, YES},
|
||||
sel, sel_impl,
|
||||
};
|
||||
use parking_lot::Mutex;
|
||||
|
@ -36,7 +36,7 @@ use raw_window_handle as rwh;
|
|||
use smallvec::SmallVec;
|
||||
use std::{
|
||||
cell::Cell,
|
||||
ffi::{c_void, CStr},
|
||||
ffi::{CStr, c_void},
|
||||
mem,
|
||||
ops::Range,
|
||||
path::PathBuf,
|
||||
|
@ -1198,11 +1198,7 @@ fn get_scale_factor(native_window: id) -> f32 {
|
|||
// (if it is off-screen), though we'd expect to see viewDidChangeBackingProperties before
|
||||
// it was rendered for real.
|
||||
// Regardless, attempt to avoid the issue here.
|
||||
if factor == 0.0 {
|
||||
2.
|
||||
} else {
|
||||
factor
|
||||
}
|
||||
if factor == 0.0 { 2. } else { factor }
|
||||
}
|
||||
|
||||
unsafe fn get_window_state(object: &Object) -> Arc<Mutex<MacWindowState>> {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::{px, Bounds, DisplayId, Pixels, PlatformDisplay, Point};
|
||||
use crate::{Bounds, DisplayId, Pixels, PlatformDisplay, Point, px};
|
||||
use anyhow::{Ok, Result};
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::{
|
||||
px, size, AnyWindowHandle, BackgroundExecutor, ClipboardItem, CursorStyle, ForegroundExecutor,
|
||||
Keymap, Platform, PlatformDisplay, PlatformTextSystem, ScreenCaptureFrame, ScreenCaptureSource,
|
||||
ScreenCaptureStream, Task, TestDisplay, TestWindow, WindowAppearance, WindowParams,
|
||||
AnyWindowHandle, BackgroundExecutor, ClipboardItem, CursorStyle, ForegroundExecutor, Keymap,
|
||||
Platform, PlatformDisplay, PlatformTextSystem, ScreenCaptureFrame, ScreenCaptureSource,
|
||||
ScreenCaptureStream, Task, TestDisplay, TestWindow, WindowAppearance, WindowParams, px, size,
|
||||
};
|
||||
use anyhow::Result;
|
||||
use collections::VecDeque;
|
||||
|
@ -16,7 +16,7 @@ use std::{
|
|||
#[cfg(target_os = "windows")]
|
||||
use windows::Win32::{
|
||||
Graphics::Imaging::{CLSID_WICImagingFactory, IWICImagingFactory},
|
||||
System::Com::{CoCreateInstance, CLSCTX_INPROC_SERVER},
|
||||
System::Com::{CLSCTX_INPROC_SERVER, CoCreateInstance},
|
||||
};
|
||||
|
||||
/// TestPlatform implements the Platform trait for use in tests.
|
||||
|
|
|
@ -12,7 +12,7 @@ use windows::Win32::{
|
|||
GetClipboardData, GetClipboardFormatNameW, IsClipboardFormatAvailable, OpenClipboard,
|
||||
RegisterClipboardFormatW, SetClipboardData,
|
||||
},
|
||||
Memory::{GlobalAlloc, GlobalLock, GlobalUnlock, GMEM_MOVEABLE},
|
||||
Memory::{GMEM_MOVEABLE, GlobalAlloc, GlobalLock, GlobalUnlock},
|
||||
Ole::{CF_HDROP, CF_UNICODETEXT},
|
||||
},
|
||||
UI::Shell::{DragQueryFileW, HDROP},
|
||||
|
@ -20,7 +20,7 @@ use windows::Win32::{
|
|||
use windows_core::PCWSTR;
|
||||
|
||||
use crate::{
|
||||
hash, ClipboardEntry, ClipboardItem, ClipboardString, Image, ImageFormat, SmartGlobal,
|
||||
ClipboardEntry, ClipboardItem, ClipboardString, Image, ImageFormat, SmartGlobal, hash,
|
||||
};
|
||||
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-dragqueryfilew
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
use std::{borrow::Cow, sync::Arc};
|
||||
|
||||
use ::util::ResultExt;
|
||||
use anyhow::{anyhow, Result};
|
||||
use anyhow::{Result, anyhow};
|
||||
use collections::HashMap;
|
||||
use itertools::Itertools;
|
||||
use parking_lot::{RwLock, RwLockUpgradableReadGuard};
|
||||
use smallvec::SmallVec;
|
||||
use windows::{
|
||||
core::*,
|
||||
Win32::{
|
||||
Foundation::*,
|
||||
Globalization::GetUserDefaultLocaleName,
|
||||
|
@ -21,6 +20,7 @@ use windows::{
|
|||
System::SystemServices::LOCALE_NAME_MAX_LENGTH,
|
||||
UI::WindowsAndMessaging::*,
|
||||
},
|
||||
core::*,
|
||||
};
|
||||
use windows_numerics::Vector2;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use std::{
|
||||
thread::{current, ThreadId},
|
||||
thread::{ThreadId, current},
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ use std::rc::Rc;
|
|||
use util::ResultExt;
|
||||
use uuid::Uuid;
|
||||
use windows::{
|
||||
core::*,
|
||||
Win32::{
|
||||
Foundation::*,
|
||||
Graphics::Gdi::*,
|
||||
|
@ -13,9 +12,10 @@ use windows::{
|
|||
WindowsAndMessaging::USER_DEFAULT_SCREEN_DPI,
|
||||
},
|
||||
},
|
||||
core::*,
|
||||
};
|
||||
|
||||
use crate::{logical_point, point, size, Bounds, DevicePixels, DisplayId, Pixels, PlatformDisplay};
|
||||
use crate::{Bounds, DevicePixels, DisplayId, Pixels, PlatformDisplay, logical_point, point, size};
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub(crate) struct WindowsDisplay {
|
||||
|
|
|
@ -3,7 +3,6 @@ use std::rc::Rc;
|
|||
use ::util::ResultExt;
|
||||
use anyhow::Context as _;
|
||||
use windows::{
|
||||
core::PCWSTR,
|
||||
Win32::{
|
||||
Foundation::*,
|
||||
Graphics::Gdi::*,
|
||||
|
@ -15,6 +14,7 @@ use windows::{
|
|||
WindowsAndMessaging::*,
|
||||
},
|
||||
},
|
||||
core::PCWSTR,
|
||||
};
|
||||
|
||||
use crate::*;
|
||||
|
@ -232,11 +232,7 @@ fn handle_close_msg(state_ptr: Rc<WindowsWindowStatePtr>) -> Option<isize> {
|
|||
drop(lock);
|
||||
let should_close = callback();
|
||||
state_ptr.state.borrow_mut().callbacks.should_close = Some(callback);
|
||||
if should_close {
|
||||
None
|
||||
} else {
|
||||
Some(0)
|
||||
}
|
||||
if should_close { None } else { Some(0) }
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -6,15 +6,18 @@ use std::{
|
|||
sync::Arc,
|
||||
};
|
||||
|
||||
use ::util::{paths::SanitizedPath, ResultExt};
|
||||
use anyhow::{anyhow, Context as _, Result};
|
||||
use ::util::{ResultExt, paths::SanitizedPath};
|
||||
use anyhow::{Context as _, Result, anyhow};
|
||||
use async_task::Runnable;
|
||||
use futures::channel::oneshot::{self, Receiver};
|
||||
use itertools::Itertools;
|
||||
use parking_lot::RwLock;
|
||||
use smallvec::SmallVec;
|
||||
use windows::{
|
||||
core::*,
|
||||
UI::{
|
||||
StartScreen::{JumpList, JumpListItem},
|
||||
ViewManagement::UISettings,
|
||||
},
|
||||
Win32::{
|
||||
Foundation::*,
|
||||
Graphics::{
|
||||
|
@ -25,10 +28,7 @@ use windows::{
|
|||
System::{Com::*, LibraryLoader::*, Ole::*, SystemInformation::*, Threading::*},
|
||||
UI::{Input::KeyboardAndMouse::*, Shell::*, WindowsAndMessaging::*},
|
||||
},
|
||||
UI::{
|
||||
StartScreen::{JumpList, JumpListItem},
|
||||
ViewManagement::UISettings,
|
||||
},
|
||||
core::*,
|
||||
};
|
||||
|
||||
use crate::{platform::blade::BladeContext, *};
|
||||
|
@ -826,7 +826,7 @@ fn should_auto_hide_scrollbars() -> Result<bool> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::{read_from_clipboard, write_to_clipboard, ClipboardItem};
|
||||
use crate::{ClipboardItem, read_from_clipboard, write_to_clipboard};
|
||||
|
||||
#[test]
|
||||
fn test_clipboard() {
|
||||
|
|
|
@ -2,10 +2,10 @@ use std::ffi::{c_uint, c_void};
|
|||
|
||||
use ::util::ResultExt;
|
||||
use windows::Win32::UI::{
|
||||
Shell::{SHAppBarMessage, ABM_GETSTATE, ABM_GETTASKBARPOS, ABS_AUTOHIDE, APPBARDATA},
|
||||
Shell::{ABM_GETSTATE, ABM_GETTASKBARPOS, ABS_AUTOHIDE, APPBARDATA, SHAppBarMessage},
|
||||
WindowsAndMessaging::{
|
||||
SystemParametersInfoW, SPI_GETWHEELSCROLLCHARS, SPI_GETWHEELSCROLLLINES,
|
||||
SYSTEM_PARAMETERS_INFO_UPDATE_FLAGS,
|
||||
SPI_GETWHEELSCROLLCHARS, SPI_GETWHEELSCROLLLINES, SYSTEM_PARAMETERS_INFO_UPDATE_FLAGS,
|
||||
SystemParametersInfoW,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -2,13 +2,13 @@ use std::sync::OnceLock;
|
|||
|
||||
use ::util::ResultExt;
|
||||
use windows::{
|
||||
core::BOOL,
|
||||
Wdk::System::SystemServices::RtlGetVersion,
|
||||
Win32::{Foundation::*, Graphics::Dwm::*, UI::WindowsAndMessaging::*},
|
||||
UI::{
|
||||
Color,
|
||||
ViewManagement::{UIColorType, UISettings},
|
||||
},
|
||||
Wdk::System::SystemServices::RtlGetVersion,
|
||||
Win32::{Foundation::*, Graphics::Dwm::*, UI::WindowsAndMessaging::*},
|
||||
core::BOOL,
|
||||
};
|
||||
|
||||
use crate::*;
|
||||
|
|
|
@ -17,13 +17,13 @@ use futures::channel::oneshot::{self, Receiver};
|
|||
use raw_window_handle as rwh;
|
||||
use smallvec::SmallVec;
|
||||
use windows::{
|
||||
core::*,
|
||||
Win32::{
|
||||
Foundation::*,
|
||||
Graphics::Gdi::*,
|
||||
System::{Com::*, LibraryLoader::*, Ole::*, SystemServices::*},
|
||||
UI::{Controls::*, HiDpi::*, Input::KeyboardAndMouse::*, Shell::*, WindowsAndMessaging::*},
|
||||
},
|
||||
core::*,
|
||||
};
|
||||
|
||||
use crate::platform::blade::{BladeContext, BladeRenderer};
|
||||
|
@ -1326,7 +1326,7 @@ mod windows_renderer {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::ClickState;
|
||||
use crate::{point, DevicePixels, MouseButton};
|
||||
use crate::{DevicePixels, MouseButton, point};
|
||||
use std::time::Duration;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//! application to avoid having to import each trait individually.
|
||||
|
||||
pub use crate::{
|
||||
util::FluentBuilder, AppContext as _, BorrowAppContext, Context, Element, FocusableElement,
|
||||
InteractiveElement, IntoElement, ParentElement, Refineable, Render, RenderOnce,
|
||||
StatefulInteractiveElement, Styled, StyledImage, VisualContext,
|
||||
AppContext as _, BorrowAppContext, Context, Element, FocusableElement, InteractiveElement,
|
||||
IntoElement, ParentElement, Refineable, Render, RenderOnce, StatefulInteractiveElement, Styled,
|
||||
StyledImage, VisualContext, util::FluentBuilder,
|
||||
};
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#![cfg_attr(windows, allow(dead_code))]
|
||||
|
||||
use crate::{
|
||||
bounds_tree::BoundsTree, point, AtlasTextureId, AtlasTile, Background, Bounds, ContentMask,
|
||||
Corners, Edges, Hsla, Pixels, Point, Radians, ScaledPixels, Size,
|
||||
AtlasTextureId, AtlasTile, Background, Bounds, ContentMask, Corners, Edges, Hsla, Pixels,
|
||||
Point, Radians, ScaledPixels, Size, bounds_tree::BoundsTree, point,
|
||||
};
|
||||
use std::{fmt::Debug, iter::Peekable, ops::Range, slice};
|
||||
|
||||
|
|
|
@ -5,11 +5,11 @@ use std::{
|
|||
};
|
||||
|
||||
use crate::{
|
||||
black, phi, point, quad, rems, size, AbsoluteLength, App, Background, BackgroundTag,
|
||||
BorderStyle, Bounds, ContentMask, Corners, CornersRefinement, CursorStyle, DefiniteLength,
|
||||
DevicePixels, Edges, EdgesRefinement, Font, FontFallbacks, FontFeatures, FontStyle, FontWeight,
|
||||
Hsla, Length, Pixels, Point, PointRefinement, Rgba, SharedString, Size, SizeRefinement, Styled,
|
||||
TextRun, Window,
|
||||
AbsoluteLength, App, Background, BackgroundTag, BorderStyle, Bounds, ContentMask, Corners,
|
||||
CornersRefinement, CursorStyle, DefiniteLength, DevicePixels, Edges, EdgesRefinement, Font,
|
||||
FontFallbacks, FontFeatures, FontStyle, FontWeight, Hsla, Length, Pixels, Point,
|
||||
PointRefinement, Rgba, SharedString, Size, SizeRefinement, Styled, TextRun, Window, black, phi,
|
||||
point, quad, rems, size,
|
||||
};
|
||||
use collections::HashSet;
|
||||
use refineable::Refineable;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use crate::{
|
||||
self as gpui, px, relative, rems, AbsoluteLength, AlignItems, BorderStyle, CursorStyle,
|
||||
DefiniteLength, Fill, FlexDirection, FlexWrap, Font, FontStyle, FontWeight, Hsla,
|
||||
JustifyContent, Length, SharedString, StrikethroughStyle, StyleRefinement, TextOverflow,
|
||||
UnderlineStyle, WhiteSpace,
|
||||
self as gpui, AbsoluteLength, AlignItems, BorderStyle, CursorStyle, DefiniteLength, Fill,
|
||||
FlexDirection, FlexWrap, Font, FontStyle, FontWeight, Hsla, JustifyContent, Length,
|
||||
SharedString, StrikethroughStyle, StyleRefinement, TextOverflow, UnderlineStyle, WhiteSpace,
|
||||
px, relative, rems,
|
||||
};
|
||||
use crate::{TextAlign, TextStyleRefinement};
|
||||
pub use gpui_macros::{
|
||||
|
|
|
@ -5,10 +5,10 @@ use collections::{FxHashMap, FxHashSet};
|
|||
use smallvec::SmallVec;
|
||||
use std::fmt::Debug;
|
||||
use taffy::{
|
||||
TaffyTree, TraversePartialTree as _,
|
||||
geometry::{Point as TaffyPoint, Rect as TaffyRect, Size as TaffySize},
|
||||
style::AvailableSpace as TaffyAvailableSpace,
|
||||
tree::NodeId,
|
||||
TaffyTree, TraversePartialTree as _,
|
||||
};
|
||||
|
||||
type NodeMeasureFn = Box<
|
||||
|
@ -71,8 +71,13 @@ impl TaffyLayoutEngine {
|
|||
&mut self,
|
||||
style: Style,
|
||||
rem_size: Pixels,
|
||||
measure: impl FnMut(Size<Option<Pixels>>, Size<AvailableSpace>, &mut Window, &mut App) -> Size<Pixels>
|
||||
+ 'static,
|
||||
measure: impl FnMut(
|
||||
Size<Option<Pixels>>,
|
||||
Size<AvailableSpace>,
|
||||
&mut Window,
|
||||
&mut App,
|
||||
) -> Size<Pixels>
|
||||
+ 'static,
|
||||
) -> LayoutId {
|
||||
let taffy_style = style.to_taffy(rem_size);
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ use schemars::JsonSchema;
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
px, Bounds, DevicePixels, Hsla, Pixels, PlatformTextSystem, Point, Result, SharedString, Size,
|
||||
StrikethroughStyle, UnderlineStyle,
|
||||
Bounds, DevicePixels, Hsla, Pixels, PlatformTextSystem, Point, Result, SharedString, Size,
|
||||
StrikethroughStyle, UnderlineStyle, px,
|
||||
};
|
||||
use anyhow::anyhow;
|
||||
use collections::FxHashMap;
|
||||
|
@ -22,7 +22,7 @@ use core::fmt;
|
|||
use derive_more::Deref;
|
||||
use itertools::Itertools;
|
||||
use parking_lot::{Mutex, RwLock, RwLockUpgradableReadGuard};
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
use smallvec::{SmallVec, smallvec};
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
cmp,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::{
|
||||
black, fill, point, px, size, App, Bounds, Half, Hsla, LineLayout, Pixels, Point, Result,
|
||||
SharedString, StrikethroughStyle, TextAlign, UnderlineStyle, Window, WrapBoundary,
|
||||
WrappedLineLayout,
|
||||
App, Bounds, Half, Hsla, LineLayout, Pixels, Point, Result, SharedString, StrikethroughStyle,
|
||||
TextAlign, UnderlineStyle, Window, WrapBoundary, WrappedLineLayout, black, fill, point, px,
|
||||
size,
|
||||
};
|
||||
use derive_more::{Deref, DerefMut};
|
||||
use smallvec::SmallVec;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::{point, px, FontId, GlyphId, Pixels, PlatformTextSystem, Point, SharedString, Size};
|
||||
use crate::{FontId, GlyphId, Pixels, PlatformTextSystem, Point, SharedString, Size, point, px};
|
||||
use collections::FxHashMap;
|
||||
use parking_lot::{Mutex, RwLock, RwLockUpgradableReadGuard};
|
||||
use smallvec::SmallVec;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::{px, FontId, FontRun, Pixels, PlatformTextSystem, SharedString, TextRun};
|
||||
use crate::{FontId, FontRun, Pixels, PlatformTextSystem, SharedString, TextRun, px};
|
||||
use collections::HashMap;
|
||||
use std::{iter, sync::Arc};
|
||||
|
||||
|
@ -232,7 +232,7 @@ impl Boundary {
|
|||
mod tests {
|
||||
use super::*;
|
||||
use crate::{
|
||||
font, Font, FontFeatures, FontStyle, FontWeight, Hsla, TestAppContext, TestDispatcher,
|
||||
Font, FontFeatures, FontStyle, FontWeight, Hsla, TestAppContext, TestDispatcher, font,
|
||||
};
|
||||
#[cfg(target_os = "macos")]
|
||||
use crate::{TextRun, WindowTextSystem, WrapBoundary};
|
||||
|
@ -242,11 +242,11 @@ mod tests {
|
|||
let dispatcher = TestDispatcher::new(StdRng::seed_from_u64(0));
|
||||
let cx = TestAppContext::new(dispatcher, None);
|
||||
cx.text_system()
|
||||
.add_fonts(vec![std::fs::read(
|
||||
"../../assets/fonts/plex-mono/ZedPlexMono-Regular.ttf",
|
||||
)
|
||||
.unwrap()
|
||||
.into()])
|
||||
.add_fonts(vec![
|
||||
std::fs::read("../../assets/fonts/plex-mono/ZedPlexMono-Regular.ttf")
|
||||
.unwrap()
|
||||
.into(),
|
||||
])
|
||||
.unwrap();
|
||||
let id = cx.text_system().font_id(&font("Zed Plex Mono")).unwrap();
|
||||
LineWrapper::new(id, px(16.), cx.text_system().platform_text_system.clone())
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
use crate::{
|
||||
point, prelude::*, px, size, transparent_black, Action, AnyDrag, AnyElement, AnyTooltip,
|
||||
AnyView, App, AppContext, Arena, Asset, AsyncWindowContext, AvailableSpace, Background,
|
||||
BorderStyle, Bounds, BoxShadow, Context, Corners, CursorStyle, Decorations, DevicePixels,
|
||||
DispatchActionListener, DispatchNodeId, DispatchTree, DisplayId, Edges, Effect, Entity,
|
||||
EntityId, EventEmitter, FileDropEvent, FontId, Global, GlobalElementId, GlyphId, GpuSpecs,
|
||||
Hsla, InputHandler, IsZero, KeyBinding, KeyContext, KeyDownEvent, KeyEvent, Keystroke,
|
||||
KeystrokeEvent, LayoutId, LineLayoutIndex, Modifiers, ModifiersChangedEvent, MonochromeSprite,
|
||||
MouseButton, MouseEvent, MouseMoveEvent, MouseUpEvent, Path, Pixels, PlatformAtlas,
|
||||
PlatformDisplay, PlatformInput, PlatformInputHandler, PlatformWindow, Point, PolychromeSprite,
|
||||
PromptLevel, Quad, Render, RenderGlyphParams, RenderImage, RenderImageParams, RenderSvgParams,
|
||||
Replay, ResizeEdge, ScaledPixels, Scene, Shadow, SharedString, Size, StrikethroughStyle, Style,
|
||||
Action, AnyDrag, AnyElement, AnyTooltip, AnyView, App, AppContext, Arena, Asset,
|
||||
AsyncWindowContext, AvailableSpace, Background, BorderStyle, Bounds, BoxShadow, Context,
|
||||
Corners, CursorStyle, Decorations, DevicePixels, DispatchActionListener, DispatchNodeId,
|
||||
DispatchTree, DisplayId, Edges, Effect, Entity, EntityId, EventEmitter, FileDropEvent, FontId,
|
||||
Global, GlobalElementId, GlyphId, GpuSpecs, Hsla, InputHandler, IsZero, KeyBinding, KeyContext,
|
||||
KeyDownEvent, KeyEvent, Keystroke, KeystrokeEvent, LayoutId, LineLayoutIndex, Modifiers,
|
||||
ModifiersChangedEvent, MonochromeSprite, MouseButton, MouseEvent, MouseMoveEvent, MouseUpEvent,
|
||||
Path, Pixels, PlatformAtlas, PlatformDisplay, PlatformInput, PlatformInputHandler,
|
||||
PlatformWindow, Point, PolychromeSprite, PromptLevel, Quad, Render, RenderGlyphParams,
|
||||
RenderImage, RenderImageParams, RenderSvgParams, Replay, ResizeEdge, SMOOTH_SVG_SCALE_FACTOR,
|
||||
SUBPIXEL_VARIANTS, ScaledPixels, Scene, Shadow, SharedString, Size, StrikethroughStyle, Style,
|
||||
SubscriberSet, Subscription, TaffyLayoutEngine, Task, TextStyle, TextStyleRefinement,
|
||||
TransformationMatrix, Underline, UnderlineStyle, WindowAppearance, WindowBackgroundAppearance,
|
||||
WindowBounds, WindowControls, WindowDecorations, WindowOptions, WindowParams, WindowTextSystem,
|
||||
SMOOTH_SVG_SCALE_FACTOR, SUBPIXEL_VARIANTS,
|
||||
point, prelude::*, px, size, transparent_black,
|
||||
};
|
||||
use anyhow::{anyhow, Context as _, Result};
|
||||
use anyhow::{Context as _, Result, anyhow};
|
||||
use collections::{FxHashMap, FxHashSet};
|
||||
#[cfg(target_os = "macos")]
|
||||
use core_video::pixel_buffer::CVPixelBuffer;
|
||||
use derive_more::{Deref, DerefMut};
|
||||
use futures::channel::oneshot;
|
||||
use futures::FutureExt;
|
||||
use futures::channel::oneshot;
|
||||
use parking_lot::RwLock;
|
||||
use raw_window_handle::{HandleError, HasWindowHandle};
|
||||
use refineable::Refineable;
|
||||
|
@ -39,13 +39,13 @@ use std::{
|
|||
ops::{DerefMut, Range},
|
||||
rc::Rc,
|
||||
sync::{
|
||||
atomic::{AtomicUsize, Ordering::SeqCst},
|
||||
Arc, Weak,
|
||||
atomic::{AtomicUsize, Ordering::SeqCst},
|
||||
},
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
use util::post_inc;
|
||||
use util::{measure, ResultExt};
|
||||
use util::{ResultExt, measure};
|
||||
use uuid::Uuid;
|
||||
|
||||
mod prompts;
|
||||
|
|
|
@ -3,9 +3,9 @@ use std::ops::Deref;
|
|||
use futures::channel::oneshot;
|
||||
|
||||
use crate::{
|
||||
div, opaque_grey, white, AnyView, App, AppContext as _, Context, Entity, EventEmitter,
|
||||
FocusHandle, Focusable, InteractiveElement, IntoElement, ParentElement, PromptLevel, Render,
|
||||
StatefulInteractiveElement, Styled,
|
||||
AnyView, App, AppContext as _, Context, Entity, EventEmitter, FocusHandle, Focusable,
|
||||
InteractiveElement, IntoElement, ParentElement, PromptLevel, Render,
|
||||
StatefulInteractiveElement, Styled, div, opaque_grey, white,
|
||||
};
|
||||
|
||||
use super::Window;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue