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

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(