Skip to content

Commit 661f5cf

Browse files
committed
chore: reduce dependiences
iced_layershell and iced_sessionlock do not need to depend on iced
1 parent 9c809af commit 661f5cf

File tree

24 files changed

+203
-181
lines changed

24 files changed

+203
-181
lines changed

Cargo.lock

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

iced_layershell/Cargo.toml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,14 @@ description = "layershell binding for iced"
1111
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1212

1313
[features]
14-
default = ["tiny-skia", "wgpu", "fira-sans", "linux-theme-detection"]
15-
tiny-skia = ["iced/tiny-skia", "iced_renderer/tiny-skia"]
16-
wgpu = ["iced/wgpu", "iced_renderer/wgpu"]
17-
fira-sans = ["iced/fira-sans", "iced_renderer/fira-sans"]
18-
debug = ["iced/debug"]
19-
time-travel = ["iced/time-travel"]
20-
unconditional-rendering = ["iced/unconditional-rendering"]
21-
linux-theme-detection = ["iced/linux-theme-detection", "dep:mundy"]
14+
default = ["linux-theme-detection"]
15+
16+
debug = ["iced_debug/enable"]
17+
time-travel = ["iced_exdevtools/time-travel", "debug"]
18+
unconditional-rendering = []
19+
linux-theme-detection = ["dep:mundy"]
2220

2321
[dependencies]
24-
iced.workspace = true
2522
iced_renderer.workspace = true
2623
iced_runtime.workspace = true
2724
iced_core.workspace = true
@@ -42,4 +39,3 @@ enumflags2.workspace = true
4239

4340
# workspace features cannot be optional so we need to define the dependency here
4441
mundy = { version = "0.2.0", optional = true }
45-

iced_layershell/src/actions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::reexport::{Anchor, Layer, WlRegion};
2-
use iced::window::Id as IcedId;
2+
use iced_core::window::Id as IcedId;
33
use layershellev::{NewInputPanelSettings, NewLayerShellSettings, NewXdgWindowSettings};
44

55
use std::sync::Arc;

iced_layershell/src/build_pattern/application.rs

Lines changed: 43 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ mod time;
22

33
use std::borrow::Cow;
44

5-
use iced::Font;
6-
use iced::{Element, Task};
5+
use iced_core::Element;
6+
use iced_core::Font;
7+
use iced_runtime::Task;
78

89
use crate::actions::LayershellCustomActionWithId;
910

@@ -131,8 +132,8 @@ pub trait ThemeFn<State, Theme> {
131132
fn theme(&self, state: &State) -> Option<Theme>;
132133
}
133134

134-
impl<State> ThemeFn<State, iced::Theme> for iced::Theme {
135-
fn theme(&self, _state: &State) -> Option<iced::Theme> {
135+
impl<State> ThemeFn<State, iced_core::Theme> for iced_core::Theme {
136+
fn theme(&self, _state: &State) -> Option<iced_core::Theme> {
136137
Some(self.clone())
137138
}
138139
}
@@ -208,12 +209,12 @@ where
208209
fn view<'a>(
209210
&self,
210211
state: &'a Self::State,
211-
_window: iced::window::Id,
212+
_window: iced_core::window::Id,
212213
) -> Element<'a, Self::Message, Self::Theme, Self::Renderer> {
213214
debug::hot(|| self.view.view(state))
214215
}
215216

216-
fn settings(&self) -> iced::Settings {
217+
fn settings(&self) -> iced_core::Settings {
217218
Default::default()
218219
}
219220

@@ -270,27 +271,27 @@ pub fn with_executor<P: Program, E: iced_futures::Executor>(
270271
fn view<'a>(
271272
&self,
272273
state: &'a Self::State,
273-
window: iced::window::Id,
274+
window: iced_core::window::Id,
274275
) -> Element<'a, Self::Message, Self::Theme, Self::Renderer> {
275276
self.program.view(state, window)
276277
}
277278

278-
fn subscription(&self, state: &Self::State) -> iced::Subscription<Self::Message> {
279+
fn subscription(&self, state: &Self::State) -> iced_futures::Subscription<Self::Message> {
279280
self.program.subscription(state)
280281
}
281282

282-
fn theme(&self, state: &Self::State, window: iced::window::Id) -> Option<Self::Theme> {
283+
fn theme(&self, state: &Self::State, window: iced_core::window::Id) -> Option<Self::Theme> {
283284
self.program.theme(state, window)
284285
}
285286

286287
fn style(&self, state: &Self::State, theme: &Self::Theme) -> crate::Appearance {
287288
self.program.style(state, theme)
288289
}
289290

290-
fn scale_factor(&self, state: &Self::State, id: iced::window::Id) -> f32 {
291+
fn scale_factor(&self, state: &Self::State, id: iced_core::window::Id) -> f32 {
291292
self.program.scale_factor(state, id)
292293
}
293-
fn settings(&self) -> iced::Settings {
294+
fn settings(&self) -> iced_core::Settings {
294295
Default::default()
295296
}
296297

@@ -307,7 +308,7 @@ pub fn with_executor<P: Program, E: iced_futures::Executor>(
307308

308309
pub fn with_subscription<P: Program>(
309310
program: P,
310-
f: impl Fn(&P::State) -> iced::Subscription<P::Message>,
311+
f: impl Fn(&P::State) -> iced_futures::Subscription<P::Message>,
311312
) -> impl Program<State = P::State, Message = P::Message, Theme = P::Theme> {
312313
struct WithSubscription<P, F> {
313314
program: P,
@@ -316,15 +317,15 @@ pub fn with_subscription<P: Program>(
316317

317318
impl<P: Program, F> Program for WithSubscription<P, F>
318319
where
319-
F: Fn(&P::State) -> iced::Subscription<P::Message>,
320+
F: Fn(&P::State) -> iced_futures::Subscription<P::Message>,
320321
{
321322
type State = P::State;
322323
type Message = P::Message;
323324
type Theme = P::Theme;
324325
type Renderer = P::Renderer;
325326
type Executor = P::Executor;
326327

327-
fn subscription(&self, state: &Self::State) -> iced::Subscription<Self::Message> {
328+
fn subscription(&self, state: &Self::State) -> iced_futures::Subscription<Self::Message> {
328329
(self.subscription)(state)
329330
}
330331
fn boot(&self) -> (Self::State, Task<Self::Message>) {
@@ -341,23 +342,23 @@ pub fn with_subscription<P: Program>(
341342
fn view<'a>(
342343
&self,
343344
state: &'a Self::State,
344-
window: iced::window::Id,
345+
window: iced_core::window::Id,
345346
) -> Element<'a, Self::Message, Self::Theme, Self::Renderer> {
346347
self.program.view(state, window)
347348
}
348349

349-
fn theme(&self, state: &Self::State, window: iced::window::Id) -> Option<Self::Theme> {
350+
fn theme(&self, state: &Self::State, window: iced_core::window::Id) -> Option<Self::Theme> {
350351
self.program.theme(state, window)
351352
}
352353

353354
fn style(&self, state: &Self::State, theme: &Self::Theme) -> crate::Appearance {
354355
self.program.style(state, theme)
355356
}
356357

357-
fn scale_factor(&self, state: &Self::State, id: iced::window::Id) -> f32 {
358+
fn scale_factor(&self, state: &Self::State, id: iced_core::window::Id) -> f32 {
358359
self.program.scale_factor(state, id)
359360
}
360-
fn settings(&self) -> iced::Settings {
361+
fn settings(&self) -> iced_core::Settings {
361362
Default::default()
362363
}
363364

@@ -391,7 +392,11 @@ pub fn with_theme<P: Program>(
391392
type Renderer = P::Renderer;
392393
type Executor = P::Executor;
393394

394-
fn theme(&self, state: &Self::State, _window: iced::window::Id) -> Option<Self::Theme> {
395+
fn theme(
396+
&self,
397+
state: &Self::State,
398+
_window: iced_core::window::Id,
399+
) -> Option<Self::Theme> {
395400
(self.theme)(state)
396401
}
397402

@@ -409,23 +414,23 @@ pub fn with_theme<P: Program>(
409414
fn view<'a>(
410415
&self,
411416
state: &'a Self::State,
412-
window: iced::window::Id,
417+
window: iced_core::window::Id,
413418
) -> Element<'a, Self::Message, Self::Theme, Self::Renderer> {
414419
self.program.view(state, window)
415420
}
416421

417-
fn subscription(&self, state: &Self::State) -> iced::Subscription<Self::Message> {
422+
fn subscription(&self, state: &Self::State) -> iced_futures::Subscription<Self::Message> {
418423
self.program.subscription(state)
419424
}
420425

421426
fn style(&self, state: &Self::State, theme: &Self::Theme) -> crate::Appearance {
422427
self.program.style(state, theme)
423428
}
424429

425-
fn scale_factor(&self, state: &Self::State, id: iced::window::Id) -> f32 {
430+
fn scale_factor(&self, state: &Self::State, id: iced_core::window::Id) -> f32 {
426431
self.program.scale_factor(state, id)
427432
}
428-
fn settings(&self) -> iced::Settings {
433+
fn settings(&self) -> iced_core::Settings {
429434
Default::default()
430435
}
431436

@@ -474,23 +479,23 @@ pub fn with_style<P: Program>(
474479
fn view<'a>(
475480
&self,
476481
state: &'a Self::State,
477-
window: iced::window::Id,
482+
window: iced_core::window::Id,
478483
) -> Element<'a, Self::Message, Self::Theme, Self::Renderer> {
479484
self.program.view(state, window)
480485
}
481486

482-
fn subscription(&self, state: &Self::State) -> iced::Subscription<Self::Message> {
487+
fn subscription(&self, state: &Self::State) -> iced_futures::Subscription<Self::Message> {
483488
self.program.subscription(state)
484489
}
485490

486-
fn theme(&self, state: &Self::State, window: iced::window::Id) -> Option<Self::Theme> {
491+
fn theme(&self, state: &Self::State, window: iced_core::window::Id) -> Option<Self::Theme> {
487492
self.program.theme(state, window)
488493
}
489494

490-
fn scale_factor(&self, state: &Self::State, id: iced::window::Id) -> f32 {
495+
fn scale_factor(&self, state: &Self::State, id: iced_core::window::Id) -> f32 {
491496
self.program.scale_factor(state, id)
492497
}
493-
fn settings(&self) -> iced::Settings {
498+
fn settings(&self) -> iced_core::Settings {
494499
Default::default()
495500
}
496501

@@ -532,30 +537,30 @@ pub fn with_scale_factor<P: Program>(
532537
fn view<'a>(
533538
&self,
534539
state: &'a Self::State,
535-
window: iced::window::Id,
540+
window: iced_core::window::Id,
536541
) -> Element<'a, Self::Message, Self::Theme, Self::Renderer> {
537542
self.program.view(state, window)
538543
}
539544

540-
fn subscription(&self, state: &Self::State) -> iced::Subscription<Self::Message> {
545+
fn subscription(&self, state: &Self::State) -> iced_futures::Subscription<Self::Message> {
541546
self.program.subscription(state)
542547
}
543548

544-
fn theme(&self, state: &Self::State, window: iced::window::Id) -> Option<Self::Theme> {
549+
fn theme(&self, state: &Self::State, window: iced_core::window::Id) -> Option<Self::Theme> {
545550
self.program.theme(state, window)
546551
}
547552

548553
fn style(&self, state: &Self::State, theme: &Self::Theme) -> crate::Appearance {
549554
self.program.style(state, theme)
550555
}
551556

552-
fn scale_factor(&self, state: &Self::State, _id: iced::window::Id) -> f32 {
557+
fn scale_factor(&self, state: &Self::State, _id: iced_core::window::Id) -> f32 {
553558
(self.scale_factor)(state)
554559
}
555560
fn boot(&self) -> (Self::State, Task<Self::Message>) {
556561
self.program.boot()
557562
}
558-
fn settings(&self) -> iced::Settings {
563+
fn settings(&self) -> iced_core::Settings {
559564
Default::default()
560565
}
561566

@@ -658,7 +663,10 @@ impl<P: Program> SingleApplication<P> {
658663
}
659664

660665
/// set the default_text_size
661-
pub fn default_text_size<Pixels: Into<iced::Pixels>>(self, default_text_size: Pixels) -> Self {
666+
pub fn default_text_size<Pixels: Into<iced_core::Pixels>>(
667+
self,
668+
default_text_size: Pixels,
669+
) -> Self {
662670
Self {
663671
settings: Settings {
664672
default_text_size: default_text_size.into(),
@@ -682,7 +690,7 @@ impl<P: Program> SingleApplication<P> {
682690
/// Sets the subscription logic of the [`SingleApplication`].
683691
pub fn subscription(
684692
self,
685-
f: impl Fn(&P::State) -> iced::Subscription<P::Message>,
693+
f: impl Fn(&P::State) -> iced_futures::Subscription<P::Message>,
686694
) -> SingleApplication<impl Program<State = P::State, Message = P::Message, Theme = P::Theme>>
687695
{
688696
SingleApplication {

iced_layershell/src/build_pattern/application/time.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use super::{BootFn, NameSpace, SingleApplication, ViewFn};
22
use crate::DefaultStyle;
3-
use iced::Subscription;
4-
use iced::Task;
53
use iced_core::Element;
64
use iced_debug as debug;
5+
use iced_futures::Subscription;
76
use iced_program::Program;
7+
use iced_runtime::Task;
88
use std::time::Instant;
99

1010
/// Creates an [`SingleApplication`] with an `update` function that also
@@ -67,7 +67,7 @@ where
6767
name.split("::").next().unwrap_or("a_cool_application")
6868
}
6969

70-
fn settings(&self) -> iced::Settings {
70+
fn settings(&self) -> iced_core::Settings {
7171
Default::default()
7272
}
7373

@@ -97,7 +97,7 @@ where
9797
fn view<'a>(
9898
&self,
9999
state: &'a Self::State,
100-
_window: iced::window::Id,
100+
_window: iced_core::window::Id,
101101
) -> Element<'a, Self::Message, Self::Theme, Self::Renderer> {
102102
debug::hot(|| {
103103
self.view

0 commit comments

Comments
 (0)