Merge branch 'pop-os:master' into rfd-fix
This commit is contained in:
commit
2defa51b45
5 changed files with 31 additions and 13 deletions
16
Cargo.toml
16
Cargo.toml
|
|
@ -14,7 +14,7 @@ a11y = ["iced/a11y", "iced_accessibility"]
|
||||||
# Enable about widget
|
# Enable about widget
|
||||||
about = ["desktop", "dep:license"]
|
about = ["desktop", "dep:license"]
|
||||||
# Builds support for animated images
|
# Builds support for animated images
|
||||||
animated-image = ["image", "dep:async-fs", "tokio?/io-util", "tokio?/fs"]
|
animated-image = ["dep:async-fs", "image/gif", "tokio?/io-util", "tokio?/fs"]
|
||||||
# XXX autosize should not be used on winit windows unless dialogs
|
# XXX autosize should not be used on winit windows unless dialogs
|
||||||
autosize = []
|
autosize = []
|
||||||
applet = [
|
applet = [
|
||||||
|
|
@ -95,7 +95,10 @@ cosmic-config = { path = "cosmic-config" }
|
||||||
cosmic-settings-daemon = { git = "https://github.com/pop-os/dbus-settings-bindings", optional = true }
|
cosmic-settings-daemon = { git = "https://github.com/pop-os/dbus-settings-bindings", optional = true }
|
||||||
css-color = "0.2.5"
|
css-color = "0.2.5"
|
||||||
derive_setters = "0.1.5"
|
derive_setters = "0.1.5"
|
||||||
image = { version = "0.25.1", optional = true }
|
image = { version = "0.25.5", default-features = false, features = [
|
||||||
|
"jpeg",
|
||||||
|
"png",
|
||||||
|
] }
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
libc = { version = "0.2.155", optional = true }
|
libc = { version = "0.2.155", optional = true }
|
||||||
license = { version = "3.5.1", optional = true }
|
license = { version = "3.5.1", optional = true }
|
||||||
|
|
@ -127,7 +130,14 @@ path = "cosmic-theme"
|
||||||
[dependencies.iced]
|
[dependencies.iced]
|
||||||
path = "./iced"
|
path = "./iced"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["advanced", "image", "lazy", "svg", "web-colors", "tiny-skia"]
|
features = [
|
||||||
|
"advanced",
|
||||||
|
"image-without-codecs",
|
||||||
|
"lazy",
|
||||||
|
"svg",
|
||||||
|
"web-colors",
|
||||||
|
"tiny-skia",
|
||||||
|
]
|
||||||
|
|
||||||
[dependencies.iced_runtime]
|
[dependencies.iced_runtime]
|
||||||
path = "./iced/runtime"
|
path = "./iced/runtime"
|
||||||
|
|
|
||||||
2
iced
2
iced
|
|
@ -1 +1 @@
|
||||||
Subproject commit 2cc6865c908d025e43d7fc937f6b67defd51ea18
|
Subproject commit 82b87f9caac6be9e1a6d75425e7a39d193a8590d
|
||||||
|
|
@ -8,8 +8,8 @@ use cosmic_theme::composite::over;
|
||||||
use iced::{
|
use iced::{
|
||||||
overlay::menu,
|
overlay::menu,
|
||||||
widget::{
|
widget::{
|
||||||
button as iced_button, checkbox as iced_checkbox, container as iced_container, pane_grid,
|
button as iced_button, checkbox as iced_checkbox, combo_box, container as iced_container,
|
||||||
pick_list, progress_bar, radio, rule, scrollable,
|
pane_grid, pick_list, progress_bar, radio, rule, scrollable,
|
||||||
slider::{self, Rail},
|
slider::{self, Rail},
|
||||||
svg, toggler,
|
svg, toggler,
|
||||||
},
|
},
|
||||||
|
|
@ -1481,3 +1481,5 @@ impl iced_widget::qr_code::Catalog for Theme {
|
||||||
class(self)
|
class(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl combo_box::Catalog for Theme {}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ pub struct DndSource<'a, Message, D> {
|
||||||
container: Element<'a, Message>,
|
container: Element<'a, Message>,
|
||||||
window: Option<window::Id>,
|
window: Option<window::Id>,
|
||||||
drag_content: Option<Box<dyn Fn() -> D>>,
|
drag_content: Option<Box<dyn Fn() -> D>>,
|
||||||
drag_icon: Option<Box<dyn Fn() -> (Element<'static, ()>, tree::State)>>,
|
drag_icon: Option<Box<dyn Fn(Vector) -> (Element<'static, ()>, tree::State, Vector)>>,
|
||||||
on_start: Option<Message>,
|
on_start: Option<Message>,
|
||||||
on_cancelled: Option<Message>,
|
on_cancelled: Option<Message>,
|
||||||
on_finish: Option<Message>,
|
on_finish: Option<Message>,
|
||||||
|
|
@ -90,7 +90,7 @@ impl<
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn drag_icon(
|
pub fn drag_icon(
|
||||||
mut self,
|
mut self,
|
||||||
f: impl Fn() -> (Element<'static, ()>, tree::State) + 'static,
|
f: impl Fn(Vector) -> (Element<'static, ()>, tree::State, Vector) + 'static,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
self.drag_icon = Some(Box::new(f));
|
self.drag_icon = Some(Box::new(f));
|
||||||
self
|
self
|
||||||
|
|
@ -102,7 +102,7 @@ impl<
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn start_dnd(&self, clipboard: &mut dyn Clipboard, bounds: Rectangle) {
|
pub fn start_dnd(&self, clipboard: &mut dyn Clipboard, bounds: Rectangle, offset: Vector) {
|
||||||
let Some(content) = self.drag_content.as_ref().map(|f| f()) else {
|
let Some(content) = self.drag_content.as_ref().map(|f| f()) else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
@ -116,13 +116,14 @@ impl<
|
||||||
Some(iced_core::clipboard::DndSource::Widget(self.id.clone()))
|
Some(iced_core::clipboard::DndSource::Widget(self.id.clone()))
|
||||||
},
|
},
|
||||||
self.drag_icon.as_ref().map(|f| {
|
self.drag_icon.as_ref().map(|f| {
|
||||||
let (icon, state) = f();
|
let (icon, state, offset) = f(offset);
|
||||||
(
|
iced_core::clipboard::IconSurface::new(
|
||||||
container(icon)
|
container(icon)
|
||||||
.width(Length::Fixed(bounds.width))
|
.width(Length::Fixed(bounds.width))
|
||||||
.height(Length::Fixed(bounds.height))
|
.height(Length::Fixed(bounds.height))
|
||||||
.into(),
|
.into(),
|
||||||
state,
|
state,
|
||||||
|
offset,
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
Box::new(content),
|
Box::new(content),
|
||||||
|
|
@ -262,7 +263,11 @@ impl<
|
||||||
if let Some(on_start) = self.on_start.as_ref() {
|
if let Some(on_start) = self.on_start.as_ref() {
|
||||||
shell.publish(on_start.clone())
|
shell.publish(on_start.clone())
|
||||||
}
|
}
|
||||||
self.start_dnd(clipboard, state.cached_bounds);
|
let offset = Vector::new(
|
||||||
|
left_pressed_position.x - layout.bounds().x,
|
||||||
|
left_pressed_position.y - layout.bounds().y,
|
||||||
|
);
|
||||||
|
self.start_dnd(clipboard, state.cached_bounds, offset);
|
||||||
state.is_dragging = true;
|
state.is_dragging = true;
|
||||||
state.left_pressed_position = None;
|
state.left_pressed_position = None;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1350,12 +1350,13 @@ where
|
||||||
clipboard,
|
clipboard,
|
||||||
false,
|
false,
|
||||||
id.map(|id| iced_core::clipboard::DndSource::Widget(id)),
|
id.map(|id| iced_core::clipboard::DndSource::Widget(id)),
|
||||||
Some((
|
Some(iced_core::clipboard::IconSurface::new(
|
||||||
Element::from(
|
Element::from(
|
||||||
TextInput::<'static, ()>::new("", input_text.clone())
|
TextInput::<'static, ()>::new("", input_text.clone())
|
||||||
.dnd_icon(true),
|
.dnd_icon(true),
|
||||||
),
|
),
|
||||||
iced_core::widget::tree::State::new(state_clone),
|
iced_core::widget::tree::State::new(state_clone),
|
||||||
|
Vector::ZERO,
|
||||||
)),
|
)),
|
||||||
Box::new(TextInputString(input_text)),
|
Box::new(TextInputString(input_text)),
|
||||||
DndAction::Move,
|
DndAction::Move,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue