Merge branch 'main' into overlay-rounding
This commit is contained in:
commit
12f06a96d0
60 changed files with 447 additions and 443 deletions
|
@ -2168,6 +2168,19 @@ impl CollabPanel {
|
||||||
)
|
)
|
||||||
.end_slot(
|
.end_slot(
|
||||||
h_stack()
|
h_stack()
|
||||||
|
.absolute()
|
||||||
|
.right_0()
|
||||||
|
// HACK: Without this the channel name clips on top of the icons, but I'm not sure why.
|
||||||
|
.z_index(10)
|
||||||
|
.bg(cx.theme().colors().panel_background)
|
||||||
|
.child(
|
||||||
|
h_stack()
|
||||||
|
// The element hover background has a slight transparency to it, so we
|
||||||
|
// need to apply it to the inner element so that it blends with the solid
|
||||||
|
// background color of the absolutely-positioned element.
|
||||||
|
.group_hover("", |style| {
|
||||||
|
style.bg(cx.theme().colors().ghost_element_hover)
|
||||||
|
})
|
||||||
.child(
|
.child(
|
||||||
IconButton::new("channel_chat", Icon::MessageBubbles)
|
IconButton::new("channel_chat", Icon::MessageBubbles)
|
||||||
.icon_size(IconSize::Small)
|
.icon_size(IconSize::Small)
|
||||||
|
@ -2192,13 +2205,16 @@ impl CollabPanel {
|
||||||
} else {
|
} else {
|
||||||
Color::Muted
|
Color::Muted
|
||||||
})
|
})
|
||||||
.when(!has_notes_notification, |this| this.visible_on_hover(""))
|
.when(!has_notes_notification, |this| {
|
||||||
|
this.visible_on_hover("")
|
||||||
|
})
|
||||||
.on_click(cx.listener(move |this, _, cx| {
|
.on_click(cx.listener(move |this, _, cx| {
|
||||||
this.open_channel_notes(channel_id, cx)
|
this.open_channel_notes(channel_id, cx)
|
||||||
}))
|
}))
|
||||||
.tooltip(|cx| Tooltip::text("Open channel notes", cx)),
|
.tooltip(|cx| Tooltip::text("Open channel notes", cx)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
.tooltip(|cx| Tooltip::text("Join channel", cx))
|
.tooltip(|cx| Tooltip::text("Join channel", cx))
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,7 @@ impl Renderer {
|
||||||
"underline_fragment",
|
"underline_fragment",
|
||||||
PIXEL_FORMAT,
|
PIXEL_FORMAT,
|
||||||
);
|
);
|
||||||
let cv_texture_cache = CVMetalTextureCache::new(device.as_ptr()).unwrap();
|
let cv_texture_cache = unsafe { CVMetalTextureCache::new(device.as_ptr()).unwrap() };
|
||||||
Self {
|
Self {
|
||||||
layer,
|
layer,
|
||||||
command_queue: device.new_command_queue(),
|
command_queue: device.new_command_queue(),
|
||||||
|
@ -887,8 +887,8 @@ impl Renderer {
|
||||||
core_video::kCVPixelFormatType_420YpCbCr8BiPlanarFullRange
|
core_video::kCVPixelFormatType_420YpCbCr8BiPlanarFullRange
|
||||||
);
|
);
|
||||||
|
|
||||||
let y_texture = self
|
let y_texture = unsafe {
|
||||||
.cv_texture_cache
|
self.cv_texture_cache
|
||||||
.create_texture_from_image(
|
.create_texture_from_image(
|
||||||
surface.image_buffer.as_concrete_TypeRef(),
|
surface.image_buffer.as_concrete_TypeRef(),
|
||||||
ptr::null(),
|
ptr::null(),
|
||||||
|
@ -897,9 +897,10 @@ impl Renderer {
|
||||||
surface.image_buffer.plane_height(0),
|
surface.image_buffer.plane_height(0),
|
||||||
0,
|
0,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap()
|
||||||
let cb_cr_texture = self
|
};
|
||||||
.cv_texture_cache
|
let cb_cr_texture = unsafe {
|
||||||
|
self.cv_texture_cache
|
||||||
.create_texture_from_image(
|
.create_texture_from_image(
|
||||||
surface.image_buffer.as_concrete_TypeRef(),
|
surface.image_buffer.as_concrete_TypeRef(),
|
||||||
ptr::null(),
|
ptr::null(),
|
||||||
|
@ -908,7 +909,8 @@ impl Renderer {
|
||||||
surface.image_buffer.plane_height(1),
|
surface.image_buffer.plane_height(1),
|
||||||
1,
|
1,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap()
|
||||||
|
};
|
||||||
|
|
||||||
align_offset(offset);
|
align_offset(offset);
|
||||||
let next_offset = *offset + mem::size_of::<shaders::GPUISurface>();
|
let next_offset = *offset + mem::size_of::<shaders::GPUISurface>();
|
||||||
|
|
|
@ -52,7 +52,7 @@ pub struct AppCell {
|
||||||
impl AppCell {
|
impl AppCell {
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
pub fn borrow(&self) -> AppRef {
|
pub fn borrow(&self) -> AppRef {
|
||||||
if let Some(_) = option_env!("TRACK_THREAD_BORROWS") {
|
if option_env!("TRACK_THREAD_BORROWS").is_some() {
|
||||||
let thread_id = std::thread::current().id();
|
let thread_id = std::thread::current().id();
|
||||||
eprintln!("borrowed {thread_id:?}");
|
eprintln!("borrowed {thread_id:?}");
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ impl AppCell {
|
||||||
|
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
pub fn borrow_mut(&self) -> AppRefMut {
|
pub fn borrow_mut(&self) -> AppRefMut {
|
||||||
if let Some(_) = option_env!("TRACK_THREAD_BORROWS") {
|
if option_env!("TRACK_THREAD_BORROWS").is_some() {
|
||||||
let thread_id = std::thread::current().id();
|
let thread_id = std::thread::current().id();
|
||||||
eprintln!("borrowed {thread_id:?}");
|
eprintln!("borrowed {thread_id:?}");
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ pub struct AppRef<'a>(Ref<'a, AppContext>);
|
||||||
|
|
||||||
impl<'a> Drop for AppRef<'a> {
|
impl<'a> Drop for AppRef<'a> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if let Some(_) = option_env!("TRACK_THREAD_BORROWS") {
|
if option_env!("TRACK_THREAD_BORROWS").is_some() {
|
||||||
let thread_id = std::thread::current().id();
|
let thread_id = std::thread::current().id();
|
||||||
eprintln!("dropped borrow from {thread_id:?}");
|
eprintln!("dropped borrow from {thread_id:?}");
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ pub struct AppRefMut<'a>(RefMut<'a, AppContext>);
|
||||||
|
|
||||||
impl<'a> Drop for AppRefMut<'a> {
|
impl<'a> Drop for AppRefMut<'a> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if let Some(_) = option_env!("TRACK_THREAD_BORROWS") {
|
if option_env!("TRACK_THREAD_BORROWS").is_some() {
|
||||||
let thread_id = std::thread::current().id();
|
let thread_id = std::thread::current().id();
|
||||||
eprintln!("dropped {thread_id:?}");
|
eprintln!("dropped {thread_id:?}");
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ impl App {
|
||||||
let this = Rc::downgrade(&self.0);
|
let this = Rc::downgrade(&self.0);
|
||||||
self.0.borrow().platform.on_open_urls(Box::new(move |urls| {
|
self.0.borrow().platform.on_open_urls(Box::new(move |urls| {
|
||||||
if let Some(app) = this.upgrade() {
|
if let Some(app) = this.upgrade() {
|
||||||
callback(urls, &mut *app.borrow_mut());
|
callback(urls, &mut app.borrow_mut());
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
self
|
self
|
||||||
|
@ -280,7 +280,7 @@ impl AppContext {
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
init_app_menus(platform.as_ref(), &mut *app.borrow_mut());
|
init_app_menus(platform.as_ref(), &mut app.borrow_mut());
|
||||||
|
|
||||||
platform.on_quit(Box::new({
|
platform.on_quit(Box::new({
|
||||||
let cx = app.clone();
|
let cx = app.clone();
|
||||||
|
@ -428,7 +428,7 @@ impl AppContext {
|
||||||
pub fn windows(&self) -> Vec<AnyWindowHandle> {
|
pub fn windows(&self) -> Vec<AnyWindowHandle> {
|
||||||
self.windows
|
self.windows
|
||||||
.values()
|
.values()
|
||||||
.filter_map(|window| Some(window.as_ref()?.handle.clone()))
|
.filter_map(|window| Some(window.as_ref()?.handle))
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -808,7 +808,7 @@ impl AppContext {
|
||||||
self.push_effect(Effect::NotifyGlobalObservers { global_type });
|
self.push_effect(Effect::NotifyGlobalObservers { global_type });
|
||||||
self.globals_by_type
|
self.globals_by_type
|
||||||
.entry(global_type)
|
.entry(global_type)
|
||||||
.or_insert_with(|| Box::new(G::default()))
|
.or_insert_with(|| Box::<G>::default())
|
||||||
.downcast_mut::<G>()
|
.downcast_mut::<G>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
@ -993,7 +993,7 @@ impl AppContext {
|
||||||
(),
|
(),
|
||||||
Box::new(move |cx| {
|
Box::new(move |cx| {
|
||||||
let future = on_quit(cx);
|
let future = on_quit(cx);
|
||||||
async move { future.await }.boxed_local()
|
future.boxed_local()
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
activate();
|
activate();
|
||||||
|
|
|
@ -106,7 +106,7 @@ impl AsyncAppContext {
|
||||||
.upgrade()
|
.upgrade()
|
||||||
.ok_or_else(|| anyhow!("app was released"))?;
|
.ok_or_else(|| anyhow!("app was released"))?;
|
||||||
let mut lock = app.borrow_mut();
|
let mut lock = app.borrow_mut();
|
||||||
Ok(f(&mut *lock))
|
Ok(f(&mut lock))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn open_window<V>(
|
pub fn open_window<V>(
|
||||||
|
|
|
@ -327,9 +327,9 @@ impl<T: 'static> Model<T> {
|
||||||
cx.entities.read(self)
|
cx.entities.read(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn read_with<'a, R, C: Context>(
|
pub fn read_with<R, C: Context>(
|
||||||
&self,
|
&self,
|
||||||
cx: &'a C,
|
cx: &C,
|
||||||
f: impl FnOnce(&T, &AppContext) -> R,
|
f: impl FnOnce(&T, &AppContext) -> R,
|
||||||
) -> C::Result<R> {
|
) -> C::Result<R> {
|
||||||
cx.read_model(self, f)
|
cx.read_model(self, f)
|
||||||
|
|
|
@ -262,12 +262,12 @@ impl<'a, T> Context for ModelContext<'a, T> {
|
||||||
|
|
||||||
impl<T> Borrow<AppContext> for ModelContext<'_, T> {
|
impl<T> Borrow<AppContext> for ModelContext<'_, T> {
|
||||||
fn borrow(&self) -> &AppContext {
|
fn borrow(&self) -> &AppContext {
|
||||||
&self.app
|
self.app
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> BorrowMut<AppContext> for ModelContext<'_, T> {
|
impl<T> BorrowMut<AppContext> for ModelContext<'_, T> {
|
||||||
fn borrow_mut(&mut self) -> &mut AppContext {
|
fn borrow_mut(&mut self) -> &mut AppContext {
|
||||||
&mut self.app
|
self.app
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ impl fmt::Debug for Rgba {
|
||||||
impl Rgba {
|
impl Rgba {
|
||||||
pub fn blend(&self, other: Rgba) -> Self {
|
pub fn blend(&self, other: Rgba) -> Self {
|
||||||
if other.a >= 1.0 {
|
if other.a >= 1.0 {
|
||||||
return other;
|
other
|
||||||
} else if other.a <= 0.0 {
|
} else if other.a <= 0.0 {
|
||||||
return *self;
|
return *self;
|
||||||
} else {
|
} else {
|
||||||
|
@ -117,7 +117,7 @@ impl TryFrom<&'_ str> for Rgba {
|
||||||
const RRGGBB: usize = "rrggbb".len();
|
const RRGGBB: usize = "rrggbb".len();
|
||||||
const RRGGBBAA: usize = "rrggbbaa".len();
|
const RRGGBBAA: usize = "rrggbbaa".len();
|
||||||
|
|
||||||
const EXPECTED_FORMATS: &'static str = "Expected #rgb, #rgba, #rrggbb, or #rrggbbaa";
|
const EXPECTED_FORMATS: &str = "Expected #rgb, #rgba, #rrggbb, or #rrggbbaa";
|
||||||
|
|
||||||
let Some(("", hex)) = value.trim().split_once('#') else {
|
let Some(("", hex)) = value.trim().split_once('#') else {
|
||||||
bail!("invalid RGBA hex color: '{value}'. {EXPECTED_FORMATS}");
|
bail!("invalid RGBA hex color: '{value}'. {EXPECTED_FORMATS}");
|
||||||
|
@ -328,7 +328,7 @@ impl Hsla {
|
||||||
let alpha = other.a;
|
let alpha = other.a;
|
||||||
|
|
||||||
if alpha >= 1.0 {
|
if alpha >= 1.0 {
|
||||||
return other;
|
other
|
||||||
} else if alpha <= 0.0 {
|
} else if alpha <= 0.0 {
|
||||||
return self;
|
return self;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -193,11 +193,7 @@ impl<C: RenderOnce> Element for Component<C> {
|
||||||
((), element_state)
|
((), element_state)
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
element.paint(
|
element.paint(bounds, state.rendered_element_state.as_mut().unwrap(), cx);
|
||||||
bounds,
|
|
||||||
&mut state.rendered_element_state.as_mut().unwrap(),
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,8 +176,8 @@ impl Interactivity {
|
||||||
{
|
{
|
||||||
self.mouse_move_listeners
|
self.mouse_move_listeners
|
||||||
.push(Box::new(move |event, bounds, phase, cx| {
|
.push(Box::new(move |event, bounds, phase, cx| {
|
||||||
if phase == DispatchPhase::Capture {
|
if phase == DispatchPhase::Capture
|
||||||
if cx
|
&& cx
|
||||||
.active_drag
|
.active_drag
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.is_some_and(|drag| drag.value.as_ref().type_id() == TypeId::of::<T>())
|
.is_some_and(|drag| drag.value.as_ref().type_id() == TypeId::of::<T>())
|
||||||
|
@ -191,7 +191,6 @@ impl Interactivity {
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,7 +235,7 @@ impl Interactivity {
|
||||||
|
|
||||||
pub fn on_boxed_action(
|
pub fn on_boxed_action(
|
||||||
&mut self,
|
&mut self,
|
||||||
action: &Box<dyn Action>,
|
action: &dyn Action,
|
||||||
listener: impl Fn(&Box<dyn Action>, &mut WindowContext) + 'static,
|
listener: impl Fn(&Box<dyn Action>, &mut WindowContext) + 'static,
|
||||||
) {
|
) {
|
||||||
let action = action.boxed_clone();
|
let action = action.boxed_clone();
|
||||||
|
@ -511,7 +510,7 @@ pub trait InteractiveElement: Sized {
|
||||||
|
|
||||||
fn on_boxed_action(
|
fn on_boxed_action(
|
||||||
mut self,
|
mut self,
|
||||||
action: &Box<dyn Action>,
|
action: &dyn Action,
|
||||||
listener: impl Fn(&Box<dyn Action>, &mut WindowContext) + 'static,
|
listener: impl Fn(&Box<dyn Action>, &mut WindowContext) + 'static,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
self.interactivity().on_boxed_action(action, listener);
|
self.interactivity().on_boxed_action(action, listener);
|
||||||
|
@ -878,6 +877,7 @@ impl DivState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct Interactivity {
|
pub struct Interactivity {
|
||||||
pub element_id: Option<ElementId>,
|
pub element_id: Option<ElementId>,
|
||||||
pub key_context: Option<KeyContext>,
|
pub key_context: Option<KeyContext>,
|
||||||
|
@ -921,12 +921,12 @@ pub struct InteractiveBounds {
|
||||||
|
|
||||||
impl InteractiveBounds {
|
impl InteractiveBounds {
|
||||||
pub fn visibly_contains(&self, point: &Point<Pixels>, cx: &WindowContext) -> bool {
|
pub fn visibly_contains(&self, point: &Point<Pixels>, cx: &WindowContext) -> bool {
|
||||||
self.bounds.contains(point) && cx.was_top_layer(&point, &self.stacking_order)
|
self.bounds.contains(point) && cx.was_top_layer(point, &self.stacking_order)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn drag_target_contains(&self, point: &Point<Pixels>, cx: &WindowContext) -> bool {
|
pub fn drag_target_contains(&self, point: &Point<Pixels>, cx: &WindowContext) -> bool {
|
||||||
self.bounds.contains(point)
|
self.bounds.contains(point)
|
||||||
&& cx.was_top_layer_under_active_drag(&point, &self.stacking_order)
|
&& cx.was_top_layer_under_active_drag(point, &self.stacking_order)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1009,8 +1009,7 @@ impl Interactivity {
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
.ok()
|
.ok()
|
||||||
.map(|mut text| text.pop())
|
.and_then(|mut text| text.pop())
|
||||||
.flatten()
|
|
||||||
{
|
{
|
||||||
text.paint(bounds.origin, FONT_SIZE, cx).ok();
|
text.paint(bounds.origin, FONT_SIZE, cx).ok();
|
||||||
|
|
||||||
|
@ -1024,7 +1023,6 @@ impl Interactivity {
|
||||||
{
|
{
|
||||||
let command_held = cx.modifiers().command;
|
let command_held = cx.modifiers().command;
|
||||||
cx.on_key_event({
|
cx.on_key_event({
|
||||||
let text_bounds = text_bounds.clone();
|
|
||||||
move |e: &crate::ModifiersChangedEvent, _phase, cx| {
|
move |e: &crate::ModifiersChangedEvent, _phase, cx| {
|
||||||
if e.modifiers.command != command_held
|
if e.modifiers.command != command_held
|
||||||
&& text_bounds.contains(&cx.mouse_position())
|
&& text_bounds.contains(&cx.mouse_position())
|
||||||
|
@ -1037,17 +1035,16 @@ impl Interactivity {
|
||||||
let hovered = bounds.contains(&cx.mouse_position());
|
let hovered = bounds.contains(&cx.mouse_position());
|
||||||
cx.on_mouse_event(
|
cx.on_mouse_event(
|
||||||
move |event: &MouseMoveEvent, phase, cx| {
|
move |event: &MouseMoveEvent, phase, cx| {
|
||||||
if phase == DispatchPhase::Capture {
|
if phase == DispatchPhase::Capture
|
||||||
if bounds.contains(&event.position) != hovered {
|
&& bounds.contains(&event.position) != hovered
|
||||||
|
{
|
||||||
cx.notify();
|
cx.notify();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
cx.on_mouse_event({
|
cx.on_mouse_event({
|
||||||
let location = self.location.clone().unwrap();
|
let location = self.location.unwrap();
|
||||||
let text_bounds = text_bounds.clone();
|
|
||||||
move |e: &crate::MouseDownEvent, phase, cx| {
|
move |e: &crate::MouseDownEvent, phase, cx| {
|
||||||
if text_bounds.contains(&e.position)
|
if text_bounds.contains(&e.position)
|
||||||
&& phase.capture()
|
&& phase.capture()
|
||||||
|
@ -1188,11 +1185,11 @@ impl Interactivity {
|
||||||
if let Some(group_bounds) = hover_group_bounds {
|
if let Some(group_bounds) = hover_group_bounds {
|
||||||
let hovered = group_bounds.contains(&cx.mouse_position());
|
let hovered = group_bounds.contains(&cx.mouse_position());
|
||||||
cx.on_mouse_event(move |event: &MouseMoveEvent, phase, cx| {
|
cx.on_mouse_event(move |event: &MouseMoveEvent, phase, cx| {
|
||||||
if phase == DispatchPhase::Capture {
|
if phase == DispatchPhase::Capture
|
||||||
if group_bounds.contains(&event.position) != hovered {
|
&& group_bounds.contains(&event.position) != hovered
|
||||||
|
{
|
||||||
cx.notify();
|
cx.notify();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1203,11 +1200,11 @@ impl Interactivity {
|
||||||
let bounds = bounds.intersect(&cx.content_mask().bounds);
|
let bounds = bounds.intersect(&cx.content_mask().bounds);
|
||||||
let hovered = bounds.contains(&cx.mouse_position());
|
let hovered = bounds.contains(&cx.mouse_position());
|
||||||
cx.on_mouse_event(move |event: &MouseMoveEvent, phase, cx| {
|
cx.on_mouse_event(move |event: &MouseMoveEvent, phase, cx| {
|
||||||
if phase == DispatchPhase::Capture {
|
if phase == DispatchPhase::Capture
|
||||||
if bounds.contains(&event.position) != hovered {
|
&& bounds.contains(&event.position) != hovered
|
||||||
|
{
|
||||||
cx.notify();
|
cx.notify();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1366,7 +1363,7 @@ impl Interactivity {
|
||||||
&& !cx.has_active_drag();
|
&& !cx.has_active_drag();
|
||||||
let mut was_hovered = was_hovered.borrow_mut();
|
let mut was_hovered = was_hovered.borrow_mut();
|
||||||
|
|
||||||
if is_hovered != was_hovered.clone() {
|
if is_hovered != *was_hovered {
|
||||||
*was_hovered = is_hovered;
|
*was_hovered = is_hovered;
|
||||||
drop(was_hovered);
|
drop(was_hovered);
|
||||||
|
|
||||||
|
@ -1693,46 +1690,6 @@ impl Interactivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Interactivity {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
element_id: None,
|
|
||||||
key_context: None,
|
|
||||||
focusable: false,
|
|
||||||
tracked_focus_handle: None,
|
|
||||||
scroll_handle: None,
|
|
||||||
// scroll_offset: Point::default(),
|
|
||||||
group: None,
|
|
||||||
base_style: Box::new(StyleRefinement::default()),
|
|
||||||
focus_style: None,
|
|
||||||
in_focus_style: None,
|
|
||||||
hover_style: None,
|
|
||||||
group_hover_style: None,
|
|
||||||
active_style: None,
|
|
||||||
group_active_style: None,
|
|
||||||
drag_over_styles: Vec::new(),
|
|
||||||
group_drag_over_styles: Vec::new(),
|
|
||||||
mouse_down_listeners: Vec::new(),
|
|
||||||
mouse_up_listeners: Vec::new(),
|
|
||||||
mouse_move_listeners: Vec::new(),
|
|
||||||
scroll_wheel_listeners: Vec::new(),
|
|
||||||
key_down_listeners: Vec::new(),
|
|
||||||
key_up_listeners: Vec::new(),
|
|
||||||
action_listeners: Vec::new(),
|
|
||||||
drop_listeners: Vec::new(),
|
|
||||||
can_drop_predicate: None,
|
|
||||||
click_listeners: Vec::new(),
|
|
||||||
drag_listener: None,
|
|
||||||
hover_listener: None,
|
|
||||||
tooltip_builder: None,
|
|
||||||
block_mouse: false,
|
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
location: None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct InteractiveElementState {
|
pub struct InteractiveElementState {
|
||||||
pub focus_handle: Option<FocusHandle>,
|
pub focus_handle: Option<FocusHandle>,
|
||||||
|
@ -1942,13 +1899,19 @@ struct ScrollHandleState {
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct ScrollHandle(Rc<RefCell<ScrollHandleState>>);
|
pub struct ScrollHandle(Rc<RefCell<ScrollHandleState>>);
|
||||||
|
|
||||||
|
impl Default for ScrollHandle {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl ScrollHandle {
|
impl ScrollHandle {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self(Rc::default())
|
Self(Rc::default())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn offset(&self) -> Point<Pixels> {
|
pub fn offset(&self) -> Point<Pixels> {
|
||||||
self.0.borrow().offset.borrow().clone()
|
*self.0.borrow().offset.borrow()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn top_item(&self) -> usize {
|
pub fn top_item(&self) -> usize {
|
||||||
|
|
|
@ -71,9 +71,11 @@ impl Element for Overlay {
|
||||||
.map(|child| child.layout(cx))
|
.map(|child| child.layout(cx))
|
||||||
.collect::<SmallVec<_>>();
|
.collect::<SmallVec<_>>();
|
||||||
|
|
||||||
let mut overlay_style = Style::default();
|
let overlay_style = Style {
|
||||||
overlay_style.position = Position::Absolute;
|
position: Position::Absolute,
|
||||||
overlay_style.display = Display::Flex;
|
display: Display::Flex,
|
||||||
|
..Style::default()
|
||||||
|
};
|
||||||
|
|
||||||
let layout_id = cx.request_layout(&overlay_style, child_layout_ids.iter().copied());
|
let layout_id = cx.request_layout(&overlay_style, child_layout_ids.iter().copied());
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,6 @@ impl TextState {
|
||||||
let line_height = text_style
|
let line_height = text_style
|
||||||
.line_height
|
.line_height
|
||||||
.to_pixels(font_size.into(), cx.rem_size());
|
.to_pixels(font_size.into(), cx.rem_size());
|
||||||
let text = SharedString::from(text);
|
|
||||||
|
|
||||||
let runs = if let Some(runs) = runs {
|
let runs = if let Some(runs) = runs {
|
||||||
runs
|
runs
|
||||||
|
|
|
@ -41,7 +41,7 @@ where
|
||||||
item_to_measure_index: 0,
|
item_to_measure_index: 0,
|
||||||
render_items: Box::new(render_range),
|
render_items: Box::new(render_range),
|
||||||
interactivity: Interactivity {
|
interactivity: Interactivity {
|
||||||
element_id: Some(id.into()),
|
element_id: Some(id),
|
||||||
base_style: Box::new(base_style),
|
base_style: Box::new(base_style),
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
|
|
|
@ -80,6 +80,12 @@ impl<T> Future for Task<T> {
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
|
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
|
||||||
pub struct TaskLabel(NonZeroUsize);
|
pub struct TaskLabel(NonZeroUsize);
|
||||||
|
|
||||||
|
impl Default for TaskLabel {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl TaskLabel {
|
impl TaskLabel {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
static NEXT_TASK_LABEL: AtomicUsize = AtomicUsize::new(1);
|
static NEXT_TASK_LABEL: AtomicUsize = AtomicUsize::new(1);
|
||||||
|
|
|
@ -1601,13 +1601,13 @@ impl Edges<Pixels> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Into<Edges<Pixels>> for f32 {
|
impl From<f32> for Edges<Pixels> {
|
||||||
fn into(self) -> Edges<Pixels> {
|
fn from(val: f32) -> Self {
|
||||||
Edges {
|
Edges {
|
||||||
top: self.into(),
|
top: val.into(),
|
||||||
right: self.into(),
|
right: val.into(),
|
||||||
bottom: self.into(),
|
bottom: val.into(),
|
||||||
left: self.into(),
|
left: val.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1840,24 +1840,24 @@ where
|
||||||
|
|
||||||
impl<T> Copy for Corners<T> where T: Copy + Clone + Default + Debug {}
|
impl<T> Copy for Corners<T> where T: Copy + Clone + Default + Debug {}
|
||||||
|
|
||||||
impl Into<Corners<Pixels>> for f32 {
|
impl From<f32> for Corners<Pixels> {
|
||||||
fn into(self) -> Corners<Pixels> {
|
fn from(val: f32) -> Self {
|
||||||
Corners {
|
Corners {
|
||||||
top_left: self.into(),
|
top_left: val.into(),
|
||||||
top_right: self.into(),
|
top_right: val.into(),
|
||||||
bottom_right: self.into(),
|
bottom_right: val.into(),
|
||||||
bottom_left: self.into(),
|
bottom_left: val.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Into<Corners<Pixels>> for Pixels {
|
impl From<Pixels> for Corners<Pixels> {
|
||||||
fn into(self) -> Corners<Pixels> {
|
fn from(val: Pixels) -> Self {
|
||||||
Corners {
|
Corners {
|
||||||
top_left: self,
|
top_left: val,
|
||||||
top_right: self,
|
top_right: val,
|
||||||
bottom_right: self,
|
bottom_right: val,
|
||||||
bottom_left: self,
|
bottom_left: val,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1896,7 +1896,6 @@ impl Into<Corners<Pixels>> for Pixels {
|
||||||
Div,
|
Div,
|
||||||
DivAssign,
|
DivAssign,
|
||||||
PartialEq,
|
PartialEq,
|
||||||
PartialOrd,
|
|
||||||
Serialize,
|
Serialize,
|
||||||
Deserialize,
|
Deserialize,
|
||||||
)]
|
)]
|
||||||
|
@ -2039,9 +2038,15 @@ impl Mul<Pixels> for Pixels {
|
||||||
|
|
||||||
impl Eq for Pixels {}
|
impl Eq for Pixels {}
|
||||||
|
|
||||||
|
impl PartialOrd for Pixels {
|
||||||
|
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
|
||||||
|
self.0.partial_cmp(&other.0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Ord for Pixels {
|
impl Ord for Pixels {
|
||||||
fn cmp(&self, other: &Self) -> cmp::Ordering {
|
fn cmp(&self, other: &Self) -> cmp::Ordering {
|
||||||
self.0.partial_cmp(&other.0).unwrap()
|
self.partial_cmp(other).unwrap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2517,12 +2522,12 @@ impl Debug for Length {
|
||||||
///
|
///
|
||||||
/// A `DefiniteLength` representing the relative length as a fraction of the parent's size.
|
/// A `DefiniteLength` representing the relative length as a fraction of the parent's size.
|
||||||
pub fn relative(fraction: f32) -> DefiniteLength {
|
pub fn relative(fraction: f32) -> DefiniteLength {
|
||||||
DefiniteLength::Fraction(fraction).into()
|
DefiniteLength::Fraction(fraction)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the Golden Ratio, i.e. `~(1.0 + sqrt(5.0)) / 2.0`.
|
/// Returns the Golden Ratio, i.e. `~(1.0 + sqrt(5.0)) / 2.0`.
|
||||||
pub fn phi() -> DefiniteLength {
|
pub fn phi() -> DefiniteLength {
|
||||||
relative(1.61803398875)
|
relative(1.618_034)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Constructs a `Rems` value representing a length in rems.
|
/// Constructs a `Rems` value representing a length in rems.
|
||||||
|
|
|
@ -258,7 +258,7 @@ impl InputEvent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mouse_event<'a>(&'a self) -> Option<&'a dyn Any> {
|
pub fn mouse_event(&self) -> Option<&dyn Any> {
|
||||||
match self {
|
match self {
|
||||||
InputEvent::KeyDown { .. } => None,
|
InputEvent::KeyDown { .. } => None,
|
||||||
InputEvent::KeyUp { .. } => None,
|
InputEvent::KeyUp { .. } => None,
|
||||||
|
@ -272,7 +272,7 @@ impl InputEvent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn keyboard_event<'a>(&'a self) -> Option<&'a dyn Any> {
|
pub fn keyboard_event(&self) -> Option<&dyn Any> {
|
||||||
match self {
|
match self {
|
||||||
InputEvent::KeyDown(event) => Some(event),
|
InputEvent::KeyDown(event) => Some(event),
|
||||||
InputEvent::KeyUp(event) => Some(event),
|
InputEvent::KeyUp(event) => Some(event),
|
||||||
|
|
|
@ -200,7 +200,7 @@ impl DispatchTree {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
false
|
||||||
})
|
})
|
||||||
.cloned()
|
.cloned()
|
||||||
.collect()
|
.collect()
|
||||||
|
|
|
@ -54,7 +54,7 @@ impl KeyBinding {
|
||||||
pending_keystrokes: &[Keystroke],
|
pending_keystrokes: &[Keystroke],
|
||||||
contexts: &[KeyContext],
|
contexts: &[KeyContext],
|
||||||
) -> KeyMatch {
|
) -> KeyMatch {
|
||||||
if self.keystrokes.as_ref().starts_with(&pending_keystrokes)
|
if self.keystrokes.as_ref().starts_with(pending_keystrokes)
|
||||||
&& self.matches_context(contexts)
|
&& self.matches_context(contexts)
|
||||||
{
|
{
|
||||||
// If the binding is completed, push it onto the matches list
|
// If the binding is completed, push it onto the matches list
|
||||||
|
|
|
@ -24,7 +24,7 @@ impl KeyContext {
|
||||||
pub fn parse(source: &str) -> Result<Self> {
|
pub fn parse(source: &str) -> Result<Self> {
|
||||||
let mut context = Self::default();
|
let mut context = Self::default();
|
||||||
let source = skip_whitespace(source);
|
let source = skip_whitespace(source);
|
||||||
Self::parse_expr(&source, &mut context)?;
|
Self::parse_expr(source, &mut context)?;
|
||||||
Ok(context)
|
Ok(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ impl KeyBindingContextPredicate {
|
||||||
}
|
}
|
||||||
'!' => {
|
'!' => {
|
||||||
let source = skip_whitespace(&source[1..]);
|
let source = skip_whitespace(&source[1..]);
|
||||||
let (predicate, source) = Self::parse_expr(&source, PRECEDENCE_NOT)?;
|
let (predicate, source) = Self::parse_expr(source, PRECEDENCE_NOT)?;
|
||||||
Ok((KeyBindingContextPredicate::Not(Box::new(predicate)), source))
|
Ok((KeyBindingContextPredicate::Not(Box::new(predicate)), source))
|
||||||
}
|
}
|
||||||
_ if is_identifier_char(next) => {
|
_ if is_identifier_char(next) => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///! Macos screen have a y axis that goings up from the bottom of the screen and
|
//! Macos screen have a y axis that goings up from the bottom of the screen and
|
||||||
///! an origin at the bottom left of the main display.
|
//! an origin at the bottom left of the main display.
|
||||||
mod dispatcher;
|
mod dispatcher;
|
||||||
mod display;
|
mod display;
|
||||||
mod display_linker;
|
mod display_linker;
|
||||||
|
|
|
@ -23,6 +23,12 @@ pub struct MacDispatcher {
|
||||||
parker: Arc<Mutex<Parker>>,
|
parker: Arc<Mutex<Parker>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for MacDispatcher {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl MacDispatcher {
|
impl MacDispatcher {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
MacDispatcher {
|
MacDispatcher {
|
||||||
|
|
|
@ -41,7 +41,7 @@ impl MacDisplay {
|
||||||
CGGetActiveDisplayList(display_count, displays.as_mut_ptr(), &mut display_count);
|
CGGetActiveDisplayList(display_count, displays.as_mut_ptr(), &mut display_count);
|
||||||
displays.set_len(display_count as usize);
|
displays.set_len(display_count as usize);
|
||||||
|
|
||||||
displays.into_iter().map(|display| MacDisplay(display))
|
displays.into_iter().map(MacDisplay)
|
||||||
} else {
|
} else {
|
||||||
panic!("Failed to get active display list");
|
panic!("Failed to get active display list");
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,6 @@ impl MacDisplayLinker {
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
log::warn!("DisplayLink could not be obtained for {:?}", display_id);
|
log::warn!("DisplayLink could not be obtained for {:?}", display_id);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ impl PlatformAtlas for MetalAtlas {
|
||||||
) -> Result<AtlasTile> {
|
) -> Result<AtlasTile> {
|
||||||
let mut lock = self.0.lock();
|
let mut lock = self.0.lock();
|
||||||
if let Some(tile) = lock.tiles_by_key.get(key) {
|
if let Some(tile) = lock.tiles_by_key.get(key) {
|
||||||
return Ok(tile.clone());
|
Ok(tile.clone())
|
||||||
} else {
|
} else {
|
||||||
let (size, bytes) = build()?;
|
let (size, bytes) = build()?;
|
||||||
let tile = lock.allocate(size, key.texture_kind());
|
let tile = lock.allocate(size, key.texture_kind());
|
||||||
|
@ -203,7 +203,7 @@ impl MetalAtlasTexture {
|
||||||
region,
|
region,
|
||||||
0,
|
0,
|
||||||
bytes.as_ptr() as *const _,
|
bytes.as_ptr() as *const _,
|
||||||
u32::from(bounds.size.width.to_bytes(self.bytes_per_pixel())) as u64,
|
bounds.size.width.to_bytes(self.bytes_per_pixel()) as u64,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,13 +66,11 @@ impl MetalRenderer {
|
||||||
.expect("error building metal library");
|
.expect("error building metal library");
|
||||||
|
|
||||||
fn to_float2_bits(point: crate::PointF) -> u64 {
|
fn to_float2_bits(point: crate::PointF) -> u64 {
|
||||||
unsafe {
|
let mut output = point.y.to_bits() as u64;
|
||||||
let mut output = mem::transmute::<_, u32>(point.y.to_bits()) as u64;
|
|
||||||
output <<= 32;
|
output <<= 32;
|
||||||
output |= mem::transmute::<_, u32>(point.x.to_bits()) as u64;
|
output |= point.x.to_bits() as u64;
|
||||||
output
|
output
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
let unit_vertices = [
|
let unit_vertices = [
|
||||||
to_float2_bits(point(0., 0.)),
|
to_float2_bits(point(0., 0.)),
|
||||||
|
@ -174,12 +172,12 @@ impl MetalRenderer {
|
||||||
unit_vertices,
|
unit_vertices,
|
||||||
instances,
|
instances,
|
||||||
sprite_atlas,
|
sprite_atlas,
|
||||||
core_video_texture_cache: CVMetalTextureCache::new(device.as_ptr()).unwrap(),
|
core_video_texture_cache: unsafe { CVMetalTextureCache::new(device.as_ptr()).unwrap() },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn layer(&self) -> &metal::MetalLayerRef {
|
pub fn layer(&self) -> &metal::MetalLayerRef {
|
||||||
&*self.layer
|
&self.layer
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn sprite_atlas(&self) -> &Arc<MetalAtlas> {
|
pub fn sprite_atlas(&self) -> &Arc<MetalAtlas> {
|
||||||
|
@ -206,7 +204,7 @@ impl MetalRenderer {
|
||||||
let command_buffer = command_queue.new_command_buffer();
|
let command_buffer = command_queue.new_command_buffer();
|
||||||
let mut instance_offset = 0;
|
let mut instance_offset = 0;
|
||||||
|
|
||||||
let path_tiles = self.rasterize_paths(scene.paths(), &mut instance_offset, &command_buffer);
|
let path_tiles = self.rasterize_paths(scene.paths(), &mut instance_offset, command_buffer);
|
||||||
|
|
||||||
let render_pass_descriptor = metal::RenderPassDescriptor::new();
|
let render_pass_descriptor = metal::RenderPassDescriptor::new();
|
||||||
let color_attachment = render_pass_descriptor
|
let color_attachment = render_pass_descriptor
|
||||||
|
@ -429,7 +427,7 @@ impl MetalRenderer {
|
||||||
&viewport_size as *const Size<DevicePixels> as *const _,
|
&viewport_size as *const Size<DevicePixels> as *const _,
|
||||||
);
|
);
|
||||||
|
|
||||||
let shadow_bytes_len = mem::size_of::<Shadow>() * shadows.len();
|
let shadow_bytes_len = std::mem::size_of_val(shadows);
|
||||||
let buffer_contents = unsafe { (self.instances.contents() as *mut u8).add(*offset) };
|
let buffer_contents = unsafe { (self.instances.contents() as *mut u8).add(*offset) };
|
||||||
unsafe {
|
unsafe {
|
||||||
ptr::copy_nonoverlapping(
|
ptr::copy_nonoverlapping(
|
||||||
|
@ -489,7 +487,7 @@ impl MetalRenderer {
|
||||||
&viewport_size as *const Size<DevicePixels> as *const _,
|
&viewport_size as *const Size<DevicePixels> as *const _,
|
||||||
);
|
);
|
||||||
|
|
||||||
let quad_bytes_len = mem::size_of::<Quad>() * quads.len();
|
let quad_bytes_len = std::mem::size_of_val(quads);
|
||||||
let buffer_contents = unsafe { (self.instances.contents() as *mut u8).add(*offset) };
|
let buffer_contents = unsafe { (self.instances.contents() as *mut u8).add(*offset) };
|
||||||
unsafe {
|
unsafe {
|
||||||
ptr::copy_nonoverlapping(quads.as_ptr() as *const u8, buffer_contents, quad_bytes_len);
|
ptr::copy_nonoverlapping(quads.as_ptr() as *const u8, buffer_contents, quad_bytes_len);
|
||||||
|
@ -537,7 +535,7 @@ impl MetalRenderer {
|
||||||
let mut prev_texture_id = None;
|
let mut prev_texture_id = None;
|
||||||
let mut sprites = SmallVec::<[_; 1]>::new();
|
let mut sprites = SmallVec::<[_; 1]>::new();
|
||||||
let mut paths_and_tiles = paths
|
let mut paths_and_tiles = paths
|
||||||
.into_iter()
|
.iter()
|
||||||
.map(|path| (path, tiles_by_path_id.get(&path.id).unwrap()))
|
.map(|path| (path, tiles_by_path_id.get(&path.id).unwrap()))
|
||||||
.peekable();
|
.peekable();
|
||||||
|
|
||||||
|
@ -652,7 +650,7 @@ impl MetalRenderer {
|
||||||
&viewport_size as *const Size<DevicePixels> as *const _,
|
&viewport_size as *const Size<DevicePixels> as *const _,
|
||||||
);
|
);
|
||||||
|
|
||||||
let quad_bytes_len = mem::size_of::<Underline>() * underlines.len();
|
let quad_bytes_len = std::mem::size_of_val(underlines);
|
||||||
let buffer_contents = unsafe { (self.instances.contents() as *mut u8).add(*offset) };
|
let buffer_contents = unsafe { (self.instances.contents() as *mut u8).add(*offset) };
|
||||||
unsafe {
|
unsafe {
|
||||||
ptr::copy_nonoverlapping(
|
ptr::copy_nonoverlapping(
|
||||||
|
@ -723,7 +721,7 @@ impl MetalRenderer {
|
||||||
);
|
);
|
||||||
command_encoder.set_fragment_texture(SpriteInputIndex::AtlasTexture as u64, Some(&texture));
|
command_encoder.set_fragment_texture(SpriteInputIndex::AtlasTexture as u64, Some(&texture));
|
||||||
|
|
||||||
let sprite_bytes_len = mem::size_of::<MonochromeSprite>() * sprites.len();
|
let sprite_bytes_len = std::mem::size_of_val(sprites);
|
||||||
let buffer_contents = unsafe { (self.instances.contents() as *mut u8).add(*offset) };
|
let buffer_contents = unsafe { (self.instances.contents() as *mut u8).add(*offset) };
|
||||||
unsafe {
|
unsafe {
|
||||||
ptr::copy_nonoverlapping(
|
ptr::copy_nonoverlapping(
|
||||||
|
@ -794,7 +792,7 @@ impl MetalRenderer {
|
||||||
);
|
);
|
||||||
command_encoder.set_fragment_texture(SpriteInputIndex::AtlasTexture as u64, Some(&texture));
|
command_encoder.set_fragment_texture(SpriteInputIndex::AtlasTexture as u64, Some(&texture));
|
||||||
|
|
||||||
let sprite_bytes_len = mem::size_of::<PolychromeSprite>() * sprites.len();
|
let sprite_bytes_len = std::mem::size_of_val(sprites);
|
||||||
let buffer_contents = unsafe { (self.instances.contents() as *mut u8).add(*offset) };
|
let buffer_contents = unsafe { (self.instances.contents() as *mut u8).add(*offset) };
|
||||||
unsafe {
|
unsafe {
|
||||||
ptr::copy_nonoverlapping(
|
ptr::copy_nonoverlapping(
|
||||||
|
@ -849,8 +847,8 @@ impl MetalRenderer {
|
||||||
media::core_video::kCVPixelFormatType_420YpCbCr8BiPlanarFullRange
|
media::core_video::kCVPixelFormatType_420YpCbCr8BiPlanarFullRange
|
||||||
);
|
);
|
||||||
|
|
||||||
let y_texture = self
|
let y_texture = unsafe {
|
||||||
.core_video_texture_cache
|
self.core_video_texture_cache
|
||||||
.create_texture_from_image(
|
.create_texture_from_image(
|
||||||
surface.image_buffer.as_concrete_TypeRef(),
|
surface.image_buffer.as_concrete_TypeRef(),
|
||||||
ptr::null(),
|
ptr::null(),
|
||||||
|
@ -859,9 +857,10 @@ impl MetalRenderer {
|
||||||
surface.image_buffer.plane_height(0),
|
surface.image_buffer.plane_height(0),
|
||||||
0,
|
0,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap()
|
||||||
let cb_cr_texture = self
|
};
|
||||||
.core_video_texture_cache
|
let cb_cr_texture = unsafe {
|
||||||
|
self.core_video_texture_cache
|
||||||
.create_texture_from_image(
|
.create_texture_from_image(
|
||||||
surface.image_buffer.as_concrete_TypeRef(),
|
surface.image_buffer.as_concrete_TypeRef(),
|
||||||
ptr::null(),
|
ptr::null(),
|
||||||
|
@ -870,7 +869,8 @@ impl MetalRenderer {
|
||||||
surface.image_buffer.plane_height(1),
|
surface.image_buffer.plane_height(1),
|
||||||
1,
|
1,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap()
|
||||||
|
};
|
||||||
|
|
||||||
align_offset(offset);
|
align_offset(offset);
|
||||||
let next_offset = *offset + mem::size_of::<Surface>();
|
let next_offset = *offset + mem::size_of::<Surface>();
|
||||||
|
|
|
@ -166,6 +166,12 @@ pub struct MacPlatformState {
|
||||||
finish_launching: Option<Box<dyn FnOnce()>>,
|
finish_launching: Option<Box<dyn FnOnce()>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for MacPlatform {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl MacPlatform {
|
impl MacPlatform {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let dispatcher = Arc::new(MacDispatcher::new());
|
let dispatcher = Arc::new(MacDispatcher::new());
|
||||||
|
@ -219,7 +225,12 @@ impl MacPlatform {
|
||||||
menu.setDelegate_(delegate);
|
menu.setDelegate_(delegate);
|
||||||
|
|
||||||
for item_config in menu_config.items {
|
for item_config in menu_config.items {
|
||||||
menu.addItem_(self.create_menu_item(item_config, delegate, actions, keymap));
|
menu.addItem_(Self::create_menu_item(
|
||||||
|
item_config,
|
||||||
|
delegate,
|
||||||
|
actions,
|
||||||
|
keymap,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
let menu_item = NSMenuItem::new(nil).autorelease();
|
let menu_item = NSMenuItem::new(nil).autorelease();
|
||||||
|
@ -236,7 +247,6 @@ impl MacPlatform {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn create_menu_item(
|
unsafe fn create_menu_item(
|
||||||
&self,
|
|
||||||
item: MenuItem,
|
item: MenuItem,
|
||||||
delegate: id,
|
delegate: id,
|
||||||
actions: &mut Vec<Box<dyn Action>>,
|
actions: &mut Vec<Box<dyn Action>>,
|
||||||
|
@ -342,7 +352,7 @@ impl MacPlatform {
|
||||||
let submenu = NSMenu::new(nil).autorelease();
|
let submenu = NSMenu::new(nil).autorelease();
|
||||||
submenu.setDelegate_(delegate);
|
submenu.setDelegate_(delegate);
|
||||||
for item in items {
|
for item in items {
|
||||||
submenu.addItem_(self.create_menu_item(item, delegate, actions, keymap));
|
submenu.addItem_(Self::create_menu_item(item, delegate, actions, keymap));
|
||||||
}
|
}
|
||||||
item.setSubmenu_(submenu);
|
item.setSubmenu_(submenu);
|
||||||
item.setTitle_(ns_string(name));
|
item.setTitle_(ns_string(name));
|
||||||
|
@ -475,7 +485,6 @@ impl Platform for MacPlatform {
|
||||||
|
|
||||||
fn displays(&self) -> Vec<Rc<dyn PlatformDisplay>> {
|
fn displays(&self) -> Vec<Rc<dyn PlatformDisplay>> {
|
||||||
MacDisplay::all()
|
MacDisplay::all()
|
||||||
.into_iter()
|
|
||||||
.map(|screen| Rc::new(screen) as Rc<_>)
|
.map(|screen| Rc::new(screen) as Rc<_>)
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
@ -1035,7 +1044,6 @@ extern "C" fn will_terminate(this: &mut Object, _: Sel, _: id) {
|
||||||
extern "C" fn open_urls(this: &mut Object, _: Sel, _: id, urls: id) {
|
extern "C" fn open_urls(this: &mut Object, _: Sel, _: id, urls: id) {
|
||||||
let urls = unsafe {
|
let urls = unsafe {
|
||||||
(0..urls.count())
|
(0..urls.count())
|
||||||
.into_iter()
|
|
||||||
.filter_map(|i| {
|
.filter_map(|i| {
|
||||||
let url = urls.objectAtIndex(i);
|
let url = urls.objectAtIndex(i);
|
||||||
match CStr::from_ptr(url.absoluteString().UTF8String() as *mut c_char).to_str() {
|
match CStr::from_ptr(url.absoluteString().UTF8String() as *mut c_char).to_str() {
|
||||||
|
|
|
@ -335,7 +335,7 @@ impl MacTextSystemState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok((bitmap_size.into(), bytes))
|
Ok((bitmap_size, bytes))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,10 +343,10 @@ impl MacTextSystemState {
|
||||||
// Construct the attributed string, converting UTF8 ranges to UTF16 ranges.
|
// Construct the attributed string, converting UTF8 ranges to UTF16 ranges.
|
||||||
let mut string = CFMutableAttributedString::new();
|
let mut string = CFMutableAttributedString::new();
|
||||||
{
|
{
|
||||||
string.replace_str(&CFString::new(text.as_ref()), CFRange::init(0, 0));
|
string.replace_str(&CFString::new(text), CFRange::init(0, 0));
|
||||||
let utf16_line_len = string.char_len() as usize;
|
let utf16_line_len = string.char_len() as usize;
|
||||||
|
|
||||||
let mut ix_converter = StringIndexConverter::new(text.as_ref());
|
let mut ix_converter = StringIndexConverter::new(text);
|
||||||
for run in font_runs {
|
for run in font_runs {
|
||||||
let utf8_end = ix_converter.utf8_ix + run.len;
|
let utf8_end = ix_converter.utf8_ix + run.len;
|
||||||
let utf16_start = ix_converter.utf16_ix;
|
let utf16_start = ix_converter.utf16_ix;
|
||||||
|
@ -390,7 +390,7 @@ impl MacTextSystemState {
|
||||||
};
|
};
|
||||||
let font_id = self.id_for_native_font(font);
|
let font_id = self.id_for_native_font(font);
|
||||||
|
|
||||||
let mut ix_converter = StringIndexConverter::new(text.as_ref());
|
let mut ix_converter = StringIndexConverter::new(text);
|
||||||
let mut glyphs = SmallVec::new();
|
let mut glyphs = SmallVec::new();
|
||||||
for ((glyph_id, position), glyph_utf16_ix) in run
|
for ((glyph_id, position), glyph_utf16_ix) in run
|
||||||
.glyphs()
|
.glyphs()
|
||||||
|
@ -453,7 +453,7 @@ impl MacTextSystemState {
|
||||||
if ix_converter.utf8_ix >= text.len() {
|
if ix_converter.utf8_ix >= text.len() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break_indices.push(ix_converter.utf8_ix as usize);
|
break_indices.push(ix_converter.utf8_ix);
|
||||||
}
|
}
|
||||||
break_indices
|
break_indices
|
||||||
}
|
}
|
||||||
|
|
|
@ -487,7 +487,7 @@ impl MacWindow {
|
||||||
let display = options
|
let display = options
|
||||||
.display_id
|
.display_id
|
||||||
.and_then(|display_id| MacDisplay::all().find(|display| display.id() == display_id))
|
.and_then(|display_id| MacDisplay::all().find(|display| display.id() == display_id))
|
||||||
.unwrap_or_else(|| MacDisplay::primary());
|
.unwrap_or_else(MacDisplay::primary);
|
||||||
|
|
||||||
let mut target_screen = nil;
|
let mut target_screen = nil;
|
||||||
let screens = NSScreen::screens(nil);
|
let screens = NSScreen::screens(nil);
|
||||||
|
@ -701,7 +701,7 @@ impl PlatformWindow for MacWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn content_size(&self) -> Size<Pixels> {
|
fn content_size(&self) -> Size<Pixels> {
|
||||||
self.0.as_ref().lock().content_size().into()
|
self.0.as_ref().lock().content_size()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn scale_factor(&self) -> f32 {
|
fn scale_factor(&self) -> f32 {
|
||||||
|
@ -1338,14 +1338,12 @@ extern "C" fn window_did_change_key_status(this: &Object, selector: Sel, _: id)
|
||||||
// The following code detects the spurious event and invokes `resignKeyWindow`:
|
// The following code detects the spurious event and invokes `resignKeyWindow`:
|
||||||
// in theory, we're not supposed to invoke this method manually but it balances out
|
// in theory, we're not supposed to invoke this method manually but it balances out
|
||||||
// the spurious `becomeKeyWindow` event and helps us work around that bug.
|
// the spurious `becomeKeyWindow` event and helps us work around that bug.
|
||||||
if selector == sel!(windowDidBecomeKey:) {
|
if selector == sel!(windowDidBecomeKey:) && !is_active {
|
||||||
if !is_active {
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let _: () = msg_send![lock.native_window, resignKeyWindow];
|
let _: () = msg_send![lock.native_window, resignKeyWindow];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
let executor = lock.executor.clone();
|
let executor = lock.executor.clone();
|
||||||
drop(lock);
|
drop(lock);
|
||||||
|
@ -1664,11 +1662,11 @@ extern "C" fn accepts_first_mouse(this: &Object, _: Sel, _: id) -> BOOL {
|
||||||
unsafe {
|
unsafe {
|
||||||
let state = get_window_state(this);
|
let state = get_window_state(this);
|
||||||
let lock = state.as_ref().lock();
|
let lock = state.as_ref().lock();
|
||||||
return if lock.kind == WindowKind::PopUp {
|
if lock.kind == WindowKind::PopUp {
|
||||||
YES
|
YES
|
||||||
} else {
|
} else {
|
||||||
NO
|
NO
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ pub type LayerId = u32;
|
||||||
|
|
||||||
pub type DrawOrder = u32;
|
pub type DrawOrder = u32;
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub(crate) struct SceneBuilder {
|
pub(crate) struct SceneBuilder {
|
||||||
last_order: Option<(StackingOrder, LayerId)>,
|
last_order: Option<(StackingOrder, LayerId)>,
|
||||||
layers_by_order: BTreeMap<StackingOrder, LayerId>,
|
layers_by_order: BTreeMap<StackingOrder, LayerId>,
|
||||||
|
@ -26,22 +27,6 @@ pub(crate) struct SceneBuilder {
|
||||||
surfaces: Vec<Surface>,
|
surfaces: Vec<Surface>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for SceneBuilder {
|
|
||||||
fn default() -> Self {
|
|
||||||
SceneBuilder {
|
|
||||||
last_order: None,
|
|
||||||
layers_by_order: BTreeMap::new(),
|
|
||||||
shadows: Vec::new(),
|
|
||||||
quads: Vec::new(),
|
|
||||||
paths: Vec::new(),
|
|
||||||
underlines: Vec::new(),
|
|
||||||
monochrome_sprites: Vec::new(),
|
|
||||||
polychrome_sprites: Vec::new(),
|
|
||||||
surfaces: Vec::new(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl SceneBuilder {
|
impl SceneBuilder {
|
||||||
pub fn build(&mut self) -> Scene {
|
pub fn build(&mut self) -> Scene {
|
||||||
let mut orders = vec![0; self.layers_by_order.len()];
|
let mut orders = vec![0; self.layers_by_order.len()];
|
||||||
|
|
|
@ -60,9 +60,9 @@ impl<'a> PartialEq<&'a str> for SharedString {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Into<Arc<str>> for SharedString {
|
impl From<SharedString> for Arc<str> {
|
||||||
fn into(self) -> Arc<str> {
|
fn from(val: SharedString) -> Self {
|
||||||
match self.0 {
|
match val.0 {
|
||||||
ArcCow::Borrowed(borrowed) => Arc::from(borrowed),
|
ArcCow::Borrowed(borrowed) => Arc::from(borrowed),
|
||||||
ArcCow::Owned(owned) => owned.clone(),
|
ArcCow::Owned(owned) => owned.clone(),
|
||||||
}
|
}
|
||||||
|
@ -75,9 +75,9 @@ impl<T: Into<ArcCow<'static, str>>> From<T> for SharedString {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Into<String> for SharedString {
|
impl From<SharedString> for String {
|
||||||
fn into(self) -> String {
|
fn from(val: SharedString) -> Self {
|
||||||
self.0.to_string()
|
val.0.to_string()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -210,7 +210,7 @@ impl TextStyle {
|
||||||
pub fn font(&self) -> Font {
|
pub fn font(&self) -> Font {
|
||||||
Font {
|
Font {
|
||||||
family: self.font_family.clone(),
|
family: self.font_family.clone(),
|
||||||
features: self.font_features.clone(),
|
features: self.font_features,
|
||||||
weight: self.font_weight,
|
weight: self.font_weight,
|
||||||
style: self.font_style,
|
style: self.font_style,
|
||||||
}
|
}
|
||||||
|
@ -232,7 +232,7 @@ impl TextStyle {
|
||||||
},
|
},
|
||||||
color: self.color,
|
color: self.color,
|
||||||
background_color: self.background_color,
|
background_color: self.background_color,
|
||||||
underline: self.underline.clone(),
|
underline: self.underline,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -386,12 +386,14 @@ impl Style {
|
||||||
let background_color = self.background.as_ref().and_then(Fill::color);
|
let background_color = self.background.as_ref().and_then(Fill::color);
|
||||||
if background_color.map_or(false, |color| !color.is_transparent()) {
|
if background_color.map_or(false, |color| !color.is_transparent()) {
|
||||||
cx.with_z_index(1, |cx| {
|
cx.with_z_index(1, |cx| {
|
||||||
|
let mut border_color = background_color.unwrap_or_default();
|
||||||
|
border_color.a = 0.;
|
||||||
cx.paint_quad(quad(
|
cx.paint_quad(quad(
|
||||||
bounds,
|
bounds,
|
||||||
self.corner_radii.to_pixels(bounds.size, rem_size),
|
self.corner_radii.to_pixels(bounds.size, rem_size),
|
||||||
background_color.unwrap_or_default(),
|
background_color.unwrap_or_default(),
|
||||||
Edges::default(),
|
Edges::default(),
|
||||||
Hsla::transparent_black(),
|
border_color,
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -426,10 +428,12 @@ impl Style {
|
||||||
bottom_bounds.upper_right(),
|
bottom_bounds.upper_right(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let mut background = self.border_color.unwrap_or_default();
|
||||||
|
background.a = 0.;
|
||||||
let quad = quad(
|
let quad = quad(
|
||||||
bounds,
|
bounds,
|
||||||
corner_radii,
|
corner_radii,
|
||||||
Hsla::transparent_black(),
|
background,
|
||||||
border_widths,
|
border_widths,
|
||||||
self.border_color.unwrap_or_default(),
|
self.border_color.unwrap_or_default(),
|
||||||
);
|
);
|
||||||
|
@ -570,7 +574,7 @@ impl From<&TextStyle> for HighlightStyle {
|
||||||
font_weight: Some(other.font_weight),
|
font_weight: Some(other.font_weight),
|
||||||
font_style: Some(other.font_style),
|
font_style: Some(other.font_style),
|
||||||
background_color: other.background_color,
|
background_color: other.background_color,
|
||||||
underline: other.underline.clone(),
|
underline: other.underline,
|
||||||
fade_out: None,
|
fade_out: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ where
|
||||||
lock.subscribers
|
lock.subscribers
|
||||||
.entry(emitter_key.clone())
|
.entry(emitter_key.clone())
|
||||||
.or_default()
|
.or_default()
|
||||||
.get_or_insert_with(|| Default::default())
|
.get_or_insert_with(Default::default)
|
||||||
.insert(
|
.insert(
|
||||||
subscriber_id,
|
subscriber_id,
|
||||||
Subscriber {
|
Subscriber {
|
||||||
|
@ -90,7 +90,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn remove(&self, emitter: &EmitterKey) -> impl IntoIterator<Item = Callback> {
|
pub fn remove(&self, emitter: &EmitterKey) -> impl IntoIterator<Item = Callback> {
|
||||||
let subscribers = self.0.lock().subscribers.remove(&emitter);
|
let subscribers = self.0.lock().subscribers.remove(emitter);
|
||||||
subscribers
|
subscribers
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.map(|s| s.into_values())
|
.map(|s| s.into_values())
|
||||||
|
@ -131,7 +131,7 @@ where
|
||||||
let mut lock = self.0.lock();
|
let mut lock = self.0.lock();
|
||||||
|
|
||||||
// Add any new subscribers that were added while invoking the callback.
|
// Add any new subscribers that were added while invoking the callback.
|
||||||
if let Some(Some(new_subscribers)) = lock.subscribers.remove(&emitter) {
|
if let Some(Some(new_subscribers)) = lock.subscribers.remove(emitter) {
|
||||||
subscribers.extend(new_subscribers);
|
subscribers.extend(new_subscribers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,7 @@ pub struct TaffyLayoutEngine {
|
||||||
>,
|
>,
|
||||||
}
|
}
|
||||||
|
|
||||||
static EXPECT_MESSAGE: &'static str =
|
static EXPECT_MESSAGE: &str = "we should avoid taffy layout errors by construction if possible";
|
||||||
"we should avoid taffy layout errors by construction if possible";
|
|
||||||
|
|
||||||
impl TaffyLayoutEngine {
|
impl TaffyLayoutEngine {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
@ -246,7 +245,7 @@ impl ToTaffy<taffy::style::Style> for Style {
|
||||||
fn to_taffy(&self, rem_size: Pixels) -> taffy::style::Style {
|
fn to_taffy(&self, rem_size: Pixels) -> taffy::style::Style {
|
||||||
taffy::style::Style {
|
taffy::style::Style {
|
||||||
display: self.display,
|
display: self.display,
|
||||||
overflow: self.overflow.clone().into(),
|
overflow: self.overflow.into(),
|
||||||
scrollbar_width: self.scrollbar_width,
|
scrollbar_width: self.scrollbar_width,
|
||||||
position: self.position,
|
position: self.position,
|
||||||
inset: self.inset.to_taffy(rem_size),
|
inset: self.inset.to_taffy(rem_size),
|
||||||
|
@ -378,14 +377,14 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T, T2> Into<TaffyPoint<T2>> for Point<T>
|
impl<T, T2> From<Point<T>> for TaffyPoint<T2>
|
||||||
where
|
where
|
||||||
T: Into<T2> + Clone + Default + Debug,
|
T: Into<T2> + Clone + Default + Debug,
|
||||||
{
|
{
|
||||||
fn into(self) -> TaffyPoint<T2> {
|
fn from(val: Point<T>) -> Self {
|
||||||
TaffyPoint {
|
TaffyPoint {
|
||||||
x: self.x.into(),
|
x: val.x.into(),
|
||||||
y: self.y.into(),
|
y: val.y.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -396,8 +395,8 @@ where
|
||||||
{
|
{
|
||||||
fn to_taffy(&self, rem_size: Pixels) -> TaffySize<U> {
|
fn to_taffy(&self, rem_size: Pixels) -> TaffySize<U> {
|
||||||
TaffySize {
|
TaffySize {
|
||||||
width: self.width.to_taffy(rem_size).into(),
|
width: self.width.to_taffy(rem_size),
|
||||||
height: self.height.to_taffy(rem_size).into(),
|
height: self.height.to_taffy(rem_size),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -408,10 +407,10 @@ where
|
||||||
{
|
{
|
||||||
fn to_taffy(&self, rem_size: Pixels) -> TaffyRect<U> {
|
fn to_taffy(&self, rem_size: Pixels) -> TaffyRect<U> {
|
||||||
TaffyRect {
|
TaffyRect {
|
||||||
top: self.top.to_taffy(rem_size).into(),
|
top: self.top.to_taffy(rem_size),
|
||||||
right: self.right.to_taffy(rem_size).into(),
|
right: self.right.to_taffy(rem_size),
|
||||||
bottom: self.bottom.to_taffy(rem_size).into(),
|
bottom: self.bottom.to_taffy(rem_size),
|
||||||
left: self.left.to_taffy(rem_size).into(),
|
left: self.left.to_taffy(rem_size),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ impl TextSystem {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn units_per_em(&self, font_id: FontId) -> u32 {
|
pub fn units_per_em(&self, font_id: FontId) -> u32 {
|
||||||
self.read_metrics(font_id, |metrics| metrics.units_per_em as u32)
|
self.read_metrics(font_id, |metrics| metrics.units_per_em)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn cap_height(&self, font_id: FontId, font_size: Pixels) -> Pixels {
|
pub fn cap_height(&self, font_id: FontId, font_size: Pixels) -> Pixels {
|
||||||
|
@ -174,7 +174,7 @@ impl TextSystem {
|
||||||
|
|
||||||
let layout = self
|
let layout = self
|
||||||
.line_layout_cache
|
.line_layout_cache
|
||||||
.layout_line(&text, font_size, &font_runs);
|
.layout_line(text, font_size, &font_runs);
|
||||||
|
|
||||||
font_runs.clear();
|
font_runs.clear();
|
||||||
self.font_runs_pool.lock().push(font_runs);
|
self.font_runs_pool.lock().push(font_runs);
|
||||||
|
@ -208,7 +208,7 @@ impl TextSystem {
|
||||||
len: run.len as u32,
|
len: run.len as u32,
|
||||||
color: run.color,
|
color: run.color,
|
||||||
background_color: run.background_color,
|
background_color: run.background_color,
|
||||||
underline: run.underline.clone(),
|
underline: run.underline,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,7 +268,7 @@ impl TextSystem {
|
||||||
len: run_len_within_line as u32,
|
len: run_len_within_line as u32,
|
||||||
color: run.color,
|
color: run.color,
|
||||||
background_color: run.background_color,
|
background_color: run.background_color,
|
||||||
underline: run.underline.clone(),
|
underline: run.underline,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ impl TextSystem {
|
||||||
lines.push(WrappedLine {
|
lines.push(WrappedLine {
|
||||||
layout,
|
layout,
|
||||||
decoration_runs,
|
decoration_runs,
|
||||||
text: SharedString::from(line_text),
|
text: line_text,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Skip `\n` character.
|
// Skip `\n` character.
|
||||||
|
@ -338,7 +338,7 @@ impl TextSystem {
|
||||||
pub fn raster_bounds(&self, params: &RenderGlyphParams) -> Result<Bounds<DevicePixels>> {
|
pub fn raster_bounds(&self, params: &RenderGlyphParams) -> Result<Bounds<DevicePixels>> {
|
||||||
let raster_bounds = self.raster_bounds.upgradable_read();
|
let raster_bounds = self.raster_bounds.upgradable_read();
|
||||||
if let Some(bounds) = raster_bounds.get(params) {
|
if let Some(bounds) = raster_bounds.get(params) {
|
||||||
Ok(bounds.clone())
|
Ok(*bounds)
|
||||||
} else {
|
} else {
|
||||||
let mut raster_bounds = RwLockUpgradableReadGuard::upgrade(raster_bounds);
|
let mut raster_bounds = RwLockUpgradableReadGuard::upgrade(raster_bounds);
|
||||||
let bounds = self.platform_text_system.glyph_raster_bounds(params)?;
|
let bounds = self.platform_text_system.glyph_raster_bounds(params)?;
|
||||||
|
@ -374,7 +374,7 @@ impl Drop for LineWrapperHandle {
|
||||||
let wrapper = self.wrapper.take().unwrap();
|
let wrapper = self.wrapper.take().unwrap();
|
||||||
state
|
state
|
||||||
.get_mut(&FontIdWithSize {
|
.get_mut(&FontIdWithSize {
|
||||||
font_id: wrapper.font_id.clone(),
|
font_id: wrapper.font_id,
|
||||||
font_size: wrapper.font_size,
|
font_size: wrapper.font_size,
|
||||||
})
|
})
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -438,9 +438,10 @@ impl FontWeight {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Allows italic or oblique faces to be selected.
|
/// Allows italic or oblique faces to be selected.
|
||||||
#[derive(Clone, Copy, Eq, PartialEq, Debug, Hash)]
|
#[derive(Clone, Copy, Eq, PartialEq, Debug, Hash, Default)]
|
||||||
pub enum FontStyle {
|
pub enum FontStyle {
|
||||||
/// A face that is neither italic not obliqued.
|
/// A face that is neither italic not obliqued.
|
||||||
|
#[default]
|
||||||
Normal,
|
Normal,
|
||||||
/// A form that is generally cursive in nature.
|
/// A form that is generally cursive in nature.
|
||||||
Italic,
|
Italic,
|
||||||
|
@ -448,12 +449,6 @@ pub enum FontStyle {
|
||||||
Oblique,
|
Oblique,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for FontStyle {
|
|
||||||
fn default() -> FontStyle {
|
|
||||||
FontStyle::Normal
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Display for FontStyle {
|
impl Display for FontStyle {
|
||||||
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
||||||
Debug::fmt(self, f)
|
Debug::fmt(self, f)
|
||||||
|
|
|
@ -97,8 +97,7 @@ impl LineWrapper {
|
||||||
self.cached_ascii_char_widths[c as usize] = Some(width);
|
self.cached_ascii_char_widths[c as usize] = Some(width);
|
||||||
width
|
width
|
||||||
}
|
}
|
||||||
} else {
|
} else if let Some(cached_width) = self.cached_other_char_widths.get(&c) {
|
||||||
if let Some(cached_width) = self.cached_other_char_widths.get(&c) {
|
|
||||||
*cached_width
|
*cached_width
|
||||||
} else {
|
} else {
|
||||||
let width = self.compute_width_for_char(c);
|
let width = self.compute_width_for_char(c);
|
||||||
|
@ -106,7 +105,6 @@ impl LineWrapper {
|
||||||
width
|
width
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn compute_width_for_char(&self, c: char) -> Pixels {
|
fn compute_width_for_char(&self, c: char) -> Pixels {
|
||||||
let mut buffer = [0; 4];
|
let mut buffer = [0; 4];
|
||||||
|
|
|
@ -221,7 +221,7 @@ impl<V: Render> From<View<V>> for AnyView {
|
||||||
AnyView {
|
AnyView {
|
||||||
model: value.model.into_any(),
|
model: value.model.into_any(),
|
||||||
layout: any_view::layout::<V>,
|
layout: any_view::layout::<V>,
|
||||||
paint: any_view::paint::<V>,
|
paint: any_view::paint,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -243,7 +243,7 @@ impl Element for AnyView {
|
||||||
state.is_some(),
|
state.is_some(),
|
||||||
"state is None. Did you include an AnyView twice in the tree?"
|
"state is None. Did you include an AnyView twice in the tree?"
|
||||||
);
|
);
|
||||||
(self.paint)(&self, state.as_mut().unwrap(), cx)
|
(self.paint)(self, state.as_mut().unwrap(), cx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ impl<V: 'static + Render> From<WeakView<V>> for AnyWeakView {
|
||||||
Self {
|
Self {
|
||||||
model: view.model.into(),
|
model: view.model.into(),
|
||||||
layout: any_view::layout::<V>,
|
layout: any_view::layout::<V>,
|
||||||
paint: any_view::paint::<V>,
|
paint: any_view::paint,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -325,11 +325,7 @@ mod any_view {
|
||||||
(layout_id, element)
|
(layout_id, element)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn paint<V: 'static + Render>(
|
pub(crate) fn paint(_view: &AnyView, element: &mut AnyElement, cx: &mut WindowContext) {
|
||||||
_view: &AnyView,
|
|
||||||
element: &mut AnyElement,
|
|
||||||
cx: &mut WindowContext,
|
|
||||||
) {
|
|
||||||
element.paint(cx);
|
element.paint(cx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ use std::{
|
||||||
any::{Any, TypeId},
|
any::{Any, TypeId},
|
||||||
borrow::{Borrow, BorrowMut, Cow},
|
borrow::{Borrow, BorrowMut, Cow},
|
||||||
cell::RefCell,
|
cell::RefCell,
|
||||||
|
collections::hash_map::Entry,
|
||||||
fmt::Debug,
|
fmt::Debug,
|
||||||
future::Future,
|
future::Future,
|
||||||
hash::{Hash, Hasher},
|
hash::{Hash, Hasher},
|
||||||
|
@ -403,7 +404,7 @@ impl Window {
|
||||||
element_id_stack: GlobalElementId::default(),
|
element_id_stack: GlobalElementId::default(),
|
||||||
rendered_frame: Frame::new(DispatchTree::new(cx.keymap.clone(), cx.actions.clone())),
|
rendered_frame: Frame::new(DispatchTree::new(cx.keymap.clone(), cx.actions.clone())),
|
||||||
next_frame: Frame::new(DispatchTree::new(cx.keymap.clone(), cx.actions.clone())),
|
next_frame: Frame::new(DispatchTree::new(cx.keymap.clone(), cx.actions.clone())),
|
||||||
frame_arena: Arena::new(1 * 1024 * 1024),
|
frame_arena: Arena::new(1024 * 1024),
|
||||||
focus_handles: Arc::new(RwLock::new(SlotMap::with_key())),
|
focus_handles: Arc::new(RwLock::new(SlotMap::with_key())),
|
||||||
focus_listeners: SubscriberSet::new(),
|
focus_listeners: SubscriberSet::new(),
|
||||||
blur_listeners: SubscriberSet::new(),
|
blur_listeners: SubscriberSet::new(),
|
||||||
|
@ -637,7 +638,8 @@ impl<'a> WindowContext<'a> {
|
||||||
let handle = self.window.handle;
|
let handle = self.window.handle;
|
||||||
let display_id = self.window.display_id;
|
let display_id = self.window.display_id;
|
||||||
|
|
||||||
if !self.frame_consumers.contains_key(&display_id) {
|
let mut frame_consumers = std::mem::take(&mut self.app.frame_consumers);
|
||||||
|
if let Entry::Vacant(e) = frame_consumers.entry(display_id) {
|
||||||
let (tx, mut rx) = mpsc::unbounded::<()>();
|
let (tx, mut rx) = mpsc::unbounded::<()>();
|
||||||
self.platform.set_display_link_output_callback(
|
self.platform.set_display_link_output_callback(
|
||||||
display_id,
|
display_id,
|
||||||
|
@ -669,8 +671,10 @@ impl<'a> WindowContext<'a> {
|
||||||
.ok();
|
.ok();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
self.frame_consumers.insert(display_id, consumer_task);
|
e.insert(consumer_task);
|
||||||
}
|
}
|
||||||
|
debug_assert!(self.app.frame_consumers.is_empty());
|
||||||
|
self.app.frame_consumers = frame_consumers;
|
||||||
|
|
||||||
if self.next_frame_callbacks.is_empty() {
|
if self.next_frame_callbacks.is_empty() {
|
||||||
self.platform.start_display_link(display_id);
|
self.platform.start_display_link(display_id);
|
||||||
|
@ -718,7 +722,7 @@ impl<'a> WindowContext<'a> {
|
||||||
children: impl IntoIterator<Item = LayoutId>,
|
children: impl IntoIterator<Item = LayoutId>,
|
||||||
) -> LayoutId {
|
) -> LayoutId {
|
||||||
self.app.layout_id_buffer.clear();
|
self.app.layout_id_buffer.clear();
|
||||||
self.app.layout_id_buffer.extend(children.into_iter());
|
self.app.layout_id_buffer.extend(children);
|
||||||
let rem_size = self.rem_size();
|
let rem_size = self.rem_size();
|
||||||
|
|
||||||
self.window.layout_engine.as_mut().unwrap().request_layout(
|
self.window.layout_engine.as_mut().unwrap().request_layout(
|
||||||
|
@ -844,7 +848,7 @@ impl<'a> WindowContext<'a> {
|
||||||
let text_style = self.text_style();
|
let text_style = self.text_style();
|
||||||
text_style
|
text_style
|
||||||
.line_height
|
.line_height
|
||||||
.to_pixels(text_style.font_size.into(), rem_size)
|
.to_pixels(text_style.font_size, rem_size)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Call to prevent the default action of an event. Currently only used to prevent
|
/// Call to prevent the default action of an event. Currently only used to prevent
|
||||||
|
@ -966,7 +970,7 @@ impl<'a> WindowContext<'a> {
|
||||||
pub fn add_opaque_layer(&mut self, bounds: Bounds<Pixels>) {
|
pub fn add_opaque_layer(&mut self, bounds: Bounds<Pixels>) {
|
||||||
let stacking_order = self.window.next_frame.z_index_stack.clone();
|
let stacking_order = self.window.next_frame.z_index_stack.clone();
|
||||||
let depth_map = &mut self.window.next_frame.depth_map;
|
let depth_map = &mut self.window.next_frame.depth_map;
|
||||||
match depth_map.binary_search_by(|(level, _)| stacking_order.cmp(&level)) {
|
match depth_map.binary_search_by(|(level, _)| stacking_order.cmp(level)) {
|
||||||
Ok(i) | Err(i) => depth_map.insert(i, (stacking_order, bounds)),
|
Ok(i) | Err(i) => depth_map.insert(i, (stacking_order, bounds)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1886,7 +1890,7 @@ impl Context for WindowContext<'_> {
|
||||||
T: 'static,
|
T: 'static,
|
||||||
{
|
{
|
||||||
let entity = self.entities.read(handle);
|
let entity = self.entities.read(handle);
|
||||||
read(&*entity, &*self.app)
|
read(entity, &*self.app)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_window<T, R>(
|
fn read_window<T, R>(
|
||||||
|
@ -1946,7 +1950,7 @@ impl VisualContext for WindowContext<'_> {
|
||||||
update: impl FnOnce(&mut T, &mut ViewContext<'_, T>) -> R,
|
update: impl FnOnce(&mut T, &mut ViewContext<'_, T>) -> R,
|
||||||
) -> Self::Result<R> {
|
) -> Self::Result<R> {
|
||||||
let mut lease = self.app.entities.lease(&view.model);
|
let mut lease = self.app.entities.lease(&view.model);
|
||||||
let mut cx = ViewContext::new(&mut *self.app, &mut *self.window, &view);
|
let mut cx = ViewContext::new(&mut *self.app, &mut *self.window, view);
|
||||||
let result = update(&mut *lease, &mut cx);
|
let result = update(&mut *lease, &mut cx);
|
||||||
cx.app.entities.end_lease(lease);
|
cx.app.entities.end_lease(lease);
|
||||||
result
|
result
|
||||||
|
@ -1983,25 +1987,25 @@ impl<'a> std::ops::Deref for WindowContext<'a> {
|
||||||
type Target = AppContext;
|
type Target = AppContext;
|
||||||
|
|
||||||
fn deref(&self) -> &Self::Target {
|
fn deref(&self) -> &Self::Target {
|
||||||
&self.app
|
self.app
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> std::ops::DerefMut for WindowContext<'a> {
|
impl<'a> std::ops::DerefMut for WindowContext<'a> {
|
||||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||||
&mut self.app
|
self.app
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Borrow<AppContext> for WindowContext<'a> {
|
impl<'a> Borrow<AppContext> for WindowContext<'a> {
|
||||||
fn borrow(&self) -> &AppContext {
|
fn borrow(&self) -> &AppContext {
|
||||||
&self.app
|
self.app
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> BorrowMut<AppContext> for WindowContext<'a> {
|
impl<'a> BorrowMut<AppContext> for WindowContext<'a> {
|
||||||
fn borrow_mut(&mut self) -> &mut AppContext {
|
fn borrow_mut(&mut self) -> &mut AppContext {
|
||||||
&mut self.app
|
self.app
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2033,7 +2037,7 @@ pub trait BorrowWindow: BorrowMut<Window> + BorrowMut<AppContext> {
|
||||||
) -> R {
|
) -> R {
|
||||||
if let Some(id) = id.map(Into::into) {
|
if let Some(id) = id.map(Into::into) {
|
||||||
let window = self.window_mut();
|
let window = self.window_mut();
|
||||||
window.element_id_stack.push(id.into());
|
window.element_id_stack.push(id);
|
||||||
let result = f(self);
|
let result = f(self);
|
||||||
let window: &mut Window = self.borrow_mut();
|
let window: &mut Window = self.borrow_mut();
|
||||||
window.element_id_stack.pop();
|
window.element_id_stack.pop();
|
||||||
|
@ -2255,13 +2259,13 @@ pub trait BorrowWindow: BorrowMut<Window> + BorrowMut<AppContext> {
|
||||||
|
|
||||||
impl Borrow<Window> for WindowContext<'_> {
|
impl Borrow<Window> for WindowContext<'_> {
|
||||||
fn borrow(&self) -> &Window {
|
fn borrow(&self) -> &Window {
|
||||||
&self.window
|
self.window
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BorrowMut<Window> for WindowContext<'_> {
|
impl BorrowMut<Window> for WindowContext<'_> {
|
||||||
fn borrow_mut(&mut self) -> &mut Window {
|
fn borrow_mut(&mut self) -> &mut Window {
|
||||||
&mut self.window
|
self.window
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2915,10 +2919,7 @@ impl<V> Copy for WindowHandle<V> {}
|
||||||
|
|
||||||
impl<V> Clone for WindowHandle<V> {
|
impl<V> Clone for WindowHandle<V> {
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
WindowHandle {
|
*self
|
||||||
any_handle: self.any_handle,
|
|
||||||
state_type: PhantomData,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2936,9 +2937,9 @@ impl<V> Hash for WindowHandle<V> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<V: 'static> Into<AnyWindowHandle> for WindowHandle<V> {
|
impl<V: 'static> From<WindowHandle<V>> for AnyWindowHandle {
|
||||||
fn into(self) -> AnyWindowHandle {
|
fn from(val: WindowHandle<V>) -> Self {
|
||||||
self.any_handle
|
val.any_handle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ fn generate_methods() -> Vec<TokenStream2> {
|
||||||
fn generate_predefined_setter(
|
fn generate_predefined_setter(
|
||||||
name: &'static str,
|
name: &'static str,
|
||||||
length: &'static str,
|
length: &'static str,
|
||||||
fields: &Vec<TokenStream2>,
|
fields: &[TokenStream2],
|
||||||
length_tokens: &TokenStream2,
|
length_tokens: &TokenStream2,
|
||||||
negate: bool,
|
negate: bool,
|
||||||
doc_string: &str,
|
doc_string: &str,
|
||||||
|
@ -143,12 +143,12 @@ fn generate_predefined_setter(
|
||||||
fn generate_custom_value_setter(
|
fn generate_custom_value_setter(
|
||||||
prefix: &'static str,
|
prefix: &'static str,
|
||||||
length_type: TokenStream2,
|
length_type: TokenStream2,
|
||||||
fields: &Vec<TokenStream2>,
|
fields: &[TokenStream2],
|
||||||
doc_string: &str,
|
doc_string: &str,
|
||||||
) -> TokenStream2 {
|
) -> TokenStream2 {
|
||||||
let method_name = format_ident!("{}", prefix);
|
let method_name = format_ident!("{}", prefix);
|
||||||
|
|
||||||
let mut iter = fields.into_iter();
|
let mut iter = fields.iter();
|
||||||
let last = iter.next_back().unwrap();
|
let last = iter.next_back().unwrap();
|
||||||
let field_assignments = iter
|
let field_assignments = iter
|
||||||
.map(|field_tokens| {
|
.map(|field_tokens| {
|
||||||
|
|
|
@ -108,8 +108,7 @@ pub mod core_video {
|
||||||
impl_CFTypeDescription!(CVMetalTextureCache);
|
impl_CFTypeDescription!(CVMetalTextureCache);
|
||||||
|
|
||||||
impl CVMetalTextureCache {
|
impl CVMetalTextureCache {
|
||||||
pub fn new(metal_device: *mut MTLDevice) -> Result<Self> {
|
pub unsafe fn new(metal_device: *mut MTLDevice) -> Result<Self> {
|
||||||
unsafe {
|
|
||||||
let mut this = ptr::null();
|
let mut this = ptr::null();
|
||||||
let result = CVMetalTextureCacheCreate(
|
let result = CVMetalTextureCacheCreate(
|
||||||
kCFAllocatorDefault,
|
kCFAllocatorDefault,
|
||||||
|
@ -124,9 +123,8 @@ pub mod core_video {
|
||||||
Err(anyhow!("could not create texture cache, code: {}", result))
|
Err(anyhow!("could not create texture cache, code: {}", result))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
pub fn create_texture_from_image(
|
pub unsafe fn create_texture_from_image(
|
||||||
&self,
|
&self,
|
||||||
source: CVImageBufferRef,
|
source: CVImageBufferRef,
|
||||||
texture_attributes: CFDictionaryRef,
|
texture_attributes: CFDictionaryRef,
|
||||||
|
@ -135,7 +133,6 @@ pub mod core_video {
|
||||||
height: usize,
|
height: usize,
|
||||||
plane_index: usize,
|
plane_index: usize,
|
||||||
) -> Result<CVMetalTexture> {
|
) -> Result<CVMetalTexture> {
|
||||||
unsafe {
|
|
||||||
let mut this = ptr::null();
|
let mut this = ptr::null();
|
||||||
let result = CVMetalTextureCacheCreateTextureFromImage(
|
let result = CVMetalTextureCacheCreateTextureFromImage(
|
||||||
kCFAllocatorDefault,
|
kCFAllocatorDefault,
|
||||||
|
@ -155,7 +152,6 @@ pub mod core_video {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#[link(name = "CoreVideo", kind = "framework")]
|
#[link(name = "CoreVideo", kind = "framework")]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -438,14 +434,13 @@ pub mod video_toolbox {
|
||||||
impl_CFTypeDescription!(VTCompressionSession);
|
impl_CFTypeDescription!(VTCompressionSession);
|
||||||
|
|
||||||
impl VTCompressionSession {
|
impl VTCompressionSession {
|
||||||
pub fn new(
|
pub unsafe fn new(
|
||||||
width: usize,
|
width: usize,
|
||||||
height: usize,
|
height: usize,
|
||||||
codec: CMVideoCodecType,
|
codec: CMVideoCodecType,
|
||||||
callback: VTCompressionOutputCallback,
|
callback: VTCompressionOutputCallback,
|
||||||
callback_data: *const c_void,
|
callback_data: *const c_void,
|
||||||
) -> Result<Self> {
|
) -> Result<Self> {
|
||||||
unsafe {
|
|
||||||
let mut this = ptr::null();
|
let mut this = ptr::null();
|
||||||
let result = VTCompressionSessionCreate(
|
let result = VTCompressionSessionCreate(
|
||||||
ptr::null(),
|
ptr::null(),
|
||||||
|
@ -469,15 +464,13 @@ pub mod video_toolbox {
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
pub fn encode_frame(
|
pub unsafe fn encode_frame(
|
||||||
&self,
|
&self,
|
||||||
buffer: CVImageBufferRef,
|
buffer: CVImageBufferRef,
|
||||||
presentation_timestamp: CMTime,
|
presentation_timestamp: CMTime,
|
||||||
duration: CMTime,
|
duration: CMTime,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
unsafe {
|
|
||||||
let result = VTCompressionSessionEncodeFrame(
|
let result = VTCompressionSessionEncodeFrame(
|
||||||
self.as_concrete_TypeRef(),
|
self.as_concrete_TypeRef(),
|
||||||
buffer,
|
buffer,
|
||||||
|
@ -494,7 +487,6 @@ pub mod video_toolbox {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
type VTCompressionOutputCallback = Option<
|
type VTCompressionOutputCallback = Option<
|
||||||
unsafe extern "C" fn(
|
unsafe extern "C" fn(
|
||||||
|
|
|
@ -85,9 +85,7 @@ pub fn derive_refineable(input: TokenStream) -> TokenStream {
|
||||||
// Append to where_clause or create a new one if it doesn't exist
|
// Append to where_clause or create a new one if it doesn't exist
|
||||||
let where_clause = match where_clause.cloned() {
|
let where_clause = match where_clause.cloned() {
|
||||||
Some(mut where_clause) => {
|
Some(mut where_clause) => {
|
||||||
where_clause
|
where_clause.predicates.extend(type_param_bounds);
|
||||||
.predicates
|
|
||||||
.extend(type_param_bounds.into_iter());
|
|
||||||
where_clause.clone()
|
where_clause.clone()
|
||||||
}
|
}
|
||||||
None => WhereClause {
|
None => WhereClause {
|
||||||
|
|
|
@ -27,7 +27,7 @@ pub struct CascadeSlot(usize);
|
||||||
impl<S: Refineable + Default> Cascade<S> {
|
impl<S: Refineable + Default> Cascade<S> {
|
||||||
pub fn reserve(&mut self) -> CascadeSlot {
|
pub fn reserve(&mut self) -> CascadeSlot {
|
||||||
self.0.push(None);
|
self.0.push(None);
|
||||||
return CascadeSlot(self.0.len() - 1);
|
CascadeSlot(self.0.len() - 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn base(&mut self) -> &mut S::Refinement {
|
pub fn base(&mut self) -> &mut S::Refinement {
|
||||||
|
@ -40,11 +40,9 @@ impl<S: Refineable + Default> Cascade<S> {
|
||||||
|
|
||||||
pub fn merged(&self) -> S::Refinement {
|
pub fn merged(&self) -> S::Refinement {
|
||||||
let mut merged = self.0[0].clone().unwrap();
|
let mut merged = self.0[0].clone().unwrap();
|
||||||
for refinement in self.0.iter().skip(1) {
|
for refinement in self.0.iter().skip(1).flatten() {
|
||||||
if let Some(refinement) = refinement {
|
|
||||||
merged.refine(refinement);
|
merged.refine(refinement);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
merged
|
merged
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -906,7 +906,7 @@ impl Chunk {
|
||||||
|
|
||||||
fn clip_offset_utf16(&self, target: OffsetUtf16, bias: Bias) -> OffsetUtf16 {
|
fn clip_offset_utf16(&self, target: OffsetUtf16, bias: Bias) -> OffsetUtf16 {
|
||||||
let mut code_units = self.0.encode_utf16();
|
let mut code_units = self.0.encode_utf16();
|
||||||
let mut offset = code_units.by_ref().take(target.0 as usize).count();
|
let mut offset = code_units.by_ref().take(target.0).count();
|
||||||
if char::decode_utf16(code_units).next().transpose().is_err() {
|
if char::decode_utf16(code_units).next().transpose().is_err() {
|
||||||
match bias {
|
match bias {
|
||||||
Bias::Left => offset -= 1,
|
Bias::Left => offset -= 1,
|
||||||
|
|
|
@ -20,8 +20,8 @@ impl Connection {
|
||||||
self.sqlite3,
|
self.sqlite3,
|
||||||
sql_str.as_c_str().as_ptr(),
|
sql_str.as_c_str().as_ptr(),
|
||||||
None,
|
None,
|
||||||
0 as *mut _,
|
std::ptr::null_mut(),
|
||||||
0 as *mut _,
|
std::ptr::null_mut(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
self.last_error()
|
self.last_error()
|
||||||
|
|
|
@ -232,13 +232,13 @@ impl<'a> Statement<'a> {
|
||||||
.last_error()
|
.last_error()
|
||||||
.with_context(|| format!("Failed to read text length at {index}"))?;
|
.with_context(|| format!("Failed to read text length at {index}"))?;
|
||||||
|
|
||||||
let slice = unsafe { slice::from_raw_parts(pointer as *const u8, len) };
|
let slice = unsafe { slice::from_raw_parts(pointer, len) };
|
||||||
Ok(str::from_utf8(slice)?)
|
Ok(str::from_utf8(slice)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn bind<T: Bind>(&self, value: &T, index: i32) -> Result<i32> {
|
pub fn bind<T: Bind>(&self, value: &T, index: i32) -> Result<i32> {
|
||||||
debug_assert!(index > 0);
|
debug_assert!(index > 0);
|
||||||
Ok(value.bind(self, index)?)
|
value.bind(self, index)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn column<T: Column>(&mut self) -> Result<T> {
|
pub fn column<T: Column>(&mut self) -> Result<T> {
|
||||||
|
|
|
@ -10,14 +10,14 @@ use crate::{connection::Connection, domain::Migrator, util::UnboundedSyncSender}
|
||||||
const MIGRATION_RETRIES: usize = 10;
|
const MIGRATION_RETRIES: usize = 10;
|
||||||
|
|
||||||
type QueuedWrite = Box<dyn 'static + Send + FnOnce()>;
|
type QueuedWrite = Box<dyn 'static + Send + FnOnce()>;
|
||||||
type WriteQueueConstructor =
|
type WriteQueue = Box<dyn 'static + Send + Sync + Fn(QueuedWrite)>;
|
||||||
Box<dyn 'static + Send + FnMut() -> Box<dyn 'static + Send + Sync + Fn(QueuedWrite)>>;
|
type WriteQueueConstructor = Box<dyn 'static + Send + FnMut() -> WriteQueue>;
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
/// List of queues of tasks by database uri. This lets us serialize writes to the database
|
/// List of queues of tasks by database uri. This lets us serialize writes to the database
|
||||||
/// and have a single worker thread per db file. This means many thread safe connections
|
/// and have a single worker thread per db file. This means many thread safe connections
|
||||||
/// (possibly with different migrations) could all be communicating with the same background
|
/// (possibly with different migrations) could all be communicating with the same background
|
||||||
/// thread.
|
/// thread.
|
||||||
static ref QUEUES: RwLock<HashMap<Arc<str>, Box<dyn 'static + Send + Sync + Fn(QueuedWrite)>>> =
|
static ref QUEUES: RwLock<HashMap<Arc<str>, WriteQueue>> =
|
||||||
Default::default();
|
Default::default();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ impl<K: Clone + Debug + Default + Ord, V: Clone + Debug> TreeMap<K, V> {
|
||||||
self.0.is_empty()
|
self.0.is_empty()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get<'a>(&self, key: &'a K) -> Option<&V> {
|
pub fn get(&self, key: &K) -> Option<&V> {
|
||||||
let mut cursor = self.0.cursor::<MapKeyRef<'_, K>>();
|
let mut cursor = self.0.cursor::<MapKeyRef<'_, K>>();
|
||||||
cursor.seek(&MapKeyRef(Some(key)), Bias::Left, &());
|
cursor.seek(&MapKeyRef(Some(key)), Bias::Left, &());
|
||||||
if let Some(item) = cursor.item() {
|
if let Some(item) = cursor.item() {
|
||||||
|
@ -98,9 +98,7 @@ impl<K: Clone + Debug + Default + Ord, V: Clone + Debug> TreeMap<K, V> {
|
||||||
let from_key = MapKeyRef(Some(from));
|
let from_key = MapKeyRef(Some(from));
|
||||||
cursor.seek(&from_key, Bias::Left, &());
|
cursor.seek(&from_key, Bias::Left, &());
|
||||||
|
|
||||||
cursor
|
cursor.map(|map_entry| (&map_entry.key, &map_entry.value))
|
||||||
.into_iter()
|
|
||||||
.map(|map_entry| (&map_entry.key, &map_entry.value))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update<F, T>(&mut self, key: &K, f: F) -> Option<T>
|
pub fn update<F, T>(&mut self, key: &K, f: F) -> Option<T>
|
||||||
|
|
|
@ -20,11 +20,11 @@ impl Locator {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn min_ref() -> &'static Self {
|
pub fn min_ref() -> &'static Self {
|
||||||
&*MIN
|
&MIN
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn max_ref() -> &'static Self {
|
pub fn max_ref() -> &'static Self {
|
||||||
&*MAX
|
&MAX
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn assign(&mut self, other: &Self) {
|
pub fn assign(&mut self, other: &Self) {
|
||||||
|
|
|
@ -18,7 +18,7 @@ impl Topic {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn publish(&self, edits: impl Clone + IntoIterator<Item = Edit<usize>>) {
|
pub fn publish(&self, edits: impl Clone + IntoIterator<Item = Edit<usize>>) {
|
||||||
publish(&mut *self.0.lock(), edits);
|
publish(&mut self.0.lock(), edits);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn publish_mut(&mut self, edits: impl Clone + IntoIterator<Item = Edit<usize>>) {
|
pub fn publish_mut(&mut self, edits: impl Clone + IntoIterator<Item = Edit<usize>>) {
|
||||||
|
|
|
@ -2652,7 +2652,7 @@ impl LineEnding {
|
||||||
max_ix -= 1;
|
max_ix -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(ix) = text[..max_ix].find(&['\n']) {
|
if let Some(ix) = text[..max_ix].find(['\n']) {
|
||||||
if ix > 0 && text.as_bytes()[ix - 1] == b'\r' {
|
if ix > 0 && text.as_bytes()[ix - 1] == b'\r' {
|
||||||
Self::Windows
|
Self::Windows
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -74,6 +74,7 @@ pub fn andromeda() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xf82872ff).into()),
|
error: Some(rgba(0xf82872ff).into()),
|
||||||
hint: Some(rgba(0x618399ff).into()),
|
hint: Some(rgba(0x618399ff).into()),
|
||||||
modified: Some(rgba(0xfee56dff).into()),
|
modified: Some(rgba(0xfee56dff).into()),
|
||||||
|
predictive: Some(rgba(0x315f70ff).into()),
|
||||||
success: Some(rgba(0xf7f7f8ff).into()),
|
success: Some(rgba(0xf7f7f8ff).into()),
|
||||||
warning: Some(rgba(0xfee56dff).into()),
|
warning: Some(rgba(0xfee56dff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
@ -75,6 +75,7 @@ pub fn atelier() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xba6337ff).into()),
|
error: Some(rgba(0xba6337ff).into()),
|
||||||
hint: Some(rgba(0x768962ff).into()),
|
hint: Some(rgba(0x768962ff).into()),
|
||||||
modified: Some(rgba(0xa59810ff).into()),
|
modified: Some(rgba(0xa59810ff).into()),
|
||||||
|
predictive: Some(rgba(0x879a72ff).into()),
|
||||||
success: Some(rgba(0x22221bff).into()),
|
success: Some(rgba(0x22221bff).into()),
|
||||||
warning: Some(rgba(0xa59810ff).into()),
|
warning: Some(rgba(0xa59810ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -479,6 +480,7 @@ pub fn atelier() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xf22d40ff).into()),
|
error: Some(rgba(0xf22d40ff).into()),
|
||||||
hint: Some(rgba(0xa87187ff).into()),
|
hint: Some(rgba(0xa87187ff).into()),
|
||||||
modified: Some(rgba(0xc38419ff).into()),
|
modified: Some(rgba(0xc38419ff).into()),
|
||||||
|
predictive: Some(rgba(0x8f5b71ff).into()),
|
||||||
success: Some(rgba(0xf1efeeff).into()),
|
success: Some(rgba(0xf1efeeff).into()),
|
||||||
warning: Some(rgba(0xc38419ff).into()),
|
warning: Some(rgba(0xc38419ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -883,6 +885,7 @@ pub fn atelier() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xb1623aff).into()),
|
error: Some(rgba(0xb1623aff).into()),
|
||||||
hint: Some(rgba(0x66847cff).into()),
|
hint: Some(rgba(0x66847cff).into()),
|
||||||
modified: Some(rgba(0xa07e3cff).into()),
|
modified: Some(rgba(0xa07e3cff).into()),
|
||||||
|
predictive: Some(rgba(0x76958cff).into()),
|
||||||
success: Some(rgba(0x171c19ff).into()),
|
success: Some(rgba(0x171c19ff).into()),
|
||||||
warning: Some(rgba(0xa07e3cff).into()),
|
warning: Some(rgba(0xa07e3cff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -1287,6 +1290,7 @@ pub fn atelier() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xbe4678ff).into()),
|
error: Some(rgba(0xbe4678ff).into()),
|
||||||
hint: Some(rgba(0x716998ff).into()),
|
hint: Some(rgba(0x716998ff).into()),
|
||||||
modified: Some(rgba(0xa06e3bff).into()),
|
modified: Some(rgba(0xa06e3bff).into()),
|
||||||
|
predictive: Some(rgba(0x625887ff).into()),
|
||||||
success: Some(rgba(0xefecf4ff).into()),
|
success: Some(rgba(0xefecf4ff).into()),
|
||||||
warning: Some(rgba(0xa06e3bff).into()),
|
warning: Some(rgba(0xa06e3bff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -1691,6 +1695,7 @@ pub fn atelier() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xba6237ff).into()),
|
error: Some(rgba(0xba6237ff).into()),
|
||||||
hint: Some(rgba(0x70825bff).into()),
|
hint: Some(rgba(0x70825bff).into()),
|
||||||
modified: Some(rgba(0xa59810ff).into()),
|
modified: Some(rgba(0xa59810ff).into()),
|
||||||
|
predictive: Some(rgba(0x5f724cff).into()),
|
||||||
success: Some(rgba(0xf4f3ecff).into()),
|
success: Some(rgba(0xf4f3ecff).into()),
|
||||||
warning: Some(rgba(0xa59810ff).into()),
|
warning: Some(rgba(0xa59810ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -2095,6 +2100,7 @@ pub fn atelier() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xc94923ff).into()),
|
error: Some(rgba(0xc94923ff).into()),
|
||||||
hint: Some(rgba(0x6d82a6ff).into()),
|
hint: Some(rgba(0x6d82a6ff).into()),
|
||||||
modified: Some(rgba(0xc08b31ff).into()),
|
modified: Some(rgba(0xc08b31ff).into()),
|
||||||
|
predictive: Some(rgba(0x58709aff).into()),
|
||||||
success: Some(rgba(0xf5f7ffff).into()),
|
success: Some(rgba(0xf5f7ffff).into()),
|
||||||
warning: Some(rgba(0xc08b31ff).into()),
|
warning: Some(rgba(0xc08b31ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -2499,6 +2505,7 @@ pub fn atelier() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xc94a23ff).into()),
|
error: Some(rgba(0xc94a23ff).into()),
|
||||||
hint: Some(rgba(0x7087b2ff).into()),
|
hint: Some(rgba(0x7087b2ff).into()),
|
||||||
modified: Some(rgba(0xc08b31ff).into()),
|
modified: Some(rgba(0xc08b31ff).into()),
|
||||||
|
predictive: Some(rgba(0x8599beff).into()),
|
||||||
success: Some(rgba(0x202746ff).into()),
|
success: Some(rgba(0x202746ff).into()),
|
||||||
warning: Some(rgba(0xc08b31ff).into()),
|
warning: Some(rgba(0xc08b31ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -2903,6 +2910,7 @@ pub fn atelier() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xd73837ff).into()),
|
error: Some(rgba(0xd73837ff).into()),
|
||||||
hint: Some(rgba(0xb17272ff).into()),
|
hint: Some(rgba(0xb17272ff).into()),
|
||||||
modified: Some(rgba(0xae9515ff).into()),
|
modified: Some(rgba(0xae9515ff).into()),
|
||||||
|
predictive: Some(rgba(0x9c6262ff).into()),
|
||||||
success: Some(rgba(0xfefbecff).into()),
|
success: Some(rgba(0xfefbecff).into()),
|
||||||
warning: Some(rgba(0xae9515ff).into()),
|
warning: Some(rgba(0xae9515ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -3307,6 +3315,7 @@ pub fn atelier() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xe61c3cff).into()),
|
error: Some(rgba(0xe61c3cff).into()),
|
||||||
hint: Some(rgba(0x008b9fff).into()),
|
hint: Some(rgba(0x008b9fff).into()),
|
||||||
modified: Some(rgba(0x98981cff).into()),
|
modified: Some(rgba(0x98981cff).into()),
|
||||||
|
predictive: Some(rgba(0x00788bff).into()),
|
||||||
success: Some(rgba(0xf4fbf4ff).into()),
|
success: Some(rgba(0xf4fbf4ff).into()),
|
||||||
warning: Some(rgba(0x98981cff).into()),
|
warning: Some(rgba(0x98981cff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -3711,6 +3720,7 @@ pub fn atelier() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xbe4778ff).into()),
|
error: Some(rgba(0xbe4778ff).into()),
|
||||||
hint: Some(rgba(0x786e9dff).into()),
|
hint: Some(rgba(0x786e9dff).into()),
|
||||||
modified: Some(rgba(0xa06e3cff).into()),
|
modified: Some(rgba(0xa06e3cff).into()),
|
||||||
|
predictive: Some(rgba(0x887fafff).into()),
|
||||||
success: Some(rgba(0x19171cff).into()),
|
success: Some(rgba(0x19171cff).into()),
|
||||||
warning: Some(rgba(0xa06e3cff).into()),
|
warning: Some(rgba(0xa06e3cff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -4115,6 +4125,7 @@ pub fn atelier() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xca4949ff).into()),
|
error: Some(rgba(0xca4949ff).into()),
|
||||||
hint: Some(rgba(0x8a647aff).into()),
|
hint: Some(rgba(0x8a647aff).into()),
|
||||||
modified: Some(rgba(0xa06e3bff).into()),
|
modified: Some(rgba(0xa06e3bff).into()),
|
||||||
|
predictive: Some(rgba(0x795369ff).into()),
|
||||||
success: Some(rgba(0xf4ececff).into()),
|
success: Some(rgba(0xf4ececff).into()),
|
||||||
warning: Some(rgba(0xa06e3bff).into()),
|
warning: Some(rgba(0xa06e3bff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -4519,6 +4530,7 @@ pub fn atelier() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xca402cff).into()),
|
error: Some(rgba(0xca402cff).into()),
|
||||||
hint: Some(rgba(0x8d70a8ff).into()),
|
hint: Some(rgba(0x8d70a8ff).into()),
|
||||||
modified: Some(rgba(0xbb8a36ff).into()),
|
modified: Some(rgba(0xbb8a36ff).into()),
|
||||||
|
predictive: Some(rgba(0x765990ff).into()),
|
||||||
success: Some(rgba(0xf7f3f7ff).into()),
|
success: Some(rgba(0xf7f3f7ff).into()),
|
||||||
warning: Some(rgba(0xbb8a36ff).into()),
|
warning: Some(rgba(0xbb8a36ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -4923,6 +4935,7 @@ pub fn atelier() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xd22e72ff).into()),
|
error: Some(rgba(0xd22e72ff).into()),
|
||||||
hint: Some(rgba(0x52809aff).into()),
|
hint: Some(rgba(0x52809aff).into()),
|
||||||
modified: Some(rgba(0x8a8a11ff).into()),
|
modified: Some(rgba(0x8a8a11ff).into()),
|
||||||
|
predictive: Some(rgba(0x427088ff).into()),
|
||||||
success: Some(rgba(0xebf8ffff).into()),
|
success: Some(rgba(0xebf8ffff).into()),
|
||||||
warning: Some(rgba(0x8a8a11ff).into()),
|
warning: Some(rgba(0x8a8a11ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -5327,6 +5340,7 @@ pub fn atelier() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xf22e41ff).into()),
|
error: Some(rgba(0xf22e41ff).into()),
|
||||||
hint: Some(rgba(0xa67287ff).into()),
|
hint: Some(rgba(0xa67287ff).into()),
|
||||||
modified: Some(rgba(0xc3841aff).into()),
|
modified: Some(rgba(0xc3841aff).into()),
|
||||||
|
predictive: Some(rgba(0xbe899eff).into()),
|
||||||
success: Some(rgba(0x1b1918ff).into()),
|
success: Some(rgba(0x1b1918ff).into()),
|
||||||
warning: Some(rgba(0xc3841aff).into()),
|
warning: Some(rgba(0xc3841aff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -5731,6 +5745,7 @@ pub fn atelier() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xd73838ff).into()),
|
error: Some(rgba(0xd73838ff).into()),
|
||||||
hint: Some(rgba(0xb37979ff).into()),
|
hint: Some(rgba(0xb37979ff).into()),
|
||||||
modified: Some(rgba(0xae9515ff).into()),
|
modified: Some(rgba(0xae9515ff).into()),
|
||||||
|
predictive: Some(rgba(0xc88a8aff).into()),
|
||||||
success: Some(rgba(0x20201dff).into()),
|
success: Some(rgba(0x20201dff).into()),
|
||||||
warning: Some(rgba(0xae9515ff).into()),
|
warning: Some(rgba(0xae9515ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -6135,6 +6150,7 @@ pub fn atelier() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xca4a4aff).into()),
|
error: Some(rgba(0xca4a4aff).into()),
|
||||||
hint: Some(rgba(0x916a80ff).into()),
|
hint: Some(rgba(0x916a80ff).into()),
|
||||||
modified: Some(rgba(0xa06e3cff).into()),
|
modified: Some(rgba(0xa06e3cff).into()),
|
||||||
|
predictive: Some(rgba(0xa27a91ff).into()),
|
||||||
success: Some(rgba(0x1b1818ff).into()),
|
success: Some(rgba(0x1b1818ff).into()),
|
||||||
warning: Some(rgba(0xa06e3cff).into()),
|
warning: Some(rgba(0xa06e3cff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -6539,6 +6555,7 @@ pub fn atelier() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xe61c3dff).into()),
|
error: Some(rgba(0xe61c3dff).into()),
|
||||||
hint: Some(rgba(0x008fa1ff).into()),
|
hint: Some(rgba(0x008fa1ff).into()),
|
||||||
modified: Some(rgba(0x98981dff).into()),
|
modified: Some(rgba(0x98981dff).into()),
|
||||||
|
predictive: Some(rgba(0x00a2b5ff).into()),
|
||||||
success: Some(rgba(0x131513ff).into()),
|
success: Some(rgba(0x131513ff).into()),
|
||||||
warning: Some(rgba(0x98981dff).into()),
|
warning: Some(rgba(0x98981dff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -6943,6 +6960,7 @@ pub fn atelier() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xb16139ff).into()),
|
error: Some(rgba(0xb16139ff).into()),
|
||||||
hint: Some(rgba(0x607e76ff).into()),
|
hint: Some(rgba(0x607e76ff).into()),
|
||||||
modified: Some(rgba(0xa07e3bff).into()),
|
modified: Some(rgba(0xa07e3bff).into()),
|
||||||
|
predictive: Some(rgba(0x506d66ff).into()),
|
||||||
success: Some(rgba(0xecf4eeff).into()),
|
success: Some(rgba(0xecf4eeff).into()),
|
||||||
warning: Some(rgba(0xa07e3bff).into()),
|
warning: Some(rgba(0xa07e3bff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -7347,6 +7365,7 @@ pub fn atelier() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xca412cff).into()),
|
error: Some(rgba(0xca412cff).into()),
|
||||||
hint: Some(rgba(0x8c70a6ff).into()),
|
hint: Some(rgba(0x8c70a6ff).into()),
|
||||||
modified: Some(rgba(0xbb8a36ff).into()),
|
modified: Some(rgba(0xbb8a36ff).into()),
|
||||||
|
predictive: Some(rgba(0xa587bfff).into()),
|
||||||
success: Some(rgba(0x1b181bff).into()),
|
success: Some(rgba(0x1b181bff).into()),
|
||||||
warning: Some(rgba(0xbb8a36ff).into()),
|
warning: Some(rgba(0xbb8a36ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -7751,6 +7770,7 @@ pub fn atelier() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xd22f72ff).into()),
|
error: Some(rgba(0xd22f72ff).into()),
|
||||||
hint: Some(rgba(0x5a87a0ff).into()),
|
hint: Some(rgba(0x5a87a0ff).into()),
|
||||||
modified: Some(rgba(0x8a8a11ff).into()),
|
modified: Some(rgba(0x8a8a11ff).into()),
|
||||||
|
predictive: Some(rgba(0x6a97b2ff).into()),
|
||||||
success: Some(rgba(0x161b1dff).into()),
|
success: Some(rgba(0x161b1dff).into()),
|
||||||
warning: Some(rgba(0x8a8a11ff).into()),
|
warning: Some(rgba(0x8a8a11ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
@ -75,6 +75,7 @@ pub fn ayu() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xef7178ff).into()),
|
error: Some(rgba(0xef7178ff).into()),
|
||||||
hint: Some(rgba(0x638c81ff).into()),
|
hint: Some(rgba(0x638c81ff).into()),
|
||||||
modified: Some(rgba(0xfeb454ff).into()),
|
modified: Some(rgba(0xfeb454ff).into()),
|
||||||
|
predictive: Some(rgba(0x5b728cff).into()),
|
||||||
success: Some(rgba(0xbfbdb6ff).into()),
|
success: Some(rgba(0xbfbdb6ff).into()),
|
||||||
warning: Some(rgba(0xfeb454ff).into()),
|
warning: Some(rgba(0xfeb454ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -458,6 +459,7 @@ pub fn ayu() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xef7271ff).into()),
|
error: Some(rgba(0xef7271ff).into()),
|
||||||
hint: Some(rgba(0x8ca7c2ff).into()),
|
hint: Some(rgba(0x8ca7c2ff).into()),
|
||||||
modified: Some(rgba(0xf1ae4aff).into()),
|
modified: Some(rgba(0xf1ae4aff).into()),
|
||||||
|
predictive: Some(rgba(0x9eb9d3ff).into()),
|
||||||
success: Some(rgba(0x5c6166ff).into()),
|
success: Some(rgba(0x5c6166ff).into()),
|
||||||
warning: Some(rgba(0xf1ae4aff).into()),
|
warning: Some(rgba(0xf1ae4aff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -841,6 +843,7 @@ pub fn ayu() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xf18779ff).into()),
|
error: Some(rgba(0xf18779ff).into()),
|
||||||
hint: Some(rgba(0x7399a3ff).into()),
|
hint: Some(rgba(0x7399a3ff).into()),
|
||||||
modified: Some(rgba(0xfed073ff).into()),
|
modified: Some(rgba(0xfed073ff).into()),
|
||||||
|
predictive: Some(rgba(0x6d839bff).into()),
|
||||||
success: Some(rgba(0xcccac2ff).into()),
|
success: Some(rgba(0xcccac2ff).into()),
|
||||||
warning: Some(rgba(0xfed073ff).into()),
|
warning: Some(rgba(0xfed073ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
@ -75,6 +75,7 @@ pub fn gruvbox() -> UserThemeFamily {
|
||||||
error: Some(rgba(0x9d0408ff).into()),
|
error: Some(rgba(0x9d0408ff).into()),
|
||||||
hint: Some(rgba(0x677562ff).into()),
|
hint: Some(rgba(0x677562ff).into()),
|
||||||
modified: Some(rgba(0xb57616ff).into()),
|
modified: Some(rgba(0xb57616ff).into()),
|
||||||
|
predictive: Some(rgba(0x7d9881ff).into()),
|
||||||
success: Some(rgba(0x282828ff).into()),
|
success: Some(rgba(0x282828ff).into()),
|
||||||
warning: Some(rgba(0xb57616ff).into()),
|
warning: Some(rgba(0xb57616ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -465,6 +466,7 @@ pub fn gruvbox() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xfb4a35ff).into()),
|
error: Some(rgba(0xfb4a35ff).into()),
|
||||||
hint: Some(rgba(0x8d957eff).into()),
|
hint: Some(rgba(0x8d957eff).into()),
|
||||||
modified: Some(rgba(0xf9bd30ff).into()),
|
modified: Some(rgba(0xf9bd30ff).into()),
|
||||||
|
predictive: Some(rgba(0x717363ff).into()),
|
||||||
success: Some(rgba(0xfbf1c7ff).into()),
|
success: Some(rgba(0xfbf1c7ff).into()),
|
||||||
warning: Some(rgba(0xf9bd30ff).into()),
|
warning: Some(rgba(0xf9bd30ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -855,6 +857,7 @@ pub fn gruvbox() -> UserThemeFamily {
|
||||||
error: Some(rgba(0x9d0408ff).into()),
|
error: Some(rgba(0x9d0408ff).into()),
|
||||||
hint: Some(rgba(0x677562ff).into()),
|
hint: Some(rgba(0x677562ff).into()),
|
||||||
modified: Some(rgba(0xb57616ff).into()),
|
modified: Some(rgba(0xb57616ff).into()),
|
||||||
|
predictive: Some(rgba(0x7d9881ff).into()),
|
||||||
success: Some(rgba(0x282828ff).into()),
|
success: Some(rgba(0x282828ff).into()),
|
||||||
warning: Some(rgba(0xb57616ff).into()),
|
warning: Some(rgba(0xb57616ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -1245,6 +1248,7 @@ pub fn gruvbox() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xfb4a35ff).into()),
|
error: Some(rgba(0xfb4a35ff).into()),
|
||||||
hint: Some(rgba(0x8d957eff).into()),
|
hint: Some(rgba(0x8d957eff).into()),
|
||||||
modified: Some(rgba(0xf9bd30ff).into()),
|
modified: Some(rgba(0xf9bd30ff).into()),
|
||||||
|
predictive: Some(rgba(0x717363ff).into()),
|
||||||
success: Some(rgba(0xfbf1c7ff).into()),
|
success: Some(rgba(0xfbf1c7ff).into()),
|
||||||
warning: Some(rgba(0xf9bd30ff).into()),
|
warning: Some(rgba(0xf9bd30ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -1635,6 +1639,7 @@ pub fn gruvbox() -> UserThemeFamily {
|
||||||
error: Some(rgba(0x9d0408ff).into()),
|
error: Some(rgba(0x9d0408ff).into()),
|
||||||
hint: Some(rgba(0x677562ff).into()),
|
hint: Some(rgba(0x677562ff).into()),
|
||||||
modified: Some(rgba(0xb57616ff).into()),
|
modified: Some(rgba(0xb57616ff).into()),
|
||||||
|
predictive: Some(rgba(0x7d9881ff).into()),
|
||||||
success: Some(rgba(0x282828ff).into()),
|
success: Some(rgba(0x282828ff).into()),
|
||||||
warning: Some(rgba(0xb57616ff).into()),
|
warning: Some(rgba(0xb57616ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -2025,6 +2030,7 @@ pub fn gruvbox() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xfb4a35ff).into()),
|
error: Some(rgba(0xfb4a35ff).into()),
|
||||||
hint: Some(rgba(0x8d957eff).into()),
|
hint: Some(rgba(0x8d957eff).into()),
|
||||||
modified: Some(rgba(0xf9bd30ff).into()),
|
modified: Some(rgba(0xf9bd30ff).into()),
|
||||||
|
predictive: Some(rgba(0x717363ff).into()),
|
||||||
success: Some(rgba(0xfbf1c7ff).into()),
|
success: Some(rgba(0xfbf1c7ff).into()),
|
||||||
warning: Some(rgba(0xf9bd30ff).into()),
|
warning: Some(rgba(0xf9bd30ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
@ -75,6 +75,7 @@ pub fn one() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xd36151ff).into()),
|
error: Some(rgba(0xd36151ff).into()),
|
||||||
hint: Some(rgba(0x9295beff).into()),
|
hint: Some(rgba(0x9295beff).into()),
|
||||||
modified: Some(rgba(0xdec184ff).into()),
|
modified: Some(rgba(0xdec184ff).into()),
|
||||||
|
predictive: Some(rgba(0x9c9fc7ff).into()),
|
||||||
success: Some(rgba(0x383a41ff).into()),
|
success: Some(rgba(0x383a41ff).into()),
|
||||||
warning: Some(rgba(0xdec184ff).into()),
|
warning: Some(rgba(0xdec184ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -465,6 +466,7 @@ pub fn one() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xd07277ff).into()),
|
error: Some(rgba(0xd07277ff).into()),
|
||||||
hint: Some(rgba(0x5b708aff).into()),
|
hint: Some(rgba(0x5b708aff).into()),
|
||||||
modified: Some(rgba(0xdec184ff).into()),
|
modified: Some(rgba(0xdec184ff).into()),
|
||||||
|
predictive: Some(rgba(0x5b6b88ff).into()),
|
||||||
success: Some(rgba(0xc8ccd4ff).into()),
|
success: Some(rgba(0xc8ccd4ff).into()),
|
||||||
warning: Some(rgba(0xdec184ff).into()),
|
warning: Some(rgba(0xdec184ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
@ -75,6 +75,7 @@ pub fn rose_pine() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xb4647aff).into()),
|
error: Some(rgba(0xb4647aff).into()),
|
||||||
hint: Some(rgba(0x7a92aaff).into()),
|
hint: Some(rgba(0x7a92aaff).into()),
|
||||||
modified: Some(rgba(0xe99d35ff).into()),
|
modified: Some(rgba(0xe99d35ff).into()),
|
||||||
|
predictive: Some(rgba(0xa2acbeff).into()),
|
||||||
success: Some(rgba(0x575279ff).into()),
|
success: Some(rgba(0x575279ff).into()),
|
||||||
warning: Some(rgba(0xe99d35ff).into()),
|
warning: Some(rgba(0xe99d35ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -472,6 +473,7 @@ pub fn rose_pine() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xea6f92ff).into()),
|
error: Some(rgba(0xea6f92ff).into()),
|
||||||
hint: Some(rgba(0x728aa2ff).into()),
|
hint: Some(rgba(0x728aa2ff).into()),
|
||||||
modified: Some(rgba(0xf5c177ff).into()),
|
modified: Some(rgba(0xf5c177ff).into()),
|
||||||
|
predictive: Some(rgba(0x516b83ff).into()),
|
||||||
success: Some(rgba(0xe0def4ff).into()),
|
success: Some(rgba(0xe0def4ff).into()),
|
||||||
warning: Some(rgba(0xf5c177ff).into()),
|
warning: Some(rgba(0xf5c177ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -869,6 +871,7 @@ pub fn rose_pine() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xea6f92ff).into()),
|
error: Some(rgba(0xea6f92ff).into()),
|
||||||
hint: Some(rgba(0x5e768cff).into()),
|
hint: Some(rgba(0x5e768cff).into()),
|
||||||
modified: Some(rgba(0xf5c177ff).into()),
|
modified: Some(rgba(0xf5c177ff).into()),
|
||||||
|
predictive: Some(rgba(0x556b81ff).into()),
|
||||||
success: Some(rgba(0xe0def4ff).into()),
|
success: Some(rgba(0xe0def4ff).into()),
|
||||||
warning: Some(rgba(0xf5c177ff).into()),
|
warning: Some(rgba(0xf5c177ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
@ -74,6 +74,7 @@ pub fn sandcastle() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xb4637aff).into()),
|
error: Some(rgba(0xb4637aff).into()),
|
||||||
hint: Some(rgba(0x727d68ff).into()),
|
hint: Some(rgba(0x727d68ff).into()),
|
||||||
modified: Some(rgba(0xa07e3bff).into()),
|
modified: Some(rgba(0xa07e3bff).into()),
|
||||||
|
predictive: Some(rgba(0x5c6152ff).into()),
|
||||||
success: Some(rgba(0xfdf4c1ff).into()),
|
success: Some(rgba(0xfdf4c1ff).into()),
|
||||||
warning: Some(rgba(0xa07e3bff).into()),
|
warning: Some(rgba(0xa07e3bff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
@ -75,6 +75,7 @@ pub fn solarized() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xdc3330ff).into()),
|
error: Some(rgba(0xdc3330ff).into()),
|
||||||
hint: Some(rgba(0x5889a3ff).into()),
|
hint: Some(rgba(0x5889a3ff).into()),
|
||||||
modified: Some(rgba(0xb58904ff).into()),
|
modified: Some(rgba(0xb58904ff).into()),
|
||||||
|
predictive: Some(rgba(0x679aafff).into()),
|
||||||
success: Some(rgba(0x002b36ff).into()),
|
success: Some(rgba(0x002b36ff).into()),
|
||||||
warning: Some(rgba(0xb58904ff).into()),
|
warning: Some(rgba(0xb58904ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -458,6 +459,7 @@ pub fn solarized() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xdc3330ff).into()),
|
error: Some(rgba(0xdc3330ff).into()),
|
||||||
hint: Some(rgba(0x4f8297ff).into()),
|
hint: Some(rgba(0x4f8297ff).into()),
|
||||||
modified: Some(rgba(0xb58903ff).into()),
|
modified: Some(rgba(0xb58903ff).into()),
|
||||||
|
predictive: Some(rgba(0x40728bff).into()),
|
||||||
success: Some(rgba(0xfdf6e3ff).into()),
|
success: Some(rgba(0xfdf6e3ff).into()),
|
||||||
warning: Some(rgba(0xb58903ff).into()),
|
warning: Some(rgba(0xb58903ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
@ -74,6 +74,7 @@ pub fn summercamp() -> UserThemeFamily {
|
||||||
error: Some(rgba(0xe35142ff).into()),
|
error: Some(rgba(0xe35142ff).into()),
|
||||||
hint: Some(rgba(0x246e61ff).into()),
|
hint: Some(rgba(0x246e61ff).into()),
|
||||||
modified: Some(rgba(0xf1fe29ff).into()),
|
modified: Some(rgba(0xf1fe29ff).into()),
|
||||||
|
predictive: Some(rgba(0x79434bff).into()),
|
||||||
success: Some(rgba(0xf8f5deff).into()),
|
success: Some(rgba(0xf8f5deff).into()),
|
||||||
warning: Some(rgba(0xf1fe29ff).into()),
|
warning: Some(rgba(0xf1fe29ff).into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
@ -83,6 +83,7 @@ impl Zed1ThemeConverter {
|
||||||
warning: convert(diagnostic_summary.icon_color_warning),
|
warning: convert(diagnostic_summary.icon_color_warning),
|
||||||
error: convert(diagnostic_summary.icon_color_error),
|
error: convert(diagnostic_summary.icon_color_error),
|
||||||
hint: editor.hint.color.map(zed1_color_to_hsla),
|
hint: editor.hint.color.map(zed1_color_to_hsla),
|
||||||
|
predictive: editor.suggestion.color.map(zed1_color_to_hsla),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,7 +253,7 @@ impl Render for ContextMenu {
|
||||||
} = item
|
} = item
|
||||||
{
|
{
|
||||||
el = el.on_boxed_action(
|
el = el.on_boxed_action(
|
||||||
action,
|
&**action,
|
||||||
cx.listener(ContextMenu::on_action_dispatch),
|
cx.listener(ContextMenu::on_action_dispatch),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,8 +67,8 @@ impl<T: AsRef<Path>> PathExt for T {
|
||||||
fn icon_suffix(&self) -> Option<&str> {
|
fn icon_suffix(&self) -> Option<&str> {
|
||||||
let file_name = self.as_ref().file_name()?.to_str()?;
|
let file_name = self.as_ref().file_name()?.to_str()?;
|
||||||
|
|
||||||
if file_name.starts_with(".") {
|
if file_name.starts_with('.') {
|
||||||
return file_name.strip_prefix(".");
|
return file_name.strip_prefix('.');
|
||||||
}
|
}
|
||||||
|
|
||||||
self.as_ref()
|
self.as_ref()
|
||||||
|
@ -213,7 +213,7 @@ impl Eq for PathMatcher {}
|
||||||
impl PathMatcher {
|
impl PathMatcher {
|
||||||
pub fn new(maybe_glob: &str) -> Result<Self, globset::Error> {
|
pub fn new(maybe_glob: &str) -> Result<Self, globset::Error> {
|
||||||
Ok(PathMatcher {
|
Ok(PathMatcher {
|
||||||
glob: Glob::new(&maybe_glob)?.compile_matcher(),
|
glob: Glob::new(maybe_glob)?.compile_matcher(),
|
||||||
maybe_path: PathBuf::from(maybe_glob),
|
maybe_path: PathBuf::from(maybe_glob),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue