diff --git a/winit/src/platform_specific/wayland/sctk_event.rs b/winit/src/platform_specific/wayland/sctk_event.rs index f6c2bef6a4..ac655e95d3 100755 --- a/winit/src/platform_specific/wayland/sctk_event.rs +++ b/winit/src/platform_specific/wayland/sctk_event.rs @@ -23,7 +23,7 @@ use iced_futures::{ }, PlatformSpecific, }, - Clipboard as _, + Clipboard as _, Size, }, event, futures::channel::mpsc, @@ -838,9 +838,12 @@ impl SctkEvent { surface, first, ) => { - if let Some(w) = surface_ids - .get(&surface.id()) - .and_then(|id| window_manager.get_mut(id.inner())) + if let Some((id, w)) = + surface_ids.get(&surface.id()).and_then(|id| { + window_manager + .get_mut(id.inner()) + .map(|v| (id.inner(), v)) + }) { let scale = w.state.scale_factor(); let p_w = (configure.new_size.0.max(1) as f64 * scale) @@ -854,6 +857,26 @@ impl SctkEvent { )), debug, ); + if first { + events.push(( + Some(id), + iced_runtime::core::Event::Window( + window::Event::Resized( + w.state.logical_size(), + ), + ), + )) + } else { + events.push(( + Some(id), + iced_runtime::core::Event::Window( + window::Event::Opened { + size: w.state.logical_size(), + position: Default::default(), + }, + ), + )) + } } } }, @@ -1044,7 +1067,34 @@ impl SctkEvent { let _ = user_interfaces.insert(surface_id, ui); } - PopupEventVariant::Configure(_, _, _) => {} // TODO + PopupEventVariant::Configure(configure, surface, first) => { + let size = Size::new( + configure.width as f32, + configure.height as f32, + ); + if let Some(id) = + surface_ids.get(&surface.id()).map(|id| id.inner()) + { + if first { + events.push(( + Some(id), + iced_runtime::core::Event::Window( + window::Event::Resized(size), + ), + )) + } else { + events.push(( + Some(id), + iced_runtime::core::Event::Window( + window::Event::Opened { + size: size, + position: Default::default(), + }, + ), + )) + } + } + } // TODO PopupEventVariant::RepositionionedPopup { token: _ } => {} PopupEventVariant::Size(_, _) => {} PopupEventVariant::ScaleFactorChanged(..) => {} @@ -1190,7 +1240,38 @@ impl SctkEvent { ), ); } - SctkEvent::SessionLockSurfaceConfigure { .. } => {} + SctkEvent::SessionLockSurfaceConfigure { + surface, + configure, + first, + } => { + let size = Size::new( + configure.new_size.0 as f32, + configure.new_size.1 as f32, + ); + if let Some(id) = + surface_ids.get(&surface.id()).map(|id| id.inner()) + { + if first { + events.push(( + Some(id), + iced_runtime::core::Event::Window( + window::Event::Resized(size), + ), + )) + } else { + events.push(( + Some(id), + iced_runtime::core::Event::Window( + window::Event::Opened { + size: size, + position: Default::default(), + }, + ), + )) + } + } + } SctkEvent::SessionLockSurfaceDone { surface } => { if let Some(id) = surface_ids.remove(&surface.id()) { _ = window_manager.remove(id.inner());