Update smithay for DnD updates

This commit is contained in:
Victoria Brekenfeld 2025-11-10 18:32:34 +01:00 committed by Victoria Brekenfeld
parent 3ddc9421e4
commit 77d3605fb9
12 changed files with 340 additions and 99 deletions

View file

@ -523,18 +523,14 @@ impl CosmicStack {
let active_window = &p.windows.lock().unwrap()[p.active.load(Ordering::SeqCst)];
stack_ui.or_else(|| {
active_window
.0
.surface_under(relative_pos, surface_type)
.map(|(surface, surface_offset)| {
active_window.focus_under(relative_pos, surface_type).map(
|(target, surface_offset)| {
(
PointerFocusTarget::WlSurface {
surface,
toplevel: Some(active_window.clone().into()),
},
target,
surface_offset.to_f64() + Point::from((0., TAB_HEIGHT as f64)),
)
})
},
)
})
})
}

View file

@ -1,4 +1,6 @@
use crate::wayland::protocols::corner_radius::CacheableCorners;
use crate::{
shell::focus::target::PointerFocusTarget, wayland::protocols::corner_radius::CacheableCorners,
};
use std::{
borrow::Cow,
sync::{
@ -618,6 +620,38 @@ impl CosmicSurface {
}
}
pub fn focus_under(
&self,
relative_pos: Point<f64, Logical>,
surface_type: WindowSurfaceType,
) -> Option<(PointerFocusTarget, Point<f64, Logical>)> {
if let Some(xsurface) = self.x11_surface() {
xsurface
.surface_under(relative_pos, Point::default(), surface_type)
.map(|(_surface, surface_offset)| {
(
PointerFocusTarget::X11Surface {
surface: xsurface.clone(),
toplevel: Some(self.clone()),
},
surface_offset.to_f64(),
)
})
} else {
self.0
.surface_under(relative_pos, surface_type)
.map(|(surface, surface_offset)| {
(
PointerFocusTarget::WlSurface {
surface,
toplevel: Some(self.clone().into()),
},
surface_offset.to_f64(),
)
})
}
}
pub fn on_commit(&self) {
self.0.on_commit();
}

View file

@ -281,17 +281,9 @@ impl CosmicWindow {
}
window_ui.or_else(|| {
p.window.0.surface_under(relative_pos, surface_type).map(
|(surface, surface_offset)| {
(
PointerFocusTarget::WlSurface {
surface,
toplevel: Some(p.window.clone().into()),
},
(offset + surface_offset.to_f64()),
)
},
)
p.window
.focus_under(relative_pos, surface_type)
.map(|(target, surface_offset)| (target, offset + surface_offset))
})
})
}