fix(sctk): popup initial configure ack handling
This commit is contained in:
parent
8cfe449315
commit
686c6afb8d
7 changed files with 68 additions and 45 deletions
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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()),
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue