diff --git a/sctk/src/application.rs b/sctk/src/application.rs index 333e6b3316..8a289173d1 100644 --- a/sctk/src/application.rs +++ b/sctk/src/application.rs @@ -2275,7 +2275,14 @@ where | SctkEvent::UpdateOutput { .. } | SctkEvent::RemovedOutput(_) => false, SctkEvent::ScaleFactorChanged { id, .. } => &id.id() == object_id, - SctkEvent::DndOffer { surface, .. } => &surface.id() == object_id, + SctkEvent::DndOffer { surface, .. } => { + let event_object_id = surface.id(); + &event_object_id == object_id + || state + .subsurfaces + .iter() + .any(|s| s.wl_surface.id() == event_object_id) + } SctkEvent::DataSource(_) => true, SctkEvent::SessionLocked => false, SctkEvent::SessionLockFinished => false, diff --git a/sctk/src/sctk_event.rs b/sctk/src/sctk_event.rs index 3d9a3c6da3..b7af4c841b 100755 --- a/sctk/src/sctk_event.rs +++ b/sctk/src/sctk_event.rs @@ -785,7 +785,7 @@ impl SctkEvent { id: _, inner_size: _, } => Default::default(), - SctkEvent::DndOffer { event, .. } => match event { + SctkEvent::DndOffer { event, surface } => match event { DndOfferEvent::Enter { mime_types, x, y } => { Some(iced_runtime::core::Event::PlatformSpecific( PlatformSpecific::Wayland(wayland::Event::DndOffer( @@ -796,9 +796,19 @@ impl SctkEvent { .collect() } DndOfferEvent::Motion { x, y } => { + let offset = if let Some((x_offset, y_offset, _)) = + subsurface_ids.get(&surface.id()) + { + (*x_offset, *y_offset) + } else { + (0, 0) + }; Some(iced_runtime::core::Event::PlatformSpecific( PlatformSpecific::Wayland(wayland::Event::DndOffer( - wayland::DndOfferEvent::Motion { x, y }, + wayland::DndOfferEvent::Motion { + x: x + offset.0 as f64, + y: y + offset.1 as f64, + }, )), )) .into_iter()