Skip to content

Commit 771da29

Browse files
authored
update debug breakages (#299)
1 parent 0b8361f commit 771da29

File tree

2 files changed

+32
-43
lines changed

2 files changed

+32
-43
lines changed

iced_layershell/src/multi_window.rs

Lines changed: 28 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
mod state;
21
use crate::{
32
DefaultStyle,
43
actions::{IcedNewPopupSettings, LayershellCustomActionWithId, MenuDirection},
@@ -7,36 +6,28 @@ use crate::{
76
settings::VirtualKeyboardSettings,
87
user_interface::UserInterfaces,
98
};
10-
use std::{
11-
borrow::Cow,
12-
collections::{HashMap, VecDeque},
13-
mem,
14-
os::fd::AsFd,
15-
sync::Arc,
16-
task::Poll,
17-
time::Duration,
18-
};
19-
209
use crate::{
2110
actions::LayershellCustomAction, clipboard::LayerShellClipboard, conversion, error::Error,
2211
};
23-
12+
use crate::{
13+
event::{IcedLayerShellEvent, WindowEvent as LayerShellWindowEvent},
14+
proxy::IcedProxy,
15+
settings::Settings,
16+
};
17+
use futures::{FutureExt, StreamExt, future::LocalBoxFuture};
2418
#[cfg(not(all(feature = "linux-theme-detection", target_os = "linux")))]
2519
use iced::theme::Mode;
2620
use iced::{
2721
Event as IcedEvent, theme,
2822
window::{Event as IcedWindowEvent, Id as IcedId, RedrawRequest},
2923
};
24+
use iced_core::{Size, mouse::Cursor, time::Instant};
25+
use iced_futures::{Executor, Runtime};
3026
use iced_graphics::{Compositor, Shell, compositor};
27+
use iced_program::Instance;
28+
use iced_program::Program as IcedProgram;
3129
use iced_runtime::Action;
32-
33-
use iced_runtime::debug;
34-
35-
use iced_core::{Size, mouse::Cursor, time::Instant};
3630
use iced_runtime::user_interface;
37-
38-
use iced_futures::{Executor, Runtime};
39-
4031
use layershellev::{
4132
LayerShellEvent, NewPopUpSettings, RefreshRequest, ReturnData, WindowState, WindowWrapper,
4233
calloop::timer::{TimeoutAction, Timer},
@@ -46,23 +37,22 @@ use layershellev::{
4637
zwp_virtual_keyboard_v1,
4738
},
4839
};
49-
50-
use futures::{FutureExt, StreamExt, future::LocalBoxFuture};
51-
use window_manager::Window;
52-
53-
use crate::{
54-
event::{IcedLayerShellEvent, WindowEvent as LayerShellWindowEvent},
55-
proxy::IcedProxy,
56-
settings::Settings,
40+
use std::{
41+
borrow::Cow,
42+
collections::{HashMap, VecDeque},
43+
mem,
44+
os::fd::AsFd,
45+
sync::Arc,
46+
task::Poll,
47+
time::Duration,
5748
};
49+
use window_manager::Window;
5850

51+
mod state;
5952
mod window_manager;
6053

6154
type MultiRuntime<E, Message> = Runtime<E, IcedProxy<Action<Message>>, Action<Message>>;
6255

63-
use iced_program::Instance;
64-
use iced_program::Program as IcedProgram;
65-
6656
// a dispatch loop, another is listen loop
6757
pub fn run<P>(
6858
program: P,
@@ -78,14 +68,14 @@ where
7868
use futures::task;
7969
let (message_sender, message_receiver) = std::sync::mpsc::channel::<Action<P::Message>>();
8070

81-
let boot_span = debug::boot();
71+
let boot_span = iced_debug::boot();
8272
let proxy = IcedProxy::new(message_sender);
8373

8474
#[cfg(feature = "debug")]
8575
{
8676
let proxy = proxy.clone();
8777

88-
debug::on_hotpatch(move || {
78+
iced_debug::on_hotpatch(move || {
8979
proxy.send_action(Action::Reload);
9080
});
9181
}
@@ -427,7 +417,7 @@ where
427417
|| window_size.height != height
428418
|| window.state.wayland_scale_factor() != scale_float
429419
{
430-
let layout_span = debug::layout(iced_id);
420+
let layout_span = iced_debug::layout(iced_id);
431421
window.state.update_view_port(width, height, scale_float);
432422
if let Some(ui) = self.user_interfaces.ui_mut(&iced_id) {
433423
ui.relayout(window.state.viewport().logical_size(), &mut window.renderer);
@@ -488,7 +478,7 @@ where
488478
Instant::now(),
489479
)));
490480

491-
let draw_span = debug::draw(iced_id);
481+
let draw_span = iced_debug::draw(iced_id);
492482
let (ui_state, statuses) = ui.update(
493483
&events,
494484
cursor,
@@ -548,7 +538,7 @@ where
548538

549539
window.draw_preedit();
550540

551-
let present_span = debug::present(iced_id);
541+
let present_span = iced_debug::present(iced_id);
552542
match compositor.present(
553543
&mut window.renderer,
554544
&mut window.surface,
@@ -855,7 +845,7 @@ where
855845

856846
let mut rebuilds = Vec::new();
857847
for (iced_id, window) in self.window_manager.iter_mut() {
858-
let interact_span = debug::interact(iced_id);
848+
let interact_span = iced_debug::interact(iced_id);
859849
let mut window_events = vec![];
860850

861851
self.iced_events.retain(|(window_id, event)| {
@@ -912,7 +902,7 @@ where
912902
for (_, window) in self.window_manager.iter_mut() {
913903
window.state.synchronize(application);
914904
}
915-
debug::theme_changed(|| {
905+
iced_debug::theme_changed(|| {
916906
self.window_manager
917907
.first()
918908
.and_then(|window| theme::Base::palette(window.state.theme()))
@@ -1039,7 +1029,7 @@ pub(crate) fn update<P: IcedProgram, E: Executor>(
10391029
let subscription = runtime.enter(|| application.subscription());
10401030
let recipes = iced_futures::subscription::into_recipes(subscription.map(Action::Output));
10411031

1042-
debug::subscriptions_tracked(recipes.len());
1032+
iced_debug::subscriptions_tracked(recipes.len());
10431033
runtime.track(recipes);
10441034
}
10451035

iced_layershell/src/user_interface.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
use std::{collections::HashMap, mem};
2-
31
use iced::{Event, Program, Size, event::Status, mouse::Cursor, window::Id};
42
use iced_core::{Clipboard, renderer::Style, widget::Operation};
53
use iced_program::Instance;
64
use iced_runtime::{
7-
UserInterface as IcedUserInterface, debug,
5+
UserInterface as IcedUserInterface,
86
user_interface::{Cache, State},
97
};
8+
use std::{collections::HashMap, mem};
109

1110
pub(crate) trait UserInterfaceReclaim<Message, Theme, Renderer> {
1211
fn reclaim(&mut self, ui: IcedUserInterface<'static, Message, Theme, Renderer>);
@@ -137,11 +136,11 @@ where
137136
}
138137

139138
pub fn build(&mut self, id: Id, cache: Cache, renderer: &mut P::Renderer, size: Size) {
140-
let view_span = debug::view(id);
139+
let view_span = iced_debug::view(id);
141140
let view = self.application.view(id);
142141
view_span.finish();
143142

144-
let layout_span = debug::layout(id);
143+
let layout_span = iced_debug::layout(id);
145144
let ui = IcedUserInterface::build(view, size, cache, renderer);
146145
layout_span.finish();
147146
// SAFETY ui won't outlive application.

0 commit comments

Comments
 (0)