fix(sctk): popup initial configure ack handling

This commit is contained in:
Ashley Wulber 2026-02-20 18:15:28 -05:00
parent 8cfe449315
commit 686c6afb8d
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
7 changed files with 68 additions and 45 deletions

69
Cargo.lock generated
View file

@ -1316,8 +1316,8 @@ dependencies = [
[[package]]
name = "cosmic-text"
version = "0.16.0"
source = "git+https://github.com/pop-os/cosmic-text.git#ee702e50901d90cd842dbd88154687bd2512b52c"
version = "0.18.0"
source = "git+https://github.com/pop-os/cosmic-text.git#cd1d3aa1efb7d5529fb9de09d37fbc85b8ce1253"
dependencies = [
"bitflags 2.10.0",
"fontdb",
@ -1325,10 +1325,10 @@ dependencies = [
"linebender_resource_handle",
"log",
"rangemap",
"rustc-hash 1.1.0",
"rustc-hash 2.1.1",
"self_cell",
"skrifa 0.39.0",
"smol_str 0.2.2",
"skrifa 0.40.0",
"smol_str",
"swash",
"sys-locale",
"unicode-bidi",
@ -1980,6 +1980,15 @@ dependencies = [
"bytemuck",
]
[[package]]
name = "font-types"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1e4d2d0cf79d38430cc9dc9aadec84774bff2e1ba30ae2bf6c16cfce9385a23"
dependencies = [
"bytemuck",
]
[[package]]
name = "fontconfig-parser"
version = "0.5.8"
@ -2654,14 +2663,14 @@ dependencies = [
[[package]]
name = "harfrust"
version = "0.4.1"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0caaee032384c10dd597af4579c67dee16650d862a9ccbe1233ff1a379abc07"
checksum = "4f9f40651a03bc0f7316bd75267ff5767e93017ef3cfffe76c6aa7252cc5a31c"
dependencies = [
"bitflags 2.10.0",
"bytemuck",
"core_maths",
"read-fonts 0.36.0",
"read-fonts 0.37.0",
"smallvec",
]
@ -3006,7 +3015,7 @@ dependencies = [
"raw-window-handle",
"rustc-hash 2.1.1",
"serde",
"smol_str 0.3.2",
"smol_str",
"thiserror 2.0.18",
"web-time",
"window_clipboard",
@ -5355,18 +5364,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6717cf23b488adf64b9d711329542ba34de147df262370221940dfabc2c91358"
dependencies = [
"bytemuck",
"font-types",
"font-types 0.10.1",
]
[[package]]
name = "read-fonts"
version = "0.36.0"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5eaa2941a4c05443ee3a7b26ab076a553c343ad5995230cc2b1d3e993bdc6345"
checksum = "7b634fabf032fab15307ffd272149b622260f55974d9fad689292a5d33df02e5"
dependencies = [
"bytemuck",
"core_maths",
"font-types",
"font-types 0.11.0",
]
[[package]]
@ -6053,12 +6062,12 @@ dependencies = [
[[package]]
name = "skrifa"
version = "0.39.0"
version = "0.40.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c9eb0b904a04d09bd68c65d946617b8ff733009999050f3b851c32fb3cfb60e"
checksum = "7fbdfe3d2475fbd7ddd1f3e5cf8288a30eb3e5f95832829570cd88115a7434ac"
dependencies = [
"bytemuck",
"read-fonts 0.36.0",
"read-fonts 0.37.0",
]
[[package]]
@ -6199,12 +6208,6 @@ dependencies = [
"futures-lite",
]
[[package]]
name = "smol_str"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead"
[[package]]
name = "smol_str"
version = "0.3.2"
@ -8451,7 +8454,7 @@ dependencies = [
"libc",
"raw-window-handle",
"rustix 1.1.3",
"smol_str 0.3.2",
"smol_str",
"tracing",
"winit-android",
"winit-appkit",
@ -8475,7 +8478,7 @@ dependencies = [
"dpi",
"ndk",
"raw-window-handle",
"smol_str 0.3.2",
"smol_str",
"tracing",
"winit-core",
]
@ -8496,7 +8499,7 @@ dependencies = [
"objc2-core-video",
"objc2-foundation 0.3.2",
"raw-window-handle",
"smol_str 0.3.2",
"smol_str",
"tracing",
"winit-common",
"winit-core",
@ -8510,7 +8513,7 @@ dependencies = [
"memmap2 0.9.9",
"objc2 0.6.3",
"objc2-core-foundation",
"smol_str 0.3.2",
"smol_str",
"tracing",
"winit-core",
"x11-dl",
@ -8527,7 +8530,7 @@ dependencies = [
"dpi",
"keyboard-types",
"raw-window-handle",
"smol_str 0.3.2",
"smol_str",
"web-time",
]
@ -8542,7 +8545,7 @@ dependencies = [
"orbclient",
"raw-window-handle",
"redox_syscall 0.7.0",
"smol_str 0.3.2",
"smol_str",
"tracing",
"winit-core",
]
@ -8561,7 +8564,7 @@ dependencies = [
"objc2-foundation 0.3.2",
"objc2-ui-kit",
"raw-window-handle",
"smol_str 0.3.2",
"smol_str",
"tracing",
"winit-common",
"winit-core",
@ -8583,7 +8586,7 @@ dependencies = [
"rustix 1.1.3",
"sctk-adwaita",
"smithay-client-toolkit 0.20.0",
"smol_str 0.3.2",
"smol_str",
"tracing",
"wayland-backend",
"wayland-client",
@ -8606,7 +8609,7 @@ dependencies = [
"js-sys",
"pin-project",
"raw-window-handle",
"smol_str 0.3.2",
"smol_str",
"tracing",
"wasm-bindgen",
"wasm-bindgen-futures",
@ -8624,7 +8627,7 @@ dependencies = [
"cursor-icon",
"dpi",
"raw-window-handle",
"smol_str 0.3.2",
"smol_str",
"tracing",
"unicode-segmentation",
"windows-sys 0.59.0",
@ -8645,7 +8648,7 @@ dependencies = [
"percent-encoding",
"raw-window-handle",
"rustix 1.1.3",
"smol_str 0.3.2",
"smol_str",
"tracing",
"winit-common",
"winit-core",

View file

@ -10,7 +10,7 @@ tester = ["iced/tester"]
[dependencies]
iced.workspace = true
iced.features = ["tokio", "debug", "time-travel", "winit", "wgpu"]
iced.features = ["tokio", "debug", "time-travel", "winit", "wgpu", "wayland"]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

View file

@ -945,11 +945,14 @@ async fn run_instance<P>(
continue;
};
let Some((id, mut window)) =
let Some((id, mut window)) =
window_manager.get_mut_alias(window_id)
else {
continue;
};
if !window.state.ready {
continue;
}
// XX must force update to corner radius before the surface is committed.
#[cfg(feature = "wayland")]
if window.surface_version != window.state.surface_version()

View file

@ -1289,7 +1289,6 @@ impl SctkState {
match self.get_popup(settings) {
Ok((id, parent_id, toplevel_id, surface, common)) => {
let wl_surface = surface.wl_surface().clone();
receive_frame(&mut self.frame_status, &wl_surface);
send_event(&self.events_sender, &self.proxy,
SctkEvent::PopupEvent {
variant: crate::platform_specific::wayland::sctk_event::PopupEventVariant::Created(self.queue_handle.clone(), surface, id, common, self.connection.display()),

View file

@ -1,3 +1,4 @@
use crate::event_loop::state::receive_frame;
use crate::platform_specific::wayland::{
event_loop::state::{self, PopupParent, SctkState},
sctk_event::{PopupEventVariant, SctkEvent},
@ -28,6 +29,7 @@ impl PopupHandler for SctkState {
let mut guard = sctk_popup.common.lock().unwrap();
guard.size =
LogicalSize::new(configure.width as u32, configure.height as u32);
receive_frame(&mut self.frame_status, popup.wl_surface());
self.sctk_events.push(SctkEvent::PopupEvent {
variant: PopupEventVariant::Configure(

View file

@ -17,7 +17,7 @@ use dnd::DndSurface;
use iced_debug::core::theme;
use iced_futures::{
core::{
Clipboard as _, Clipboard as _, Size,
Size,
event::{
PlatformSpecific,
wayland::{
@ -26,7 +26,7 @@ use iced_futures::{
},
},
event,
futures::channel::mpsc,
futures::{SinkExt, channel::mpsc},
};
use iced_graphics::{Compositor, compositor};
use iced_runtime::{
@ -1010,6 +1010,7 @@ impl SctkEvent {
false, // TODO do we want to get this value here?
theme::Mode::None, // TODO do we really need to track the system theme here?
);
window.state.ready = false;
let logical_size = window.logical_size();
let mut ui = crate::build_user_interface(
@ -1083,7 +1084,6 @@ impl SctkEvent {
configure.width as f32,
configure.height as f32,
);
if let Some((id, w)) =
surface_ids.get(&surface.id()).and_then(|id| {
window_manager
@ -1091,6 +1091,17 @@ impl SctkEvent {
.map(|v| (id.inner(), v))
})
{
w.state.ready = true;
if first {
control_sender
.send(Control::Winit(
w.raw.id(),
winit::event::WindowEvent::RedrawRequested,
)).await
.expect("Send control message");
proxy.wake_up();
}
let scale = w.state.scale_factor();
let p_w = (configure.width.max(1) as f64 * scale)
.ceil()
@ -1199,12 +1210,15 @@ impl SctkEvent {
queue_handle,
);
#[cfg(feature = "a11y")]
control_sender
.start_send(Control::InitAdapter(
surface_id,
sctk_winit.clone(),
))
.expect("Send control message");
{
control_sender
.start_send(Control::InitAdapter(
surface_id,
sctk_winit.clone(),
))
.expect("Send control message");
proxy.wake_up();
}
if clipboard.window_id().is_none() {
*clipboard = Clipboard::connect(

View file

@ -25,6 +25,7 @@ where
theme_mode: theme::Mode,
default_theme: P::Theme,
style: theme::Style,
pub(crate) ready: bool,
}
impl<P: Program> Debug for State<P>
@ -81,6 +82,7 @@ where
theme_mode,
default_theme,
style,
ready: true,
}
}